@valtimo/components 4.15.2-next-main.8

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 (202) hide show
  1. package/bundles/valtimo-components.umd.js +5089 -0
  2. package/bundles/valtimo-components.umd.js.map +1 -0
  3. package/bundles/valtimo-components.umd.min.js +17 -0
  4. package/bundles/valtimo-components.umd.min.js.map +1 -0
  5. package/esm2015/lib/alert/alert.component.js +142 -0
  6. package/esm2015/lib/alert/alert.module.js +28 -0
  7. package/esm2015/lib/alert/alert.service.js +81 -0
  8. package/esm2015/lib/bpmn-js-diagram/bpmn-js-diagram.component.js +160 -0
  9. package/esm2015/lib/bpmn-js-diagram/bpmn-js-diagram.module.js +30 -0
  10. package/esm2015/lib/breadcrumb-navigation/breadcrumb-navigation.component.js +93 -0
  11. package/esm2015/lib/breadcrumb-navigation/breadcrumb-navigation.module.js +34 -0
  12. package/esm2015/lib/camunda/form/camunda-form.components.js +37 -0
  13. package/esm2015/lib/camunda/form/camunda-form.module.js +38 -0
  14. package/esm2015/lib/camunda/form/custom/camunda-custom-form.component.js +42 -0
  15. package/esm2015/lib/camunda/form/custom/camunda-custom-form.module.js +34 -0
  16. package/esm2015/lib/camunda/form/generated/camunda-generated-form.component.js +69 -0
  17. package/esm2015/lib/camunda/form/generated/camunda-generated-form.module.js +63 -0
  18. package/esm2015/lib/camunda/form/generated/formfield/boolean/camunda-boolean-formfield.component.js +28 -0
  19. package/esm2015/lib/camunda/form/generated/formfield/camunda-formfield-generator.directive.js +64 -0
  20. package/esm2015/lib/camunda/form/generated/formfield/camunda-formfield.service.js +67 -0
  21. package/esm2015/lib/camunda/form/generated/formfield/choicefield/camunda-choicefield-formfield.component.js +38 -0
  22. package/esm2015/lib/camunda/form/generated/formfield/date/camunda-date-formfield.component.js +66 -0
  23. package/esm2015/lib/camunda/form/generated/formfield/enum/camunda-enum-formfield.component.js +31 -0
  24. package/esm2015/lib/camunda/form/generated/formfield/formfield.model.js +16 -0
  25. package/esm2015/lib/camunda/form/generated/formfield/long/camunda-long-formfield.component.js +28 -0
  26. package/esm2015/lib/camunda/form/generated/formfield/string/camunda-string-formfield.component.js +28 -0
  27. package/esm2015/lib/camunda/form/generated/formfield/textarea/camunda-textarea-formfield.component.js +28 -0
  28. package/esm2015/lib/camunda/form/generated/formfield/validation/camunda-formfield-validation.component.js +36 -0
  29. package/esm2015/lib/camunda/form/generated/formfield/validation/date.validators.js +60 -0
  30. package/esm2015/lib/card/card.component.js +37 -0
  31. package/esm2015/lib/card/card.module.js +30 -0
  32. package/esm2015/lib/components.module.js +22 -0
  33. package/esm2015/lib/data-list/data-list.component.js +34 -0
  34. package/esm2015/lib/data-list/data-list.module.js +30 -0
  35. package/esm2015/lib/dropzone/dropzone.component.js +143 -0
  36. package/esm2015/lib/dropzone/dropzone.module.js +32 -0
  37. package/esm2015/lib/field-auto-focus/field-auto-focus.directive.js +35 -0
  38. package/esm2015/lib/field-auto-focus/field-auto-focus.module.js +32 -0
  39. package/esm2015/lib/file-size/file-size.module.js +30 -0
  40. package/esm2015/lib/file-size/file-size.pipe.js +45 -0
  41. package/esm2015/lib/filter-sidebar/filter-sidebar.component.js +46 -0
  42. package/esm2015/lib/filter-sidebar/filter-sidebar.module.js +30 -0
  43. package/esm2015/lib/form-io/form-io-builder.component.js +39 -0
  44. package/esm2015/lib/form-io/form-io-uploader/form-io-uploader-edit-form.js +90 -0
  45. package/esm2015/lib/form-io/form-io-uploader/form-io-uploader.component.js +72 -0
  46. package/esm2015/lib/form-io/form-io-uploader/form-io-uploader.formio.js +26 -0
  47. package/esm2015/lib/form-io/form-io.component.js +160 -0
  48. package/esm2015/lib/form-io/form-io.module.js +56 -0
  49. package/esm2015/lib/form-io/formio-config.js +22 -0
  50. package/esm2015/lib/form-io/services/form-io-dom.service.js +23 -0
  51. package/esm2015/lib/form-io/services/form-io-state.service.js +24 -0
  52. package/esm2015/lib/left-sidebar/left-sidebar.component.js +114 -0
  53. package/esm2015/lib/left-sidebar/left-sidebar.module.js +34 -0
  54. package/esm2015/lib/list/ListFilterPipe.directive.js +35 -0
  55. package/esm2015/lib/list/list.component.js +177 -0
  56. package/esm2015/lib/list/list.module.js +33 -0
  57. package/esm2015/lib/menu/menu-item-text.component.js +36 -0
  58. package/esm2015/lib/menu/menu-routing.module.js +29 -0
  59. package/esm2015/lib/menu/menu.component.js +65 -0
  60. package/esm2015/lib/menu/menu.init.js +34 -0
  61. package/esm2015/lib/menu/menu.module.js +39 -0
  62. package/esm2015/lib/menu/menu.service.js +127 -0
  63. package/esm2015/lib/menu/submenu-item-text.component.js +33 -0
  64. package/esm2015/lib/modal/modal.component.js +48 -0
  65. package/esm2015/lib/modal/modal.module.js +28 -0
  66. package/esm2015/lib/page-header/page-header.component.js +29 -0
  67. package/esm2015/lib/page-header/page-header.module.js +34 -0
  68. package/esm2015/lib/page-title/page-title.component.js +76 -0
  69. package/esm2015/lib/page-title/page-title.module.js +32 -0
  70. package/esm2015/lib/progress-bar/progress-bar.component.js +26 -0
  71. package/esm2015/lib/progress-bar/progress-bar.module.js +30 -0
  72. package/esm2015/lib/right-sidebar/right-sidebar.component.js +131 -0
  73. package/esm2015/lib/right-sidebar/right-sidebar.module.js +49 -0
  74. package/esm2015/lib/searchable-dropdown/searchable-dropdown.component.js +185 -0
  75. package/esm2015/lib/searchable-dropdown/searchable-dropdown.module.js +29 -0
  76. package/esm2015/lib/searchable-dropdown-select/searchable-dropdown-select.component.js +52 -0
  77. package/esm2015/lib/searchable-dropdown-select/searchable-dropdown-select.module.js +30 -0
  78. package/esm2015/lib/spinner/spinner.component.js +43 -0
  79. package/esm2015/lib/spinner/spinner.module.js +36 -0
  80. package/esm2015/lib/timeline/timeline.component.js +29 -0
  81. package/esm2015/lib/timeline/timeline.module.js +32 -0
  82. package/esm2015/lib/topbar/topbar.component.js +29 -0
  83. package/esm2015/lib/topbar/topbar.module.js +32 -0
  84. package/esm2015/lib/uploader/uploader-drag-drop.directive.js +49 -0
  85. package/esm2015/lib/uploader/uploader.component.js +70 -0
  86. package/esm2015/lib/uploader/uploader.module.js +33 -0
  87. package/esm2015/lib/version/version.service.js +38 -0
  88. package/esm2015/lib/view-content/type-converters/booleanTypeConverter.js +29 -0
  89. package/esm2015/lib/view-content/type-converters/dateTypeConverter.js +30 -0
  90. package/esm2015/lib/view-content/type-converters/enumTypeConverter.js +24 -0
  91. package/esm2015/lib/view-content/type-converters/relatedFilesTypeConverter.js +24 -0
  92. package/esm2015/lib/view-content/type-converters/stringReplaceUnderscoreTypeConverter.js +27 -0
  93. package/esm2015/lib/view-content/type-converters/stringTypeConverter.js +24 -0
  94. package/esm2015/lib/view-content/type-converters/type-converters.model.js +37 -0
  95. package/esm2015/lib/view-content/view-content.service.js +51 -0
  96. package/esm2015/lib/webcam/webcam.component.js +103 -0
  97. package/esm2015/lib/webcam/webcam.module.js +32 -0
  98. package/esm2015/lib/widget/widget.component.js +80 -0
  99. package/esm2015/lib/widget/widget.module.js +30 -0
  100. package/esm2015/public_api.js +84 -0
  101. package/esm2015/valtimo-components.js +27 -0
  102. package/fesm2015/valtimo-components.js +4536 -0
  103. package/fesm2015/valtimo-components.js.map +1 -0
  104. package/lib/alert/alert.component.d.ts +21 -0
  105. package/lib/alert/alert.module.d.ts +2 -0
  106. package/lib/alert/alert.service.d.ts +21 -0
  107. package/lib/bpmn-js-diagram/bpmn-js-diagram.component.d.ts +27 -0
  108. package/lib/bpmn-js-diagram/bpmn-js-diagram.module.d.ts +2 -0
  109. package/lib/breadcrumb-navigation/breadcrumb-navigation.component.d.ts +14 -0
  110. package/lib/breadcrumb-navigation/breadcrumb-navigation.module.d.ts +2 -0
  111. package/lib/camunda/form/camunda-form.components.d.ts +9 -0
  112. package/lib/camunda/form/camunda-form.module.d.ts +2 -0
  113. package/lib/camunda/form/custom/camunda-custom-form.component.d.ts +8 -0
  114. package/lib/camunda/form/custom/camunda-custom-form.module.d.ts +2 -0
  115. package/lib/camunda/form/generated/camunda-generated-form.component.d.ts +19 -0
  116. package/lib/camunda/form/generated/camunda-generated-form.module.d.ts +2 -0
  117. package/lib/camunda/form/generated/formfield/boolean/camunda-boolean-formfield.component.d.ts +7 -0
  118. package/lib/camunda/form/generated/formfield/camunda-formfield-generator.directive.d.ts +13 -0
  119. package/lib/camunda/form/generated/formfield/camunda-formfield.service.d.ts +7 -0
  120. package/lib/camunda/form/generated/formfield/choicefield/camunda-choicefield-formfield.component.d.ts +12 -0
  121. package/lib/camunda/form/generated/formfield/date/camunda-date-formfield.component.d.ts +14 -0
  122. package/lib/camunda/form/generated/formfield/enum/camunda-enum-formfield.component.d.ts +10 -0
  123. package/lib/camunda/form/generated/formfield/formfield.model.d.ts +20 -0
  124. package/lib/camunda/form/generated/formfield/long/camunda-long-formfield.component.d.ts +7 -0
  125. package/lib/camunda/form/generated/formfield/string/camunda-string-formfield.component.d.ts +7 -0
  126. package/lib/camunda/form/generated/formfield/textarea/camunda-textarea-formfield.component.d.ts +7 -0
  127. package/lib/camunda/form/generated/formfield/validation/camunda-formfield-validation.component.d.ts +10 -0
  128. package/lib/camunda/form/generated/formfield/validation/date.validators.d.ts +3 -0
  129. package/lib/card/card.component.d.ts +16 -0
  130. package/lib/card/card.module.d.ts +2 -0
  131. package/lib/components.module.d.ts +2 -0
  132. package/lib/data-list/data-list.component.d.ts +7 -0
  133. package/lib/data-list/data-list.module.d.ts +2 -0
  134. package/lib/dropzone/dropzone.component.d.ts +38 -0
  135. package/lib/dropzone/dropzone.module.d.ts +2 -0
  136. package/lib/field-auto-focus/field-auto-focus.directive.d.ts +6 -0
  137. package/lib/field-auto-focus/field-auto-focus.module.d.ts +2 -0
  138. package/lib/file-size/file-size.module.d.ts +2 -0
  139. package/lib/file-size/file-size.pipe.d.ts +5 -0
  140. package/lib/filter-sidebar/filter-sidebar.component.d.ts +8 -0
  141. package/lib/filter-sidebar/filter-sidebar.module.d.ts +2 -0
  142. package/lib/form-io/form-io-builder.component.d.ts +8 -0
  143. package/lib/form-io/form-io-uploader/form-io-uploader-edit-form.d.ts +61 -0
  144. package/lib/form-io/form-io-uploader/form-io-uploader.component.d.ts +29 -0
  145. package/lib/form-io/form-io-uploader/form-io-uploader.formio.d.ts +3 -0
  146. package/lib/form-io/form-io.component.d.ts +45 -0
  147. package/lib/form-io/form-io.module.d.ts +2 -0
  148. package/lib/form-io/formio-config.d.ts +6 -0
  149. package/lib/form-io/services/form-io-dom.service.d.ts +6 -0
  150. package/lib/form-io/services/form-io-state.service.d.ts +10 -0
  151. package/lib/left-sidebar/left-sidebar.component.d.ts +34 -0
  152. package/lib/left-sidebar/left-sidebar.module.d.ts +2 -0
  153. package/lib/list/ListFilterPipe.directive.d.ts +4 -0
  154. package/lib/list/list.component.d.ts +43 -0
  155. package/lib/list/list.module.d.ts +2 -0
  156. package/lib/menu/menu-item-text.component.d.ts +4 -0
  157. package/lib/menu/menu-routing.module.d.ts +2 -0
  158. package/lib/menu/menu.component.d.ts +18 -0
  159. package/lib/menu/menu.init.d.ts +3 -0
  160. package/lib/menu/menu.module.d.ts +2 -0
  161. package/lib/menu/menu.service.d.ts +23 -0
  162. package/lib/menu/submenu-item-text.component.d.ts +4 -0
  163. package/lib/modal/modal.component.d.ts +12 -0
  164. package/lib/modal/modal.module.d.ts +2 -0
  165. package/lib/page-header/page-header.component.d.ts +5 -0
  166. package/lib/page-header/page-header.module.d.ts +2 -0
  167. package/lib/page-title/page-title.component.d.ts +19 -0
  168. package/lib/page-title/page-title.module.d.ts +2 -0
  169. package/lib/progress-bar/progress-bar.component.d.ts +2 -0
  170. package/lib/progress-bar/progress-bar.module.d.ts +2 -0
  171. package/lib/right-sidebar/right-sidebar.component.d.ts +34 -0
  172. package/lib/right-sidebar/right-sidebar.module.d.ts +2 -0
  173. package/lib/searchable-dropdown/searchable-dropdown.component.d.ts +39 -0
  174. package/lib/searchable-dropdown/searchable-dropdown.module.d.ts +2 -0
  175. package/lib/searchable-dropdown-select/searchable-dropdown-select.component.d.ts +19 -0
  176. package/lib/searchable-dropdown-select/searchable-dropdown-select.module.d.ts +2 -0
  177. package/lib/spinner/spinner.component.d.ts +9 -0
  178. package/lib/spinner/spinner.module.d.ts +2 -0
  179. package/lib/timeline/timeline.component.d.ts +4 -0
  180. package/lib/timeline/timeline.module.d.ts +2 -0
  181. package/lib/topbar/topbar.component.d.ts +3 -0
  182. package/lib/topbar/topbar.module.d.ts +2 -0
  183. package/lib/uploader/uploader-drag-drop.directive.d.ts +7 -0
  184. package/lib/uploader/uploader.component.d.ts +15 -0
  185. package/lib/uploader/uploader.module.d.ts +2 -0
  186. package/lib/version/version.service.d.ts +8 -0
  187. package/lib/view-content/type-converters/booleanTypeConverter.d.ts +5 -0
  188. package/lib/view-content/type-converters/dateTypeConverter.d.ts +5 -0
  189. package/lib/view-content/type-converters/enumTypeConverter.d.ts +5 -0
  190. package/lib/view-content/type-converters/relatedFilesTypeConverter.d.ts +5 -0
  191. package/lib/view-content/type-converters/stringReplaceUnderscoreTypeConverter.d.ts +6 -0
  192. package/lib/view-content/type-converters/stringTypeConverter.d.ts +5 -0
  193. package/lib/view-content/type-converters/type-converters.model.d.ts +5 -0
  194. package/lib/view-content/view-content.service.d.ts +8 -0
  195. package/lib/webcam/webcam.component.d.ts +20 -0
  196. package/lib/webcam/webcam.module.d.ts +2 -0
  197. package/lib/widget/widget.component.d.ts +28 -0
  198. package/lib/widget/widget.module.d.ts +2 -0
  199. package/package.json +34 -0
  200. package/public_api.d.ts +65 -0
  201. package/valtimo-components.d.ts +26 -0
  202. package/valtimo-components.metadata.json +1 -0
@@ -0,0 +1,4536 @@
1
+ import { EventEmitter, Component, Input, Output, ComponentFactoryResolver, ViewChild, ViewContainerRef, NgModule, ɵɵdefineInjectable, Injectable, Directive, ɵɵinject, ElementRef, Renderer2, Pipe, HostListener, ViewChildren } from '@angular/core';
2
+ import { CommonModule, Location } from '@angular/common';
3
+ import { Validators, FormControl, FormBuilder, ReactiveFormsModule, FormsModule } from '@angular/forms';
4
+ import * as momentImported from 'moment';
5
+ import { ChoicefieldService } from '@valtimo/choicefield';
6
+ import { RouterModule, NavigationEnd, Router, ActivatedRoute, PRIMARY_OUTLET, NavigationStart } from '@angular/router';
7
+ import { NGXLogger } from 'ngx-logger';
8
+ import { ConfigService } from '@valtimo/config';
9
+ import { BehaviorSubject, Observable, combineLatest, fromEvent, Subscription, Subject, timer, from } from 'rxjs';
10
+ import { DocumentService, DocumentModule } from '@valtimo/document';
11
+ import { UserProviderService } from '@valtimo/security';
12
+ import { NgbTooltipModule, NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap';
13
+ import { TranslateModule, TranslateService, TranslateLoader } from '@ngx-translate/core';
14
+ import { HttpClient } from '@angular/common/http';
15
+ import { ContextService } from '@valtimo/context';
16
+ import { HttpLoaderFactory, S3Resource, Alert, AlertType } from '@valtimo/contract';
17
+ import { map, debounceTime, take, filter, switchMap } from 'rxjs/operators';
18
+ import { Title } from '@angular/platform-browser';
19
+ import * as BpmnJS from 'bpmn-js/dist/bpmn-navigated-viewer.production.min.js';
20
+ import { create } from 'heatmap.js-fixed/build/heatmap.js';
21
+ import { S3Service, UploadProviderService, DownloadService, ResourceModule } from '@valtimo/resource';
22
+ import { Formio, FormioModule, FormioAppConfig, createCustomFormioComponent, registerCustomFormioComponentWithClass } from 'angular-formio';
23
+ import jwt_decode from 'jwt-decode';
24
+ import * as Dropzone from 'dropzone';
25
+ import { NgxSpinnerModule } from 'ngx-spinner';
26
+
27
+ /*
28
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
29
+ *
30
+ * Licensed under EUPL, Version 1.2 (the "License");
31
+ * you may not use this file except in compliance with the License.
32
+ * You may obtain a copy of the License at
33
+ *
34
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
35
+ *
36
+ * Unless required by applicable law or agreed to in writing, software
37
+ * distributed under the License is distributed on an "AS IS" basis,
38
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39
+ * See the License for the specific language governing permissions and
40
+ * limitations under the License.
41
+ */
42
+ class CamundaFormComponent {
43
+ constructor() {
44
+ this.submitted = new EventEmitter();
45
+ }
46
+ onSubmitted(event) {
47
+ this.submitted.emit(event);
48
+ }
49
+ }
50
+ CamundaFormComponent.decorators = [
51
+ { type: Component, args: [{
52
+ selector: 'valtimo-camunda-form',
53
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"!componentName && submitted\">\n <valtimo-camunda-generated-form *ngIf=\"formFields\"\n [formFields]=\"formFields\"\n (submitted)=\"onSubmitted($event)\">\n </valtimo-camunda-generated-form>\n</ng-container>\n<ng-container *ngIf=\"componentName\">\n <valtimo-custom-form [componentName]=\"componentName\"></valtimo-custom-form>\n</ng-container>\n"
54
+ },] }
55
+ ];
56
+ CamundaFormComponent.ctorParameters = () => [];
57
+ CamundaFormComponent.propDecorators = {
58
+ componentName: [{ type: Input }],
59
+ formFields: [{ type: Input }],
60
+ submitted: [{ type: Output }]
61
+ };
62
+
63
+ /*
64
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
65
+ *
66
+ * Licensed under EUPL, Version 1.2 (the "License");
67
+ * you may not use this file except in compliance with the License.
68
+ * You may obtain a copy of the License at
69
+ *
70
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
71
+ *
72
+ * Unless required by applicable law or agreed to in writing, software
73
+ * distributed under the License is distributed on an "AS IS" basis,
74
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
75
+ * See the License for the specific language governing permissions and
76
+ * limitations under the License.
77
+ */
78
+ class CamundaCustomFormComponent {
79
+ constructor(resolver) {
80
+ this.resolver = resolver;
81
+ }
82
+ ngOnInit() {
83
+ const factories = Array.from(this.resolver['_factories'].keys());
84
+ const factoryClass = factories.find((x) => x.name === this.componentName);
85
+ const cmpFactory = this.resolver.resolveComponentFactory(factoryClass);
86
+ this.viewContainerRef.createComponent(cmpFactory);
87
+ }
88
+ }
89
+ CamundaCustomFormComponent.decorators = [
90
+ { type: Component, args: [{
91
+ selector: 'valtimo-custom-form',
92
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-template #customFormContainer></ng-template>\n\n",
93
+ styles: [""]
94
+ },] }
95
+ ];
96
+ CamundaCustomFormComponent.ctorParameters = () => [
97
+ { type: ComponentFactoryResolver }
98
+ ];
99
+ CamundaCustomFormComponent.propDecorators = {
100
+ componentName: [{ type: Input }],
101
+ viewContainerRef: [{ type: ViewChild, args: ['customFormContainer', { read: ViewContainerRef, static: true },] }]
102
+ };
103
+
104
+ /*
105
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
106
+ *
107
+ * Licensed under EUPL, Version 1.2 (the "License");
108
+ * you may not use this file except in compliance with the License.
109
+ * You may obtain a copy of the License at
110
+ *
111
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
112
+ *
113
+ * Unless required by applicable law or agreed to in writing, software
114
+ * distributed under the License is distributed on an "AS IS" basis,
115
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
116
+ * See the License for the specific language governing permissions and
117
+ * limitations under the License.
118
+ */
119
+ class CamundaCustomFormModule {
120
+ }
121
+ CamundaCustomFormModule.decorators = [
122
+ { type: NgModule, args: [{
123
+ declarations: [
124
+ CamundaCustomFormComponent
125
+ ],
126
+ imports: [
127
+ CommonModule
128
+ ],
129
+ exports: [
130
+ CamundaCustomFormComponent
131
+ ]
132
+ },] }
133
+ ];
134
+
135
+ /*
136
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
137
+ *
138
+ * Licensed under EUPL, Version 1.2 (the "License");
139
+ * you may not use this file except in compliance with the License.
140
+ * You may obtain a copy of the License at
141
+ *
142
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
143
+ *
144
+ * Unless required by applicable law or agreed to in writing, software
145
+ * distributed under the License is distributed on an "AS IS" basis,
146
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
147
+ * See the License for the specific language governing permissions and
148
+ * limitations under the License.
149
+ */
150
+ const moment = momentImported;
151
+ moment.locale(localStorage.getItem('langKey'));
152
+ const DATE_FORMAT = 'DD-MM-YYYY';
153
+ function minDate(minDateIn) {
154
+ return (control) => {
155
+ if (!control.value) {
156
+ return null;
157
+ }
158
+ const controlDate = moment.utc(control.value).startOf('day');
159
+ const momentMinDate = moment.utc(minDateIn, DATE_FORMAT, true);
160
+ if (!controlDate.isSameOrAfter(momentMinDate)) {
161
+ return {
162
+ minDate: {
163
+ minDate: momentMinDate.format(DATE_FORMAT),
164
+ actual: controlDate.format(DATE_FORMAT)
165
+ }
166
+ };
167
+ }
168
+ else {
169
+ return null;
170
+ }
171
+ };
172
+ }
173
+ function maxDate(maxDateIn) {
174
+ return (control) => {
175
+ if (!control.value) {
176
+ return null;
177
+ }
178
+ const controlDate = moment.utc(control.value).startOf('day');
179
+ const momentMaxDate = moment.utc(maxDateIn, DATE_FORMAT, true);
180
+ if (!controlDate.isSameOrBefore(momentMaxDate)) {
181
+ return {
182
+ maxDate: {
183
+ maxDate: momentMaxDate.format(DATE_FORMAT),
184
+ actual: controlDate.format(DATE_FORMAT)
185
+ }
186
+ };
187
+ }
188
+ else {
189
+ return null;
190
+ }
191
+ };
192
+ }
193
+
194
+ /*
195
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
196
+ *
197
+ * Licensed under EUPL, Version 1.2 (the "License");
198
+ * you may not use this file except in compliance with the License.
199
+ * You may obtain a copy of the License at
200
+ *
201
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
202
+ *
203
+ * Unless required by applicable law or agreed to in writing, software
204
+ * distributed under the License is distributed on an "AS IS" basis,
205
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
206
+ * See the License for the specific language governing permissions and
207
+ * limitations under the License.
208
+ */
209
+ class CamundaFormfieldService {
210
+ constructor() {
211
+ }
212
+ isFormFieldDisabled(formField) {
213
+ return formField.validationConstraints.filter(vc => vc.name === 'readonly').length > 0;
214
+ }
215
+ getMinDate(formField) {
216
+ return formField.validationConstraints.filter(vc => vc.name === 'minDate' && vc.configuration)[0];
217
+ }
218
+ getMaxDate(formField) {
219
+ return formField.validationConstraints.filter(vc => vc.name === 'maxDate' && vc.configuration)[0];
220
+ }
221
+ getValidatorTypes(formField) {
222
+ const validatorTypes = [];
223
+ formField.validationConstraints.forEach(validationConstraint => {
224
+ if (validationConstraint.name === 'required') {
225
+ validatorTypes.push(Validators.required);
226
+ }
227
+ if (validationConstraint.name === 'minlength') {
228
+ validatorTypes.push(Validators.minLength(+validationConstraint.configuration));
229
+ }
230
+ if (validationConstraint.name === 'maxlength') {
231
+ validatorTypes.push(Validators.maxLength(+validationConstraint.configuration));
232
+ }
233
+ if (validationConstraint.name === 'min') {
234
+ validatorTypes.push(Validators.min(+validationConstraint.configuration));
235
+ }
236
+ if (validationConstraint.name === 'max') {
237
+ validatorTypes.push(Validators.max(+validationConstraint.configuration));
238
+ }
239
+ if (validationConstraint.name === 'minDate') {
240
+ validatorTypes.push(minDate(validationConstraint.configuration));
241
+ }
242
+ if (validationConstraint.name === 'maxDate') {
243
+ validatorTypes.push(maxDate(validationConstraint.configuration));
244
+ }
245
+ });
246
+ return validatorTypes;
247
+ }
248
+ }
249
+ CamundaFormfieldService.ɵprov = ɵɵdefineInjectable({ factory: function CamundaFormfieldService_Factory() { return new CamundaFormfieldService(); }, token: CamundaFormfieldService, providedIn: "root" });
250
+ CamundaFormfieldService.decorators = [
251
+ { type: Injectable, args: [{
252
+ providedIn: 'root'
253
+ },] }
254
+ ];
255
+ CamundaFormfieldService.ctorParameters = () => [];
256
+
257
+ /*
258
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
259
+ *
260
+ * Licensed under EUPL, Version 1.2 (the "License");
261
+ * you may not use this file except in compliance with the License.
262
+ * You may obtain a copy of the License at
263
+ *
264
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
265
+ *
266
+ * Unless required by applicable law or agreed to in writing, software
267
+ * distributed under the License is distributed on an "AS IS" basis,
268
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
269
+ * See the License for the specific language governing permissions and
270
+ * limitations under the License.
271
+ */
272
+ class CamundaGeneratedFormComponent {
273
+ constructor(formBuilder, camundaFormFieldService, location) {
274
+ this.formBuilder = formBuilder;
275
+ this.camundaFormFieldService = camundaFormFieldService;
276
+ this.location = location;
277
+ this.submitted = new EventEmitter();
278
+ this.formFields = [];
279
+ }
280
+ ngOnInit() {
281
+ this.formGroup = this.createFormGroup();
282
+ }
283
+ createFormGroup() {
284
+ const group = this.formBuilder.group({});
285
+ this.formFields.forEach(formField => {
286
+ const control = new FormControl({
287
+ value: formField.defaultValue,
288
+ disabled: this.camundaFormFieldService.isFormFieldDisabled(formField)
289
+ }, this.camundaFormFieldService.getValidatorTypes(formField));
290
+ group.addControl(formField.id, control);
291
+ });
292
+ return group;
293
+ }
294
+ reset() {
295
+ this.formGroup.reset();
296
+ }
297
+ back() {
298
+ this.location.back();
299
+ }
300
+ handleSubmit(event) {
301
+ event.preventDefault();
302
+ event.stopPropagation();
303
+ this.submitted.emit(this.formGroup.value);
304
+ }
305
+ }
306
+ CamundaGeneratedFormComponent.decorators = [
307
+ { type: Component, args: [{
308
+ selector: 'valtimo-camunda-generated-form',
309
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<form [formGroup]=\"formGroup\" (ngSubmit)=\"handleSubmit($event)\">\n <ng-container\n *ngFor=\"let formField of formFields\"\n valtimoCamundaFormfieldGenerator\n [formGroup]=\"formGroup\"\n [formField]=\"formField\">\n <ng-content></ng-content>\n </ng-container>\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-sm-12\">\n <div class=\"text-right\">\n <button class=\"btn btn-space btn-default float-left\" type=\"button\" (click)=\"back()\" id=\"back-button\">\n Back\n </button>\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\" id=\"reset-button\">Reset</button>\n <button class=\"btn btn-space btn-primary\"\n [disabled]=\"!formGroup.disabled && !formGroup.valid\"\n type=\"submit\"\n id=\"submit-button\">\n Submit\n </button>\n </div>\n </div>\n </div>\n</form>\n"
310
+ },] }
311
+ ];
312
+ CamundaGeneratedFormComponent.ctorParameters = () => [
313
+ { type: FormBuilder },
314
+ { type: CamundaFormfieldService },
315
+ { type: Location }
316
+ ];
317
+ CamundaGeneratedFormComponent.propDecorators = {
318
+ submitted: [{ type: Output }],
319
+ formFields: [{ type: Input }]
320
+ };
321
+
322
+ /*
323
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
324
+ *
325
+ * Licensed under EUPL, Version 1.2 (the "License");
326
+ * you may not use this file except in compliance with the License.
327
+ * You may obtain a copy of the License at
328
+ *
329
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
330
+ *
331
+ * Unless required by applicable law or agreed to in writing, software
332
+ * distributed under the License is distributed on an "AS IS" basis,
333
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
334
+ * See the License for the specific language governing permissions and
335
+ * limitations under the License.
336
+ */
337
+ class CamundaStringFormfieldComponent {
338
+ constructor() {
339
+ }
340
+ }
341
+ CamundaStringFormfieldComponent.decorators = [
342
+ { type: Component, args: [{
343
+ selector: 'valtimo-camunda-string-formfield',
344
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"form-group row\" *ngIf=\"formGroup\" [formGroup]=\"formGroup\">\n <label for=\"{{ formField.id }}\" class=\"col-12 col-sm-3 col-form-label text-sm-right\">\n {{ formField.label }}\n </label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input id=\"{{ formField.id }}\"\n class=\"form-control\"\n type=\"text\"\n [attr.placeholder]=\"formField.defaultValue\"\n [formControlName]=\"formField.id\"/>\n <valtimo-camunda-formfield-validation\n [formGroup]=\"formGroup\"\n [formField]=\"formField\">\n </valtimo-camunda-formfield-validation>\n </div>\n</div>\n\n"
345
+ },] }
346
+ ];
347
+ CamundaStringFormfieldComponent.ctorParameters = () => [];
348
+
349
+ /*
350
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
351
+ *
352
+ * Licensed under EUPL, Version 1.2 (the "License");
353
+ * you may not use this file except in compliance with the License.
354
+ * You may obtain a copy of the License at
355
+ *
356
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
357
+ *
358
+ * Unless required by applicable law or agreed to in writing, software
359
+ * distributed under the License is distributed on an "AS IS" basis,
360
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
361
+ * See the License for the specific language governing permissions and
362
+ * limitations under the License.
363
+ */
364
+ class CamundaBooleanFormfieldComponent {
365
+ constructor() {
366
+ }
367
+ }
368
+ CamundaBooleanFormfieldComponent.decorators = [
369
+ { type: Component, args: [{
370
+ selector: 'valtimo-camunda-boolean-formfield',
371
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"form-group row\" *ngIf=\"formGroup\" [formGroup]=\"formGroup\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\">\n {{ formField.label }}\n </label>\n <div class=\"col-12 col-sm-8 col-lg-6 form-check mt-1\">\n <label for=\"yes_{{ formField.id }}\" class=\"custom-control custom-radio custom-control-inline\">\n <input\n class=\"custom-control-input\"\n id=\"yes_{{ formField.id }}\"\n type=\"radio\"\n [value]=\"true\"\n [formControlName]=\"formField.id\"/>\n <span class=\"custom-control-label custom-control-color\">Yes</span>\n </label>\n <label for=\"no_{{ formField.id }}\" class=\"custom-control custom-radio custom-control-inline\">\n <input\n class=\"custom-control-input\"\n id=\"no_{{ formField.id }}\"\n type=\"radio\"\n [value]=\"false\"\n [formControlName]=\"formField.id\"/>\n <span class=\"custom-control-label custom-control-color\">No</span>\n </label>\n <valtimo-camunda-formfield-validation\n [formGroup]=\"formGroup\"\n [formField]=\"formField\">\n </valtimo-camunda-formfield-validation>\n </div>\n</div>\n"
372
+ },] }
373
+ ];
374
+ CamundaBooleanFormfieldComponent.ctorParameters = () => [];
375
+
376
+ /*
377
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
378
+ *
379
+ * Licensed under EUPL, Version 1.2 (the "License");
380
+ * you may not use this file except in compliance with the License.
381
+ * You may obtain a copy of the License at
382
+ *
383
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
384
+ *
385
+ * Unless required by applicable law or agreed to in writing, software
386
+ * distributed under the License is distributed on an "AS IS" basis,
387
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
388
+ * See the License for the specific language governing permissions and
389
+ * limitations under the License.
390
+ */
391
+ const moment$1 = momentImported;
392
+ moment$1.locale(localStorage.getItem('langKey'));
393
+ class CamundaDateFormfieldComponent {
394
+ constructor(formFieldService) {
395
+ this.formFieldService = formFieldService;
396
+ this.datePickerOptions = {};
397
+ }
398
+ ngOnInit() {
399
+ this.INPUT_SELECTOR = '#' + this.formField.id;
400
+ this.datePickerOptions = {
401
+ autoclose: true,
402
+ componentIcon: '.mdi.mdi-calendar',
403
+ navIcons: {
404
+ rightIcon: 'mdi mdi-chevron-right',
405
+ leftIcon: 'mdi mdi-chevron-left'
406
+ },
407
+ format: 'dd-mm-yyyy'
408
+ };
409
+ }
410
+ ngAfterViewInit() {
411
+ const formGroup = this.formGroup;
412
+ const formField = this.formField;
413
+ const maxDate = this.formFieldService.getMaxDate(this.formField);
414
+ if (maxDate) {
415
+ this.datePickerOptions.endDate = maxDate.configuration;
416
+ }
417
+ const minDate = this.formFieldService.getMinDate(this.formField);
418
+ if (minDate) {
419
+ this.datePickerOptions.startDate = minDate.configuration;
420
+ }
421
+ $(this.INPUT_SELECTOR).datetimepicker(this.datePickerOptions);
422
+ $(this.INPUT_SELECTOR).on('changeDate', function (e) {
423
+ formGroup.patchValue({
424
+ [formField.id]: moment$1(e.date.valueOf()).format('DD/MM/YYYY')
425
+ });
426
+ });
427
+ }
428
+ }
429
+ CamundaDateFormfieldComponent.decorators = [
430
+ { type: Component, args: [{
431
+ selector: 'valtimo-camunda-date-formfield',
432
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"form-group row\" *ngIf=\"formGroup\" [formGroup]=\"formGroup\">\n <label for=\"{{ formField.id }}\" class=\"col-12 col-sm-3 col-form-label text-sm-right\">\n {{ formField.label }}\n </label>\n <div class=\"col-12 col-sm-8 col-lg-6 pt1\">\n <input\n type=\"input\"\n class=\"form-control\"\n data-min-view=\"2\"\n id=\"{{ formField.id }}\"\n autocomplete=\"off\"\n [formControlName]=\"formField.id\"/>\n <valtimo-camunda-formfield-validation\n [formGroup]=\"formGroup\"\n [formField]=\"formField\">\n </valtimo-camunda-formfield-validation>\n </div>\n</div>\n"
433
+ },] }
434
+ ];
435
+ CamundaDateFormfieldComponent.ctorParameters = () => [
436
+ { type: CamundaFormfieldService }
437
+ ];
438
+
439
+ /*
440
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
441
+ *
442
+ * Licensed under EUPL, Version 1.2 (the "License");
443
+ * you may not use this file except in compliance with the License.
444
+ * You may obtain a copy of the License at
445
+ *
446
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
447
+ *
448
+ * Unless required by applicable law or agreed to in writing, software
449
+ * distributed under the License is distributed on an "AS IS" basis,
450
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
451
+ * See the License for the specific language governing permissions and
452
+ * limitations under the License.
453
+ */
454
+ class CamundaLongFormfieldComponent {
455
+ constructor() {
456
+ }
457
+ }
458
+ CamundaLongFormfieldComponent.decorators = [
459
+ { type: Component, args: [{
460
+ selector: 'valtimo-camunda-long-formfield',
461
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"form-group row\" *ngIf=\"formGroup\" [formGroup]=\"formGroup\">\n <label for=\"{{ formField.id }}\" class=\"col-12 col-sm-3 col-form-label text-sm-right\">\n {{ formField.label }}\n </label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input id=\"{{ formField.id }}\"\n class=\"form-control\"\n type=\"number\"\n [attr.placeholder]=\"formField.defaultValue\"\n [formControlName]=\"formField.id\"/>\n <valtimo-camunda-formfield-validation\n [formGroup]=\"formGroup\"\n [formField]=\"formField\">\n </valtimo-camunda-formfield-validation>\n </div>\n</div>\n"
462
+ },] }
463
+ ];
464
+ CamundaLongFormfieldComponent.ctorParameters = () => [];
465
+
466
+ /*
467
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
468
+ *
469
+ * Licensed under EUPL, Version 1.2 (the "License");
470
+ * you may not use this file except in compliance with the License.
471
+ * You may obtain a copy of the License at
472
+ *
473
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
474
+ *
475
+ * Unless required by applicable law or agreed to in writing, software
476
+ * distributed under the License is distributed on an "AS IS" basis,
477
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
478
+ * See the License for the specific language governing permissions and
479
+ * limitations under the License.
480
+ */
481
+ class CamundaEnumFormfieldComponent {
482
+ constructor() {
483
+ }
484
+ ngOnInit() {
485
+ this.valueKeys = Object.keys(this.formField.type.values);
486
+ }
487
+ }
488
+ CamundaEnumFormfieldComponent.decorators = [
489
+ { type: Component, args: [{
490
+ selector: 'valtimo-camunda-enum-formfield',
491
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"form-group row\" [formGroup]=\"formGroup\">\n <label for=\"{{ formField.id }}\" class=\"col-12 col-sm-3 col-form-label text-sm-right\">\n {{ formField.label }}\n </label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select\n class=\"form-control\"\n id=\"{{ formField.id }}\"\n [formControlName]=\"formField.id\">\n <option selected=\"selected\" value=\"\"></option>\n <option *ngFor=\"let key of valueKeys\" [value]=\"key\" id=\"option_{{ key }}\">\n {{ formField.type.values[key] }}\n </option>\n </select>\n <valtimo-camunda-formfield-validation\n [formGroup]=\"formGroup\"\n [formField]=\"formField\">\n </valtimo-camunda-formfield-validation>\n </div>\n</div>\n"
492
+ },] }
493
+ ];
494
+ CamundaEnumFormfieldComponent.ctorParameters = () => [];
495
+
496
+ /*
497
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
498
+ *
499
+ * Licensed under EUPL, Version 1.2 (the "License");
500
+ * you may not use this file except in compliance with the License.
501
+ * You may obtain a copy of the License at
502
+ *
503
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
504
+ *
505
+ * Unless required by applicable law or agreed to in writing, software
506
+ * distributed under the License is distributed on an "AS IS" basis,
507
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
508
+ * See the License for the specific language governing permissions and
509
+ * limitations under the License.
510
+ */
511
+ class CamundaTextareaFormfieldComponent {
512
+ constructor() {
513
+ }
514
+ }
515
+ CamundaTextareaFormfieldComponent.decorators = [
516
+ { type: Component, args: [{
517
+ selector: 'valtimo-camunda-textarea-formfield',
518
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"form-group row\" *ngIf=\"formGroup\" [formGroup]=\"formGroup\">\n <label for=\"{{ formField.id }}\" class=\"col-12 col-sm-3 col-form-label text-sm-right\">\n {{ formField.label }}\n </label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <textarea id=\"{{ formField.id }}\"\n class=\"form-control\"\n [attr.placeholder]=\"formField.defaultValue\"\n [formControlName]=\"formField.id\"></textarea>\n <valtimo-camunda-formfield-validation\n [formGroup]=\"formGroup\"\n [formField]=\"formField\">\n </valtimo-camunda-formfield-validation>\n </div>\n</div>\n\n"
519
+ },] }
520
+ ];
521
+ CamundaTextareaFormfieldComponent.ctorParameters = () => [];
522
+
523
+ /*
524
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
525
+ *
526
+ * Licensed under EUPL, Version 1.2 (the "License");
527
+ * you may not use this file except in compliance with the License.
528
+ * You may obtain a copy of the License at
529
+ *
530
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
531
+ *
532
+ * Unless required by applicable law or agreed to in writing, software
533
+ * distributed under the License is distributed on an "AS IS" basis,
534
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
535
+ * See the License for the specific language governing permissions and
536
+ * limitations under the License.
537
+ */
538
+ class CamundaChoicefieldFormfieldComponent {
539
+ constructor(choicefieldService) {
540
+ this.choicefieldService = choicefieldService;
541
+ this.choicefieldValues = [];
542
+ }
543
+ ngOnInit() {
544
+ this.choicefieldService.getChoiceFieldValuesByName(this.formField.properties['choicefield']).subscribe(data => {
545
+ this.choicefieldValues = data;
546
+ });
547
+ }
548
+ }
549
+ CamundaChoicefieldFormfieldComponent.decorators = [
550
+ { type: Component, args: [{
551
+ selector: 'valtimo-camunda-choicefield-formfield',
552
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"form-group row\" [formGroup]=\"formGroup\">\n <label for=\"{{ formField.id }}\" class=\"col-12 col-sm-3 col-form-label text-sm-right\">\n {{ formField.label }}\n </label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select\n class=\"form-control\"\n id=\"{{ formField.id }}\"\n [formControlName]=\"formField.id\">\n <option selected=\"selected\" value=\"\"></option>\n <ng-container *ngFor=\"let choicefieldValue of choicefieldValues\">\n <option *ngIf=\"!choicefieldValue.deprecated\"\n [value]=\"choicefieldValue.value\"\n id=\"option_{{ choicefieldValue.value }}\">\n {{ choicefieldValue.name }}\n </option>\n </ng-container>\n </select>\n <valtimo-camunda-formfield-validation\n [formGroup]=\"formGroup\"\n [formField]=\"formField\">\n </valtimo-camunda-formfield-validation>\n </div>\n</div>\n"
553
+ },] }
554
+ ];
555
+ CamundaChoicefieldFormfieldComponent.ctorParameters = () => [
556
+ { type: ChoicefieldService }
557
+ ];
558
+
559
+ /*
560
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
561
+ *
562
+ * Licensed under EUPL, Version 1.2 (the "License");
563
+ * you may not use this file except in compliance with the License.
564
+ * You may obtain a copy of the License at
565
+ *
566
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
567
+ *
568
+ * Unless required by applicable law or agreed to in writing, software
569
+ * distributed under the License is distributed on an "AS IS" basis,
570
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
571
+ * See the License for the specific language governing permissions and
572
+ * limitations under the License.
573
+ */
574
+ class CamundaFormfieldGeneratorDirective {
575
+ constructor(viewContainerRef, componentFactoryResolver) {
576
+ this.viewContainerRef = viewContainerRef;
577
+ this.componentFactoryResolver = componentFactoryResolver;
578
+ this.COMPONENTS = {
579
+ string: CamundaStringFormfieldComponent,
580
+ boolean: CamundaBooleanFormfieldComponent,
581
+ date: CamundaDateFormfieldComponent,
582
+ long: CamundaLongFormfieldComponent,
583
+ enum: CamundaEnumFormfieldComponent,
584
+ textarea: CamundaTextareaFormfieldComponent,
585
+ choicefield: CamundaChoicefieldFormfieldComponent
586
+ };
587
+ }
588
+ ngOnInit() {
589
+ const typeName = this.formField.typeName.toLowerCase();
590
+ if (!this.COMPONENTS[typeName]) {
591
+ throw new Error('Could not find component for formfield type: ' + typeName);
592
+ }
593
+ const component = this.COMPONENTS[typeName];
594
+ const factory = this.componentFactoryResolver.resolveComponentFactory(component);
595
+ this.component = this.viewContainerRef.createComponent(factory);
596
+ this.component.instance.formGroup = this.formGroup;
597
+ this.component.instance.formField = this.formField;
598
+ }
599
+ }
600
+ CamundaFormfieldGeneratorDirective.decorators = [
601
+ { type: Directive, args: [{
602
+ selector: '[valtimoCamundaFormfieldGenerator]'
603
+ },] }
604
+ ];
605
+ CamundaFormfieldGeneratorDirective.ctorParameters = () => [
606
+ { type: ViewContainerRef },
607
+ { type: ComponentFactoryResolver }
608
+ ];
609
+ CamundaFormfieldGeneratorDirective.propDecorators = {
610
+ formField: [{ type: Input }],
611
+ formGroup: [{ type: Input }]
612
+ };
613
+
614
+ /*
615
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
616
+ *
617
+ * Licensed under EUPL, Version 1.2 (the "License");
618
+ * you may not use this file except in compliance with the License.
619
+ * You may obtain a copy of the License at
620
+ *
621
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
622
+ *
623
+ * Unless required by applicable law or agreed to in writing, software
624
+ * distributed under the License is distributed on an "AS IS" basis,
625
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
626
+ * See the License for the specific language governing permissions and
627
+ * limitations under the License.
628
+ */
629
+ class CamundaFormfieldValidationComponent {
630
+ constructor() {
631
+ }
632
+ ngOnInit() {
633
+ this.formControl = this.formGroup.get(this.formField.id);
634
+ }
635
+ }
636
+ CamundaFormfieldValidationComponent.decorators = [
637
+ { type: Component, args: [{
638
+ selector: 'valtimo-camunda-formfield-validation',
639
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ul class=\"parsley-errors-list filled\"\n *ngIf=\"formControl.invalid && (formControl.dirty || formControl.touched)\">\n <li *ngIf=\"formControl.errors.required\">\n This field is required.\n </li>\n <li *ngIf=\"formControl.errors.minlength\">\n This field should be more than {{ formControl.errors.minlength.requiredLength }} characters.\n </li>\n <li *ngIf=\"formControl.errors.maxlength\">\n This field cannot be more than {{ formControl.errors.maxlength.requiredLength }} characters.\n </li>\n <li *ngIf=\"formControl.errors.min\">\n This field should be more than {{ formControl.errors.min.min }}.\n </li>\n <li *ngIf=\"formControl.errors.max\">\n This field should be less or equal to {{ formControl.errors.max.max }}.\n </li>\n <li *ngIf=\"formControl.errors.minDate\">\n This field should be more than {{ formControl.errors.minDate.minDate }}.\n </li>\n <li *ngIf=\"formControl.errors.maxDate\">\n This field should be less or equal to {{ formControl.errors.maxDate.maxDate }}.\n </li>\n</ul>\n"
640
+ },] }
641
+ ];
642
+ CamundaFormfieldValidationComponent.ctorParameters = () => [];
643
+ CamundaFormfieldValidationComponent.propDecorators = {
644
+ formGroup: [{ type: Input }],
645
+ formField: [{ type: Input }]
646
+ };
647
+
648
+ /*
649
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
650
+ *
651
+ * Licensed under EUPL, Version 1.2 (the "License");
652
+ * you may not use this file except in compliance with the License.
653
+ * You may obtain a copy of the License at
654
+ *
655
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
656
+ *
657
+ * Unless required by applicable law or agreed to in writing, software
658
+ * distributed under the License is distributed on an "AS IS" basis,
659
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
660
+ * See the License for the specific language governing permissions and
661
+ * limitations under the License.
662
+ */
663
+ class CamundaGeneratedFormModule {
664
+ }
665
+ CamundaGeneratedFormModule.decorators = [
666
+ { type: NgModule, args: [{
667
+ declarations: [
668
+ CamundaStringFormfieldComponent,
669
+ CamundaBooleanFormfieldComponent,
670
+ CamundaDateFormfieldComponent,
671
+ CamundaFormfieldGeneratorDirective,
672
+ CamundaLongFormfieldComponent,
673
+ CamundaEnumFormfieldComponent,
674
+ CamundaTextareaFormfieldComponent,
675
+ CamundaChoicefieldFormfieldComponent,
676
+ CamundaFormfieldValidationComponent,
677
+ CamundaGeneratedFormComponent
678
+ ],
679
+ imports: [
680
+ CommonModule,
681
+ ReactiveFormsModule
682
+ ],
683
+ exports: [
684
+ CamundaGeneratedFormComponent
685
+ ],
686
+ entryComponents: [
687
+ CamundaStringFormfieldComponent,
688
+ CamundaBooleanFormfieldComponent,
689
+ CamundaDateFormfieldComponent,
690
+ CamundaLongFormfieldComponent,
691
+ CamundaEnumFormfieldComponent,
692
+ CamundaTextareaFormfieldComponent,
693
+ CamundaChoicefieldFormfieldComponent
694
+ ]
695
+ },] }
696
+ ];
697
+
698
+ /*
699
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
700
+ *
701
+ * Licensed under EUPL, Version 1.2 (the "License");
702
+ * you may not use this file except in compliance with the License.
703
+ * You may obtain a copy of the License at
704
+ *
705
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
706
+ *
707
+ * Unless required by applicable law or agreed to in writing, software
708
+ * distributed under the License is distributed on an "AS IS" basis,
709
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
710
+ * See the License for the specific language governing permissions and
711
+ * limitations under the License.
712
+ */
713
+ class CamundaFormModule {
714
+ }
715
+ CamundaFormModule.decorators = [
716
+ { type: NgModule, args: [{
717
+ declarations: [
718
+ CamundaFormComponent
719
+ ],
720
+ imports: [
721
+ CommonModule,
722
+ CamundaGeneratedFormModule,
723
+ CamundaCustomFormModule
724
+ ],
725
+ exports: [
726
+ CamundaFormComponent
727
+ ]
728
+ },] }
729
+ ];
730
+
731
+ /*
732
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
733
+ *
734
+ * Licensed under EUPL, Version 1.2 (the "License");
735
+ * you may not use this file except in compliance with the License.
736
+ * You may obtain a copy of the License at
737
+ *
738
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
739
+ *
740
+ * Unless required by applicable law or agreed to in writing, software
741
+ * distributed under the License is distributed on an "AS IS" basis,
742
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
743
+ * See the License for the specific language governing permissions and
744
+ * limitations under the License.
745
+ */
746
+ class TopbarComponent {
747
+ constructor() {
748
+ }
749
+ }
750
+ TopbarComponent.decorators = [
751
+ { type: Component, args: [{
752
+ selector: 'valtimo-topbar',
753
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<nav class=\"navbar navbar-expand fixed-top be-top-header\">\n <div class=\"container-fluid\">\n <div class=\"be-navbar-header\">\n <a class=\"navbar-brand\" [routerLink]=\"['/']\"></a>\n </div>\n <div class=\"be-right-navbar\">\n <!-- important empty div: in order to made float-right element works on mobile -->\n <div></div>\n <ul class=\"nav navbar-nav be-user-nav float-right be-icons-nav\">\n <li class=\"nav-item dropdown special\">\n <a class=\"nav-link be-toggle-right-sidebar\" href=\"#\" role=\"button\" aria-expanded=\"false\">\n <i class=\"fas fa-user-circle user-icon\"></i>\n </a>\n </li>\n </ul>\n </div>\n </div>\n</nav>\n",
754
+ styles: [".user-icon{font-size:30px;padding-top:5px}"]
755
+ },] }
756
+ ];
757
+ TopbarComponent.ctorParameters = () => [];
758
+
759
+ /*
760
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
761
+ *
762
+ * Licensed under EUPL, Version 1.2 (the "License");
763
+ * you may not use this file except in compliance with the License.
764
+ * You may obtain a copy of the License at
765
+ *
766
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
767
+ *
768
+ * Unless required by applicable law or agreed to in writing, software
769
+ * distributed under the License is distributed on an "AS IS" basis,
770
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
771
+ * See the License for the specific language governing permissions and
772
+ * limitations under the License.
773
+ */
774
+ class TopbarModule {
775
+ }
776
+ TopbarModule.decorators = [
777
+ { type: NgModule, args: [{
778
+ declarations: [TopbarComponent],
779
+ imports: [
780
+ CommonModule,
781
+ RouterModule
782
+ ],
783
+ exports: [TopbarComponent]
784
+ },] }
785
+ ];
786
+
787
+ /*
788
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
789
+ *
790
+ * Licensed under EUPL, Version 1.2 (the "License");
791
+ * you may not use this file except in compliance with the License.
792
+ * You may obtain a copy of the License at
793
+ *
794
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
795
+ *
796
+ * Unless required by applicable law or agreed to in writing, software
797
+ * distributed under the License is distributed on an "AS IS" basis,
798
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
799
+ * See the License for the specific language governing permissions and
800
+ * limitations under the License.
801
+ */
802
+ class MenuService {
803
+ constructor(configService, documentService, userProviderService, logger) {
804
+ this.configService = configService;
805
+ this.documentService = documentService;
806
+ this.userProviderService = userProviderService;
807
+ this.logger = logger;
808
+ this._menuItems$ = new BehaviorSubject(undefined);
809
+ this.menuConfig = configService.config.menu;
810
+ }
811
+ init() {
812
+ this.reload();
813
+ this.logger.debug('Menu initialized');
814
+ }
815
+ get menuItems$() {
816
+ return this._menuItems$.asObservable();
817
+ }
818
+ reload() {
819
+ return this._menuItems$.next(this.loadMenuItems());
820
+ }
821
+ loadMenuItems() {
822
+ let menuItems = [];
823
+ this.menuConfig.menuItems.forEach((menuItem) => {
824
+ menuItem.show = true;
825
+ menuItems.push(menuItem);
826
+ });
827
+ menuItems = this.sortMenuItems(menuItems);
828
+ this.appendDossierSubMenuItems(menuItems).subscribe(value => menuItems = this.applyMenuRoleSecurity(value));
829
+ return menuItems;
830
+ }
831
+ sortMenuItems(menuItems) {
832
+ return menuItems.sort((a, b) => {
833
+ return a.sequence - b.sequence;
834
+ });
835
+ }
836
+ appendDossierSubMenuItems(menuItems) {
837
+ return new Observable(subscriber => {
838
+ this.logger.debug('appendDossierSubMenuItems');
839
+ this.documentService.getAllDefinitions().subscribe(definitions => {
840
+ const dossierMenuItems = definitions.content
841
+ .map((definition, index) => ({
842
+ link: ['/dossiers/' + definition.id.name],
843
+ title: definition.schema.title,
844
+ iconClass: 'icon mdi mdi-dot-circle',
845
+ sequence: index,
846
+ show: true
847
+ }));
848
+ this.logger.debug('found dossierMenuItems', dossierMenuItems);
849
+ const menuItemIndex = menuItems.findIndex(({ title }) => title === 'Dossiers');
850
+ if (menuItemIndex > 0) {
851
+ const dossierMenu = menuItems[menuItemIndex];
852
+ this.logger.debug('updating dossierMenu', dossierMenu);
853
+ dossierMenu.children = dossierMenuItems;
854
+ menuItems[menuItemIndex] = dossierMenu;
855
+ }
856
+ subscriber.next(menuItems);
857
+ this.logger.debug('appendDossierSubMenuItems finished');
858
+ });
859
+ });
860
+ }
861
+ applyMenuRoleSecurity(menuItems) {
862
+ this.userProviderService.getUserSubject().subscribe(user => {
863
+ if (user.roles != null) {
864
+ this.logger.debug('applyMenuRoleSecurity');
865
+ const userRoles = user.roles;
866
+ menuItems.forEach((menuItem) => {
867
+ const access = this.determineRoleAccess(menuItem, userRoles);
868
+ this.logger.debug('Menu: check role access', menuItem.roles, access);
869
+ if (menuItem.show !== access) {
870
+ this.logger.debug('Menu: Change access', menuItem, access);
871
+ menuItem.show = access;
872
+ }
873
+ });
874
+ }
875
+ });
876
+ return menuItems;
877
+ }
878
+ determineRoleAccess(menuItem, roles) {
879
+ if (!menuItem.roles) {
880
+ return true;
881
+ }
882
+ else if (menuItem.roles.some(role => roles.includes(role))) {
883
+ return true;
884
+ }
885
+ else {
886
+ return false;
887
+ }
888
+ }
889
+ }
890
+ MenuService.ɵprov = ɵɵdefineInjectable({ factory: function MenuService_Factory() { return new MenuService(ɵɵinject(ConfigService), ɵɵinject(DocumentService), ɵɵinject(UserProviderService), ɵɵinject(NGXLogger)); }, token: MenuService, providedIn: "root" });
891
+ MenuService.decorators = [
892
+ { type: Injectable, args: [{
893
+ providedIn: 'root'
894
+ },] }
895
+ ];
896
+ MenuService.ctorParameters = () => [
897
+ { type: ConfigService },
898
+ { type: DocumentService },
899
+ { type: UserProviderService },
900
+ { type: NGXLogger }
901
+ ];
902
+
903
+ /*
904
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
905
+ *
906
+ * Licensed under EUPL, Version 1.2 (the "License");
907
+ * you may not use this file except in compliance with the License.
908
+ * You may obtain a copy of the License at
909
+ *
910
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
911
+ *
912
+ * Unless required by applicable law or agreed to in writing, software
913
+ * distributed under the License is distributed on an "AS IS" basis,
914
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
915
+ * See the License for the specific language governing permissions and
916
+ * limitations under the License.
917
+ */
918
+ const routes = [];
919
+ class MenuRoutingModule {
920
+ }
921
+ MenuRoutingModule.decorators = [
922
+ { type: NgModule, args: [{
923
+ imports: [
924
+ RouterModule.forChild(routes)
925
+ ],
926
+ exports: [RouterModule]
927
+ },] }
928
+ ];
929
+
930
+ /*
931
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
932
+ *
933
+ * Licensed under EUPL, Version 1.2 (the "License");
934
+ * you may not use this file except in compliance with the License.
935
+ * You may obtain a copy of the License at
936
+ *
937
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
938
+ *
939
+ * Unless required by applicable law or agreed to in writing, software
940
+ * distributed under the License is distributed on an "AS IS" basis,
941
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
942
+ * See the License for the specific language governing permissions and
943
+ * limitations under the License.
944
+ */
945
+ class MenuComponent {
946
+ constructor(menuService, elRef, renderer, router) {
947
+ this.menuService = menuService;
948
+ this.elRef = elRef;
949
+ this.renderer = renderer;
950
+ this.router = router;
951
+ }
952
+ ngOnInit() {
953
+ this.openRouterSubscription();
954
+ this.menuItemSubscription = this.menuService.menuItems$.subscribe(value => this.menuItems = value);
955
+ }
956
+ ngOnDestroy() {
957
+ this.routerSubscription.unsubscribe();
958
+ this.menuItemSubscription.unsubscribe();
959
+ }
960
+ openRouterSubscription() {
961
+ this.routerSubscription = this.router.events.subscribe((event) => {
962
+ if (event instanceof NavigationEnd) {
963
+ this.closeSubMenu();
964
+ }
965
+ });
966
+ }
967
+ closeSubMenu() {
968
+ const visibleSubMenuElm = this.elRef.nativeElement.querySelector('.sub-menu.visible');
969
+ if (visibleSubMenuElm) {
970
+ this.renderer.removeClass(visibleSubMenuElm, 'visible');
971
+ const topLevelMenuItem = this.elRef.nativeElement.querySelector('li.parent.open');
972
+ if (topLevelMenuItem) {
973
+ this.renderer.removeClass(topLevelMenuItem, 'open');
974
+ }
975
+ }
976
+ }
977
+ }
978
+ MenuComponent.decorators = [
979
+ { type: Component, args: [{
980
+ selector: 'valtimo-menu',
981
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ul class=\"sidebar-elements\">\n <ng-container *ngFor=\"let menuItem of menuItems\">\n <li\n [class.parent]=\"menuItem.children\"\n [hidden]=\"!menuItem.show\"\n [routerLinkActive]=\"'active'\"\n [routerLinkActiveOptions]=\"{exact: true}\"\n >\n <a *ngIf=\"menuItem.link\" [routerLink]=\"menuItem.link\" class=\"sub-item\">\n <valtimo-menu-item-text [menuItem]=\"menuItem\"></valtimo-menu-item-text>\n </a>\n <a *ngIf=\"!menuItem.link\" class=\"sub-item\">\n <valtimo-menu-item-text [menuItem]=\"menuItem\"></valtimo-menu-item-text>\n </a>\n <ng-container *ngIf=\"menuItem.children\">\n <ul class=\"sub-menu\">\n <li class=\"title\">{{ menuItem.title | translate }}</li>\n <li\n *ngFor=\"let subMenuItem of menuItem.children\"\n [routerLinkActive]=\"'active'\"\n [routerLinkActiveOptions]=\"{exact: true}\"\n >\n <a *ngIf=\"subMenuItem.link\" [routerLink]=\"subMenuItem.link\">\n <valtimo-submenu-item-text [submenuItem]=\"subMenuItem\"></valtimo-submenu-item-text>\n </a>\n <a *ngIf=\"!subMenuItem.link\">\n <valtimo-submenu-item-text [submenuItem]=\"subMenuItem\"></valtimo-submenu-item-text>\n </a>\n </li>\n </ul>\n </ng-container>\n </li>\n </ng-container>\n</ul>\n",
982
+ styles: [".c-default{cursor:default}.sub-item{cursor:pointer}"]
983
+ },] }
984
+ ];
985
+ MenuComponent.ctorParameters = () => [
986
+ { type: MenuService },
987
+ { type: ElementRef },
988
+ { type: Renderer2 },
989
+ { type: Router }
990
+ ];
991
+
992
+ /*
993
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
994
+ *
995
+ * Licensed under EUPL, Version 1.2 (the "License");
996
+ * you may not use this file except in compliance with the License.
997
+ * You may obtain a copy of the License at
998
+ *
999
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1000
+ *
1001
+ * Unless required by applicable law or agreed to in writing, software
1002
+ * distributed under the License is distributed on an "AS IS" basis,
1003
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1004
+ * See the License for the specific language governing permissions and
1005
+ * limitations under the License.
1006
+ */
1007
+ class MenuItemTextComponent {
1008
+ }
1009
+ MenuItemTextComponent.decorators = [
1010
+ { type: Component, args: [{
1011
+ selector: 'valtimo-menu-item-text',
1012
+ template: `
1013
+ <i class="{{ menuItem.iconClass }}"
1014
+ container="body"
1015
+ placement="right"
1016
+ ngbTooltip="{{ menuItem.title | translate }}"
1017
+ autoClose="true">
1018
+ </i>
1019
+ <span>{{ menuItem.title | translate }}</span>
1020
+ `
1021
+ },] }
1022
+ ];
1023
+ MenuItemTextComponent.propDecorators = {
1024
+ menuItem: [{ type: Input }]
1025
+ };
1026
+
1027
+ /*
1028
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1029
+ *
1030
+ * Licensed under EUPL, Version 1.2 (the "License");
1031
+ * you may not use this file except in compliance with the License.
1032
+ * You may obtain a copy of the License at
1033
+ *
1034
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1035
+ *
1036
+ * Unless required by applicable law or agreed to in writing, software
1037
+ * distributed under the License is distributed on an "AS IS" basis,
1038
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1039
+ * See the License for the specific language governing permissions and
1040
+ * limitations under the License.
1041
+ */
1042
+ class SubmenuItemTextComponent {
1043
+ }
1044
+ SubmenuItemTextComponent.decorators = [
1045
+ { type: Component, args: [{
1046
+ selector: 'valtimo-submenu-item-text',
1047
+ template: `
1048
+ <span [ngClass]="submenuItem.textClass">
1049
+ {{ submenuItem.title | translate }}
1050
+ <ng-container *ngIf="!submenuItem.link">&gt;</ng-container>
1051
+ </span>
1052
+ `
1053
+ },] }
1054
+ ];
1055
+ SubmenuItemTextComponent.propDecorators = {
1056
+ submenuItem: [{ type: Input }]
1057
+ };
1058
+
1059
+ /*
1060
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1061
+ *
1062
+ * Licensed under EUPL, Version 1.2 (the "License");
1063
+ * you may not use this file except in compliance with the License.
1064
+ * You may obtain a copy of the License at
1065
+ *
1066
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1067
+ *
1068
+ * Unless required by applicable law or agreed to in writing, software
1069
+ * distributed under the License is distributed on an "AS IS" basis,
1070
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1071
+ * See the License for the specific language governing permissions and
1072
+ * limitations under the License.
1073
+ */
1074
+ class MenuModule {
1075
+ }
1076
+ MenuModule.decorators = [
1077
+ { type: NgModule, args: [{
1078
+ declarations: [MenuComponent, MenuItemTextComponent, SubmenuItemTextComponent],
1079
+ imports: [
1080
+ CommonModule,
1081
+ RouterModule,
1082
+ NgbTooltipModule,
1083
+ TranslateModule
1084
+ ],
1085
+ exports: [MenuComponent],
1086
+ providers: []
1087
+ },] }
1088
+ ];
1089
+
1090
+ /*
1091
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1092
+ *
1093
+ * Licensed under EUPL, Version 1.2 (the "License");
1094
+ * you may not use this file except in compliance with the License.
1095
+ * You may obtain a copy of the License at
1096
+ *
1097
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1098
+ *
1099
+ * Unless required by applicable law or agreed to in writing, software
1100
+ * distributed under the License is distributed on an "AS IS" basis,
1101
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1102
+ * See the License for the specific language governing permissions and
1103
+ * limitations under the License.
1104
+ */
1105
+ function menuInitializer(injector, logger) {
1106
+ const menuService = injector.get(MenuService);
1107
+ return () => {
1108
+ return new Promise((resolve, reject) => {
1109
+ try {
1110
+ logger.debug('menu initializer before init');
1111
+ menuService.init();
1112
+ logger.debug('menu initializer after init');
1113
+ resolve();
1114
+ }
1115
+ catch (error) {
1116
+ logger.debug('menu initializer error', error);
1117
+ reject(error);
1118
+ }
1119
+ });
1120
+ };
1121
+ }
1122
+
1123
+ /*
1124
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1125
+ *
1126
+ * Licensed under EUPL, Version 1.2 (the "License");
1127
+ * you may not use this file except in compliance with the License.
1128
+ * You may obtain a copy of the License at
1129
+ *
1130
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1131
+ *
1132
+ * Unless required by applicable law or agreed to in writing, software
1133
+ * distributed under the License is distributed on an "AS IS" basis,
1134
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1135
+ * See the License for the specific language governing permissions and
1136
+ * limitations under the License.
1137
+ */
1138
+ class VersionService {
1139
+ constructor(http) {
1140
+ this.http = http;
1141
+ }
1142
+ getVersion() {
1143
+ // TODO: this hardcoded string should be taken care of with the introduction of a config service
1144
+ return this.http.get(`/api/valtimo/version`);
1145
+ }
1146
+ }
1147
+ VersionService.ɵprov = ɵɵdefineInjectable({ factory: function VersionService_Factory() { return new VersionService(ɵɵinject(HttpClient)); }, token: VersionService, providedIn: "root" });
1148
+ VersionService.decorators = [
1149
+ { type: Injectable, args: [{
1150
+ providedIn: 'root'
1151
+ },] }
1152
+ ];
1153
+ VersionService.ctorParameters = () => [
1154
+ { type: HttpClient }
1155
+ ];
1156
+
1157
+ /*
1158
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1159
+ *
1160
+ * Licensed under EUPL, Version 1.2 (the "License");
1161
+ * you may not use this file except in compliance with the License.
1162
+ * You may obtain a copy of the License at
1163
+ *
1164
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1165
+ *
1166
+ * Unless required by applicable law or agreed to in writing, software
1167
+ * distributed under the License is distributed on an "AS IS" basis,
1168
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1169
+ * See the License for the specific language governing permissions and
1170
+ * limitations under the License.
1171
+ */
1172
+ class RightSidebarComponent {
1173
+ constructor(userProviderService, formBuilder, versionService, translate, contextService, http, logger) {
1174
+ this.userProviderService = userProviderService;
1175
+ this.formBuilder = formBuilder;
1176
+ this.versionService = versionService;
1177
+ this.translate = translate;
1178
+ this.contextService = contextService;
1179
+ this.http = http;
1180
+ this.logger = logger;
1181
+ }
1182
+ ngOnInit() {
1183
+ this.frequencies = [
1184
+ 'emailNotificationOnMonday',
1185
+ 'emailNotificationOnTuesday',
1186
+ 'emailNotificationOnWednesday',
1187
+ 'emailNotificationOnThursday',
1188
+ 'emailNotificationOnFriday',
1189
+ 'emailNotificationOnSaturday',
1190
+ 'emailNotificationOnSunday'
1191
+ ];
1192
+ this.settingsForm = this.formBuilder.group({
1193
+ taskNotifications: new FormControl(false),
1194
+ emailNotifications: new FormControl(false),
1195
+ emailNotificationOnMonday: new FormControl(false),
1196
+ emailNotificationOnTuesday: new FormControl(false),
1197
+ emailNotificationOnWednesday: new FormControl(false),
1198
+ emailNotificationOnThursday: new FormControl(false),
1199
+ emailNotificationOnFriday: new FormControl(false),
1200
+ emailNotificationOnSaturday: new FormControl(false),
1201
+ emailNotificationOnSunday: new FormControl(false)
1202
+ });
1203
+ this.getUserSettings();
1204
+ }
1205
+ loadContextSwitch() {
1206
+ combineLatest([this.contextService.getUserContexts(), this.contextService.getUserContextActive()])
1207
+ .subscribe(([userContexts, userContextActive]) => {
1208
+ this.userContextActive = userContextActive;
1209
+ this.userContexts = userContexts;
1210
+ });
1211
+ }
1212
+ setUserContext(contextId) {
1213
+ this.contextService.setUserContext(contextId).subscribe();
1214
+ location.href = '/';
1215
+ }
1216
+ loadUserSettingsTab() {
1217
+ this.userProviderService.getEmailNotificationSettings().subscribe(results => {
1218
+ if (results !== null) {
1219
+ this.settingsForm.controls.taskNotifications.setValue(results.taskNotifications);
1220
+ this.settingsForm.controls.emailNotifications.setValue(results.emailNotifications);
1221
+ this.settingsForm.controls.emailNotificationOnMonday.setValue(results.emailNotificationOnMonday);
1222
+ this.settingsForm.controls.emailNotificationOnTuesday.setValue(results.emailNotificationOnTuesday);
1223
+ this.settingsForm.controls.emailNotificationOnWednesday.setValue(results.emailNotificationOnWednesday);
1224
+ this.settingsForm.controls.emailNotificationOnThursday.setValue(results.emailNotificationOnThursday);
1225
+ this.settingsForm.controls.emailNotificationOnFriday.setValue(results.emailNotificationOnFriday);
1226
+ this.settingsForm.controls.emailNotificationOnSaturday.setValue(results.emailNotificationOnSaturday);
1227
+ this.settingsForm.controls.emailNotificationOnSunday.setValue(results.emailNotificationOnSunday);
1228
+ }
1229
+ else {
1230
+ // default is true in the database, even if api returns no content
1231
+ this.settingsForm.controls.taskNotifications.setValue(true);
1232
+ }
1233
+ });
1234
+ this.getVersion();
1235
+ }
1236
+ getUserSettings() {
1237
+ this.userProviderService.getUserSubject().subscribe(userIdentity => {
1238
+ this.logger.debug('user', userIdentity);
1239
+ this.userIdentity = userIdentity;
1240
+ this.loadContextSwitch();
1241
+ });
1242
+ }
1243
+ getVersion() {
1244
+ this.versionService.getVersion().subscribe((build) => {
1245
+ this.build = build;
1246
+ });
1247
+ }
1248
+ onSettingsSubmit() {
1249
+ if (!this.settingsForm.pristine) {
1250
+ this.userProviderService.updateEmailNotificationSettings(this.settingsForm.value).subscribe();
1251
+ }
1252
+ }
1253
+ updateUserLanguage(langKey) {
1254
+ this.translate.use(langKey).subscribe(() => {
1255
+ localStorage.setItem('langKey', langKey);
1256
+ });
1257
+ }
1258
+ logout() {
1259
+ this.userProviderService.logout();
1260
+ }
1261
+ }
1262
+ RightSidebarComponent.decorators = [
1263
+ { type: Component, args: [{
1264
+ selector: 'valtimo-right-sidebar',
1265
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<nav class=\"be-right-sidebar\">\n <div class=\"sb-content\">\n <div class=\"tab-navigation\">\n <ul class=\"nav nav-tabs nav-justified\" role=\"tablist\">\n <li class=\"nav-item\" role=\"presentation\">\n <a class=\"nav-link active\" href=\"#account\" aria-controls=\"account\" role=\"tab\" data-toggle=\"tab\"\n translate=\"account.title\"></a>\n </li>\n <li class=\"nav-item\" role=\"presentation\">\n <a class=\"nav-link\" (click)=\"loadUserSettingsTab()\" href=\"#settings\" aria-controls=\"settings\" role=\"tab\"\n data-toggle=\"tab\" translate=\"settings.title\"></a>\n </li>\n </ul>\n </div>\n <div class=\"tab-panel\">\n <div class=\"tab-content\">\n <!-- account -->\n <div class=\"tab-pane tab-account active\" id=\"account\" role=\"tabpanel\">\n <div class=\"p-3 be-scroller-settings\" *ngIf=\"userIdentity\">\n <div class=\"content\">\n <div class=\"category-title border-0 m-0\">\n <div class=\"p-0 text-muted\">\n <dl class=\"row mb-0\">\n <dt class=\"col-sm-3\">Email</dt>\n <dd class=\"col-sm-9 mb-0 text-bold\">{{ userIdentity.email }}</dd>\n <ng-container *ngIf=\"userIdentity.username\">\n <dt class=\"col-sm-3\">Username</dt>\n <dd class=\"col-sm-9 mb-0 text-bold\">{{ userIdentity.username }}</dd>\n </ng-container>\n <dt class=\"col-sm-3\">Name</dt>\n <dd class=\"col-sm-9 mb-0 text-bold\">{{ userIdentity.firstName + ' ' + userIdentity.lastName }}</dd>\n </dl>\n </div>\n </div>\n <!-- context switch -->\n <ul class=\"settings-list\" *ngIf=\"userContexts?.length > 1\">\n <li ngbTooltip=\"{{ 'settings.context.title' | translate }}\">\n <select class=\"form-control\" #contextSelect (change)=\"setUserContext(+contextSelect.value)\">\n <option *ngFor=\"let context of userContexts\" [value]=\"context.id\"\n [selected]=\"context.id === userContextActive.id\">\n {{ context.name }}\n </option>\n </select>\n </li>\n </ul>\n <ul class=\"list-group list-group-flush m-0\">\n <li class=\"bg-transparent list-group-item px-0\">\n <a href=\"https://docs.valtimo.nl\" target=\"_blank\" class=\"d-block\" translate=\"account.links.help\"></a>\n </li>\n <li class=\"bg-transparent list-group-item px-0\">\n <a href=\"https://www.valtimo.nl/feedback/\" target=\"_blank\" class=\"d-block\"\n translate=\"account.links.feedback\"></a>\n </li>\n <li class=\"bg-transparent list-group-item px-0\">\n <a href=\"https://forum.valtimo.nl\" target=\"_blank\" class=\"d-block\"\n translate=\"account.links.forum\"></a>\n </li>\n <li class=\"bg-transparent list-group-item px-0\">\n <a href=\"javascript:void(0)\" class=\"d-block\" (click)=\"logout()\"\n translate=\"account.links.signOut\"></a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n\n <!-- settings -->\n <div class=\"tab-pane tab-settings\" id=\"settings\" role=\"tabpanel\">\n <div class=\"p-3 be-scroller-settings\">\n <div class=\"content\">\n <span class=\"category-title\" translate=\"settings.language.title\"></span>\n <ul class=\"settings-list\">\n <li>\n <select class=\"form-control\" #langSelect (change)=\"updateUserLanguage(langSelect.value)\">\n <option *ngFor=\"let lang of translate.getLangs()\" [value]=\"lang\"\n [selected]=\"lang === translate.currentLang\">\n {{ 'settings.language.options.' + lang | translate }}\n </option>\n </select>\n </li>\n </ul>\n\n <form [formGroup]=\"settingsForm\">\n <span class=\"category-title\" translate=\"settings.notification.title\"></span>\n <ul class=\"settings-list m-0\">\n <li>\n <div class=\"switch-button switch-button-sm switch-button-success\">\n <input type=\"checkbox\" formControlName=\"taskNotifications\" id=\"taskNotifications\"\n (ngModelChange)=\"onSettingsSubmit()\"><span>\n <label for=\"taskNotifications\"></label></span>\n </div>\n <span class=\"name\" translate=\"settings.notification.taskNotifications\"></span>\n <div class=\"text-muted info-text\" translate=\"settings.notification.taskNotificationsIntro\"></div>\n </li>\n\n <li>\n <div class=\"switch-button switch-button-sm switch-button-success\">\n <input type=\"checkbox\" formControlName=\"emailNotifications\" id=\"emailNotifications\"\n (ngModelChange)=\"onSettingsSubmit()\"><span>\n <label for=\"emailNotifications\"></label></span>\n </div>\n <span class=\"name\" translate=\"settings.notification.emailNotifications\"></span>\n <div class=\"text-muted info-text\" translate=\"settings.notification.emailNotificationsIntro\"></div>\n </li>\n </ul>\n\n <div *ngIf=\"settingsForm.value.emailNotifications\">\n <ul class=\"settings-list\">\n <li *ngFor=\"let frequency of frequencies\">\n <div class=\"switch-button switch-button-sm switch-button-success\">\n <input type=\"checkbox\" formControlName=\"{{ frequency }}\" id=\"{{ frequency }}\"\n (ngModelChange)=\"onSettingsSubmit()\"><span>\n <label for=\"{{ frequency }}\"></label></span>\n </div>\n <span class=\"name\">{{ 'settings.notification.' + frequency | translate }}</span>\n </li>\n </ul>\n </div>\n </form>\n\n <div class=\"version-holder\">\n <span class=\"category-title\" translate=\"settings.version.title\"></span>\n <ul class=\"settings-list\">\n <li *ngIf=\"build\">\n <div class=\"name\">{{ build.title }}</div>\n <div class=\"text-muted\">{{ build.version }}</div>\n </li>\n </ul>\n </div>\n </div>\n </div>\n </div>\n\n </div>\n </div>\n </div>\n</nav>\n",
1266
+ styles: [".be-scroller-settings{padding-bottom:150px!important}.version-holder{background-color:#f8f9fa;bottom:0;position:fixed;width:259px}.info-text{line-height:1em!important;margin-bottom:15px;padding-right:70px}"]
1267
+ },] }
1268
+ ];
1269
+ RightSidebarComponent.ctorParameters = () => [
1270
+ { type: UserProviderService },
1271
+ { type: FormBuilder },
1272
+ { type: VersionService },
1273
+ { type: TranslateService },
1274
+ { type: ContextService },
1275
+ { type: HttpClient },
1276
+ { type: NGXLogger }
1277
+ ];
1278
+
1279
+ /*
1280
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1281
+ *
1282
+ * Licensed under EUPL, Version 1.2 (the "License");
1283
+ * you may not use this file except in compliance with the License.
1284
+ * You may obtain a copy of the License at
1285
+ *
1286
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1287
+ *
1288
+ * Unless required by applicable law or agreed to in writing, software
1289
+ * distributed under the License is distributed on an "AS IS" basis,
1290
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1291
+ * See the License for the specific language governing permissions and
1292
+ * limitations under the License.
1293
+ */
1294
+ const ɵ0 = HttpLoaderFactory;
1295
+ class RightSidebarModule {
1296
+ }
1297
+ RightSidebarModule.decorators = [
1298
+ { type: NgModule, args: [{
1299
+ declarations: [RightSidebarComponent],
1300
+ imports: [
1301
+ CommonModule,
1302
+ FormsModule,
1303
+ ReactiveFormsModule,
1304
+ RouterModule,
1305
+ TranslateModule.forRoot({
1306
+ loader: {
1307
+ provide: TranslateLoader,
1308
+ useFactory: ɵ0,
1309
+ deps: [HttpClient]
1310
+ }
1311
+ }),
1312
+ NgbTooltipModule
1313
+ ],
1314
+ exports: [RightSidebarComponent]
1315
+ },] }
1316
+ ];
1317
+
1318
+ /*
1319
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1320
+ *
1321
+ * Licensed under EUPL, Version 1.2 (the "License");
1322
+ * you may not use this file except in compliance with the License.
1323
+ * You may obtain a copy of the License at
1324
+ *
1325
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1326
+ *
1327
+ * Unless required by applicable law or agreed to in writing, software
1328
+ * distributed under the License is distributed on an "AS IS" basis,
1329
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1330
+ * See the License for the specific language governing permissions and
1331
+ * limitations under the License.
1332
+ */
1333
+ class LeftSidebarComponent {
1334
+ constructor(translateService, elementRef) {
1335
+ this.translateService = translateService;
1336
+ this.elementRef = elementRef;
1337
+ this.menuWidthChanged = new EventEmitter();
1338
+ this.menuTooltipText$ = this.translateService.stream('interface.mainMenu');
1339
+ this.toggleMenuText$ = this.translateService.stream('interface.toggleMenu');
1340
+ this.mouseIsOnResizeBorder$ = new BehaviorSubject(false);
1341
+ this.menuWidth$ = new BehaviorSubject(undefined);
1342
+ this.isResizing$ = new BehaviorSubject(false);
1343
+ this.defaultMenuWidth = 230;
1344
+ this.maxMenuWidth = 330;
1345
+ this.minMenuWidth = 120;
1346
+ this.mouseX$ = fromEvent(document.body, 'mousemove').pipe(map((e) => e.pageX));
1347
+ this.bodyStyle = elementRef.nativeElement.ownerDocument.body.style;
1348
+ }
1349
+ ngOnInit() {
1350
+ this.setMenuWidth(this.defaultMenuWidth);
1351
+ }
1352
+ ngAfterViewInit() {
1353
+ this.mouseXSubscription = combineLatest([this.mouseX$, this.isResizing$])
1354
+ .pipe(debounceTime(3))
1355
+ .subscribe(([x, isResizing]) => {
1356
+ const menuOpen = this.menuIsOpen;
1357
+ if (isResizing) {
1358
+ const offSetWidth = this.xOnClick - x;
1359
+ const newMenuWidth = this.menuWidthOnClick - offSetWidth;
1360
+ const snapMargin = 35;
1361
+ const snapInside = newMenuWidth < this.minMenuWidth - snapMargin;
1362
+ const snapOutside = !menuOpen && offSetWidth < -snapMargin;
1363
+ if (menuOpen && newMenuWidth <= this.maxMenuWidth && newMenuWidth >= this.minMenuWidth) {
1364
+ this.setMenuWidth(newMenuWidth);
1365
+ }
1366
+ else if (snapInside || snapOutside) {
1367
+ this.snapMenu(snapInside ? this.menuWidthOnClick : this.defaultMenuWidth);
1368
+ }
1369
+ }
1370
+ });
1371
+ this.mouseUpSubscription = fromEvent(document, 'mouseup').subscribe(() => {
1372
+ this.stopResizing();
1373
+ });
1374
+ }
1375
+ ngOnDestroy() {
1376
+ this.mouseXSubscription.unsubscribe();
1377
+ this.mouseUpSubscription.unsubscribe();
1378
+ }
1379
+ enterBorder() {
1380
+ this.mouseIsOnResizeBorder$.next(true);
1381
+ }
1382
+ leaveBorder() {
1383
+ this.mouseIsOnResizeBorder$.next(false);
1384
+ }
1385
+ resizeBorderClick(e) {
1386
+ this.menuWidth$.pipe(take(1)).subscribe(menuWidth => {
1387
+ this.menuWidthOnClick = menuWidth;
1388
+ this.xOnClick = e.pageX;
1389
+ this.bodyStyle.userSelect = 'none';
1390
+ this.bodyStyle.cursor = 'col-resize';
1391
+ this.isResizing$.next(true);
1392
+ });
1393
+ }
1394
+ snapMenu(snapTo) {
1395
+ this.stopResizing();
1396
+ this.setMenuWidth(snapTo);
1397
+ setTimeout(() => {
1398
+ this.toggleButtonRef.nativeElement.click();
1399
+ });
1400
+ }
1401
+ stopResizing() {
1402
+ this.bodyStyle.cursor = 'auto';
1403
+ this.bodyStyle.userSelect = 'auto';
1404
+ this.isResizing$.next(false);
1405
+ }
1406
+ setMenuWidth(width) {
1407
+ this.menuWidth$.next(width);
1408
+ this.menuWidthChanged.emit(width);
1409
+ }
1410
+ }
1411
+ LeftSidebarComponent.decorators = [
1412
+ { type: Component, args: [{
1413
+ selector: 'valtimo-left-sidebar',
1414
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n<ng-container *ngIf=\"{isResizing: isResizing$ | async} as obs\">\n <div\n class=\"be-left-sidebar\"\n [style.width.px]=\"menuIsOpen ? (menuWidth$ | async) : null\"\n [ngClass]=\"{'no-transition': obs.isResizing}\"\n >\n <div class=\"left-sidebar-wrapper\">\n <a class=\"left-sidebar-toggle\" href=\"javascript:void(0);\"><valtimo-page-title></valtimo-page-title></a>\n <div class=\"progress-widget\" style=\"padding: 20px 0\">\n <ul class=\"sidebar-elements\">\n <li>\n <a\n #toggleButton\n class=\"be-toggle-left-sidebar\"\n href=\"javascript:void(0);\"\n [title]=\"menuTooltipText$ | async\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n width=\"1em\"\n height=\"1em\"\n style=\"-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg)\"\n viewBox=\"0 0 24 24\"\n transform=\"rotate(360)\"\n >\n <path [ngClass]=\"menuIsOpen ? 'd-1' : 'd-1-flipped'\" />\n <path [ngClass]=\"menuIsOpen ? 'd-2' : 'd-2-flipped'\" />\n <path [ngClass]=\"menuIsOpen ? 'd-3' : 'd-3-flipped'\" />\n <path [ngClass]=\"menuIsOpen ? 'd-4' : 'd-4-flipped'\" />\n </svg>\n <span>{{ toggleMenuText$ | async }}</span>\n </a>\n </li>\n </ul>\n </div>\n <div class=\"left-sidebar-spacer\">\n <div class=\"left-sidebar-scroll\">\n <div class=\"left-sidebar-content\">\n <valtimo-menu></valtimo-menu>\n </div>\n </div>\n </div>\n </div>\n <div\n class=\"resize-border\"\n (mouseenter)=\"enterBorder()\"\n (mouseleave)=\"leaveBorder()\"\n (mousedown)=\"resizeBorderClick($event)\"\n [ngClass]=\"{'resize-hover': (mouseIsOnResizeBorder$ | async) || obs.isResizing}\"\n ></div>\n </div>\n</ng-container>\n",
1415
+ styles: ["@media screen and (max-width:767px){.be-left-sidebar{width:100%!important}}.be-left-sidebar .left-sidebar-toggle{padding:20px}.be-left-sidebar .left-sidebar-toggle:before{font-size:1.615rem}.be-left-sidebar .sidebar-elements>li>a.be-toggle-left-sidebar{align-items:center;display:flex;height:32px}.be-left-sidebar .left-sidebar-content{padding-top:20px}.be-toggle-left-sidebar svg{height:auto;margin-right:7px;min-width:21px;overflow:visible}.be-toggle-left-sidebar svg path{fill:#696969;transition:.27s ease}.resize-border{background-color:#ff5800;cursor:col-resize;height:100%;margin-right:-3px;opacity:0;position:absolute;right:0;top:0;transition:opacity .2s ease;width:3px}.resize-hover{opacity:.7}.no-transition{transition:none}.d-1{d:path(\"M3 18v-2h13v2z\")}.d-1-flipped{d:path(\"M3 18v-2h11v2z\")}.d-2{d:path(\"M3 13v-2h10v2H3\")}.d-2-flipped{d:path(\"M3 13v-2h12v2H3\")}.d-3{d:path(\"M3 6h13v2H3V6\")}.d-3-flipped{d:path(\"M3 6h11v2H3V6\")}.d-4{d:path(\"M21 15.61L19.59 17l-5.01-5 5.01-5L21 8.39 17.44 12 21 15.61\")}.d-4-flipped{d:path(\"M15.58 15.61L16.99 17 22 12l-5.01-5-1.41 1.39L19.14 12l-3.56 3.61\")}"]
1416
+ },] }
1417
+ ];
1418
+ LeftSidebarComponent.ctorParameters = () => [
1419
+ { type: TranslateService },
1420
+ { type: ElementRef }
1421
+ ];
1422
+ LeftSidebarComponent.propDecorators = {
1423
+ toggleButtonRef: [{ type: ViewChild, args: ['toggleButton',] }],
1424
+ menuIsOpen: [{ type: Input }],
1425
+ menuWidthChanged: [{ type: Output }]
1426
+ };
1427
+
1428
+ /*
1429
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1430
+ *
1431
+ * Licensed under EUPL, Version 1.2 (the "License");
1432
+ * you may not use this file except in compliance with the License.
1433
+ * You may obtain a copy of the License at
1434
+ *
1435
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1436
+ *
1437
+ * Unless required by applicable law or agreed to in writing, software
1438
+ * distributed under the License is distributed on an "AS IS" basis,
1439
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1440
+ * See the License for the specific language governing permissions and
1441
+ * limitations under the License.
1442
+ */
1443
+ class PageTitleComponent {
1444
+ constructor(router, activatedRoute, titleService, translateService, logger) {
1445
+ this.router = router;
1446
+ this.activatedRoute = activatedRoute;
1447
+ this.titleService = titleService;
1448
+ this.translateService = translateService;
1449
+ this.logger = logger;
1450
+ this.appTitle = 'Valtimo';
1451
+ this.routerSub = Subscription.EMPTY;
1452
+ }
1453
+ setTitle() {
1454
+ this.title = this.activatedRoute.snapshot.firstChild.data.title;
1455
+ // When loading lazy title is nested
1456
+ if (!this.title) {
1457
+ this.title = this.activatedRoute.snapshot.firstChild.children[0].data.title;
1458
+ }
1459
+ if (this.title) {
1460
+ this.translateService.stream(this.title).subscribe((title) => {
1461
+ this.logger.debug('PageTitle: setTitle translated async', title);
1462
+ this.titleService.setTitle(this.appTitle + ' - ' + title);
1463
+ });
1464
+ }
1465
+ else {
1466
+ this.logger.debug('PageTitle: setTitle default', this.appTitle);
1467
+ this.titleService.setTitle(this.appTitle);
1468
+ }
1469
+ }
1470
+ ngOnInit() {
1471
+ this.setTitle();
1472
+ this.routerSub = this.router.events
1473
+ .pipe(filter(event => event instanceof NavigationEnd))
1474
+ .subscribe((event) => {
1475
+ this.setTitle();
1476
+ });
1477
+ }
1478
+ ngOnDestroy() {
1479
+ this.routerSub.unsubscribe();
1480
+ }
1481
+ }
1482
+ PageTitleComponent.decorators = [
1483
+ { type: Component, args: [{
1484
+ selector: 'valtimo-page-title',
1485
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<h2 class=\"page-head-title\" *ngIf=\"title !== ''\"><span [innerHTML]=\"title | translate\"></span></h2>\n",
1486
+ styles: [""]
1487
+ },] }
1488
+ ];
1489
+ PageTitleComponent.ctorParameters = () => [
1490
+ { type: Router },
1491
+ { type: ActivatedRoute },
1492
+ { type: Title },
1493
+ { type: TranslateService },
1494
+ { type: NGXLogger }
1495
+ ];
1496
+
1497
+ /*
1498
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1499
+ *
1500
+ * Licensed under EUPL, Version 1.2 (the "License");
1501
+ * you may not use this file except in compliance with the License.
1502
+ * You may obtain a copy of the License at
1503
+ *
1504
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1505
+ *
1506
+ * Unless required by applicable law or agreed to in writing, software
1507
+ * distributed under the License is distributed on an "AS IS" basis,
1508
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1509
+ * See the License for the specific language governing permissions and
1510
+ * limitations under the License.
1511
+ */
1512
+ class PageTitleModule {
1513
+ }
1514
+ PageTitleModule.decorators = [
1515
+ { type: NgModule, args: [{
1516
+ declarations: [PageTitleComponent],
1517
+ imports: [
1518
+ CommonModule,
1519
+ TranslateModule
1520
+ ],
1521
+ exports: [PageTitleComponent]
1522
+ },] }
1523
+ ];
1524
+
1525
+ /*
1526
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1527
+ *
1528
+ * Licensed under EUPL, Version 1.2 (the "License");
1529
+ * you may not use this file except in compliance with the License.
1530
+ * You may obtain a copy of the License at
1531
+ *
1532
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1533
+ *
1534
+ * Unless required by applicable law or agreed to in writing, software
1535
+ * distributed under the License is distributed on an "AS IS" basis,
1536
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1537
+ * See the License for the specific language governing permissions and
1538
+ * limitations under the License.
1539
+ */
1540
+ class LeftSidebarModule {
1541
+ }
1542
+ LeftSidebarModule.decorators = [
1543
+ { type: NgModule, args: [{
1544
+ declarations: [LeftSidebarComponent],
1545
+ imports: [
1546
+ CommonModule,
1547
+ MenuModule,
1548
+ PageTitleModule
1549
+ ],
1550
+ exports: [LeftSidebarComponent]
1551
+ },] }
1552
+ ];
1553
+
1554
+ /*
1555
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1556
+ *
1557
+ * Licensed under EUPL, Version 1.2 (the "License");
1558
+ * you may not use this file except in compliance with the License.
1559
+ * You may obtain a copy of the License at
1560
+ *
1561
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1562
+ *
1563
+ * Unless required by applicable law or agreed to in writing, software
1564
+ * distributed under the License is distributed on an "AS IS" basis,
1565
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1566
+ * See the License for the specific language governing permissions and
1567
+ * limitations under the License.
1568
+ */
1569
+ class StringTypeConverter {
1570
+ getTypeString() {
1571
+ return 'string';
1572
+ }
1573
+ convert(value, definition) {
1574
+ return value;
1575
+ }
1576
+ }
1577
+
1578
+ /*
1579
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1580
+ *
1581
+ * Licensed under EUPL, Version 1.2 (the "License");
1582
+ * you may not use this file except in compliance with the License.
1583
+ * You may obtain a copy of the License at
1584
+ *
1585
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1586
+ *
1587
+ * Unless required by applicable law or agreed to in writing, software
1588
+ * distributed under the License is distributed on an "AS IS" basis,
1589
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1590
+ * See the License for the specific language governing permissions and
1591
+ * limitations under the License.
1592
+ */
1593
+ class BooleanTypeConverter {
1594
+ getTypeString() {
1595
+ return 'boolean';
1596
+ }
1597
+ convert(value, definition) {
1598
+ if (!definition.enum) {
1599
+ return value ? 'Yes' : 'No';
1600
+ }
1601
+ else {
1602
+ return value ? (definition.enum[0] || 'Yes') : (definition.enum[1] || 'No');
1603
+ }
1604
+ }
1605
+ }
1606
+
1607
+ /*
1608
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1609
+ *
1610
+ * Licensed under EUPL, Version 1.2 (the "License");
1611
+ * you may not use this file except in compliance with the License.
1612
+ * You may obtain a copy of the License at
1613
+ *
1614
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1615
+ *
1616
+ * Unless required by applicable law or agreed to in writing, software
1617
+ * distributed under the License is distributed on an "AS IS" basis,
1618
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1619
+ * See the License for the specific language governing permissions and
1620
+ * limitations under the License.
1621
+ */
1622
+ const moment$2 = momentImported;
1623
+ moment$2.locale(localStorage.getItem('langKey'));
1624
+ class DateTypeConverter {
1625
+ getTypeString() {
1626
+ return 'date';
1627
+ }
1628
+ convert(value, definition) {
1629
+ if (!value) {
1630
+ return '-';
1631
+ }
1632
+ return moment$2(value).format('DD-MM-YYYY, hh:mm A');
1633
+ }
1634
+ }
1635
+
1636
+ /*
1637
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1638
+ *
1639
+ * Licensed under EUPL, Version 1.2 (the "License");
1640
+ * you may not use this file except in compliance with the License.
1641
+ * You may obtain a copy of the License at
1642
+ *
1643
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1644
+ *
1645
+ * Unless required by applicable law or agreed to in writing, software
1646
+ * distributed under the License is distributed on an "AS IS" basis,
1647
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1648
+ * See the License for the specific language governing permissions and
1649
+ * limitations under the License.
1650
+ */
1651
+ class EnumTypeConverter {
1652
+ getTypeString() {
1653
+ return 'enum';
1654
+ }
1655
+ convert(value, definition) {
1656
+ return definition.enum[value];
1657
+ }
1658
+ }
1659
+
1660
+ /*
1661
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1662
+ *
1663
+ * Licensed under EUPL, Version 1.2 (the "License");
1664
+ * you may not use this file except in compliance with the License.
1665
+ * You may obtain a copy of the License at
1666
+ *
1667
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1668
+ *
1669
+ * Unless required by applicable law or agreed to in writing, software
1670
+ * distributed under the License is distributed on an "AS IS" basis,
1671
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1672
+ * See the License for the specific language governing permissions and
1673
+ * limitations under the License.
1674
+ */
1675
+ class StringReplaceUnderscoreTypeConverter {
1676
+ constructor() {
1677
+ this.regExpStringRemoveUnderscore = /_/g;
1678
+ }
1679
+ getTypeString() {
1680
+ return 'stringReplaceUnderscore';
1681
+ }
1682
+ convert(value, definition) {
1683
+ return value.replace(this.regExpStringRemoveUnderscore, ' ');
1684
+ }
1685
+ }
1686
+
1687
+ /*
1688
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1689
+ *
1690
+ * Licensed under EUPL, Version 1.2 (the "License");
1691
+ * you may not use this file except in compliance with the License.
1692
+ * You may obtain a copy of the License at
1693
+ *
1694
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1695
+ *
1696
+ * Unless required by applicable law or agreed to in writing, software
1697
+ * distributed under the License is distributed on an "AS IS" basis,
1698
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1699
+ * See the License for the specific language governing permissions and
1700
+ * limitations under the License.
1701
+ */
1702
+ class RelatedFilesTypeConverter {
1703
+ getTypeString() {
1704
+ return 'relatedFiles';
1705
+ }
1706
+ convert(value, definition) {
1707
+ return value.length || '-';
1708
+ }
1709
+ }
1710
+
1711
+ /*
1712
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1713
+ *
1714
+ * Licensed under EUPL, Version 1.2 (the "License");
1715
+ * you may not use this file except in compliance with the License.
1716
+ * You may obtain a copy of the License at
1717
+ *
1718
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1719
+ *
1720
+ * Unless required by applicable law or agreed to in writing, software
1721
+ * distributed under the License is distributed on an "AS IS" basis,
1722
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1723
+ * See the License for the specific language governing permissions and
1724
+ * limitations under the License.
1725
+ */
1726
+ const stringTypeConverter = new StringTypeConverter();
1727
+ const booleanTypeConverter = new BooleanTypeConverter();
1728
+ const dateTypeConverter = new DateTypeConverter();
1729
+ const enumTypeConverter = new EnumTypeConverter();
1730
+ const stringReplaceUnderscoreTypeConverter = new StringReplaceUnderscoreTypeConverter();
1731
+ const relatedFilesTypeConverter = new RelatedFilesTypeConverter();
1732
+ // TODO: Via injection
1733
+ const TYPE_CONVERTERS = [
1734
+ stringTypeConverter,
1735
+ booleanTypeConverter,
1736
+ dateTypeConverter,
1737
+ enumTypeConverter,
1738
+ stringReplaceUnderscoreTypeConverter,
1739
+ relatedFilesTypeConverter
1740
+ ];
1741
+
1742
+ /*
1743
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1744
+ *
1745
+ * Licensed under EUPL, Version 1.2 (the "License");
1746
+ * you may not use this file except in compliance with the License.
1747
+ * You may obtain a copy of the License at
1748
+ *
1749
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1750
+ *
1751
+ * Unless required by applicable law or agreed to in writing, software
1752
+ * distributed under the License is distributed on an "AS IS" basis,
1753
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1754
+ * See the License for the specific language governing permissions and
1755
+ * limitations under the License.
1756
+ */
1757
+ class ViewContentService {
1758
+ constructor() {
1759
+ this.converters = {};
1760
+ this.defaultConverter = new StringTypeConverter();
1761
+ TYPE_CONVERTERS.forEach(converter => this.addConverter(converter));
1762
+ }
1763
+ get(value, definition) {
1764
+ if (!definition.viewType) {
1765
+ definition.viewType = typeof (value);
1766
+ }
1767
+ if (typeof this.converters[definition.viewType] !== 'undefined') {
1768
+ return this.converters[definition.viewType].convert(value, definition);
1769
+ }
1770
+ else {
1771
+ return this.defaultConverter.convert(value, definition);
1772
+ }
1773
+ }
1774
+ addConverter(converter) {
1775
+ if (typeof this.converters[converter.getTypeString()] !== 'undefined') {
1776
+ throw new Error('Converter with name ' + converter.getTypeString() + ' already exists');
1777
+ }
1778
+ this.converters[converter.getTypeString()] = converter;
1779
+ }
1780
+ }
1781
+ ViewContentService.ɵprov = ɵɵdefineInjectable({ factory: function ViewContentService_Factory() { return new ViewContentService(); }, token: ViewContentService, providedIn: "root" });
1782
+ ViewContentService.decorators = [
1783
+ { type: Injectable, args: [{
1784
+ providedIn: 'root'
1785
+ },] }
1786
+ ];
1787
+ ViewContentService.ctorParameters = () => [];
1788
+
1789
+ /*
1790
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1791
+ *
1792
+ * Licensed under EUPL, Version 1.2 (the "License");
1793
+ * you may not use this file except in compliance with the License.
1794
+ * You may obtain a copy of the License at
1795
+ *
1796
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1797
+ *
1798
+ * Unless required by applicable law or agreed to in writing, software
1799
+ * distributed under the License is distributed on an "AS IS" basis,
1800
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1801
+ * See the License for the specific language governing permissions and
1802
+ * limitations under the License.
1803
+ */
1804
+ class ListComponent {
1805
+ constructor(viewContentService, logger) {
1806
+ this.viewContentService = viewContentService;
1807
+ this.logger = logger;
1808
+ this.actions = [];
1809
+ this.rowClicked = new EventEmitter();
1810
+ this.paginationClicked = new EventEmitter();
1811
+ this.paginationSet = new EventEmitter();
1812
+ this.search = new EventEmitter();
1813
+ this.sortChanged = new EventEmitter();
1814
+ this.headerProvided = false;
1815
+ this.regExpStringRemoveUnderscore = /_/g;
1816
+ this.sort$ = new BehaviorSubject({
1817
+ state: { name: '', direction: 'DESC' },
1818
+ isSorting: false
1819
+ });
1820
+ this.viewListAs = localStorage.getItem('viewListAs') || 'table';
1821
+ }
1822
+ loadPaginationSize() {
1823
+ const entries = localStorage.getItem(`${this.paginationIdentifier}${ListComponent.PAGINATION_SIZE}`);
1824
+ if (entries !== null) {
1825
+ this.pagination.size = +entries;
1826
+ this.paginationSet.emit(+entries);
1827
+ this.logger.debug('Pagination loaded from local storage for this list. Current: ', entries);
1828
+ }
1829
+ else {
1830
+ this.logger.debug('Pagination does NOT exist in local storage for this list. Will use default. Change it to create an entry.');
1831
+ }
1832
+ this.paginationSet.emit();
1833
+ }
1834
+ setPaginationSize(numberOfEntries) {
1835
+ localStorage.setItem(`${this.paginationIdentifier}${ListComponent.PAGINATION_SIZE}`, numberOfEntries);
1836
+ this.pagination.size = numberOfEntries;
1837
+ this.logger.debug('Pagination set in local storage for this list: ', numberOfEntries);
1838
+ this.paginationSet.emit(numberOfEntries);
1839
+ }
1840
+ ngOnInit() {
1841
+ if (this.pagination) {
1842
+ this.loadPaginationSize();
1843
+ }
1844
+ if (this.initialSortState) {
1845
+ this.sort$.next(this.initialSortState);
1846
+ }
1847
+ }
1848
+ ngOnChanges(changes) {
1849
+ if (changes.items && changes.items.currentValue) {
1850
+ this.transformListItemsMatchFields();
1851
+ }
1852
+ }
1853
+ ngAfterViewInit() {
1854
+ if (this.isSearchable) {
1855
+ fromEvent(this.searchBox.nativeElement, 'keyup')
1856
+ .pipe(debounceTime(500))
1857
+ .subscribe(() => {
1858
+ const value = this.searchBox.nativeElement.value;
1859
+ if (this.search.observers.length > 0) {
1860
+ // custom search callbak is specified, perhaps to query on the server side
1861
+ this.search.emit(value);
1862
+ }
1863
+ else {
1864
+ this.searchModel = value;
1865
+ }
1866
+ });
1867
+ }
1868
+ }
1869
+ transformListItemsMatchFields() {
1870
+ if (this.items && this.fields) {
1871
+ this.items.forEach(item => {
1872
+ item.listItemFields = this.fields.map(field => ({
1873
+ key: field.key,
1874
+ label: field.label,
1875
+ value: this.resolveObject(field, item)
1876
+ }));
1877
+ });
1878
+ }
1879
+ }
1880
+ onClickRow(item) {
1881
+ this.rowClicked.emit(item);
1882
+ }
1883
+ resolveObject(definition, obj) {
1884
+ const definitionKey = definition.key;
1885
+ const customPropString = '$.';
1886
+ const key = definitionKey.includes(customPropString) ? definitionKey.split(customPropString)[1] : definitionKey;
1887
+ const resolvedObjValue = key.split('.').reduce(function (prev, curr) {
1888
+ return prev ? prev[curr] : null;
1889
+ }, obj || self);
1890
+ return this.viewContentService.get(resolvedObjValue, definition);
1891
+ }
1892
+ switchView(type) {
1893
+ localStorage.setItem('viewListAs', type);
1894
+ this.viewListAs = type;
1895
+ }
1896
+ getTotalPageCount() {
1897
+ return Math.ceil(this.pagination.collectionSize / this.pagination.size);
1898
+ }
1899
+ onClickPagination(page) {
1900
+ this.paginationClicked.emit(page);
1901
+ }
1902
+ handleFieldClick(key, sortable) {
1903
+ const desc = 'DESC';
1904
+ const asc = 'ASC';
1905
+ if (!sortable) {
1906
+ return;
1907
+ }
1908
+ this.sort$.pipe(take(1)).subscribe(sort => {
1909
+ let newState;
1910
+ if (sort.state.name === key) {
1911
+ if (!sort.isSorting) {
1912
+ newState = { state: Object.assign(Object.assign({}, sort.state), { direction: desc }), isSorting: true };
1913
+ }
1914
+ else {
1915
+ if (sort.state.direction === desc) {
1916
+ newState = Object.assign(Object.assign({}, sort), { state: Object.assign(Object.assign({}, sort.state), { direction: asc }) });
1917
+ }
1918
+ else {
1919
+ newState = { state: Object.assign(Object.assign({}, sort.state), { direction: desc }), isSorting: false };
1920
+ }
1921
+ }
1922
+ }
1923
+ else {
1924
+ newState = { state: { name: key, direction: desc }, isSorting: true };
1925
+ }
1926
+ this.sort$.next(newState);
1927
+ this.sortChanged.emit(newState);
1928
+ });
1929
+ }
1930
+ }
1931
+ ListComponent.PAGINATION_SIZE = 'PaginationSize';
1932
+ ListComponent.decorators = [
1933
+ { type: Component, args: [{
1934
+ selector: 'valtimo-list',
1935
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div>\n <div *ngIf=\"(items?.length > 0 && fields?.length > 0) || header\">\n <div\n class=\"d-flex align-items-center search-holder bg-light\"\n [ngClass]=\"{'pb-4 pt-4': !header}\"\n *ngIf=\"isSearchable || viewMode || header\"\n >\n <div class=\"align-self-start\">\n <ng-content select=\"[header]\"></ng-content>\n </div>\n\n <div class=\"ml-auto row\">\n <input *ngIf=\"isSearchable\" class=\"form-control col-sm-8\" type=\"text\" placeholder=\"Search...\" #searchBox />\n\n <div class=\"switch-view-holder btn-group col-sm-4 mt-1 mt-sm-0\" role=\"group\" *ngIf=\"viewMode\">\n <button\n class=\"btn\"\n [ngClass]=\"viewListAs === 'table' ? 'btn-primary' : 'btn-default'\"\n (click)=\"switchView('table')\"\n >\n <i class=\"mdi mdi-view-headline\"></i>\n </button>\n <button\n class=\"btn\"\n [ngClass]=\"viewListAs === 'tile' ? 'btn-primary' : 'btn-default'\"\n (click)=\"switchView('tile')\"\n >\n <i class=\"mdi mdi-view-module\"></i>\n </button>\n </div>\n </div>\n </div>\n </div>\n\n <ng-content select=\"[tabs]\"></ng-content>\n\n <div *ngIf=\"items?.length > 0 && fields?.length > 0\">\n <div class=\"table-responsive noSwipe\" *ngIf=\"!viewMode || viewListAs === 'table'\">\n <table class=\"table table-striped table-hover m-0\" *ngIf=\"sort$ | async as sort\">\n <thead>\n <tr>\n <th\n *ngFor=\"let field of fields\"\n (click)=\"handleFieldClick(field.key, field.sortable)\"\n [ngClass]=\"{\n sortable: field.sortable,\n 'is-being-sorted': field.key === sort.state.name && sort.isSorting,\n ascending: sort.state.direction === 'ASC'\n }\"\n >\n {{ field.label }}\n </th>\n <th *ngFor=\"let action of actions\">\n {{ action.columnName }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n [ngClass]=\"{'click-able': this.rowClicked.observers.length > 0}\"\n *ngFor=\"let item of items | listFilter: searchModel\"\n (click)=\"onClickRow(item)\"\n >\n <td class=\"align-top\" *ngFor=\"let listItemField of item.listItemFields\">\n {{ listItemField.value || '-' }}\n </td>\n <td class=\"align-top\" *ngFor=\"let action of actions\">\n <i style=\"cursor: pointer\" [ngClass]=\"action.iconClass\" (click)=\"action.callback(item)\"></i>\n </td>\n </tr>\n <tr>\n <td *ngIf=\"(items | listFilter: searchModel).length === 0\" [colSpan]=\"fields.length\">\n {{ 'list.noMatchingItems' | translate }}<i>\"{{ searchModel }}\"</i>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n\n <div class=\"container-fluid\" *ngIf=\"viewMode && viewListAs === 'tile'\">\n <div class=\"row p-2\">\n <div\n class=\"col-12 col-sm-6 col-xl-4 p-2\"\n *ngFor=\"let item of items | listFilter: searchModel\"\n (click)=\"onClickRow(item)\"\n >\n <div class=\"click-able tile-holder p-4\">\n <dl class=\"row mb-0\" *ngFor=\"let listItemField of item.listItemFields\">\n <dt class=\"col-12 col-md-5 text-xl-right\">{{ listItemField.label }}</dt>\n <dd class=\"col-12 col-md-7\">{{ listItemField.value || '-' }}</dd>\n </dl>\n </div>\n </div>\n <div class=\"col-12\" *ngIf=\"(items | listFilter: searchModel).length === 0\">\n {{ 'list.noMatchingItems' | translate }}<i>\"{{ searchModel }}\"</i>\n </div>\n </div>\n </div>\n </div>\n\n <div\n class=\"pagination-holder bg-light px-4 pt-4 pb-2 overflow-auto row mr-0 ml-0\"\n *ngIf=\"pagination && items?.length > 0 && fields?.length > 0\"\n >\n <div class=\"float-left page-count col-4\">\n <strong>{{ 'list.currentPage' | translate: {current: pagination.page, total: getTotalPageCount()} }}</strong>\n <br />\n {{\n pagination.collectionSize === 1\n ? ('list.showingResult' | translate: {number: (items | listFilter: searchModel).length})\n : ('list.showingResults'\n | translate: {number: (items | listFilter: searchModel).length, total: pagination.collectionSize})\n }}\n </div>\n <div class=\"col-4 text-center\">\n {{ 'list.show' | translate }}\n <select [(ngModel)]=\"pagination.size\" (ngModelChange)=\"setPaginationSize($event)\">\n <option [ngValue]=\"10\">10</option>\n <option [ngValue]=\"25\">25</option>\n <option [ngValue]=\"50\">50</option>\n <option [ngValue]=\"100\">100</option>\n </select>\n {{ 'list.entries' | translate }}\n </div>\n <div class=\"col-4\">\n <ngb-pagination\n *ngIf=\"pagination.collectionSize > pagination.size\"\n class=\"float-right\"\n [collectionSize]=\"pagination.collectionSize\"\n [(page)]=\"pagination.page\"\n [pageSize]=\"pagination.size\"\n [maxSize]=\"pagination.maxPaginationItemSize\"\n [rotate]=\"true\"\n (pageChange)=\"onClickPagination(pagination.page)\"\n ></ngb-pagination>\n </div>\n </div>\n\n <div id=\"no-results\" class=\"p-5\" *ngIf=\"items?.length === 0\">{{ 'list.noResults' | translate }}</div>\n\n <div id=\"no-field-definitions\" class=\"p-5\" *ngIf=\"items?.length > 0 && fields?.length === 0\">\n {{ 'list.noFieldDefinitions' | translate }}\n </div>\n</div>\n",
1936
+ styles: ["@charset \"UTF-8\";\n/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.table{table-layout:fixed}.click-able{cursor:pointer}.pagination-holder{border-top:1px solid #dee2e6}.search-holder{border-bottom:1px solid #dee2e6;height:80px;padding-left:18px;padding-right:18px}.switch-view-holder i{font-size:1.8rem;line-height:1.2rem;margin-top:9px}.tile-holder{background-color:#f5f5f5;border:1px solid transparent}.tile-holder:hover{background-color:#eee;border:1px solid #dee2e6}.page-count{margin-bottom:1rem}td:first-child,th:first-child{padding-left:25px}th.sortable{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;cursor:pointer;user-select:none}th.sortable:after{content:\" \uF0DD\";font-family:Font Awesome\\ 5 Free;margin:auto 0 auto 5px;opacity:0;position:absolute;transition:all .15s ease}th.sortable.is-being-sorted.ascending:after{transform:rotate(-180deg)}th.sortable:hover:after{opacity:.5}th.sortable.is-being-sorted:after{opacity:1}"]
1937
+ },] }
1938
+ ];
1939
+ ListComponent.ctorParameters = () => [
1940
+ { type: ViewContentService },
1941
+ { type: NGXLogger }
1942
+ ];
1943
+ ListComponent.propDecorators = {
1944
+ items: [{ type: Input }],
1945
+ fields: [{ type: Input }],
1946
+ pagination: [{ type: Input }],
1947
+ viewMode: [{ type: Input }],
1948
+ isSearchable: [{ type: Input }],
1949
+ header: [{ type: Input }],
1950
+ actions: [{ type: Input }],
1951
+ paginationIdentifier: [{ type: Input }],
1952
+ initialSortState: [{ type: Input }],
1953
+ rowClicked: [{ type: Output }],
1954
+ paginationClicked: [{ type: Output }],
1955
+ paginationSet: [{ type: Output }],
1956
+ search: [{ type: Output }],
1957
+ sortChanged: [{ type: Output }],
1958
+ searchBox: [{ type: ViewChild, args: ['searchBox',] }]
1959
+ };
1960
+
1961
+ /*
1962
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1963
+ *
1964
+ * Licensed under EUPL, Version 1.2 (the "License");
1965
+ * you may not use this file except in compliance with the License.
1966
+ * You may obtain a copy of the License at
1967
+ *
1968
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1969
+ *
1970
+ * Unless required by applicable law or agreed to in writing, software
1971
+ * distributed under the License is distributed on an "AS IS" basis,
1972
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1973
+ * See the License for the specific language governing permissions and
1974
+ * limitations under the License.
1975
+ */
1976
+ class ListFilterPipe {
1977
+ transform(list, filterText) {
1978
+ list = list || [];
1979
+ if (!filterText) {
1980
+ return list;
1981
+ }
1982
+ return list.filter(item => Object.keys(item).some(k => item[k] != null &&
1983
+ item[k]
1984
+ .toString()
1985
+ .toLowerCase()
1986
+ .includes(filterText.toLowerCase())));
1987
+ }
1988
+ }
1989
+ ListFilterPipe.decorators = [
1990
+ { type: Pipe, args: [{
1991
+ name: 'listFilter'
1992
+ },] }
1993
+ ];
1994
+
1995
+ /*
1996
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
1997
+ *
1998
+ * Licensed under EUPL, Version 1.2 (the "License");
1999
+ * you may not use this file except in compliance with the License.
2000
+ * You may obtain a copy of the License at
2001
+ *
2002
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2003
+ *
2004
+ * Unless required by applicable law or agreed to in writing, software
2005
+ * distributed under the License is distributed on an "AS IS" basis,
2006
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2007
+ * See the License for the specific language governing permissions and
2008
+ * limitations under the License.
2009
+ */
2010
+ /**
2011
+ * Component used to display a card element
2012
+ */
2013
+ class CardComponent {
2014
+ constructor() { }
2015
+ ngOnInit() {
2016
+ }
2017
+ }
2018
+ CardComponent.decorators = [
2019
+ { type: Component, args: [{
2020
+ selector: 'valtimo-card',
2021
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"card card-border-color card-border-color-primary\">\n <div *ngIf=\"title || subtitle\"class=\"card-header card-header-divider\">\n <span *ngIf=\"title\">{{title}}</span>\n <span *ngIf=\"subtitle\" class=\"card-subtitle\">{{subtitle}}</span>\n </div>\n <div class=\"card-body\">\n <ng-content></ng-content>\n </div>\n</div>\n",
2022
+ styles: [""]
2023
+ },] }
2024
+ ];
2025
+ CardComponent.ctorParameters = () => [];
2026
+ CardComponent.propDecorators = {
2027
+ title: [{ type: Input }],
2028
+ subtitle: [{ type: Input }]
2029
+ };
2030
+
2031
+ /*
2032
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2033
+ *
2034
+ * Licensed under EUPL, Version 1.2 (the "License");
2035
+ * you may not use this file except in compliance with the License.
2036
+ * You may obtain a copy of the License at
2037
+ *
2038
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2039
+ *
2040
+ * Unless required by applicable law or agreed to in writing, software
2041
+ * distributed under the License is distributed on an "AS IS" basis,
2042
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2043
+ * See the License for the specific language governing permissions and
2044
+ * limitations under the License.
2045
+ */
2046
+ class CardModule {
2047
+ }
2048
+ CardModule.decorators = [
2049
+ { type: NgModule, args: [{
2050
+ declarations: [CardComponent],
2051
+ imports: [
2052
+ CommonModule
2053
+ ],
2054
+ exports: [CardComponent]
2055
+ },] }
2056
+ ];
2057
+
2058
+ /*
2059
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2060
+ *
2061
+ * Licensed under EUPL, Version 1.2 (the "License");
2062
+ * you may not use this file except in compliance with the License.
2063
+ * You may obtain a copy of the License at
2064
+ *
2065
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2066
+ *
2067
+ * Unless required by applicable law or agreed to in writing, software
2068
+ * distributed under the License is distributed on an "AS IS" basis,
2069
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2070
+ * See the License for the specific language governing permissions and
2071
+ * limitations under the License.
2072
+ */
2073
+ class ListModule {
2074
+ }
2075
+ ListModule.decorators = [
2076
+ { type: NgModule, args: [{
2077
+ declarations: [ListComponent, ListFilterPipe],
2078
+ imports: [CommonModule, CardModule, NgbPaginationModule, FormsModule, TranslateModule],
2079
+ exports: [ListComponent, ListFilterPipe]
2080
+ },] }
2081
+ ];
2082
+
2083
+ /*
2084
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2085
+ *
2086
+ * Licensed under EUPL, Version 1.2 (the "License");
2087
+ * you may not use this file except in compliance with the License.
2088
+ * You may obtain a copy of the License at
2089
+ *
2090
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2091
+ *
2092
+ * Unless required by applicable law or agreed to in writing, software
2093
+ * distributed under the License is distributed on an "AS IS" basis,
2094
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2095
+ * See the License for the specific language governing permissions and
2096
+ * limitations under the License.
2097
+ */
2098
+ class PageHeaderComponent {
2099
+ constructor() { }
2100
+ ngOnInit() { }
2101
+ }
2102
+ PageHeaderComponent.decorators = [
2103
+ { type: Component, args: [{
2104
+ selector: 'valtimo-page-header',
2105
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"page-head\">\n <valtimo-page-title></valtimo-page-title>\n <valtimo-breadcrumb-navigation></valtimo-breadcrumb-navigation>\n</div>\n",
2106
+ styles: [""]
2107
+ },] }
2108
+ ];
2109
+ PageHeaderComponent.ctorParameters = () => [];
2110
+
2111
+ /*
2112
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2113
+ *
2114
+ * Licensed under EUPL, Version 1.2 (the "License");
2115
+ * you may not use this file except in compliance with the License.
2116
+ * You may obtain a copy of the License at
2117
+ *
2118
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2119
+ *
2120
+ * Unless required by applicable law or agreed to in writing, software
2121
+ * distributed under the License is distributed on an "AS IS" basis,
2122
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2123
+ * See the License for the specific language governing permissions and
2124
+ * limitations under the License.
2125
+ */
2126
+ class BreadcrumbNavigationComponent {
2127
+ constructor(router, route) {
2128
+ this.router = router;
2129
+ this.route = route;
2130
+ this.breadcrumbs = [];
2131
+ this.appTitle = 'Valtimo';
2132
+ this.routerSub = Subscription.EMPTY;
2133
+ }
2134
+ ngOnInit() {
2135
+ this.setBreadcrumbs(this.route);
2136
+ this.routerSub = this.router.events
2137
+ .pipe(filter(event => event instanceof NavigationEnd))
2138
+ .pipe(map(() => this.route))
2139
+ .pipe(map((route) => {
2140
+ while (route.firstChild) {
2141
+ route = route.firstChild;
2142
+ }
2143
+ return route;
2144
+ }))
2145
+ .pipe(filter(route => route.outlet === PRIMARY_OUTLET))
2146
+ .subscribe(route => {
2147
+ this.setBreadcrumbs(route);
2148
+ });
2149
+ }
2150
+ setBreadcrumbs(route) {
2151
+ while (route.firstChild) {
2152
+ route = route.firstChild;
2153
+ }
2154
+ if (route.outlet === PRIMARY_OUTLET) {
2155
+ const snapshot = route.snapshot;
2156
+ const activeRoute = {
2157
+ url: snapshot.url.join('/'),
2158
+ path: snapshot.routeConfig.path,
2159
+ label: snapshot.data['title'],
2160
+ params: snapshot.params
2161
+ };
2162
+ this.generateBreadcrumbs(activeRoute);
2163
+ }
2164
+ }
2165
+ generateBreadcrumbs(activeBreadcrumb) {
2166
+ this.breadcrumbs = [];
2167
+ this.router.config.map(routerConfig => {
2168
+ if (activeBreadcrumb.path.indexOf(routerConfig.path + '/') === 0
2169
+ && activeBreadcrumb.path !== routerConfig.path
2170
+ && routerConfig.path !== '') {
2171
+ const parentRoute = {
2172
+ url: routerConfig.path.replace(/:(.+?)\b/g, (_, p1) => activeBreadcrumb.params[p1]),
2173
+ path: routerConfig.path,
2174
+ label: routerConfig.data['title'],
2175
+ params: activeBreadcrumb.params
2176
+ };
2177
+ const exist = this.breadcrumbs.findIndex(item => item.url === parentRoute.url);
2178
+ if (exist === -1) {
2179
+ this.breadcrumbs.push(parentRoute);
2180
+ }
2181
+ }
2182
+ });
2183
+ }
2184
+ ngOnDestroy() {
2185
+ this.routerSub.unsubscribe();
2186
+ }
2187
+ }
2188
+ BreadcrumbNavigationComponent.decorators = [
2189
+ { type: Component, args: [{
2190
+ selector: 'valtimo-breadcrumb-navigation',
2191
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<nav aria-label=\"breadcrumb\" role=\"navigation\">\n <ol class=\"breadcrumb page-head-nav\">\n <li class=\"breadcrumb-item\">\n <a [routerLink]=\"['/']\">{{ appTitle }}</a>\n </li>\n <li class=\"breadcrumb-item\" *ngFor=\"let item of breadcrumbs\">\n <a [routerLink]=\"[item.url]\">{{ item.label | translate }}</a>\n </li>\n </ol>\n</nav>\n",
2192
+ styles: [""]
2193
+ },] }
2194
+ ];
2195
+ BreadcrumbNavigationComponent.ctorParameters = () => [
2196
+ { type: Router },
2197
+ { type: ActivatedRoute }
2198
+ ];
2199
+
2200
+ /*
2201
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2202
+ *
2203
+ * Licensed under EUPL, Version 1.2 (the "License");
2204
+ * you may not use this file except in compliance with the License.
2205
+ * You may obtain a copy of the License at
2206
+ *
2207
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2208
+ *
2209
+ * Unless required by applicable law or agreed to in writing, software
2210
+ * distributed under the License is distributed on an "AS IS" basis,
2211
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2212
+ * See the License for the specific language governing permissions and
2213
+ * limitations under the License.
2214
+ */
2215
+ class BreadcrumbNavigationModule {
2216
+ }
2217
+ BreadcrumbNavigationModule.decorators = [
2218
+ { type: NgModule, args: [{
2219
+ declarations: [BreadcrumbNavigationComponent],
2220
+ imports: [
2221
+ CommonModule,
2222
+ RouterModule,
2223
+ TranslateModule
2224
+ ],
2225
+ exports: [BreadcrumbNavigationComponent]
2226
+ },] }
2227
+ ];
2228
+
2229
+ /*
2230
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2231
+ *
2232
+ * Licensed under EUPL, Version 1.2 (the "License");
2233
+ * you may not use this file except in compliance with the License.
2234
+ * You may obtain a copy of the License at
2235
+ *
2236
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2237
+ *
2238
+ * Unless required by applicable law or agreed to in writing, software
2239
+ * distributed under the License is distributed on an "AS IS" basis,
2240
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2241
+ * See the License for the specific language governing permissions and
2242
+ * limitations under the License.
2243
+ */
2244
+ class PageHeaderModule {
2245
+ }
2246
+ PageHeaderModule.decorators = [
2247
+ { type: NgModule, args: [{
2248
+ declarations: [PageHeaderComponent],
2249
+ imports: [
2250
+ CommonModule,
2251
+ PageTitleModule,
2252
+ BreadcrumbNavigationModule
2253
+ ],
2254
+ exports: [PageHeaderComponent]
2255
+ },] }
2256
+ ];
2257
+
2258
+ /*
2259
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2260
+ *
2261
+ * Licensed under EUPL, Version 1.2 (the "License");
2262
+ * you may not use this file except in compliance with the License.
2263
+ * You may obtain a copy of the License at
2264
+ *
2265
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2266
+ *
2267
+ * Unless required by applicable law or agreed to in writing, software
2268
+ * distributed under the License is distributed on an "AS IS" basis,
2269
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2270
+ * See the License for the specific language governing permissions and
2271
+ * limitations under the License.
2272
+ */
2273
+ /**
2274
+ * Component used to display a widget element
2275
+ */
2276
+ class WidgetComponent {
2277
+ ngOnInit() {
2278
+ this.setCardClassName();
2279
+ this.setType();
2280
+ this.setAdditionalClasses();
2281
+ this.setContrast();
2282
+ this.setDivider();
2283
+ this.setCollapse();
2284
+ }
2285
+ toggleContent() {
2286
+ if (this.collapseAble) {
2287
+ this.isCollapsed = !this.isCollapsed;
2288
+ }
2289
+ }
2290
+ setCardClassName() {
2291
+ this.cardClassName = 'card-full-default';
2292
+ }
2293
+ setType() {
2294
+ if (this.type) {
2295
+ this.cardClassName = `card-full-${this.type}`;
2296
+ }
2297
+ }
2298
+ setAdditionalClasses() {
2299
+ if (this.additionalClasses) {
2300
+ this.cardClassName = `${this.cardClassName} ${this.additionalClasses}`;
2301
+ }
2302
+ }
2303
+ setContrast() {
2304
+ if (this.contrast) {
2305
+ this.contrastClass = 'card-header-contrast';
2306
+ }
2307
+ }
2308
+ setDivider() {
2309
+ if (this.divider) {
2310
+ this.dividerClass = 'card-header-divider';
2311
+ }
2312
+ }
2313
+ setCollapse() {
2314
+ this.isCollapsed = !(this.collapseAble && this.collapse === 'hide');
2315
+ }
2316
+ }
2317
+ WidgetComponent.decorators = [
2318
+ { type: Component, args: [{
2319
+ selector: 'valtimo-widget',
2320
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"card card-border card-contrast {{ cardClassName }}\">\n <div class=\"card-header {{ contrastClass }} {{ dividerClass }}\"\n *ngIf=\"title || subtitle\">\n <div class=\"row\">\n <div class=\"col-7\"\n [ngClass]=\"{'clickable': collapseAble}\"\n (click)=\"toggleContent()\">\n <!-- Title -->\n <div *ngIf=\"title\" class=\"text-truncate\">{{ title }}</div>\n <!-- Sub title -->\n <div *ngIf=\"subtitle\" class=\"card-subtitle text-truncate\">{{ subtitle }}</div>\n </div>\n\n <!-- Tools-->\n <div class=\"tools col-5 text-right\">\n <!-- Collapse content -->\n <a class=\"icon mdi\"\n *ngIf=\"collapseAble\"\n [ngClass]=\"{'mdi-chevron-up': isCollapsed, 'mdi-chevron-down': !isCollapsed}\"\n (click)=\"toggleContent()\"></a>\n </div>\n </div>\n </div>\n <!-- content -->\n <div [hidden]=\"!isCollapsed\">\n <ng-content></ng-content>\n </div>\n</div>\n",
2321
+ styles: [".card-contrast .card-header{padding:20px!important}.card-subtitle{margin-bottom:0}.card-full,.card-full .card-subtitle,.card-full .tools .icon{color:#6b6b6b!important}.card-full-warning,.card-full-warning .card-subtitle,.card-full-warning .tools .icon{color:#343a40!important}.card-full-danger,.card-full-danger .card-subtitle,.card-full-danger .tools .icon,.card-full-dark,.card-full-dark .card-subtitle,.card-full-dark .tools .icon,.card-full-info,.card-full-info .card-subtitle,.card-full-info .tools .icon,.card-full-primary,.card-full-primary .card-subtitle,.card-full-primary .tools .icon,.card-full-success,.card-full-success .card-subtitle,.card-full-success .tools .icon{color:#fff!important}.card-contrast .card-body{padding-top:15px}.card-body{padding:15px 20px}.pie-label{font-size:16px!important}.widget.widget-tile svg.ngx-charts{margin-left:-1.5rem!important}svg.ngx-charts{margin:0;padding:0}"]
2322
+ },] }
2323
+ ];
2324
+ WidgetComponent.propDecorators = {
2325
+ type: [{ type: Input }],
2326
+ name: [{ type: Input }],
2327
+ icon: [{ type: Input }],
2328
+ contrast: [{ type: Input }],
2329
+ divider: [{ type: Input }],
2330
+ title: [{ type: Input }],
2331
+ subtitle: [{ type: Input }],
2332
+ collapseAble: [{ type: Input }],
2333
+ collapse: [{ type: Input }],
2334
+ additionalClasses: [{ type: Input }]
2335
+ };
2336
+
2337
+ /*
2338
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2339
+ *
2340
+ * Licensed under EUPL, Version 1.2 (the "License");
2341
+ * you may not use this file except in compliance with the License.
2342
+ * You may obtain a copy of the License at
2343
+ *
2344
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2345
+ *
2346
+ * Unless required by applicable law or agreed to in writing, software
2347
+ * distributed under the License is distributed on an "AS IS" basis,
2348
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2349
+ * See the License for the specific language governing permissions and
2350
+ * limitations under the License.
2351
+ */
2352
+ class WidgetModule {
2353
+ }
2354
+ WidgetModule.decorators = [
2355
+ { type: NgModule, args: [{
2356
+ declarations: [WidgetComponent],
2357
+ imports: [
2358
+ CommonModule
2359
+ ],
2360
+ exports: [WidgetComponent]
2361
+ },] }
2362
+ ];
2363
+
2364
+ /*
2365
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2366
+ *
2367
+ * Licensed under EUPL, Version 1.2 (the "License");
2368
+ * you may not use this file except in compliance with the License.
2369
+ * You may obtain a copy of the License at
2370
+ *
2371
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2372
+ *
2373
+ * Unless required by applicable law or agreed to in writing, software
2374
+ * distributed under the License is distributed on an "AS IS" basis,
2375
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2376
+ * See the License for the specific language governing permissions and
2377
+ * limitations under the License.
2378
+ */
2379
+ class FieldAutoFocusDirective {
2380
+ constructor(el) {
2381
+ this.el = el;
2382
+ }
2383
+ ngAfterContentInit() {
2384
+ setTimeout(() => {
2385
+ this.el.nativeElement.focus();
2386
+ }, 300);
2387
+ }
2388
+ }
2389
+ FieldAutoFocusDirective.decorators = [
2390
+ { type: Directive, args: [{
2391
+ selector: '[valtimoFieldAutoFocus]'
2392
+ },] }
2393
+ ];
2394
+ FieldAutoFocusDirective.ctorParameters = () => [
2395
+ { type: ElementRef }
2396
+ ];
2397
+
2398
+ /*
2399
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2400
+ *
2401
+ * Licensed under EUPL, Version 1.2 (the "License");
2402
+ * you may not use this file except in compliance with the License.
2403
+ * You may obtain a copy of the License at
2404
+ *
2405
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2406
+ *
2407
+ * Unless required by applicable law or agreed to in writing, software
2408
+ * distributed under the License is distributed on an "AS IS" basis,
2409
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2410
+ * See the License for the specific language governing permissions and
2411
+ * limitations under the License.
2412
+ */
2413
+ class FieldAutoFocusModule {
2414
+ }
2415
+ FieldAutoFocusModule.decorators = [
2416
+ { type: NgModule, args: [{
2417
+ declarations: [FieldAutoFocusDirective],
2418
+ exports: [
2419
+ FieldAutoFocusDirective
2420
+ ],
2421
+ imports: [
2422
+ CommonModule
2423
+ ]
2424
+ },] }
2425
+ ];
2426
+
2427
+ /*
2428
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2429
+ *
2430
+ * Licensed under EUPL, Version 1.2 (the "License");
2431
+ * you may not use this file except in compliance with the License.
2432
+ * You may obtain a copy of the License at
2433
+ *
2434
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2435
+ *
2436
+ * Unless required by applicable law or agreed to in writing, software
2437
+ * distributed under the License is distributed on an "AS IS" basis,
2438
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2439
+ * See the License for the specific language governing permissions and
2440
+ * limitations under the License.
2441
+ */
2442
+ class BpmnJsDiagramComponent {
2443
+ constructor() {
2444
+ this.importDone = new EventEmitter();
2445
+ this.heatPoints = { data: [] };
2446
+ }
2447
+ ngOnInit() {
2448
+ this.bpmnJS = new BpmnJS();
2449
+ this.bpmnJS.on('import.done', ({ error }) => {
2450
+ if (!error) {
2451
+ const canvas = this.bpmnJS.get('canvas'), eventBus = this.bpmnJS.get('eventBus');
2452
+ if (this.historicActivityInstances) {
2453
+ this.historicActivityInstances.forEach(instance => {
2454
+ canvas.addMarker(instance.activityId, instance.endTime ? 'highlight-overlay-past' : 'highlight-overlay-current');
2455
+ });
2456
+ }
2457
+ canvas.zoom('fit-viewport', 'auto');
2458
+ if (this.heatmapDuration || this.heatmapCount) {
2459
+ eventBus.on('canvas.init', () => {
2460
+ if (this.heatmapMode) {
2461
+ this.clearHeatmap();
2462
+ }
2463
+ this.getHeatmapData();
2464
+ });
2465
+ eventBus.on('canvas.viewbox.changing', () => {
2466
+ if (this.heatmapMode) {
2467
+ this.clearHeatmap();
2468
+ }
2469
+ });
2470
+ eventBus.on('canvas.viewbox.changed', () => {
2471
+ this.getHeatmapData();
2472
+ });
2473
+ }
2474
+ }
2475
+ });
2476
+ }
2477
+ ngAfterContentInit() {
2478
+ this.bpmnJS.importXML(this.bpmn20Xml);
2479
+ this.bpmnJS.attachTo(this.el.nativeElement);
2480
+ }
2481
+ getHeatmapData() {
2482
+ let inputData, valueKey;
2483
+ this.heatPoints = { data: [] };
2484
+ this.min = 0;
2485
+ this.max = 0;
2486
+ if (this.heatmapDuration) {
2487
+ inputData = this.heatmapDuration;
2488
+ valueKey = 'averageDurationInMilliseconds';
2489
+ }
2490
+ else if (this.heatmapCount) {
2491
+ inputData = this.heatmapCount;
2492
+ valueKey = 'totalCount';
2493
+ }
2494
+ if (inputData) {
2495
+ Object.keys(inputData).forEach(key => {
2496
+ const diagramContainer = this.el.nativeElement.querySelector('svg')
2497
+ .getBoundingClientRect(), diagramElm = this.el.nativeElement.querySelector(`g[data-element-id=${key}]`)
2498
+ .getBoundingClientRect();
2499
+ this.setMax(key);
2500
+ this.heatPoints.data.push({
2501
+ x: Math.round(diagramElm.x - diagramContainer.x + diagramElm.width / 2),
2502
+ y: Math.round(diagramElm.y - diagramContainer.y + diagramElm.height / 2),
2503
+ value: inputData[key][valueKey],
2504
+ radius: diagramElm.width / 2
2505
+ });
2506
+ if (inputData[key].count > 0) {
2507
+ this.addCounterActiveOverlays(key, inputData);
2508
+ }
2509
+ });
2510
+ if (this.heatmapMode) {
2511
+ this.showHeatmap();
2512
+ }
2513
+ }
2514
+ }
2515
+ setMax(key) {
2516
+ if (this.heatmapDuration) {
2517
+ this.max = Math.max(this.heatmapDuration[key].averageDurationInMilliseconds, this.max);
2518
+ }
2519
+ else if (this.heatmapCount) {
2520
+ this.max = Math.max(this.heatmapCount[key].totalCount + this.heatmapCount[key].count, this.max);
2521
+ }
2522
+ }
2523
+ addCounterActiveOverlays(key, inputData) {
2524
+ const overlays = this.bpmnJS.get('overlays');
2525
+ overlays.add(key, {
2526
+ position: {
2527
+ bottom: -10,
2528
+ left: 0
2529
+ },
2530
+ show: {
2531
+ minZoom: 0,
2532
+ maxZoom: 5.0
2533
+ },
2534
+ html: `<span class="badge badge-pill badge-primary">${inputData[key].count}</span>`
2535
+ });
2536
+ }
2537
+ showHeatmap() {
2538
+ this.heatMapInstance = create({
2539
+ radius: 54,
2540
+ blur: .70,
2541
+ maxOpacity: .4,
2542
+ minOpacity: 0,
2543
+ container: this.el.nativeElement
2544
+ });
2545
+ this.heatMapInstance.setData({
2546
+ min: this.min,
2547
+ max: this.max,
2548
+ data: this.heatPoints.data
2549
+ });
2550
+ }
2551
+ clearHeatmap() {
2552
+ this.heatMapInstance.setData({ data: [] });
2553
+ }
2554
+ toggleHeatmap() {
2555
+ this.heatmapMode = !this.heatmapMode;
2556
+ if (this.heatmapMode) {
2557
+ this.showHeatmap();
2558
+ }
2559
+ else {
2560
+ this.clearHeatmap();
2561
+ }
2562
+ }
2563
+ ngOnDestroy() {
2564
+ this.bpmnJS.destroy();
2565
+ }
2566
+ }
2567
+ BpmnJsDiagramComponent.decorators = [
2568
+ { type: Component, args: [{
2569
+ selector: 'valtimo-bpmn-js-diagram',
2570
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"p-4\" *ngIf=\"heatmapDuration || heatmapCount\">\n <div class=\"switch-button switch-button-sm switch-button-success\">\n <input type=\"checkbox\" id=\"toggleHeatmap\" [checked]=\"heatmapMode\" (click)=\"toggleHeatmap()\"><span>\n <label for=\"toggleHeatmap\"></label></span>\n </div>\n</div>\n\n<div #ref class=\"diagram-container\"></div>\n\n<div *ngIf=\"historicActivityInstances\" class=\"p-4 text-center legenda-holder\">\n <span><div class=\"legenda highlight-overlay-past\"></div> Executed tasks</span>\n <span class=\"ml-3\"><div class=\"legenda highlight-overlay-current\"></div> Current tasks</span>\n</div>\n\n<div *ngIf=\"heatmapDuration || heatmapCount\" class=\"p-4 text-center legenda-holder\">\n <span><span class=\"badge badge-pill badge-primary\">N</span>&nbsp;&nbsp;Amount of currently active instances of this task.</span>\n <span>&nbsp;&nbsp;|&nbsp;&nbsp;Red/yellow/green orbs: The amount of times the task is executed in comparison to the other tasks.</span>\n</div>\n",
2571
+ styles: [""]
2572
+ },] }
2573
+ ];
2574
+ BpmnJsDiagramComponent.ctorParameters = () => [];
2575
+ BpmnJsDiagramComponent.propDecorators = {
2576
+ el: [{ type: ViewChild, args: ['ref', { static: true },] }],
2577
+ importDone: [{ type: Output }],
2578
+ bpmn20Xml: [{ type: Input }],
2579
+ heatmapDuration: [{ type: Input }],
2580
+ heatmapCount: [{ type: Input }],
2581
+ historicActivityInstances: [{ type: Input }]
2582
+ };
2583
+
2584
+ /*
2585
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2586
+ *
2587
+ * Licensed under EUPL, Version 1.2 (the "License");
2588
+ * you may not use this file except in compliance with the License.
2589
+ * You may obtain a copy of the License at
2590
+ *
2591
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2592
+ *
2593
+ * Unless required by applicable law or agreed to in writing, software
2594
+ * distributed under the License is distributed on an "AS IS" basis,
2595
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2596
+ * See the License for the specific language governing permissions and
2597
+ * limitations under the License.
2598
+ */
2599
+ class BpmnJsDiagramModule {
2600
+ }
2601
+ BpmnJsDiagramModule.decorators = [
2602
+ { type: NgModule, args: [{
2603
+ declarations: [BpmnJsDiagramComponent],
2604
+ imports: [
2605
+ CommonModule
2606
+ ],
2607
+ exports: [BpmnJsDiagramComponent]
2608
+ },] }
2609
+ ];
2610
+
2611
+ /*
2612
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2613
+ *
2614
+ * Licensed under EUPL, Version 1.2 (the "License");
2615
+ * you may not use this file except in compliance with the License.
2616
+ * You may obtain a copy of the License at
2617
+ *
2618
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2619
+ *
2620
+ * Unless required by applicable law or agreed to in writing, software
2621
+ * distributed under the License is distributed on an "AS IS" basis,
2622
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2623
+ * See the License for the specific language governing permissions and
2624
+ * limitations under the License.
2625
+ */
2626
+ class TimelineComponent {
2627
+ }
2628
+ TimelineComponent.decorators = [
2629
+ { type: Component, args: [{
2630
+ selector: 'valtimo-timeline',
2631
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div>\n <div id=\"no-results\" class=\"p-5\" *ngIf=\"items?.length === 0\">\n No result found\n </div>\n <div class=\"pb-5\" *ngIf=\"items?.length > 0\">\n <ul class=\"timeline mb-0 py-5\">\n <li class=\"timeline-item status-done\" *ngFor=\"let item of items\">\n <div class=\"timeline-date\">\n <span>{{ item.date }}</span>\n </div>\n <div class=\"timeline-content mt-1\">\n <div class=\"timeline-header p-0\">\n <span class=\"timeline-time\">{{ item.time }}</span>\n <span class=\"timeline-author\">{{ item.user }}</span>\n <br/>\n <p class=\"timeline-activity\">{{ item.activity }}</p>\n <div class=\"timeline-summary\">\n <p [innerHTML]=\"item.summaryTranslationKey | translate: item.summaryTranslationParams\"></p>\n </div>\n </div>\n </div>\n </li>\n </ul>\n </div>\n</div>\n",
2632
+ styles: [""]
2633
+ },] }
2634
+ ];
2635
+ TimelineComponent.propDecorators = {
2636
+ items: [{ type: Input }]
2637
+ };
2638
+
2639
+ /*
2640
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2641
+ *
2642
+ * Licensed under EUPL, Version 1.2 (the "License");
2643
+ * you may not use this file except in compliance with the License.
2644
+ * You may obtain a copy of the License at
2645
+ *
2646
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2647
+ *
2648
+ * Unless required by applicable law or agreed to in writing, software
2649
+ * distributed under the License is distributed on an "AS IS" basis,
2650
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2651
+ * See the License for the specific language governing permissions and
2652
+ * limitations under the License.
2653
+ */
2654
+ class TimelineModule {
2655
+ }
2656
+ TimelineModule.decorators = [
2657
+ { type: NgModule, args: [{
2658
+ declarations: [TimelineComponent],
2659
+ imports: [
2660
+ CommonModule,
2661
+ TranslateModule,
2662
+ ],
2663
+ exports: [TimelineComponent]
2664
+ },] }
2665
+ ];
2666
+
2667
+ /*
2668
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2669
+ *
2670
+ * Licensed under EUPL, Version 1.2 (the "License");
2671
+ * you may not use this file except in compliance with the License.
2672
+ * You may obtain a copy of the License at
2673
+ *
2674
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2675
+ *
2676
+ * Unless required by applicable law or agreed to in writing, software
2677
+ * distributed under the License is distributed on an "AS IS" basis,
2678
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2679
+ * See the License for the specific language governing permissions and
2680
+ * limitations under the License.
2681
+ */
2682
+ class ComponentsModule {
2683
+ }
2684
+ ComponentsModule.decorators = [
2685
+ { type: NgModule }
2686
+ ];
2687
+
2688
+ /*
2689
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2690
+ *
2691
+ * Licensed under EUPL, Version 1.2 (the "License");
2692
+ * you may not use this file except in compliance with the License.
2693
+ * You may obtain a copy of the License at
2694
+ *
2695
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2696
+ *
2697
+ * Unless required by applicable law or agreed to in writing, software
2698
+ * distributed under the License is distributed on an "AS IS" basis,
2699
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2700
+ * See the License for the specific language governing permissions and
2701
+ * limitations under the License.
2702
+ */
2703
+ class FilterSidebarComponent {
2704
+ constructor() {
2705
+ this.filterSidebar = localStorage.getItem('filterSidebar') || 'show';
2706
+ }
2707
+ ngOnInit() {
2708
+ if (this.filterSidebar === 'show') {
2709
+ localStorage.setItem('filterSidebar', 'show');
2710
+ $('.be-content').addClass('be-aside');
2711
+ }
2712
+ $('[data-toggle="tooltip"]').tooltip();
2713
+ }
2714
+ ngOnDestroy() {
2715
+ $('.be-content').removeClass('be-aside');
2716
+ }
2717
+ toggleFilterSidebar() {
2718
+ const beContent = $('.be-content');
2719
+ beContent.toggleClass('be-aside');
2720
+ this.filterSidebar = beContent.hasClass('be-aside') ? 'show' : 'hide';
2721
+ localStorage.setItem('filterSidebar', this.filterSidebar);
2722
+ }
2723
+ }
2724
+ FilterSidebarComponent.decorators = [
2725
+ { type: Component, args: [{
2726
+ selector: 'valtimo-filter-sidebar',
2727
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div>\n <a\n class=\"toggle-filter-sidebar\"\n data-toggle=\"tooltip\"\n data-trigger=\"hover\"\n data-placement=\"right\"\n title=\"Show / hide\"\n href=\"javascript:void(0)\"\n (click)=\"toggleFilterSidebar()\"\n [ngClass]=\"this.filterSidebar === 'show' && 'toggle-expanded'\"\n >\n <div class=\"icon-container p-0 bg-transparent\">\n <i class=\"click-able icon shadow mdi mdi-filter-list\"></i>\n </div>\n </a>\n <aside class=\"page-aside p-4 mb-4 bg-light filter-holder\" *ngIf=\"this.filterSidebar === 'show'\">\n <ng-content></ng-content>\n </aside>\n</div>\n",
2728
+ styles: [".filter-holder{border:0 solid transparent}.toggle-filter-sidebar{cursor:pointer;font-size:2rem;margin-left:-50px;position:absolute;top:25px;z-index:1}.icon-container .icon{background-color:#fff;color:#6b6b6b}.toggle-filter-sidebar:hover .icon-container .icon{color:#ff5800}@media screen and (min-width:768px){.toggle-filter-sidebar{margin-left:-25px}.page-aside{height:calc(100vh - 61px);left:0;margin-top:0;position:absolute}.toggle-expanded{margin-left:255px}}"]
2729
+ },] }
2730
+ ];
2731
+ FilterSidebarComponent.ctorParameters = () => [];
2732
+
2733
+ /*
2734
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2735
+ *
2736
+ * Licensed under EUPL, Version 1.2 (the "License");
2737
+ * you may not use this file except in compliance with the License.
2738
+ * You may obtain a copy of the License at
2739
+ *
2740
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2741
+ *
2742
+ * Unless required by applicable law or agreed to in writing, software
2743
+ * distributed under the License is distributed on an "AS IS" basis,
2744
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2745
+ * See the License for the specific language governing permissions and
2746
+ * limitations under the License.
2747
+ */
2748
+ class FilterSidebarModule {
2749
+ }
2750
+ FilterSidebarModule.decorators = [
2751
+ { type: NgModule, args: [{
2752
+ declarations: [FilterSidebarComponent],
2753
+ imports: [
2754
+ CommonModule
2755
+ ],
2756
+ exports: [FilterSidebarComponent]
2757
+ },] }
2758
+ ];
2759
+
2760
+ /*
2761
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2762
+ *
2763
+ * Licensed under EUPL, Version 1.2 (the "License");
2764
+ * you may not use this file except in compliance with the License.
2765
+ * You may obtain a copy of the License at
2766
+ *
2767
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2768
+ *
2769
+ * Unless required by applicable law or agreed to in writing, software
2770
+ * distributed under the License is distributed on an "AS IS" basis,
2771
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2772
+ * See the License for the specific language governing permissions and
2773
+ * limitations under the License.
2774
+ */
2775
+ class UploaderComponent {
2776
+ constructor(s3Service) {
2777
+ this.s3Service = s3Service;
2778
+ this.resources = [];
2779
+ this.resourcesChanged = new EventEmitter();
2780
+ this.resourceRegistered = new EventEmitter();
2781
+ this.showFileList = true;
2782
+ }
2783
+ ngOnInit() {
2784
+ }
2785
+ onFileFieldChange(files) {
2786
+ for (const file of files) {
2787
+ this.uploadFile(file);
2788
+ }
2789
+ }
2790
+ uploadFile(file) {
2791
+ this.s3Service.getPreSignedUrl(file.name).subscribe(value => {
2792
+ const preSignedUrl = new URL(value);
2793
+ this.s3Service.upload(preSignedUrl, file).subscribe(result => {
2794
+ const s3ResourceDTO = new S3Resource(file, preSignedUrl);
2795
+ this.s3Service.registerResource(s3ResourceDTO).subscribe(resource => {
2796
+ this.resources.push(resource);
2797
+ this.resourceRegistered.emit(resource);
2798
+ this.resourcesChanged.emit(this.resources);
2799
+ });
2800
+ });
2801
+ });
2802
+ }
2803
+ deleteResource(resource) {
2804
+ this.s3Service.delete(resource.id).subscribe(result => {
2805
+ const index = this.resources.findIndex(res => res.id === resource.id);
2806
+ this.resources.splice(index, 1);
2807
+ this.resourcesChanged.emit(this.resources);
2808
+ });
2809
+ }
2810
+ }
2811
+ UploaderComponent.decorators = [
2812
+ { type: Component, args: [{
2813
+ selector: 'valtimo-uploader',
2814
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"upload-file-container p-5\" (click)=\"fileInput.click()\" valtimoUploaderDragDrop\n (fileDropped)=\"onFileFieldChange($event)\">\n <span class=\"align-middle\"><i class=\"fa fa-cloud-upload fa-4x\"></i></span>\n <input hidden type=\"file\" #fileInput (change)=\"onFileFieldChange($event.target.files)\" multiple/>\n</div>\n<div *ngIf=\"showFileList\">\n <div class=\"files-list px-3 py-2\" *ngFor=\"let resource of resources\">\n <p class=\"m-0\">\n <strong>{{ resource.name }}</strong><br/>\n {{ resource.sizeInBytes | filesize }}\n </p>\n <button class=\"delete-file\" (click)=\"deleteResource(resource)\">\n <i class=\"fa fa-trash text-danger\"></i>\n </button>\n </div>\n</div>\n\n",
2815
+ styles: [".upload-file-container{background-color:#fff;background-position:50%;background-repeat:no-repeat;background-size:100px;border:2px dashed #d5d8de;color:#d5d8de;margin:0 0 1rem;text-align:center}.upload-file-container i.mdi-cloud-upload{font-size:5em}.upload-file-container:hover{cursor:pointer;opacity:.8}.files-list{background:#fff;border:1px solid #bdc0c7;display:flex;font-size:1em;justify-content:space-between;margin:1rem auto;padding:5px}.files-list .delete-file{background:transparent;border:none;cursor:pointer}.files-list .delete-file i{font-size:1.5em}"]
2816
+ },] }
2817
+ ];
2818
+ UploaderComponent.ctorParameters = () => [
2819
+ { type: S3Service }
2820
+ ];
2821
+ UploaderComponent.propDecorators = {
2822
+ resourcesChanged: [{ type: Output }],
2823
+ resourceRegistered: [{ type: Output }],
2824
+ showFileList: [{ type: Input }]
2825
+ };
2826
+
2827
+ /*
2828
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2829
+ *
2830
+ * Licensed under EUPL, Version 1.2 (the "License");
2831
+ * you may not use this file except in compliance with the License.
2832
+ * You may obtain a copy of the License at
2833
+ *
2834
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2835
+ *
2836
+ * Unless required by applicable law or agreed to in writing, software
2837
+ * distributed under the License is distributed on an "AS IS" basis,
2838
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2839
+ * See the License for the specific language governing permissions and
2840
+ * limitations under the License.
2841
+ */
2842
+ class UploaderDragDropDirective {
2843
+ constructor() {
2844
+ this.fileDropped = new EventEmitter();
2845
+ }
2846
+ onDragOver(evt) {
2847
+ evt.preventDefault();
2848
+ evt.stopPropagation();
2849
+ }
2850
+ onDragLeave(evt) {
2851
+ evt.preventDefault();
2852
+ evt.stopPropagation();
2853
+ }
2854
+ ondrop(evt) {
2855
+ evt.preventDefault();
2856
+ evt.stopPropagation();
2857
+ const files = evt.dataTransfer.files;
2858
+ if (files.length > 0) {
2859
+ this.fileDropped.emit(files);
2860
+ }
2861
+ }
2862
+ }
2863
+ UploaderDragDropDirective.decorators = [
2864
+ { type: Directive, args: [{
2865
+ selector: '[valtimoUploaderDragDrop]'
2866
+ },] }
2867
+ ];
2868
+ UploaderDragDropDirective.propDecorators = {
2869
+ fileDropped: [{ type: Output }],
2870
+ onDragOver: [{ type: HostListener, args: ['dragover', ['$event'],] }],
2871
+ onDragLeave: [{ type: HostListener, args: ['dragleave', ['$event'],] }],
2872
+ ondrop: [{ type: HostListener, args: ['drop', ['$event'],] }]
2873
+ };
2874
+
2875
+ /*
2876
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2877
+ *
2878
+ * Licensed under EUPL, Version 1.2 (the "License");
2879
+ * you may not use this file except in compliance with the License.
2880
+ * You may obtain a copy of the License at
2881
+ *
2882
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2883
+ *
2884
+ * Unless required by applicable law or agreed to in writing, software
2885
+ * distributed under the License is distributed on an "AS IS" basis,
2886
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2887
+ * See the License for the specific language governing permissions and
2888
+ * limitations under the License.
2889
+ */
2890
+ class FileSizePipe {
2891
+ constructor() {
2892
+ this.units = [
2893
+ 'bytes',
2894
+ 'KB',
2895
+ 'MB',
2896
+ 'GB',
2897
+ 'TB',
2898
+ 'PB'
2899
+ ];
2900
+ }
2901
+ transform(bytes = 0, precision = 2) {
2902
+ if (isNaN(parseFloat(String(bytes))) || !isFinite(bytes)) {
2903
+ return '?';
2904
+ }
2905
+ let unit = 0;
2906
+ while (bytes >= 1024) {
2907
+ bytes /= 1024;
2908
+ unit++;
2909
+ }
2910
+ return bytes.toFixed(+precision) + ' ' + this.units[unit];
2911
+ }
2912
+ }
2913
+ FileSizePipe.decorators = [
2914
+ { type: Pipe, args: [{
2915
+ name: 'filesize'
2916
+ },] }
2917
+ ];
2918
+
2919
+ /*
2920
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2921
+ *
2922
+ * Licensed under EUPL, Version 1.2 (the "License");
2923
+ * you may not use this file except in compliance with the License.
2924
+ * You may obtain a copy of the License at
2925
+ *
2926
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2927
+ *
2928
+ * Unless required by applicable law or agreed to in writing, software
2929
+ * distributed under the License is distributed on an "AS IS" basis,
2930
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2931
+ * See the License for the specific language governing permissions and
2932
+ * limitations under the License.
2933
+ */
2934
+ class FileSizeModule {
2935
+ }
2936
+ FileSizeModule.decorators = [
2937
+ { type: NgModule, args: [{
2938
+ declarations: [FileSizePipe],
2939
+ imports: [
2940
+ CommonModule
2941
+ ],
2942
+ exports: [FileSizePipe]
2943
+ },] }
2944
+ ];
2945
+
2946
+ /*
2947
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2948
+ *
2949
+ * Licensed under EUPL, Version 1.2 (the "License");
2950
+ * you may not use this file except in compliance with the License.
2951
+ * You may obtain a copy of the License at
2952
+ *
2953
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2954
+ *
2955
+ * Unless required by applicable law or agreed to in writing, software
2956
+ * distributed under the License is distributed on an "AS IS" basis,
2957
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2958
+ * See the License for the specific language governing permissions and
2959
+ * limitations under the License.
2960
+ */
2961
+ class UploaderModule {
2962
+ }
2963
+ UploaderModule.decorators = [
2964
+ { type: NgModule, args: [{
2965
+ declarations: [UploaderComponent, UploaderDragDropDirective],
2966
+ imports: [
2967
+ CommonModule,
2968
+ FileSizeModule
2969
+ ],
2970
+ exports: [UploaderComponent, UploaderDragDropDirective]
2971
+ },] }
2972
+ ];
2973
+
2974
+ /*
2975
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
2976
+ *
2977
+ * Licensed under EUPL, Version 1.2 (the "License");
2978
+ * you may not use this file except in compliance with the License.
2979
+ * You may obtain a copy of the License at
2980
+ *
2981
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
2982
+ *
2983
+ * Unless required by applicable law or agreed to in writing, software
2984
+ * distributed under the License is distributed on an "AS IS" basis,
2985
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2986
+ * See the License for the specific language governing permissions and
2987
+ * limitations under the License.
2988
+ */
2989
+ class AlertService {
2990
+ constructor(router) {
2991
+ this.router = router;
2992
+ this.confirmed = new EventEmitter();
2993
+ this.subject = new Subject();
2994
+ // clear alert messages on route change unless 'keepAfterRouteChange' flag is true
2995
+ this.router.events.subscribe(event => {
2996
+ if (event instanceof NavigationStart) {
2997
+ // clear alert messages
2998
+ this.clear();
2999
+ }
3000
+ });
3001
+ }
3002
+ // enable subscribing to alerts observable
3003
+ onAlert() {
3004
+ return this.subject.asObservable();
3005
+ }
3006
+ // convenience methods
3007
+ success(message, confirmations, iconClass) {
3008
+ this.alert(new Alert({ message, type: AlertType.Success, confirmations, iconClass }));
3009
+ }
3010
+ error(message, confirmations, iconClass) {
3011
+ this.alert(new Alert({ message, type: AlertType.Error, confirmations, iconClass }));
3012
+ }
3013
+ info(message, confirmations, iconClass) {
3014
+ this.alert(new Alert({ message, type: AlertType.Info, confirmations, iconClass }));
3015
+ }
3016
+ warning(message, confirmations, iconClass) {
3017
+ this.alert(new Alert({ message, type: AlertType.Warning, confirmations, iconClass }));
3018
+ }
3019
+ notification(message, confirmations, iconClass) {
3020
+ this.alert(new Alert({ message, type: AlertType.Notification, confirmations, iconClass }));
3021
+ }
3022
+ modalNotification(message, confirmations, iconClass) {
3023
+ this.alert(new Alert({ message, type: AlertType.ModalNotification, confirmations, iconClass }));
3024
+ }
3025
+ // main alert method
3026
+ alert(alert) {
3027
+ this.subject.next(alert);
3028
+ }
3029
+ // clear alerts
3030
+ clear() {
3031
+ this.subject.next(new Alert({}));
3032
+ }
3033
+ // emit confirm
3034
+ emitAlertConfirmEvent(alert) {
3035
+ this.confirmed.emit(alert);
3036
+ }
3037
+ getAlertConfirmChangeEmitter() {
3038
+ return this.confirmed;
3039
+ }
3040
+ }
3041
+ AlertService.ɵprov = ɵɵdefineInjectable({ factory: function AlertService_Factory() { return new AlertService(ɵɵinject(Router)); }, token: AlertService, providedIn: "root" });
3042
+ AlertService.decorators = [
3043
+ { type: Injectable, args: [{ providedIn: 'root' },] }
3044
+ ];
3045
+ AlertService.ctorParameters = () => [
3046
+ { type: Router }
3047
+ ];
3048
+
3049
+ /*
3050
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3051
+ *
3052
+ * Licensed under EUPL, Version 1.2 (the "License");
3053
+ * you may not use this file except in compliance with the License.
3054
+ * You may obtain a copy of the License at
3055
+ *
3056
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3057
+ *
3058
+ * Unless required by applicable law or agreed to in writing, software
3059
+ * distributed under the License is distributed on an "AS IS" basis,
3060
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3061
+ * See the License for the specific language governing permissions and
3062
+ * limitations under the License.
3063
+ */
3064
+ class AlertComponent {
3065
+ constructor(alertService) {
3066
+ this.alertService = alertService;
3067
+ this.alerts = [];
3068
+ this.autoCloseInMS = 5000;
3069
+ }
3070
+ ngOnInit() {
3071
+ }
3072
+ ngAfterContentInit() {
3073
+ this.subscription = this.alertService.onAlert()
3074
+ .subscribe(alert => {
3075
+ if (!alert.message) {
3076
+ // clear alerts when an empty alert is received
3077
+ this.alerts = [];
3078
+ return;
3079
+ }
3080
+ // set empty array when an empty alert confirmations is received
3081
+ if (!alert.confirmations) {
3082
+ alert.confirmations = [];
3083
+ }
3084
+ // add alert to array if not exist
3085
+ const alertExist = this.alerts.filter(x => x.message === alert.message);
3086
+ if (alertExist.length === 0) {
3087
+ this.alerts.push(alert);
3088
+ }
3089
+ if (this.inModal(alert)) {
3090
+ setTimeout(() => {
3091
+ this.openModal();
3092
+ }, 300);
3093
+ }
3094
+ // auto close except alert confirmations not empty
3095
+ if (this.autoCloseInMS > 0 && alert.confirmations.length === 0) {
3096
+ setTimeout(() => {
3097
+ this.removeAlert(alert);
3098
+ }, this.autoCloseInMS);
3099
+ }
3100
+ });
3101
+ }
3102
+ closeModal() {
3103
+ $('#modalNotification').modal('hide');
3104
+ }
3105
+ openModal() {
3106
+ $('#modalNotification').modal('show');
3107
+ }
3108
+ alertConfirm(alert, confirm) {
3109
+ alert.confirm = confirm;
3110
+ this.alertService.emitAlertConfirmEvent(alert);
3111
+ this.removeAlert(alert);
3112
+ }
3113
+ ngOnDestroy() {
3114
+ // unsubscribe to avoid memory leaks
3115
+ this.subscription.unsubscribe();
3116
+ }
3117
+ removeAlert(alert) {
3118
+ if (this.inModal(alert)) {
3119
+ this.closeModal();
3120
+ }
3121
+ // remove specified alert from array
3122
+ this.alerts = this.alerts.filter(x => x.message !== alert.message);
3123
+ }
3124
+ inModal(alert) {
3125
+ if (!alert) {
3126
+ return;
3127
+ }
3128
+ // return true based on AlertType.ModalNotification
3129
+ switch (alert.type) {
3130
+ case AlertType.ModalNotification:
3131
+ return true;
3132
+ default:
3133
+ return false;
3134
+ }
3135
+ }
3136
+ cssClass(alert) {
3137
+ if (!alert) {
3138
+ return;
3139
+ }
3140
+ // return css class based on alert type
3141
+ switch (alert.type) {
3142
+ case AlertType.Success:
3143
+ return 'alert alert-success';
3144
+ case AlertType.Error:
3145
+ return 'alert alert-danger';
3146
+ case AlertType.Info:
3147
+ return 'alert alert-info';
3148
+ case AlertType.Warning:
3149
+ return 'alert alert-warning';
3150
+ case AlertType.Notification:
3151
+ return 'alert alert-light';
3152
+ case AlertType.ModalNotification:
3153
+ return 'alert alert-light';
3154
+ }
3155
+ }
3156
+ cssIconClass(alert) {
3157
+ if (!alert) {
3158
+ return;
3159
+ }
3160
+ // return css class based on alert type
3161
+ switch (alert.type) {
3162
+ case AlertType.Success:
3163
+ return 'mdi mdi-check';
3164
+ case AlertType.Error:
3165
+ return 'mdi mdi-close-circle-o';
3166
+ case AlertType.Info:
3167
+ return 'mdi mdi-info-outline';
3168
+ case AlertType.Warning:
3169
+ return 'mdi mdi-alert-triangle';
3170
+ case AlertType.Notification:
3171
+ return 'mdi mdi-notifications';
3172
+ case AlertType.ModalNotification:
3173
+ return 'mdi mdi-notifications';
3174
+ }
3175
+ }
3176
+ }
3177
+ AlertComponent.decorators = [
3178
+ { type: Component, args: [{
3179
+ selector: 'valtimo-alert',
3180
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div *ngFor=\"let alert of alerts\" class=\"{{cssClass(alert)}} rounded-0 m-0 alert-dismissable\">\n\n <div *ngIf=\"inModal(alert)\">\n <!-- Modal -->\n <div class=\"modal fade\" id=\"modalNotification\" tabindex=\"-1\" role=\"dialog\">\n <div class=\"modal-dialog\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-body p-0\">\n <button class=\"close\" type=\"button\" (click)=\"removeAlert(alert)\"><span class=\"mdi mdi-close\" aria-hidden=\"true\"></span></button>\n <div class=\"icon\"><span class=\"{{ alert.iconClass || cssIconClass(alert) }}\"></span></div>\n <div class=\"message\">\n <div [innerHTML]=\"alert.message\"></div>\n </div>\n </div>\n <div class=\"modal-footer pt-0\" *ngIf=\"alert.confirmations?.length\">\n <button class=\"{{ confirmation.class }} mr-2\"\n *ngFor=\"let confirmation of alert.confirmations\"\n (click)=\"alertConfirm(alert, confirmation.value)\">{{ confirmation.label }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf=\"!inModal(alert)\" class=\"alert-block\">\n <div class=\"icon\"><span class=\"{{ alert.iconClass || cssIconClass(alert) }}\"></span></div>\n <div class=\"message\">\n <div [innerHTML]=\"alert.message\"></div>\n <div class=\"mt-3\" *ngIf=\"alert.confirmations?.length\">\n <button class=\"{{ confirmation.class }} mr-2\"\n *ngFor=\"let confirmation of alert.confirmations\"\n (click)=\"alertConfirm(alert, confirmation.value)\">{{ confirmation.label }}</button>\n </div>\n </div>\n <button class=\"close\" type=\"button\" (click)=\"removeAlert(alert)\"><span class=\"mdi mdi-close\" aria-hidden=\"true\"></span></button>\n </div>\n</div>\n",
3181
+ styles: [".alert-block{display:flex;flex-direction:row;justify-content:space-between}.alert-block .message{width:100%}.alert-block .icon{align-items:center;display:flex}.alert .message{font-size:1.1rem!important;line-height:1.5rem!important;padding:2rem 5rem 2rem 2rem!important}.alert .close{color:#fff!important;opacity:1!important;padding:2rem 2rem 0 0!important;right:0!important}.alert .icon{padding-left:2rem!important}.alert-warning{color:#404040!important}.alert-light .close,.alert-warning .close{color:#404040!important;opacity:1!important}"]
3182
+ },] }
3183
+ ];
3184
+ AlertComponent.ctorParameters = () => [
3185
+ { type: AlertService }
3186
+ ];
3187
+
3188
+ /*
3189
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3190
+ *
3191
+ * Licensed under EUPL, Version 1.2 (the "License");
3192
+ * you may not use this file except in compliance with the License.
3193
+ * You may obtain a copy of the License at
3194
+ *
3195
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3196
+ *
3197
+ * Unless required by applicable law or agreed to in writing, software
3198
+ * distributed under the License is distributed on an "AS IS" basis,
3199
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3200
+ * See the License for the specific language governing permissions and
3201
+ * limitations under the License.
3202
+ */
3203
+ class AlertModule {
3204
+ }
3205
+ AlertModule.decorators = [
3206
+ { type: NgModule, args: [{
3207
+ imports: [CommonModule],
3208
+ declarations: [AlertComponent],
3209
+ exports: [AlertComponent]
3210
+ },] }
3211
+ ];
3212
+
3213
+ /*
3214
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3215
+ *
3216
+ * Licensed under EUPL, Version 1.2 (the "License");
3217
+ * you may not use this file except in compliance with the License.
3218
+ * You may obtain a copy of the License at
3219
+ *
3220
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3221
+ *
3222
+ * Unless required by applicable law or agreed to in writing, software
3223
+ * distributed under the License is distributed on an "AS IS" basis,
3224
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3225
+ * See the License for the specific language governing permissions and
3226
+ * limitations under the License.
3227
+ */
3228
+ class DataListComponent {
3229
+ constructor() { }
3230
+ ngOnInit() {
3231
+ }
3232
+ }
3233
+ DataListComponent.decorators = [
3234
+ { type: Component, args: [{
3235
+ selector: 'valtimo-data-list',
3236
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div *ngIf=\"collection\">\n <dl class=\"row mb-0\" *ngFor=\"let item of collection\">\n <dd class=\"col-12 col-md-4 col-lg-3\">{{ item.label }}</dd>\n <dt class=\"col-12 col-md-8 col-lg-9\" [innerHTML]=\"item.value || '-'\"></dt>\n </dl>\n</div>\n\n<div *ngIf=\"object\">\n <dl class=\"row mb-0\" *ngFor=\"let item of object | keyvalue\">\n <dd class=\"col-12 col-md-4 col-lg-3\">{{ item.key }}</dd>\n <dt class=\"col-12 col-md-8 col-lg-9\" [innerHTML]=\"item.value || '-'\"></dt>\n </dl>\n</div>\n",
3237
+ styles: [""]
3238
+ },] }
3239
+ ];
3240
+ DataListComponent.ctorParameters = () => [];
3241
+ DataListComponent.propDecorators = {
3242
+ collection: [{ type: Input }],
3243
+ object: [{ type: Input }]
3244
+ };
3245
+
3246
+ /*
3247
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3248
+ *
3249
+ * Licensed under EUPL, Version 1.2 (the "License");
3250
+ * you may not use this file except in compliance with the License.
3251
+ * You may obtain a copy of the License at
3252
+ *
3253
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3254
+ *
3255
+ * Unless required by applicable law or agreed to in writing, software
3256
+ * distributed under the License is distributed on an "AS IS" basis,
3257
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3258
+ * See the License for the specific language governing permissions and
3259
+ * limitations under the License.
3260
+ */
3261
+ class DataListModule {
3262
+ }
3263
+ DataListModule.decorators = [
3264
+ { type: NgModule, args: [{
3265
+ declarations: [DataListComponent],
3266
+ imports: [
3267
+ CommonModule
3268
+ ],
3269
+ exports: [DataListComponent]
3270
+ },] }
3271
+ ];
3272
+
3273
+ class FormIoStateService {
3274
+ constructor() {
3275
+ this._documentDefinitionName$ = new BehaviorSubject(undefined);
3276
+ this._currentForm$ = new BehaviorSubject(undefined);
3277
+ }
3278
+ get documentDefinitionName$() {
3279
+ return this._documentDefinitionName$.asObservable();
3280
+ }
3281
+ setDocumentDefinitionName(documentDefinitionName) {
3282
+ this._documentDefinitionName$.next(documentDefinitionName);
3283
+ }
3284
+ get currentForm$() {
3285
+ return this._currentForm$.asObservable();
3286
+ }
3287
+ set currentForm(form) {
3288
+ this._currentForm$.next(form);
3289
+ }
3290
+ }
3291
+ FormIoStateService.decorators = [
3292
+ { type: Injectable }
3293
+ ];
3294
+
3295
+ /*
3296
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3297
+ *
3298
+ * Licensed under EUPL, Version 1.2 (the "License");
3299
+ * you may not use this file except in compliance with the License.
3300
+ * You may obtain a copy of the License at
3301
+ *
3302
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3303
+ *
3304
+ * Unless required by applicable law or agreed to in writing, software
3305
+ * distributed under the License is distributed on an "AS IS" basis,
3306
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3307
+ * See the License for the specific language governing permissions and
3308
+ * limitations under the License.
3309
+ */
3310
+ class FormioComponent {
3311
+ constructor(userProviderService, logger, stateService, route) {
3312
+ this.userProviderService = userProviderService;
3313
+ this.logger = logger;
3314
+ this.stateService = stateService;
3315
+ this.route = route;
3316
+ this.submission = {};
3317
+ this.useFormRefresh = false;
3318
+ this.submit = new EventEmitter();
3319
+ this.change = new EventEmitter();
3320
+ this.refreshForm = new EventEmitter();
3321
+ this.errors = [];
3322
+ }
3323
+ ngOnInit() {
3324
+ const documentDefinitionName = this.route.snapshot.paramMap.get('documentDefinitionName');
3325
+ const formDefinition = this.form;
3326
+ this.loadUserLanguageSetting();
3327
+ this.formDefinition = formDefinition;
3328
+ this.errors = [];
3329
+ if (this.formHasLegacyUpload(formDefinition)) {
3330
+ this.setInitialToken();
3331
+ }
3332
+ if (documentDefinitionName) {
3333
+ this.stateService.setDocumentDefinitionName(documentDefinitionName);
3334
+ }
3335
+ this.subscribeFormRefresh();
3336
+ }
3337
+ ngOnChanges(changes) {
3338
+ const currentForm = changes.form.currentValue;
3339
+ this.formDefinition = currentForm;
3340
+ this.loadUserLanguageSetting();
3341
+ this.reloadForm();
3342
+ if (this.formHasLegacyUpload(currentForm)) {
3343
+ this.setInitialToken();
3344
+ }
3345
+ if (changes.formDefinitionRefresh$) {
3346
+ this.unsubscribeFormRefresh();
3347
+ this.subscribeFormRefresh();
3348
+ }
3349
+ }
3350
+ ngOnDestroy() {
3351
+ this.unsubscribeFormRefresh();
3352
+ if (this.tokenRefreshTimerSubscription) {
3353
+ this.tokenRefreshTimerSubscription.unsubscribe();
3354
+ }
3355
+ }
3356
+ loadUserLanguageSetting() {
3357
+ this.language = localStorage.getItem('langKey') || '';
3358
+ }
3359
+ reloadForm() {
3360
+ this.refreshForm.emit({
3361
+ form: this.formDefinition
3362
+ });
3363
+ }
3364
+ showErrors(errors) {
3365
+ this.errors = errors;
3366
+ }
3367
+ onSubmit(submission) {
3368
+ this.errors = [];
3369
+ this.submit.emit(submission);
3370
+ }
3371
+ formReady(form) {
3372
+ this.reloadForm();
3373
+ this.stateService.currentForm = form;
3374
+ }
3375
+ onChange(object) {
3376
+ this.change.emit(object);
3377
+ }
3378
+ formHasLegacyUpload(formDefinition) {
3379
+ const stringifiedFormDefinition = JSON.stringify(formDefinition);
3380
+ const legacyUploadString = '"type":"file"';
3381
+ return stringifiedFormDefinition.includes(legacyUploadString);
3382
+ }
3383
+ setInitialToken() {
3384
+ this.userProviderService.getToken().then((token) => {
3385
+ this.setToken(token);
3386
+ });
3387
+ }
3388
+ setToken(token) {
3389
+ Formio.setToken(token);
3390
+ this.setTimerForTokenRefresh(token);
3391
+ this.logger.debug('New token set for form.io.');
3392
+ }
3393
+ setTimerForTokenRefresh(token) {
3394
+ const tokenExp = jwt_decode(token).exp * 1000;
3395
+ const expiryTime = tokenExp - Date.now() - 1000;
3396
+ this.tokenRefreshTimerSubscription = timer(expiryTime).subscribe(() => {
3397
+ this.refreshToken();
3398
+ });
3399
+ this.logger.debug(`Timer for form.io token refresh set for: ${expiryTime}ms.`);
3400
+ }
3401
+ refreshToken() {
3402
+ from(this.userProviderService.updateToken(-1))
3403
+ .pipe(switchMap(() => this.userProviderService.getToken()), take(1))
3404
+ .subscribe(token => {
3405
+ this.setToken(token);
3406
+ });
3407
+ }
3408
+ subscribeFormRefresh() {
3409
+ if (this.formRefresh$) {
3410
+ this.formRefreshSubscription = this.formRefresh$.subscribe((refreshValue) => {
3411
+ if (refreshValue) {
3412
+ this.refreshForm.emit(refreshValue);
3413
+ }
3414
+ });
3415
+ }
3416
+ }
3417
+ unsubscribeFormRefresh() {
3418
+ if (this.formRefreshSubscription) {
3419
+ this.formRefreshSubscription.unsubscribe();
3420
+ }
3421
+ }
3422
+ }
3423
+ FormioComponent.decorators = [
3424
+ { type: Component, args: [{
3425
+ selector: 'valtimo-form-io',
3426
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div>\n <div *ngIf=\"errors.length > 0\" class=\"alert alert-danger pt-5 pb-5 mb-2\">\n <ol>\n <li *ngFor=\"let error of errors\">\n {{error}}\n </li>\n </ol>\n </div>\n <formio [submission]=\"submission\"\n [form]=\"formDefinition\"\n [refresh]=\"useFormRefresh && refreshForm\"\n [options]=\"options\"\n [language]=\"language\"\n (submit)=\"onSubmit($event)\"\n (ready)=\"formReady($event)\"\n (change)=\"onChange($event)\"\n >\n </formio>\n</div>\n",
3427
+ styles: [""]
3428
+ },] }
3429
+ ];
3430
+ FormioComponent.ctorParameters = () => [
3431
+ { type: UserProviderService },
3432
+ { type: NGXLogger },
3433
+ { type: FormIoStateService },
3434
+ { type: ActivatedRoute }
3435
+ ];
3436
+ FormioComponent.propDecorators = {
3437
+ form: [{ type: Input }],
3438
+ options: [{ type: Input }],
3439
+ submission: [{ type: Input }],
3440
+ formRefresh$: [{ type: Input }],
3441
+ useFormRefresh: [{ type: Input }],
3442
+ submit: [{ type: Output }],
3443
+ change: [{ type: Output }]
3444
+ };
3445
+
3446
+ /*
3447
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3448
+ *
3449
+ * Licensed under EUPL, Version 1.2 (the "License");
3450
+ * you may not use this file except in compliance with the License.
3451
+ * You may obtain a copy of the License at
3452
+ *
3453
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3454
+ *
3455
+ * Unless required by applicable law or agreed to in writing, software
3456
+ * distributed under the License is distributed on an "AS IS" basis,
3457
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3458
+ * See the License for the specific language governing permissions and
3459
+ * limitations under the License.
3460
+ */
3461
+ class FormioBuilderComponent {
3462
+ constructor() {
3463
+ this.change = new EventEmitter();
3464
+ }
3465
+ ngOnInit() {
3466
+ }
3467
+ onChange(event) {
3468
+ this.change.emit(event);
3469
+ }
3470
+ }
3471
+ FormioBuilderComponent.decorators = [
3472
+ { type: Component, args: [{
3473
+ selector: 'valtimo-form-io-builder',
3474
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div>\n <form-builder [form]=\"form\" (change)=\"onChange($event)\" ></form-builder>\n</div>\n",
3475
+ styles: [""]
3476
+ },] }
3477
+ ];
3478
+ FormioBuilderComponent.ctorParameters = () => [];
3479
+ FormioBuilderComponent.propDecorators = {
3480
+ form: [{ type: Input }],
3481
+ change: [{ type: Output }]
3482
+ };
3483
+
3484
+ /*
3485
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3486
+ *
3487
+ * Licensed under EUPL, Version 1.2 (the "License");
3488
+ * you may not use this file except in compliance with the License.
3489
+ * You may obtain a copy of the License at
3490
+ *
3491
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3492
+ *
3493
+ * Unless required by applicable law or agreed to in writing, software
3494
+ * distributed under the License is distributed on an "AS IS" basis,
3495
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3496
+ * See the License for the specific language governing permissions and
3497
+ * limitations under the License.
3498
+ */
3499
+ const AppConfig = {
3500
+ appUrl: 'http://localhost:4200',
3501
+ apiUrl: 'http://localhost:4200',
3502
+ icons: 'fontawesome',
3503
+ formOnly: false
3504
+ };
3505
+
3506
+ class FormIoDomService {
3507
+ constructor(stateService) {
3508
+ this.stateService = stateService;
3509
+ }
3510
+ toggleSubmitButton(disabled) {
3511
+ this.stateService.currentForm$.pipe(take(1)).subscribe((form) => {
3512
+ const button = form.formioElement.nativeElement
3513
+ .getElementsByClassName('formio-component-submit')[0]
3514
+ .getElementsByClassName('btn-primary')[0];
3515
+ button.disabled = disabled;
3516
+ });
3517
+ }
3518
+ }
3519
+ FormIoDomService.decorators = [
3520
+ { type: Injectable }
3521
+ ];
3522
+ FormIoDomService.ctorParameters = () => [
3523
+ { type: FormIoStateService }
3524
+ ];
3525
+
3526
+ class FormIoUploaderComponent {
3527
+ constructor(uploadProviderService, stateService, domService, downloadService) {
3528
+ this.uploadProviderService = uploadProviderService;
3529
+ this.stateService = stateService;
3530
+ this.domService = domService;
3531
+ this.downloadService = downloadService;
3532
+ this.valueChange = new EventEmitter();
3533
+ this.uploading$ = new BehaviorSubject(false);
3534
+ this._value = [];
3535
+ }
3536
+ get value() {
3537
+ return this._value;
3538
+ }
3539
+ set value(value) {
3540
+ if (Array.isArray(value)) {
3541
+ this._value = value;
3542
+ }
3543
+ }
3544
+ downloadFile(resourceFile) {
3545
+ this.uploadProviderService.getResource(resourceFile.data.resourceId).subscribe((resource) => {
3546
+ this.downloadService.downloadFile(resource.url, resource.resource.name);
3547
+ });
3548
+ }
3549
+ fileSelected(file) {
3550
+ this.domService.toggleSubmitButton(true);
3551
+ this.uploading$.next(true);
3552
+ this.stateService.documentDefinitionName$.pipe(take(1)).subscribe((name) => {
3553
+ this.uploadProviderService.uploadFile(file, name).subscribe((result) => {
3554
+ this.domService.toggleSubmitButton(false);
3555
+ this.uploading$.next(false);
3556
+ this._value.push(result);
3557
+ this.valueChange.emit(this._value);
3558
+ });
3559
+ });
3560
+ }
3561
+ deleteFile(resourceId) {
3562
+ this.domService.toggleSubmitButton(true);
3563
+ this._value = this._value.filter((file) => { var _a; return (file === null || file === void 0 ? void 0 : file.data) ? ((_a = file === null || file === void 0 ? void 0 : file.data) === null || _a === void 0 ? void 0 : _a.resourceId) !== resourceId : true; });
3564
+ this.valueChange.emit(this._value);
3565
+ }
3566
+ }
3567
+ FormIoUploaderComponent.decorators = [
3568
+ { type: Component, args: [{
3569
+ selector: 'valtimo-formio-uploader',
3570
+ template: "<valtimo-dropzone\n (fileSelected)=\"fileSelected($event)\"\n [acceptedFiles]=\"null\"\n [disabled]=\"disabled\"\n [hideFilePreview]=\"true\"\n [hideTitle]=\"hideTitle\"\n [maxFileSize]=\"maxFileSize\"\n [showMaxFileSize]=\"!hideMaxFileSize\"\n [subtitle]=\"subtitle\"\n [title]=\"title\"\n [camera]=\"camera\"\n [uploading]=\"uploading$ | async\"\n></valtimo-dropzone>\n\n<div class=\"file-preview\" *ngFor=\"let resource of _value\">\n <div class=\"file-preview-name\">\n <a href=\"#\" (click)=\"downloadFile(resource)\">\n {{resource.originalName}}\n </a>\n </div>\n <div class=\"file-preview-size\">\n <span>\n {{resource.size | filesize}}\n </span>\n </div>\n <div class=\"file-preview-delete\" *ngIf=\"!disabled\">\n <a (click)=\"deleteFile(resource.data.resourceId)\">\n <i class=\"icon fa fa-trash\"></i>\n </a>\n </div>\n</div>\n",
3571
+ styles: [".progress-bar-container{padding:15px 20px}::ng-deep .formio-component-valtimo-file .btn-secondary,::ng-deep .formio-component-valtimo-file .formio-button-add-another{display:none}::ng-deep .formio-component-valtimo-file td{border:none;padding:0!important}::ng-deep .formio-component-valtimo-file .table{border:none;border-collapse:collapse;margin:10px 0}.dropzone-container{margin-bottom:12px}.file-preview{border:1px solid #dee2e6;display:flex;margin-top:-1px}.file-preview div{padding:12px 10px}.file-preview .file-preview-name{width:65%}.file-preview .file-preview-size{width:35%}.file-preview .icon{color:#a1a1a1;cursor:pointer;font-size:1.3846rem;line-height:18px}.file-preview .icon:hover{color:grey}"]
3572
+ },] }
3573
+ ];
3574
+ FormIoUploaderComponent.ctorParameters = () => [
3575
+ { type: UploadProviderService },
3576
+ { type: FormIoStateService },
3577
+ { type: FormIoDomService },
3578
+ { type: DownloadService }
3579
+ ];
3580
+ FormIoUploaderComponent.propDecorators = {
3581
+ disabled: [{ type: Input }],
3582
+ title: [{ type: Input }],
3583
+ hideTitle: [{ type: Input }],
3584
+ subtitle: [{ type: Input }],
3585
+ maxFileSize: [{ type: Input }],
3586
+ hideMaxFileSize: [{ type: Input }],
3587
+ camera: [{ type: Input }],
3588
+ valueChange: [{ type: Output }],
3589
+ value: [{ type: Input }]
3590
+ };
3591
+
3592
+ /*
3593
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3594
+ *
3595
+ * Licensed under EUPL, Version 1.2 (the "License");
3596
+ * you may not use this file except in compliance with the License.
3597
+ * You may obtain a copy of the License at
3598
+ *
3599
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3600
+ *
3601
+ * Unless required by applicable law or agreed to in writing, software
3602
+ * distributed under the License is distributed on an "AS IS" basis,
3603
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3604
+ * See the License for the specific language governing permissions and
3605
+ * limitations under the License.
3606
+ */
3607
+ class DropzoneComponent {
3608
+ constructor(translateService) {
3609
+ this.translateService = translateService;
3610
+ this.externalError$ = new BehaviorSubject('');
3611
+ this.maxFileSize = 5;
3612
+ this.showMaxFileSize = true;
3613
+ this.acceptedFiles = '.json';
3614
+ this.clear$ = new Subject();
3615
+ this.camera = false;
3616
+ this.fileSelected = new EventEmitter();
3617
+ this.file$ = new BehaviorSubject(undefined);
3618
+ this.showingCamera$ = new BehaviorSubject(false);
3619
+ this.error$ = new BehaviorSubject('');
3620
+ this.errorMessagesStrings = {
3621
+ tooBig: 'too big',
3622
+ wrongType: 'this type'
3623
+ };
3624
+ this.errorMessage$ = combineLatest([
3625
+ this.error$,
3626
+ this.translateService.stream('dropzone.error.generic'),
3627
+ this.translateService.stream('dropzone.error.tooBig'),
3628
+ this.translateService.stream('dropzone.error.wrongType')
3629
+ ]).pipe(map(([dropzoneError, generic, tooBig, wrongType]) => {
3630
+ const strings = this.errorMessagesStrings;
3631
+ if (dropzoneError) {
3632
+ if (dropzoneError.includes(strings.tooBig)) {
3633
+ return tooBig;
3634
+ }
3635
+ else if (dropzoneError.includes(strings.wrongType)) {
3636
+ return wrongType;
3637
+ }
3638
+ else {
3639
+ return generic;
3640
+ }
3641
+ }
3642
+ else {
3643
+ return '';
3644
+ }
3645
+ }));
3646
+ }
3647
+ ngOnInit() {
3648
+ this.clearSubscription = this.clear$.subscribe(() => {
3649
+ this.clearFile();
3650
+ this.clearError();
3651
+ });
3652
+ }
3653
+ ngAfterViewInit() {
3654
+ this.initDropzone();
3655
+ }
3656
+ ngOnDestroy() {
3657
+ this.clearSubscription.unsubscribe();
3658
+ }
3659
+ showCamera() {
3660
+ this.showingCamera$.next(true);
3661
+ }
3662
+ webcamImageSaved(image) {
3663
+ if (image) {
3664
+ this.setFile(image);
3665
+ }
3666
+ this.showingCamera$.next(false);
3667
+ }
3668
+ initDropzone() {
3669
+ this.dropzone = new Dropzone(this.dropzoneRef.nativeElement, {
3670
+ url: '/',
3671
+ maxFilesize: this.maxFileSize,
3672
+ clickable: this.dropzoneRef.nativeElement,
3673
+ autoProcessQueue: false,
3674
+ createImageThumbnails: false,
3675
+ acceptedFiles: this.acceptedFiles,
3676
+ previewTemplate: `<p style='display:none'></p>`,
3677
+ accept: file => {
3678
+ this.dropzone.removeAllFiles();
3679
+ this.setFile(file);
3680
+ }
3681
+ });
3682
+ this.setDropzoneEvents();
3683
+ }
3684
+ setDropzoneEvents() {
3685
+ this.dropzone.on('error', (file, message) => {
3686
+ this.clearFile();
3687
+ this.error$.next(message.toString());
3688
+ this.fileSelected.emit();
3689
+ });
3690
+ }
3691
+ clearFile() {
3692
+ this.file$.next(undefined);
3693
+ }
3694
+ clearError() {
3695
+ this.error$.next('');
3696
+ }
3697
+ setFile(file) {
3698
+ this.file$.next(file);
3699
+ this.clearError();
3700
+ this.fileSelected.emit(file);
3701
+ }
3702
+ }
3703
+ DropzoneComponent.decorators = [
3704
+ { type: Component, args: [{
3705
+ selector: 'valtimo-dropzone',
3706
+ template: "<form #dropzone [ngClass]=\"{ disabled: disabled || uploading}\" class=\"dropzone dz-clickable\">\n <div class=\"dz-message\">\n <div class=\"icon\"><span class=\"mdi mdi-cloud-upload\"></span></div>\n <ng-container *ngTemplateOutlet=\"body\"></ng-container>\n <ng-container *ngIf=\"uploading\">\n <ng-container *ngTemplateOutlet=\"progressBar\"></ng-container>\n </ng-container>\n <div class=\"dropzone-mobile-trigger needsclick\"></div>\n </div>\n <button (click)=\"showCamera()\" *ngIf=\"camera\" type=\"button\" class=\"btn btn-primary px-3 webcam-button\"><i class=\"fa fa-camera\" aria-hidden=\"true\"></i></button>\n <ng-container *ngIf=\"showingCamera$ | async\">\n <ng-container *ngTemplateOutlet=\"webcam\"></ng-container>\n </ng-container>\n</form>\n\n<ng-template #body>\n <h2 *ngIf=\"!hideTitle\" class=\"mb-4 mt-2\">{{ title || ('dropzone.drop' | translate) }}</h2>\n <span *ngIf=\"subtitle\" class=\"note mb-3\">{{ subtitle }}</span>\n <span *ngIf=\" showMaxFileSize\" class=\"note mb-3 small-font\"\n >{{ 'dropzone.maxFileSize' | translate }}<b>{{ maxFileSize }}mb</b></span\n >\n <ng-container *ngTemplateOutlet=\"preview\"></ng-container>\n</ng-template>\n\n<ng-template #preview>\n <ng-container\n *ngIf=\"{ errorMessage: errorMessage$ | async, externalError: externalError$ | async, file: file$ | async } as obs\"\n >\n <ng-container *ngIf=\"obs.externalError || obs.errorMessage\">\n <div class=\"alert alert-danger mt-2 mb-0\">\n <div class=\"message\">\n {{ obs.externalError || obs.errorMessage }}\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!hideFilePreview && (obs.file && !obs.externalError && !obs.errorMessage)\">\n <div class=\"file\">\n <i class=\"icon mdi mdi-file-text mr-2\"></i>\n <span class=\"note\">{{ obs.file.name }}</span>\n <span class=\"note file-size\">- {{ obs.file.size | filesize: 2}}</span>\n </div>\n </ng-container>\n </ng-container>\n</ng-template>\n\n<ng-template #progressBar>\n <div class=\"progress-bar-container\">\n <valtimo-progress-bar></valtimo-progress-bar>\n </div>\n</ng-template>\n\n<ng-template #webcam>\n <valtimo-webcam (imageSaved)=\"webcamImageSaved($event)\"></valtimo-webcam>\n</ng-template>\n\n",
3707
+ styles: ["form.dropzone{padding:30px 20px}form.dropzone h2{font-size:2rem;text-align:center}form.dropzone.disabled{cursor:default;opacity:.7;pointer-events:none}form.dropzone.preview{border:none;padding:15px 20px}.dz-message{align-items:center;display:flex;flex-direction:column}.dropzone-mobile-trigger{cursor:pointer}.alert-light{align-items:center;display:flex}form.dropzone .mdi{background-color:transparent;border-radius:0;display:inline-block;height:auto;margin-bottom:0;padding:0;width:auto}form.dropzone .message{padding:1.385rem 2.1542rem}.file{align-items:center;display:flex;flex-direction:row;font-size:1.5rem}.small-font{color:#959595;font-size:1rem}.file-size{margin-left:5px}.progress-bar-container{bottom:0;height:auto;position:absolute;width:100%}.webcam-button{position:absolute;right:10px;top:10px}"]
3708
+ },] }
3709
+ ];
3710
+ DropzoneComponent.ctorParameters = () => [
3711
+ { type: TranslateService }
3712
+ ];
3713
+ DropzoneComponent.propDecorators = {
3714
+ dropzoneRef: [{ type: ViewChild, args: ['dropzone',] }],
3715
+ title: [{ type: Input }],
3716
+ hideTitle: [{ type: Input }],
3717
+ subtitle: [{ type: Input }],
3718
+ externalError$: [{ type: Input }],
3719
+ maxFileSize: [{ type: Input }],
3720
+ showMaxFileSize: [{ type: Input }],
3721
+ acceptedFiles: [{ type: Input }],
3722
+ clear$: [{ type: Input }],
3723
+ disabled: [{ type: Input }],
3724
+ hideFilePreview: [{ type: Input }],
3725
+ uploading: [{ type: Input }],
3726
+ camera: [{ type: Input }],
3727
+ fileSelected: [{ type: Output }]
3728
+ };
3729
+
3730
+ /*
3731
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3732
+ *
3733
+ * Licensed under EUPL, Version 1.2 (the "License");
3734
+ * you may not use this file except in compliance with the License.
3735
+ * You may obtain a copy of the License at
3736
+ *
3737
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3738
+ *
3739
+ * Unless required by applicable law or agreed to in writing, software
3740
+ * distributed under the License is distributed on an "AS IS" basis,
3741
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3742
+ * See the License for the specific language governing permissions and
3743
+ * limitations under the License.
3744
+ */
3745
+ class ProgressBarComponent {
3746
+ }
3747
+ ProgressBarComponent.decorators = [
3748
+ { type: Component, args: [{
3749
+ selector: 'valtimo-progress-bar',
3750
+ template: "<div class=\"progress\" style=\"position: relative;\">\n <div class=\"progress-bar progress-bar-striped indeterminate\">\n </div>\n</div>\n",
3751
+ styles: [".progress-bar.indeterminate{-webkit-animation:progress-indeterminate 3s linear infinite;animation:progress-indeterminate 3s linear infinite;position:relative}@-webkit-keyframes progress-indeterminate{0%{left:-25%;width:25%}to{left:100%;width:25%}}@keyframes progress-indeterminate{0%{left:-25%;width:25%}to{left:100%;width:25%}}"]
3752
+ },] }
3753
+ ];
3754
+
3755
+ /*
3756
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3757
+ *
3758
+ * Licensed under EUPL, Version 1.2 (the "License");
3759
+ * you may not use this file except in compliance with the License.
3760
+ * You may obtain a copy of the License at
3761
+ *
3762
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3763
+ *
3764
+ * Unless required by applicable law or agreed to in writing, software
3765
+ * distributed under the License is distributed on an "AS IS" basis,
3766
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3767
+ * See the License for the specific language governing permissions and
3768
+ * limitations under the License.
3769
+ */
3770
+ class ProgressBarModule {
3771
+ }
3772
+ ProgressBarModule.decorators = [
3773
+ { type: NgModule, args: [{
3774
+ declarations: [ProgressBarComponent],
3775
+ imports: [
3776
+ CommonModule,
3777
+ ],
3778
+ exports: [ProgressBarComponent]
3779
+ },] }
3780
+ ];
3781
+
3782
+ /*
3783
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3784
+ *
3785
+ * Licensed under EUPL, Version 1.2 (the "License");
3786
+ * you may not use this file except in compliance with the License.
3787
+ * You may obtain a copy of the License at
3788
+ *
3789
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3790
+ *
3791
+ * Unless required by applicable law or agreed to in writing, software
3792
+ * distributed under the License is distributed on an "AS IS" basis,
3793
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3794
+ * See the License for the specific language governing permissions and
3795
+ * limitations under the License.
3796
+ */
3797
+ class WebcamComponent {
3798
+ constructor() {
3799
+ this.imageSaved = new EventEmitter();
3800
+ this.showing$ = new BehaviorSubject(false);
3801
+ this.stream$ = new BehaviorSubject(undefined);
3802
+ this.picture$ = new BehaviorSubject(undefined);
3803
+ }
3804
+ ngAfterViewInit() {
3805
+ const video = this.getVideoElement();
3806
+ setTimeout(() => {
3807
+ this.toggleFade();
3808
+ });
3809
+ if (navigator.mediaDevices.getUserMedia) {
3810
+ navigator.mediaDevices.getUserMedia({ video: true })
3811
+ .then((stream) => {
3812
+ video.srcObject = stream;
3813
+ this.stream$.next(stream);
3814
+ });
3815
+ }
3816
+ }
3817
+ captureImage() {
3818
+ const video = this.getVideoElement();
3819
+ const canvas = document.querySelector('#canvas');
3820
+ canvas.width = 640;
3821
+ canvas.height = 480;
3822
+ const ctx = canvas.getContext('2d');
3823
+ ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
3824
+ const dataURI = canvas.toDataURL('image/jpeg');
3825
+ this.picture$.next({ file: this.dataURItoFile(dataURI), uri: dataURI });
3826
+ return false;
3827
+ }
3828
+ clearImage() {
3829
+ this.picture$.next(undefined);
3830
+ return false;
3831
+ }
3832
+ close(emitImage = true) {
3833
+ if (!emitImage) {
3834
+ this.clearImage();
3835
+ }
3836
+ this.toggleFade();
3837
+ this.emitOnTimeOut();
3838
+ return false;
3839
+ }
3840
+ stopStream() {
3841
+ this.stream$.pipe(take(1)).subscribe((mediaStream) => {
3842
+ if (mediaStream) {
3843
+ mediaStream.getTracks().forEach((stream) => stream.stop());
3844
+ }
3845
+ });
3846
+ }
3847
+ getVideoElement() {
3848
+ return document.querySelector('#videoElement');
3849
+ }
3850
+ emitOnTimeOut() {
3851
+ setTimeout(() => {
3852
+ var _a;
3853
+ this.stopStream();
3854
+ this.imageSaved.emit((_a = this.picture$.getValue()) === null || _a === void 0 ? void 0 : _a.file);
3855
+ }, 250);
3856
+ }
3857
+ toggleFade() {
3858
+ this.showing$.next(!this.showing$.getValue());
3859
+ }
3860
+ dataURItoFile(dataURI) {
3861
+ const binary = atob(dataURI.split(',')[1]);
3862
+ const array = [];
3863
+ for (let i = 0; i < binary.length; i++) {
3864
+ array.push(binary.charCodeAt(i));
3865
+ }
3866
+ const blob = new Blob([new Uint8Array(array)], { type: 'image/jpeg' });
3867
+ const imgFileName = `IMG_${new Date().toISOString().replace(/[-:.]/g, '')}.jpg`;
3868
+ return new File([blob], imgFileName);
3869
+ }
3870
+ }
3871
+ WebcamComponent.decorators = [
3872
+ { type: Component, args: [{
3873
+ selector: 'valtimo-webcam',
3874
+ template: "<div (click)=\"close(false)\" *ngIf=\"{picture: picture$ | async, stream: stream$ | async} as obs\"\n [ngClass]=\"{showing: showing$ | async}\"\n class=\"webcam-overlay\">\n <div (click)=\"false; $event.stopPropagation();\" class=\"inner-container\">\n <div class=\"webcam-container modal-content\">\n <div class=\"video-container\">\n <video autoplay=\"true\" id=\"videoElement\"></video>\n <canvas id=\"canvas\"></canvas>\n <img *ngIf=\"obs.picture?.uri\" [src]=\"obs.picture?.uri\"/>\n </div>\n <div class=\"button-container\">\n <div class=\"picture-btn\">\n <button (click)=\"captureImage()\" [disabled]=\"obs.picture?.file || !obs.stream\" class=\"btn btn-primary btn-lg\">\n <i\n class=\"fa fa-camera\"></i>{{'webcam.takePicture' | translate}}\n </button>\n </div>\n <div class=\"new-btn\">\n <button (click)=\"clearImage()\" [disabled]=\"!obs.picture?.file\" class=\"btn btn-primary\"><i\n class=\"fa fa-undo\"></i>{{'webcam.redo' | translate}}\n </button>\n </div>\n <div class=\"save-btn\">\n <button (click)=\"close()\" [disabled]=\"!obs.picture?.file\" class=\"btn btn-primary\"><i\n class=\"fa fa-save\"></i>{{'webcam.save' | translate}}</button>\n </div>\n </div>\n </div>\n <div class=\"modal-header\">\n <button (click)=\"close(false)\" aria-label=\"Close\" class=\"close\"><span>\u00D7</span></button>\n </div>\n </div>\n</div>\n",
3875
+ styles: [".webcam-overlay{align-items:center;background-color:rgba(0,0,0,.65);display:flex;height:100%;justify-content:center;left:0;opacity:0;position:fixed;top:0;transition:opacity .15s linear;width:100%;z-index:9999}.showing{opacity:1}.webcam-container{padding:20px}.button-container{align-items:center;display:flex;height:30px;justify-content:space-evenly;margin-bottom:10px;margin-top:20px}.button-container i{margin-right:5px}.new-btn,.picture-btn,.save-btn{display:flex;justify-content:center;position:absolute}.new-btn,.save-btn{width:calc(50% - 65px)}.picture-btn{left:0;width:100%}.new-btn{left:0}.save-btn{right:0}.modal-header{color:grey;margin-top:35px;padding:0;position:absolute;right:-18px;top:0}.close{color:grey}.inner-container{position:relative}.video-container{height:495px;overflow:hidden}.video-container img,.video-container video{height:495px;position:absolute;width:660px}.video-container img{-o-object-fit:cover;object-fit:cover}#canvas{display:none}"]
3876
+ },] }
3877
+ ];
3878
+ WebcamComponent.propDecorators = {
3879
+ imageSaved: [{ type: Output }]
3880
+ };
3881
+
3882
+ /*
3883
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3884
+ *
3885
+ * Licensed under EUPL, Version 1.2 (the "License");
3886
+ * you may not use this file except in compliance with the License.
3887
+ * You may obtain a copy of the License at
3888
+ *
3889
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3890
+ *
3891
+ * Unless required by applicable law or agreed to in writing, software
3892
+ * distributed under the License is distributed on an "AS IS" basis,
3893
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3894
+ * See the License for the specific language governing permissions and
3895
+ * limitations under the License.
3896
+ */
3897
+ class WebcamModule {
3898
+ }
3899
+ WebcamModule.decorators = [
3900
+ { type: NgModule, args: [{
3901
+ declarations: [WebcamComponent],
3902
+ imports: [
3903
+ CommonModule,
3904
+ TranslateModule
3905
+ ],
3906
+ exports: [WebcamComponent]
3907
+ },] }
3908
+ ];
3909
+
3910
+ /*
3911
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3912
+ *
3913
+ * Licensed under EUPL, Version 1.2 (the "License");
3914
+ * you may not use this file except in compliance with the License.
3915
+ * You may obtain a copy of the License at
3916
+ *
3917
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3918
+ *
3919
+ * Unless required by applicable law or agreed to in writing, software
3920
+ * distributed under the License is distributed on an "AS IS" basis,
3921
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3922
+ * See the License for the specific language governing permissions and
3923
+ * limitations under the License.
3924
+ */
3925
+ class DropzoneModule {
3926
+ }
3927
+ DropzoneModule.decorators = [
3928
+ { type: NgModule, args: [{
3929
+ declarations: [DropzoneComponent],
3930
+ imports: [CommonModule, TranslateModule, FileSizeModule, ProgressBarModule, WebcamModule],
3931
+ exports: [DropzoneComponent]
3932
+ },] }
3933
+ ];
3934
+
3935
+ /*
3936
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3937
+ *
3938
+ * Licensed under EUPL, Version 1.2 (the "License");
3939
+ * you may not use this file except in compliance with the License.
3940
+ * You may obtain a copy of the License at
3941
+ *
3942
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3943
+ *
3944
+ * Unless required by applicable law or agreed to in writing, software
3945
+ * distributed under the License is distributed on an "AS IS" basis,
3946
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3947
+ * See the License for the specific language governing permissions and
3948
+ * limitations under the License.
3949
+ */
3950
+ const ɵ0$1 = AppConfig;
3951
+ class FormIoModule {
3952
+ }
3953
+ FormIoModule.decorators = [
3954
+ { type: NgModule, args: [{
3955
+ imports: [
3956
+ CommonModule,
3957
+ FormioModule,
3958
+ DropzoneModule,
3959
+ TranslateModule,
3960
+ DocumentModule,
3961
+ FileSizeModule,
3962
+ ResourceModule,
3963
+ RouterModule
3964
+ ],
3965
+ declarations: [FormioComponent, FormioBuilderComponent, FormIoUploaderComponent],
3966
+ exports: [FormioComponent, FormioBuilderComponent, FormIoUploaderComponent],
3967
+ providers: [
3968
+ FormIoStateService,
3969
+ FormIoDomService,
3970
+ { provide: FormioAppConfig, useValue: ɵ0$1 }
3971
+ ],
3972
+ },] }
3973
+ ];
3974
+
3975
+ /*
3976
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3977
+ *
3978
+ * Licensed under EUPL, Version 1.2 (the "License");
3979
+ * you may not use this file except in compliance with the License.
3980
+ * You may obtain a copy of the License at
3981
+ *
3982
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
3983
+ *
3984
+ * Unless required by applicable law or agreed to in writing, software
3985
+ * distributed under the License is distributed on an "AS IS" basis,
3986
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3987
+ * See the License for the specific language governing permissions and
3988
+ * limitations under the License.
3989
+ */
3990
+ class ModalComponent {
3991
+ constructor() {
3992
+ this.title = '';
3993
+ this.subtitle = '';
3994
+ this.showFooter = false;
3995
+ }
3996
+ ngAfterViewInit() {
3997
+ $(`#${this.elementId}`).modal({ show: false });
3998
+ }
3999
+ show() {
4000
+ $(`#${this.elementId}`).modal('show');
4001
+ }
4002
+ hide() {
4003
+ $(`#${this.elementId}`).modal('hide');
4004
+ }
4005
+ }
4006
+ ModalComponent.decorators = [
4007
+ { type: Component, args: [{
4008
+ selector: 'valtimo-modal',
4009
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"modal fade custom-width\" [id]=\"elementId\" role=\"dialog\" aria-modal=\"true\">\n <div class=\"modal-dialog modal-lg\">\n <div class=\"modal-content\">\n <div class=\"modal-header modal-header-colored colored-header-grey\">\n <div class=\"modal-title\">\n <h4 class=\"title-text mb-2\">{{ title }}</h4>\n <h5 class=\"subtitle-text\">{{ subtitle }}</h5>\n <ng-container *ngIf=\"templateBelowSubtitle\">\n <ng-container *ngTemplateOutlet=\"templateBelowSubtitle\"></ng-container>\n </ng-container>\n </div>\n <div class=\"text-right\">\n <img src=\"assets/modal/header-image.png\" class=\"modal-header-image\" />\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n </div>\n <div class=\"modal-body\">\n <ng-content select=\"[body]\"></ng-content>\n </div>\n <div class=\"modal-footer\" *ngIf=\"showFooter\">\n <ng-content select=\"[footer]\"></ng-content>\n </div>\n </div>\n </div>\n</div>\n",
4010
+ styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.colored-header-grey{background-color:#f3f4f7}.title-text{color:#585555}.subtitle-text{color:#959595}.modal-header-image{height:auto;width:50%}.modal-header{border-bottom:1px solid #c5c6c9;padding-bottom:.66rem}@media (min-width:768px){.close{left:25px;margin-top:-20px!important;padding:0!important;position:relative}.close span{color:#fff}.modal-content{overflow:visible}}"]
4011
+ },] }
4012
+ ];
4013
+ ModalComponent.ctorParameters = () => [];
4014
+ ModalComponent.propDecorators = {
4015
+ elementId: [{ type: Input }],
4016
+ title: [{ type: Input }],
4017
+ subtitle: [{ type: Input }],
4018
+ templateBelowSubtitle: [{ type: Input }],
4019
+ showFooter: [{ type: Input }]
4020
+ };
4021
+
4022
+ /*
4023
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
4024
+ *
4025
+ * Licensed under EUPL, Version 1.2 (the "License");
4026
+ * you may not use this file except in compliance with the License.
4027
+ * You may obtain a copy of the License at
4028
+ *
4029
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
4030
+ *
4031
+ * Unless required by applicable law or agreed to in writing, software
4032
+ * distributed under the License is distributed on an "AS IS" basis,
4033
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4034
+ * See the License for the specific language governing permissions and
4035
+ * limitations under the License.
4036
+ */
4037
+ class ModalModule {
4038
+ }
4039
+ ModalModule.decorators = [
4040
+ { type: NgModule, args: [{
4041
+ declarations: [ModalComponent],
4042
+ imports: [CommonModule],
4043
+ exports: [ModalComponent]
4044
+ },] }
4045
+ ];
4046
+
4047
+ /*
4048
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
4049
+ *
4050
+ * Licensed under EUPL, Version 1.2 (the "License");
4051
+ * you may not use this file except in compliance with the License.
4052
+ * You may obtain a copy of the License at
4053
+ *
4054
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
4055
+ *
4056
+ * Unless required by applicable law or agreed to in writing, software
4057
+ * distributed under the License is distributed on an "AS IS" basis,
4058
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4059
+ * See the License for the specific language governing permissions and
4060
+ * limitations under the License.
4061
+ */
4062
+ class SpinnerComponent {
4063
+ constructor() {
4064
+ this.useBootstrapSpinner = true;
4065
+ this.type = 'ball-clip-rotate';
4066
+ this.size = 'medium';
4067
+ this.color = 'currentColor';
4068
+ this.bdColor = 'rgba(0,0,0,0)';
4069
+ this.fullScreen = false;
4070
+ }
4071
+ }
4072
+ SpinnerComponent.decorators = [
4073
+ { type: Component, args: [{
4074
+ selector: 'valtimo-spinner',
4075
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"useBootstrapSpinner; else ngxSpinner\">\n <div class=\"spinner-container\">\n <div class=\"spinner-border text-primary\" role=\"status\">\n <span class=\"sr-only\">{{ \"interface.loading\" | translate }}</span>\n </div>\n </div>\n</ng-container>\n\n<ng-template #ngxSpinner>\n <ngx-spinner\n [bdColor]=\"bdColor\"\n [fullScreen]=\"fullScreen\"\n [name]=\"name\"\n [color]=\"color\"\n [size]=\"size\"\n [type]=\"type\"\n >\n </ngx-spinner>\n</ng-template>\n",
4076
+ styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.spinner-container{display:flex;justify-content:center;margin-top:30px;width:100%}"]
4077
+ },] }
4078
+ ];
4079
+ SpinnerComponent.propDecorators = {
4080
+ useBootstrapSpinner: [{ type: Input }],
4081
+ name: [{ type: Input }],
4082
+ type: [{ type: Input }],
4083
+ size: [{ type: Input }],
4084
+ color: [{ type: Input }],
4085
+ bdColor: [{ type: Input }],
4086
+ fullScreen: [{ type: Input }]
4087
+ };
4088
+
4089
+ /*
4090
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
4091
+ *
4092
+ * Licensed under EUPL, Version 1.2 (the "License");
4093
+ * you may not use this file except in compliance with the License.
4094
+ * You may obtain a copy of the License at
4095
+ *
4096
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
4097
+ *
4098
+ * Unless required by applicable law or agreed to in writing, software
4099
+ * distributed under the License is distributed on an "AS IS" basis,
4100
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4101
+ * See the License for the specific language governing permissions and
4102
+ * limitations under the License.
4103
+ */
4104
+ class SpinnerModule {
4105
+ }
4106
+ SpinnerModule.decorators = [
4107
+ { type: NgModule, args: [{
4108
+ declarations: [SpinnerComponent],
4109
+ exports: [
4110
+ SpinnerComponent
4111
+ ],
4112
+ imports: [
4113
+ CommonModule,
4114
+ NgxSpinnerModule,
4115
+ TranslateModule
4116
+ ]
4117
+ },] }
4118
+ ];
4119
+
4120
+ /*
4121
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
4122
+ *
4123
+ * Licensed under EUPL, Version 1.2 (the "License");
4124
+ * you may not use this file except in compliance with the License.
4125
+ * You may obtain a copy of the License at
4126
+ *
4127
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
4128
+ *
4129
+ * Unless required by applicable law or agreed to in writing, software
4130
+ * distributed under the License is distributed on an "AS IS" basis,
4131
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4132
+ * See the License for the specific language governing permissions and
4133
+ * limitations under the License.
4134
+ */
4135
+ class SearchableDropdownComponent {
4136
+ constructor() {
4137
+ this.width = 250;
4138
+ this.itemSelected = new EventEmitter();
4139
+ this.searchId = 'search';
4140
+ this.searchTerm = new FormControl('');
4141
+ this.focusedItemId$ = new BehaviorSubject(this.searchId);
4142
+ this.open$ = new BehaviorSubject(false);
4143
+ this.filteredItems$ = new BehaviorSubject(undefined);
4144
+ this.wasInside = false;
4145
+ this.mouseOnList$ = new BehaviorSubject(false);
4146
+ }
4147
+ clickInside() {
4148
+ this.wasInside = true;
4149
+ }
4150
+ clickout() {
4151
+ if (!this.wasInside) {
4152
+ this.closeDropdown();
4153
+ }
4154
+ this.wasInside = false;
4155
+ }
4156
+ ngOnInit() {
4157
+ this.openKeysSubscription();
4158
+ this.openSearchSubscription();
4159
+ }
4160
+ ngOnChanges(changes) {
4161
+ const itemChanges = changes.items;
4162
+ const currenItems = itemChanges.currentValue;
4163
+ if (itemChanges && !itemChanges.previousValue && currenItems) {
4164
+ this.filteredItems$.next(currenItems);
4165
+ }
4166
+ }
4167
+ ngOnDestroy() {
4168
+ this.keySubscription.unsubscribe();
4169
+ this.searchSubscription.unsubscribe();
4170
+ }
4171
+ openDropdown() {
4172
+ this.open$.next(true);
4173
+ }
4174
+ hoverOverButton(id) {
4175
+ this.focusedItemId$.next(id);
4176
+ }
4177
+ mouseEnterList() {
4178
+ this.mouseOnList$.next(true);
4179
+ }
4180
+ mouseLeaveList() {
4181
+ this.mouseOnList$.next(false);
4182
+ }
4183
+ resetFocus() {
4184
+ this.focusedItemId$.next(this.searchId);
4185
+ }
4186
+ submit(id) {
4187
+ this.itemSelected.emit(id);
4188
+ }
4189
+ closeDropdown() {
4190
+ this.searchTerm.setValue('');
4191
+ this.resetFocus();
4192
+ this.open$.next(false);
4193
+ }
4194
+ openKeysSubscription() {
4195
+ this.keySubscription = fromEvent(document, 'keyup')
4196
+ .pipe(debounceTime(50))
4197
+ .subscribe((event) => {
4198
+ combineLatest([this.mouseOnList$, this.filteredItems$, this.focusedItemId$])
4199
+ .pipe(take(1))
4200
+ .subscribe(([mouseOnList, items, focusedId]) => {
4201
+ const length = items.length;
4202
+ const focusedIndex = items.findIndex((item) => item.id === focusedId);
4203
+ const code = event.code;
4204
+ const shiftKey = event.shiftKey;
4205
+ const down = 'ArrowDown';
4206
+ const tab = 'Tab';
4207
+ const up = 'ArrowUp';
4208
+ const enter = 'Enter';
4209
+ const escape = 'Escape';
4210
+ // close dropdown on pressing escape
4211
+ if (code === escape) {
4212
+ this.closeDropdown();
4213
+ }
4214
+ // submit item when focus is on an item in the list and enter is pressed
4215
+ if (code === enter && focusedId !== this.searchId) {
4216
+ this.submit(focusedId);
4217
+ }
4218
+ // only handle tab or arrow keypresses when items are shown and the mouse is not on the list
4219
+ if (length > 0 && !mouseOnList) {
4220
+ // handle moving down in the list with arrow down or tab
4221
+ if (code === down || (code === tab && !shiftKey)) {
4222
+ // move focus to first item in the list when focus is on search box
4223
+ if (focusedId === this.searchId) {
4224
+ this.focusedItemId$.next(items[0].id);
4225
+ this.scrollButtonIntoView(focusedId);
4226
+ // move focus to next item in the list if focus is not on last item
4227
+ }
4228
+ else if (focusedIndex + 1 < length) {
4229
+ this.focusedItemId$.next(items[focusedIndex + 1].id);
4230
+ this.scrollButtonIntoView(focusedId);
4231
+ }
4232
+ // handle moving up in the list with up arrow up or shift+tab
4233
+ }
4234
+ else if ((code === up || (code === tab && shiftKey)) && focusedId !== this.searchId) {
4235
+ // move to previous item if focus is not on the first item in the list
4236
+ if (focusedIndex > 0) {
4237
+ this.focusedItemId$.next(items[focusedIndex - 1].id);
4238
+ this.scrollButtonIntoView(focusedId);
4239
+ // move focus to search box if focus is on first item in the list
4240
+ }
4241
+ else {
4242
+ this.resetFocus();
4243
+ }
4244
+ }
4245
+ }
4246
+ });
4247
+ });
4248
+ }
4249
+ openSearchSubscription() {
4250
+ this.searchSubscription = this.searchTerm.valueChanges.subscribe((searchTerm) => {
4251
+ this.focusedItemId$.pipe(take(1)).subscribe((focusedItemId) => {
4252
+ if (!searchTerm) {
4253
+ this.filteredItems$.next(this.items);
4254
+ }
4255
+ else {
4256
+ const filteredItems = this.items.filter((item) => item.text.toUpperCase().includes(searchTerm.toUpperCase()));
4257
+ this.filteredItems$.next(filteredItems);
4258
+ // move focus to search box if filtered list length is 0 or previously focused item is not in filtered list anymore
4259
+ if (filteredItems.length === 0 || !filteredItems.some((item) => item.id === focusedItemId)) {
4260
+ this.resetFocus();
4261
+ }
4262
+ }
4263
+ // move scrolling button into view to end of queue, so that DOM can be updated first
4264
+ setTimeout(() => {
4265
+ this.scrollButtonIntoView(focusedItemId);
4266
+ });
4267
+ });
4268
+ });
4269
+ }
4270
+ scrollButtonIntoView(id) {
4271
+ this.filteredItems$.pipe(take(1)).subscribe((items) => {
4272
+ const focusItemIndex = items.findIndex((item) => item.id === id);
4273
+ const focusedButton = this.buttons.toArray()[focusItemIndex];
4274
+ if (focusedButton) {
4275
+ focusedButton.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
4276
+ }
4277
+ });
4278
+ }
4279
+ }
4280
+ SearchableDropdownComponent.decorators = [
4281
+ { type: Component, args: [{
4282
+ selector: 'valtimo-searchable-dropdown',
4283
+ template: "<ng-container *ngIf=\"buttonText && items\">\n <ng-container [ngTemplateOutlet]=\"(open$ | async) ? opened : closed\"> </ng-container>\n</ng-container>\n\n<ng-template #closed>\n <ng-container *ngIf=\"style === 'button' || !style\">\n <button class=\"btn btn-primary btn-sm dropdown-size\" (click)=\"openDropdown()\" [style.width.px]=\"width\">\n {{ buttonText }}\n </button>\n </ng-container>\n <ng-container *ngIf=\"style === 'underlinedText'\">\n <h5 class=\"underline-button\" (click)=\"openDropdown()\" [style.width.px]=\"width\">\n <b>\n {{ buttonText }}\n </b>\n </h5>\n </ng-container>\n</ng-template>\n\n<ng-template #opened>\n <div class=\"dropdown-container\" [style.width.px]=\"width\">\n <div class=\"dropdown-size search\" [style.width.px]=\"width\">\n <input #search [ngClass]=\"{ disabled: disabled }\" [placeholder]=\"searchText\" [formControl]=\"searchTerm\" />\n {{ search.focus() }}\n </div>\n <div class=\"dropdown-list\" (mouseenter)=\"mouseEnterList()\" (mouseleave)=\"mouseLeaveList()\">\n <ng-container *ngIf=\"filteredItems$ | async as filteredItems\">\n <ng-container *ngIf=\"filteredItems.length > 0 && focusedItemId$ | async as focusedItemId; else noResults\">\n <button\n #button\n *ngFor=\"let item of filteredItems\"\n [ngClass]=\"{ focus: focusedItemId === item.id, disabled: disabled }\"\n class=\"dropdown-button dropdown-size\"\n (click)=\"submit(item.id)\"\n (mouseenter)=\"hoverOverButton(item.id)\"\n (mouseleave)=\"resetFocus()\"\n [style.width.px]=\"width\"\n >\n <span class=\"dropdown-button-text\">\n {{ item.text }}\n </span>\n </button>\n </ng-container>\n </ng-container>\n </div>\n </div>\n <ng-container [ngTemplateOutlet]=\"space\"> </ng-container>\n</ng-template>\n\n<ng-template #noResults>\n <div class=\"dropdown-button dropdown-size disabled\" [style.width.px]=\"width\">\n <span class=\"dropdown-button-text\">{{ noResultsText }}</span>\n </div>\n</ng-template>\n\n<ng-template #space>\n <div *ngIf=\"style === 'button' || !style\" class=\"dropdown-size\" [style.width.px]=\"width\"></div>\n <h5 *ngIf=\"style === 'underlinedText'\" class=\"underline-button\"><b>-</b></h5>\n</ng-template>\n",
4284
+ styles: [".dropdown-size{height:34px;width:250px}.underline-button{cursor:pointer;text-decoration:underline;width:250px}.dropdown-container{background-color:#fff;border:1px solid #e3e3e3;border-radius:3px;box-shadow:0 0 6px 0 rgba(0,0,0,.12);display:flex;flex-direction:column;max-height:300px;overflow:hidden;padding:7px 0;position:fixed;width:250px;z-index:999}.dropdown-list{list-style:none;margin:0;overflow:auto;overflow-x:hidden;padding:0;z-index:9999}.search{align-items:center;border-bottom:1px solid #dee2e6;display:flex;flex-shrink:0;height:44px;padding:8px 24px}.search input{padding:0;width:100%}.dropdown-button,.search input,.search input:focus{border:none;outline:none}.dropdown-button{align-items:center;background-color:#fff;color:#504e4e;cursor:pointer;display:flex;font-size:1rem;font-weight:400;padding:8px 24px}.dropdown-button.focus{background-color:#f5f5f5}.dropdown-button-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.disabled{color:#959595;cursor:default;pointer-events:none}"]
4285
+ },] }
4286
+ ];
4287
+ SearchableDropdownComponent.propDecorators = {
4288
+ style: [{ type: Input }],
4289
+ items: [{ type: Input }],
4290
+ buttonText: [{ type: Input }],
4291
+ searchText: [{ type: Input }],
4292
+ noResultsText: [{ type: Input }],
4293
+ disabled: [{ type: Input }],
4294
+ width: [{ type: Input }],
4295
+ itemSelected: [{ type: Output }],
4296
+ buttons: [{ type: ViewChildren, args: ['button',] }],
4297
+ clickInside: [{ type: HostListener, args: ['click',] }],
4298
+ clickout: [{ type: HostListener, args: ['document:click',] }]
4299
+ };
4300
+
4301
+ /*
4302
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
4303
+ *
4304
+ * Licensed under EUPL, Version 1.2 (the "License");
4305
+ * you may not use this file except in compliance with the License.
4306
+ * You may obtain a copy of the License at
4307
+ *
4308
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
4309
+ *
4310
+ * Unless required by applicable law or agreed to in writing, software
4311
+ * distributed under the License is distributed on an "AS IS" basis,
4312
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4313
+ * See the License for the specific language governing permissions and
4314
+ * limitations under the License.
4315
+ */
4316
+ class SearchableDropdownModule {
4317
+ }
4318
+ SearchableDropdownModule.decorators = [
4319
+ { type: NgModule, args: [{
4320
+ declarations: [SearchableDropdownComponent],
4321
+ imports: [CommonModule, ReactiveFormsModule],
4322
+ exports: [SearchableDropdownComponent]
4323
+ },] }
4324
+ ];
4325
+
4326
+ const formIoUploaderEditForm = () => ({
4327
+ components: [
4328
+ { key: 'type', type: 'hidden' },
4329
+ {
4330
+ type: 'textfield',
4331
+ input: true,
4332
+ key: 'label',
4333
+ label: 'Label',
4334
+ placeholder: 'Label',
4335
+ validate: {
4336
+ required: true,
4337
+ },
4338
+ },
4339
+ {
4340
+ type: 'textfield',
4341
+ input: true,
4342
+ key: 'key',
4343
+ label: 'Property Name',
4344
+ placeholder: 'Property Name',
4345
+ tooltip: 'The name of this field in the API endpoint.',
4346
+ validate: {
4347
+ required: true,
4348
+ }
4349
+ },
4350
+ {
4351
+ type: 'textfield',
4352
+ input: true,
4353
+ key: 'customOptions.title',
4354
+ label: 'Title',
4355
+ placeholder: 'Title',
4356
+ tooltip: 'Leave empty to use the default title',
4357
+ validate: {
4358
+ required: false,
4359
+ },
4360
+ },
4361
+ {
4362
+ type: 'checkbox',
4363
+ input: true,
4364
+ inputType: 'checkbox',
4365
+ key: 'customOptions.hideTitle',
4366
+ label: 'Hide title',
4367
+ validate: {
4368
+ required: false,
4369
+ },
4370
+ },
4371
+ {
4372
+ type: 'textfield',
4373
+ input: true,
4374
+ key: 'customOptions.subtitle',
4375
+ label: 'Subtitle',
4376
+ placeholder: 'Title',
4377
+ tooltip: 'Leave empty to hide subtitle',
4378
+ validate: {
4379
+ required: false,
4380
+ },
4381
+ },
4382
+ {
4383
+ type: 'number',
4384
+ input: true,
4385
+ key: 'customOptions.maxFileSize',
4386
+ label: 'Maximum file size',
4387
+ placeholder: 'Maximum file size',
4388
+ defaultValue: 5,
4389
+ validate: {
4390
+ required: true,
4391
+ },
4392
+ },
4393
+ {
4394
+ type: 'checkbox',
4395
+ input: true,
4396
+ inputType: 'checkbox',
4397
+ key: 'customOptions.hideMaxFileSize',
4398
+ label: 'Hide maximum file size',
4399
+ validate: {
4400
+ required: false,
4401
+ },
4402
+ },
4403
+ {
4404
+ type: 'checkbox',
4405
+ input: true,
4406
+ inputType: 'checkbox',
4407
+ key: 'customOptions.camera',
4408
+ label: 'Allow camera uploads',
4409
+ validate: {
4410
+ required: false,
4411
+ },
4412
+ }
4413
+ ],
4414
+ });
4415
+
4416
+ const customUploaderType = 'valtimo-file';
4417
+ const COMPONENT_OPTIONS = {
4418
+ type: customUploaderType,
4419
+ selector: 'valtimo-form-io-uploader',
4420
+ title: 'Valtimo File Upload',
4421
+ group: 'basic',
4422
+ icon: 'upload',
4423
+ // set empty value to force formio to accept arrays as valid input value for this field type
4424
+ emptyValue: [],
4425
+ editForm: formIoUploaderEditForm,
4426
+ };
4427
+ function registerFormioUploadComponent(injector) {
4428
+ const originalUploadComponent = createCustomFormioComponent(COMPONENT_OPTIONS);
4429
+ // override setValue function to allow for setting an array value
4430
+ class UploaderComponent extends originalUploadComponent {
4431
+ setValue(value) {
4432
+ this._customAngularElement.value = value;
4433
+ return true;
4434
+ }
4435
+ }
4436
+ registerCustomFormioComponentWithClass(COMPONENT_OPTIONS, FormIoUploaderComponent, UploaderComponent, injector);
4437
+ }
4438
+
4439
+ /*
4440
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
4441
+ *
4442
+ * Licensed under EUPL, Version 1.2 (the "License");
4443
+ * you may not use this file except in compliance with the License.
4444
+ * You may obtain a copy of the License at
4445
+ *
4446
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
4447
+ *
4448
+ * Unless required by applicable law or agreed to in writing, software
4449
+ * distributed under the License is distributed on an "AS IS" basis,
4450
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4451
+ * See the License for the specific language governing permissions and
4452
+ * limitations under the License.
4453
+ */
4454
+ class SearchableDropdownSelectComponent {
4455
+ constructor() {
4456
+ this.width = 250;
4457
+ this.itemSelected = new EventEmitter();
4458
+ this.clearSelection = new EventEmitter();
4459
+ }
4460
+ onSelect(id) {
4461
+ this.itemSelected.emit(id);
4462
+ }
4463
+ onClearSelection() {
4464
+ this.clearSelection.emit();
4465
+ }
4466
+ }
4467
+ SearchableDropdownSelectComponent.decorators = [
4468
+ { type: Component, args: [{
4469
+ selector: 'valtimo-searchable-dropdown-select',
4470
+ template: "<valtimo-searchable-dropdown\n *ngIf=\"!hasSelection; else selection\"\n [style]=\"style\"\n [items]=\"items\"\n [buttonText]=\"buttonText\"\n [searchText]=\"searchText\"\n [noResultsText]=\"noResultsText\"\n [disabled]=\"disabled\"\n [width]=\"width\"\n (itemSelected)=\"onSelect($event)\"\n>\n</valtimo-searchable-dropdown>\n\n<ng-template #selection>\n <div class=\"d-flex flex-row align-items-center\" [style.height.px]=\"style === 'button' ? 34 : null\">\n <h5 class=\"selected-text\">{{ selectedText }} <b>{{ selectedTextValue }}</b></h5>\n <button\n type=\"button\"\n class=\"close p-0 m-0 ml-2 d-flex text-danger\"\n aria-label=\"Close\"\n (click)=\"onClearSelection()\"\n [title]=\"clearSelectionButtonTitle\"\n >\n <i class=\"clear-icon fa fa-times text-danger\"></i>\n </button>\n </div>\n</ng-template>\n\n",
4471
+ styles: [".selected-text{margin:0}.clear-icon{font-size:13px}"]
4472
+ },] }
4473
+ ];
4474
+ SearchableDropdownSelectComponent.propDecorators = {
4475
+ style: [{ type: Input }],
4476
+ items: [{ type: Input }],
4477
+ buttonText: [{ type: Input }],
4478
+ searchText: [{ type: Input }],
4479
+ noResultsText: [{ type: Input }],
4480
+ disabled: [{ type: Input }],
4481
+ selectedText: [{ type: Input }],
4482
+ selectedTextValue: [{ type: Input }],
4483
+ clearSelectionButtonTitle: [{ type: Input }],
4484
+ hasSelection: [{ type: Input }],
4485
+ width: [{ type: Input }],
4486
+ itemSelected: [{ type: Output }],
4487
+ clearSelection: [{ type: Output }]
4488
+ };
4489
+
4490
+ /*
4491
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
4492
+ *
4493
+ * Licensed under EUPL, Version 1.2 (the "License");
4494
+ * you may not use this file except in compliance with the License.
4495
+ * You may obtain a copy of the License at
4496
+ *
4497
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
4498
+ *
4499
+ * Unless required by applicable law or agreed to in writing, software
4500
+ * distributed under the License is distributed on an "AS IS" basis,
4501
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4502
+ * See the License for the specific language governing permissions and
4503
+ * limitations under the License.
4504
+ */
4505
+ class SearchableDropdownSelectModule {
4506
+ }
4507
+ SearchableDropdownSelectModule.decorators = [
4508
+ { type: NgModule, args: [{
4509
+ declarations: [SearchableDropdownSelectComponent],
4510
+ imports: [CommonModule, ReactiveFormsModule, SearchableDropdownModule],
4511
+ exports: [SearchableDropdownSelectComponent]
4512
+ },] }
4513
+ ];
4514
+
4515
+ /*
4516
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
4517
+ *
4518
+ * Licensed under EUPL, Version 1.2 (the "License");
4519
+ * you may not use this file except in compliance with the License.
4520
+ * You may obtain a copy of the License at
4521
+ *
4522
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
4523
+ *
4524
+ * Unless required by applicable law or agreed to in writing, software
4525
+ * distributed under the License is distributed on an "AS IS" basis,
4526
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4527
+ * See the License for the specific language governing permissions and
4528
+ * limitations under the License.
4529
+ */
4530
+
4531
+ /**
4532
+ * Generated bundle index. Do not edit.
4533
+ */
4534
+
4535
+ export { AlertComponent, AlertModule, AlertService, BpmnJsDiagramComponent, BpmnJsDiagramModule, BreadcrumbNavigationComponent, BreadcrumbNavigationModule, CamundaFormComponent, CamundaFormModule, CardComponent, CardModule, ComponentsModule, DataListComponent, DataListModule, DropzoneComponent, DropzoneModule, FieldAutoFocusDirective, FieldAutoFocusModule, FileSizeModule, FileSizePipe, FilterSidebarComponent, FilterSidebarModule, FormIoModule, FormIoUploaderComponent, FormioBuilderComponent, FormioComponent, LeftSidebarComponent, LeftSidebarModule, ListComponent, ListFilterPipe, ListModule, MenuModule, MenuRoutingModule, MenuService, ModalComponent, ModalModule, PageHeaderComponent, PageHeaderModule, PageTitleComponent, PageTitleModule, ProgressBarComponent, ProgressBarModule, RightSidebarComponent, RightSidebarModule, SearchableDropdownComponent, SearchableDropdownModule, SearchableDropdownSelectComponent, SearchableDropdownSelectModule, SpinnerModule, TimelineComponent, TimelineModule, TopbarComponent, TopbarModule, UploaderComponent, UploaderDragDropDirective, UploaderModule, ViewContentService, WebcamComponent, WebcamModule, WidgetComponent, WidgetModule, customUploaderType, menuInitializer, registerFormioUploadComponent, ɵ0, CamundaGeneratedFormModule as ɵa, CamundaStringFormfieldComponent as ɵb, CamundaBooleanFormfieldComponent as ɵc, CamundaDateFormfieldComponent as ɵd, CamundaFormfieldService as ɵe, CamundaFormfieldGeneratorDirective as ɵf, CamundaLongFormfieldComponent as ɵg, CamundaEnumFormfieldComponent as ɵh, CamundaTextareaFormfieldComponent as ɵi, CamundaChoicefieldFormfieldComponent as ɵj, CamundaFormfieldValidationComponent as ɵk, CamundaGeneratedFormComponent as ɵl, CamundaCustomFormModule as ɵm, CamundaCustomFormComponent as ɵn, MenuComponent as ɵo, MenuItemTextComponent as ɵp, SubmenuItemTextComponent as ɵq, VersionService as ɵr, FormIoStateService as ɵs, FormIoDomService as ɵt, AppConfig as ɵu, SpinnerComponent as ɵv };
4536
+ //# sourceMappingURL=valtimo-components.js.map