@indice/ng-components 0.2.139 → 0.2.141

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 (228) hide show
  1. package/README.md +4 -4
  2. package/{src/assets/styles/indice-ng-icons-inline.css → _styles.css} +3501 -2286
  3. package/esm2020/indice-ng-components.mjs +5 -0
  4. package/esm2020/lib/controls/avatar-initials/avatar-initials.component.mjs +48 -0
  5. package/esm2020/lib/controls/collapsible-panel/collapsible-panel.component.mjs +20 -0
  6. package/esm2020/lib/controls/date-picker/date-picker.component.mjs +260 -0
  7. package/esm2020/lib/controls/drop-down-menu/drop-down-menu.component.mjs +68 -0
  8. package/esm2020/lib/controls/kpi-tile/kpi-tile.component.mjs +36 -0
  9. package/esm2020/lib/controls/list-view/list-column.component.mjs +25 -0
  10. package/esm2020/lib/controls/list-view/list-details-section.component.mjs +17 -0
  11. package/esm2020/lib/controls/list-view/list-tile.component.mjs +17 -0
  12. package/esm2020/lib/controls/list-view/list-view-empty-state.component.mjs +29 -0
  13. package/esm2020/lib/controls/list-view/list-view.component.mjs +183 -0
  14. package/esm2020/lib/controls/nav-links-list/nav-links-list.component.mjs +37 -0
  15. package/esm2020/lib/controls/notifications-indicator/notifications-indicator.component.mjs +77 -0
  16. package/esm2020/lib/controls/pager/pager.component.mjs +130 -0
  17. package/esm2020/lib/controls/side-pane/side-pane.component.mjs +72 -0
  18. package/esm2020/lib/controls/skeleton-loader/skeleton-loader.component.mjs +25 -0
  19. package/esm2020/lib/controls/toaster/toaster-container.component.mjs +28 -0
  20. package/esm2020/lib/controls/toaster/toaster.component.mjs +31 -0
  21. package/esm2020/lib/controls/toggle/toggle.component.mjs +64 -0
  22. package/esm2020/lib/directives/click-outside.directive.mjs +189 -0
  23. package/esm2020/lib/directives/dynamic-component-host.directive.mjs +17 -0
  24. package/esm2020/lib/helpers/base-list.component.mjs +181 -0
  25. package/esm2020/lib/icons.mjs +32 -0
  26. package/esm2020/lib/layouts/shell/shell-footer/shell-footer.component.mjs +19 -0
  27. package/esm2020/lib/layouts/shell/shell-header/shell-header.component.mjs +135 -0
  28. package/esm2020/lib/layouts/shell/shell-layout/shell-layout.component.mjs +101 -0
  29. package/esm2020/lib/layouts/views/form-layout/form-layout.component.mjs +80 -0
  30. package/esm2020/lib/layouts/views/model-view-layout/model-view-layout.component.mjs +49 -0
  31. package/esm2020/lib/layouts/views/side-view-layout/side-view-layout.component.mjs +98 -0
  32. package/esm2020/lib/layouts/views/view-layout/view-layout.component.mjs +104 -0
  33. package/esm2020/lib/ng-components.module.mjs +221 -0
  34. package/esm2020/lib/pages/auth/auth-callback/auth-callback.component.mjs +30 -0
  35. package/esm2020/lib/pages/auth/auth-renew/auth-renew.component.mjs +31 -0
  36. package/esm2020/lib/pages/auth/logged-out/logged-out.component.mjs +28 -0
  37. package/esm2020/lib/pages/http-status/error/error.component.mjs +17 -0
  38. package/esm2020/lib/pages/http-status/page-not-found/page-not-found.component.mjs +15 -0
  39. package/esm2020/lib/pages/http-status/unauthorized/unauthorized.component.mjs +14 -0
  40. package/esm2020/lib/pipes/address.pipe.mjs +21 -0
  41. package/esm2020/lib/pipes/duration-format.pipe.mjs +64 -0
  42. package/esm2020/lib/services/component-loader/component-loader-options.class.mjs +8 -0
  43. package/esm2020/lib/services/component-loader/component-loader.class.mjs +188 -0
  44. package/esm2020/lib/services/component-loader/component-loader.factory.mjs +32 -0
  45. package/esm2020/lib/services/component-loader/content-ref.class.mjs +13 -0
  46. package/esm2020/lib/services/modal-service/modal-backdrop-component.mjs +44 -0
  47. package/esm2020/lib/services/modal-service/modal-container-component.mjs +126 -0
  48. package/esm2020/lib/services/modal-service/modal-options.class.mjs +35 -0
  49. package/esm2020/lib/services/modal-service/modal-service.mjs +219 -0
  50. package/esm2020/lib/services/modal-service/modal-styles.class.mjs +11 -0
  51. package/esm2020/lib/services/modal-service/modal.class.mjs +27 -0
  52. package/esm2020/lib/services/toaster.service.mjs +24 -0
  53. package/esm2020/lib/tokens.mjs +5 -0
  54. package/esm2020/lib/types.mjs +117 -0
  55. package/esm2020/public-api.mjs +53 -0
  56. package/fesm2015/indice-ng-components.mjs +3268 -0
  57. package/fesm2015/indice-ng-components.mjs.map +1 -0
  58. package/fesm2020/indice-ng-components.mjs +3225 -0
  59. package/fesm2020/indice-ng-components.mjs.map +1 -0
  60. package/indice-ng-components.d.ts +5 -0
  61. package/lib/controls/avatar-initials/avatar-initials.component.d.ts +14 -0
  62. package/lib/controls/collapsible-panel/collapsible-panel.component.d.ts +10 -0
  63. package/lib/controls/date-picker/date-picker.component.d.ts +48 -0
  64. package/lib/controls/drop-down-menu/drop-down-menu.component.d.ts +25 -0
  65. package/lib/controls/kpi-tile/kpi-tile.component.d.ts +13 -0
  66. package/lib/controls/list-view/list-column.component.d.ts +9 -0
  67. package/lib/controls/list-view/list-details-section.component.d.ts +7 -0
  68. package/lib/controls/list-view/list-tile.component.d.ts +7 -0
  69. package/lib/controls/list-view/list-view-empty-state.component.d.ts +11 -0
  70. package/lib/controls/list-view/list-view.component.d.ts +55 -0
  71. package/lib/controls/nav-links-list/nav-links-list.component.d.ts +15 -0
  72. package/lib/controls/notifications-indicator/notifications-indicator.component.d.ts +23 -0
  73. package/lib/controls/pager/pager.component.d.ts +36 -0
  74. package/lib/controls/side-pane/side-pane.component.d.ts +18 -0
  75. package/lib/controls/skeleton-loader/skeleton-loader.component.d.ts +11 -0
  76. package/lib/controls/toaster/toaster-container.component.d.ts +13 -0
  77. package/lib/controls/toaster/toaster.component.d.ts +15 -0
  78. package/lib/controls/toggle/toggle.component.d.ts +19 -0
  79. package/lib/directives/click-outside.directive.d.ts +40 -0
  80. package/lib/directives/dynamic-component-host.directive.d.ts +9 -0
  81. package/lib/helpers/base-list.component.d.ts +42 -0
  82. package/lib/icons.d.ts +30 -0
  83. package/lib/layouts/shell/shell-footer/shell-footer.component.d.ts +8 -0
  84. package/lib/layouts/shell/shell-header/shell-header.component.d.ts +41 -0
  85. package/lib/layouts/shell/shell-layout/shell-layout.component.d.ts +28 -0
  86. package/lib/layouts/views/form-layout/form-layout.component.d.ts +24 -0
  87. package/lib/layouts/views/model-view-layout/model-view-layout.component.d.ts +25 -0
  88. package/lib/layouts/views/side-view-layout/side-view-layout.component.d.ts +28 -0
  89. package/lib/layouts/views/view-layout/view-layout.component.d.ts +31 -0
  90. package/lib/ng-components.module.d.ts +49 -0
  91. package/lib/pages/auth/auth-callback/auth-callback.component.d.ts +13 -0
  92. package/lib/pages/auth/auth-renew/auth-renew.component.d.ts +12 -0
  93. package/lib/pages/auth/logged-out/logged-out.component.d.ts +12 -0
  94. package/lib/pages/http-status/error/error.component.d.ts +8 -0
  95. package/lib/pages/http-status/page-not-found/page-not-found.component.d.ts +8 -0
  96. package/lib/pages/http-status/unauthorized/unauthorized.component.d.ts +8 -0
  97. package/lib/pipes/address.pipe.d.ts +8 -0
  98. package/lib/pipes/duration-format.pipe.d.ts +8 -0
  99. package/lib/services/component-loader/component-loader-options.class.d.ts +30 -0
  100. package/lib/services/component-loader/component-loader.class.d.ts +92 -0
  101. package/lib/services/component-loader/component-loader.factory.d.ts +24 -0
  102. package/lib/services/component-loader/content-ref.class.d.ts +12 -0
  103. package/lib/services/modal-service/modal-backdrop-component.d.ts +20 -0
  104. package/lib/services/modal-service/modal-container-component.d.ts +33 -0
  105. package/lib/services/modal-service/modal-options.class.d.ts +81 -0
  106. package/lib/services/modal-service/modal-service.d.ts +58 -0
  107. package/lib/services/modal-service/modal-styles.class.d.ts +10 -0
  108. package/lib/services/modal-service/modal.class.d.ts +43 -0
  109. package/lib/services/toaster.service.d.ts +11 -0
  110. package/lib/tokens.d.ts +5 -0
  111. package/lib/types.d.ts +153 -0
  112. package/{src/assets/styles/modal.css → modal.css} +157 -157
  113. package/package.json +24 -20
  114. package/{src/public-api.ts → public-api.d.ts} +43 -60
  115. package/CHANGELOG.md +0 -1
  116. package/karma.conf.js +0 -44
  117. package/ng-package.json +0 -10
  118. package/scripts/css-bundle.ts +0 -33
  119. package/src/_styles.css +0 -36
  120. package/src/_tests/utilities.service.spec.ts +0 -16
  121. package/src/assets/styles/avatar-initials.css +0 -37
  122. package/src/assets/styles/base.css +0 -46
  123. package/src/assets/styles/cards.css +0 -71
  124. package/src/assets/styles/collapsible-panel.css +0 -25
  125. package/src/assets/styles/components.css +0 -34
  126. package/src/assets/styles/date-picker.component.css +0 -0
  127. package/src/assets/styles/drop-down-menu.css +0 -50
  128. package/src/assets/styles/form-layout.css +0 -49
  129. package/src/assets/styles/list-view-empty-state.css +0 -0
  130. package/src/assets/styles/list-view.css +0 -64
  131. package/src/assets/styles/model-view-layout.css +0 -45
  132. package/src/assets/styles/nav-links.css +0 -35
  133. package/src/assets/styles/notifications-indicator.component.css +0 -43
  134. package/src/assets/styles/pager.css +0 -29
  135. package/src/assets/styles/shell-layout.css +0 -232
  136. package/src/assets/styles/side-pane.css +0 -46
  137. package/src/assets/styles/side-view-layout.css +0 -58
  138. package/src/assets/styles/toast.css +0 -72
  139. package/src/assets/styles/toggle.css +0 -26
  140. package/src/assets/styles/view-layout.css +0 -58
  141. package/src/lib/controls/avatar-initials/avatar-initials.component.html +0 -3
  142. package/src/lib/controls/avatar-initials/avatar-initials.component.ts +0 -47
  143. package/src/lib/controls/collapsible-panel/collapsible-panel.component.html +0 -15
  144. package/src/lib/controls/collapsible-panel/collapsible-panel.component.ts +0 -16
  145. package/src/lib/controls/date-picker/date-picker.component.html +0 -133
  146. package/src/lib/controls/date-picker/date-picker.component.ts +0 -258
  147. package/src/lib/controls/drop-down-menu/drop-down-menu.component.html +0 -61
  148. package/src/lib/controls/drop-down-menu/drop-down-menu.component.ts +0 -59
  149. package/src/lib/controls/kpi-tile/kpi-tile.component.html +0 -18
  150. package/src/lib/controls/kpi-tile/kpi-tile.component.ts +0 -26
  151. package/src/lib/controls/list-view/list-column.component.ts +0 -10
  152. package/src/lib/controls/list-view/list-details-section.component.ts +0 -8
  153. package/src/lib/controls/list-view/list-tile.component.ts +0 -8
  154. package/src/lib/controls/list-view/list-view-empty-state.component.html +0 -20
  155. package/src/lib/controls/list-view/list-view-empty-state.component.ts +0 -19
  156. package/src/lib/controls/list-view/list-view.component.html +0 -151
  157. package/src/lib/controls/list-view/list-view.component.ts +0 -146
  158. package/src/lib/controls/nav-links-list/nav-links-list.component.html +0 -27
  159. package/src/lib/controls/nav-links-list/nav-links-list.component.ts +0 -25
  160. package/src/lib/controls/notifications-indicator/notifications-indicator.component.html +0 -78
  161. package/src/lib/controls/notifications-indicator/notifications-indicator.component.ts +0 -75
  162. package/src/lib/controls/pager/pager.component.html +0 -33
  163. package/src/lib/controls/pager/pager.component.ts +0 -106
  164. package/src/lib/controls/side-pane/side-pane.component.html +0 -10
  165. package/src/lib/controls/side-pane/side-pane.component.ts +0 -59
  166. package/src/lib/controls/skeleton-loader/skeleton-loader.component.html +0 -112
  167. package/src/lib/controls/skeleton-loader/skeleton-loader.component.ts +0 -20
  168. package/src/lib/controls/toaster/toaster-container.component.html +0 -1
  169. package/src/lib/controls/toaster/toaster-container.component.ts +0 -27
  170. package/src/lib/controls/toaster/toaster.component.html +0 -103
  171. package/src/lib/controls/toaster/toaster.component.ts +0 -26
  172. package/src/lib/controls/toggle/toggle.component.html +0 -15
  173. package/src/lib/controls/toggle/toggle.component.ts +0 -58
  174. package/src/lib/directives/click-outside.directive.ts +0 -196
  175. package/src/lib/directives/dynamic-component-host.directive.ts +0 -7
  176. package/src/lib/directives/screen-size.directive.ts +0 -67
  177. package/src/lib/helpers/base-list.component.ts +0 -204
  178. package/src/lib/icons.ts +0 -39
  179. package/src/lib/layouts/shell/shell-footer/shell-footer.component.html +0 -71
  180. package/src/lib/layouts/shell/shell-footer/shell-footer.component.ts +0 -14
  181. package/src/lib/layouts/shell/shell-header/shell-header.component.html +0 -199
  182. package/src/lib/layouts/shell/shell-header/shell-header.component.ts +0 -111
  183. package/src/lib/layouts/shell/shell-layout/shell-layout.component.html +0 -36
  184. package/src/lib/layouts/shell/shell-layout/shell-layout.component.ts +0 -91
  185. package/src/lib/layouts/views/form-layout/form-layout.component.html +0 -67
  186. package/src/lib/layouts/views/form-layout/form-layout.component.ts +0 -66
  187. package/src/lib/layouts/views/model-view-layout/model-view-layout.component.html +0 -43
  188. package/src/lib/layouts/views/model-view-layout/model-view-layout.component.ts +0 -37
  189. package/src/lib/layouts/views/side-view-layout/side-view-layout.component.html +0 -36
  190. package/src/lib/layouts/views/side-view-layout/side-view-layout.component.ts +0 -67
  191. package/src/lib/layouts/views/view-layout/view-layout.component.html +0 -68
  192. package/src/lib/layouts/views/view-layout/view-layout.component.ts +0 -82
  193. package/src/lib/ng-components.module.ts +0 -135
  194. package/src/lib/pages/auth/auth-callback/auth-callback.component.html +0 -1
  195. package/src/lib/pages/auth/auth-callback/auth-callback.component.ts +0 -22
  196. package/src/lib/pages/auth/auth-renew/auth-renew.component.ts +0 -20
  197. package/src/lib/pages/auth/logged-out/logged-out.component.html +0 -1
  198. package/src/lib/pages/auth/logged-out/logged-out.component.ts +0 -22
  199. package/src/lib/pages/http-status/error/error.component.html +0 -13
  200. package/src/lib/pages/http-status/error/error.component.ts +0 -13
  201. package/src/lib/pages/http-status/page-not-found/page-not-found.component.html +0 -14
  202. package/src/lib/pages/http-status/page-not-found/page-not-found.component.ts +0 -14
  203. package/src/lib/pages/http-status/unauthorized/unauthorized.component.html +0 -15
  204. package/src/lib/pages/http-status/unauthorized/unauthorized.component.ts +0 -11
  205. package/src/lib/pipes/address.pipe.ts +0 -17
  206. package/src/lib/pipes/duration-format.pipe.ts +0 -67
  207. package/src/lib/services/component-loader/component-loader-options.class.ts +0 -31
  208. package/src/lib/services/component-loader/component-loader.class.ts +0 -226
  209. package/src/lib/services/component-loader/component-loader.factory.ts +0 -27
  210. package/src/lib/services/component-loader/content-ref.class.ts +0 -10
  211. package/src/lib/services/interceptors/bad-request.interceptor.ts +0 -34
  212. package/src/lib/services/modal-service/modal-backdrop-component.ts +0 -40
  213. package/src/lib/services/modal-service/modal-container-component.ts +0 -125
  214. package/src/lib/services/modal-service/modal-options.class.ts +0 -92
  215. package/src/lib/services/modal-service/modal-service.ts +0 -237
  216. package/src/lib/services/modal-service/modal-styles.class.ts +0 -11
  217. package/src/lib/services/modal-service/modal.class.ts +0 -45
  218. package/src/lib/services/shell-state-service.service.ts +0 -10
  219. package/src/lib/services/toaster.service.ts +0 -23
  220. package/src/lib/services/utilities.service.ts +0 -40
  221. package/src/lib/tokens.ts +0 -6
  222. package/src/lib/types.ts +0 -210
  223. package/src/test.ts +0 -28
  224. package/tsconfig.lib.json +0 -26
  225. package/tsconfig.lib.prod.json +0 -10
  226. package/tsconfig.spec.json +0 -17
  227. package/tslint.json +0 -17
  228. package/webpack.config.js +0 -36
@@ -1,237 +0,0 @@
1
- import { DOCUMENT } from '@angular/common';
2
- import { ComponentRef, Inject, Injectable, OnDestroy, Optional, Renderer2, RendererFactory2, TemplateRef } from '@angular/core';
3
- import { Subject } from 'rxjs';
4
- import { ComponentLoader } from '../component-loader/component-loader.class';
5
- import { animationTime, cssClassNames } from './modal-styles.class';
6
- import { ModalBackdropComponent } from './modal-backdrop-component';
7
- import { ModalContainerComponent } from './modal-container-component';
8
- import { modalConfigDefaults, ModalOptions, MODAL_CONFIG_DEFAULT_OVERRIDE } from './modal-options.class';
9
- import { Modal } from './modal.class';
10
- import { ComponentLoaderFactory } from '../component-loader/component-loader.factory';
11
-
12
- /**
13
- * A service for using modals.
14
- *
15
- * @public
16
- */
17
- @Injectable()
18
- export class ModalService implements OnDestroy {
19
- private onBeforeShow = new Subject();
20
- private onShown = new Subject();
21
- private onBeforeHide = new Subject();
22
- private onHidden = new Subject();
23
-
24
- private backdropRef?: ComponentRef<ModalBackdropComponent>;
25
- private defaultConfig: ModalOptions;
26
- private backdropLoader: ComponentLoader<ModalBackdropComponent>;
27
- private loaders: ComponentLoader<ModalContainerComponent>[] = [];
28
- private renderer: Renderer2;
29
- private modalsCount = 0;
30
- private initialPadding = '0px';
31
- constructor(
32
- private clf: ComponentLoaderFactory,
33
- rendererFactory: RendererFactory2,
34
- @Inject(DOCUMENT) private document: any,
35
- @Optional() @Inject(MODAL_CONFIG_DEFAULT_OVERRIDE) modalDefaultOption: ModalOptions
36
- ) {
37
- this.backdropLoader = this.clf.createLoader<ModalBackdropComponent>();
38
- this.defaultConfig = { ...modalConfigDefaults, ...modalDefaultOption };
39
- this.renderer = rendererFactory.createRenderer(null, null);
40
- }
41
-
42
- ngOnDestroy(): void {
43
- this.loaders.forEach((loader) => loader.instance?.hide());
44
- }
45
-
46
- /**
47
- * Opens a new modal.
48
- *
49
- * @param content - `Component` or `TemplateRef` type.
50
- * @param config - Specific {@link ModalOptions | options} for this modal. Global and specific options are merged.
51
- * @returns An instance of {@link Modal}
52
- */
53
- public show<T>(content: string | TemplateRef<any> | { new (...args: any[]): T }, config?: ModalOptions<T>) {
54
- this.modalsCount++;
55
- const combinedConfig = { ...this.defaultConfig, ...config };
56
- combinedConfig.id = config?.id || new Date().getUTCMilliseconds();
57
- this.createLoaders();
58
-
59
- this.addBodyPadding();
60
- if (this.modalsCount === 1) {
61
- this.renderer.addClass(this.document.body, cssClassNames.modalOpen);
62
- }
63
- this.showBackdrop(combinedConfig);
64
- return this.showModal<T>(content, combinedConfig);
65
- }
66
-
67
- /**
68
- * Hide an active modal.
69
- * @param id - Id of modal to hide. If not provided all active modals are hidden.
70
- * @param result - A result to be sent to observers.
71
- */
72
- public hide(id?: number | string, result?: any) {
73
- if (this.modalsCount === 1 || id == null) {
74
- this.hideBackdrop();
75
- this.revertScrollbar();
76
- this.renderer.removeClass(this.document.body, cssClassNames.modalOpen);
77
- }
78
- this.modalsCount = this.modalsCount >= 1 && id != null ? this.modalsCount - 1 : 0;
79
- setTimeout(
80
- () => {
81
- this.hideModal(id, result);
82
- this.removeLoaders(id);
83
- },
84
- //Bug
85
- //Should use combined config but for the moment is not possible to pass it this parameter.
86
- //If config is an instance variable then every newly opened modal will override the config
87
- //resulting in opened modals to get a new configuration
88
- this.defaultConfig.animated ? animationTime.backdrop : 0
89
- );
90
- }
91
-
92
- public getActiveModal(): ModalContainerComponent {
93
- return this.loaders[this.modalsCount - 1].instance as ModalContainerComponent;
94
- }
95
-
96
- private showModal<T>(content: any, combinedConfig: ModalOptions): Modal<T> {
97
- const modalLoader = this.loaders[this.loaders.length - 1];
98
- if (combinedConfig && combinedConfig.providers) {
99
- combinedConfig.providers.forEach((provider) => modalLoader.provide(provider));
100
- }
101
-
102
- const modal = new Modal<any>();
103
- const modalContainerRef = modalLoader
104
- .provide({ provide: ModalOptions, useValue: combinedConfig })
105
- .provide({ provide: Modal, useValue: modal })
106
- .attach(ModalContainerComponent)
107
- .to('body');
108
-
109
- modal.setClass = (newClass: string) => {
110
- if (modalContainerRef.instance) {
111
- modalContainerRef.instance.config.class = newClass;
112
- }
113
- };
114
-
115
- modal.onBeforeHide = new Subject();
116
- modal.onHidden = new Subject();
117
- this.copyEvent(modalLoader.onBeforeHide, modal.onBeforeHide);
118
- this.copyEvent(modalLoader.onHidden, modal.onHidden);
119
- modalContainerRef.show({
120
- content,
121
- animationsEnabled: combinedConfig.animated,
122
- initialState: combinedConfig.initialState,
123
- modalService: this,
124
- id: combinedConfig.id,
125
- });
126
-
127
- if (modalContainerRef.instance) {
128
- modalContainerRef.instance.level = this.modalsCount;
129
- modal.content = modalLoader.getInnerComponent();
130
- modal.id = modalContainerRef.instance.config?.id;
131
- modal.hide = (res) => modalContainerRef.instance?.hide(res);
132
- }
133
-
134
- return modal;
135
- }
136
-
137
- private hideModal(id?: number | string, result?: any): void {
138
- if (id != null) {
139
- const indexToRemove = this.loaders.findIndex((loader) => loader.instance?.config.id === id);
140
- const modalLoader = this.loaders[indexToRemove];
141
- if (modalLoader) {
142
- modalLoader.hide(id, result);
143
- }
144
- } else {
145
- this.loaders.forEach((loader: ComponentLoader<ModalContainerComponent>) => {
146
- if (loader.instance) {
147
- loader.hide(loader.instance.config.id);
148
- }
149
- });
150
- }
151
- }
152
-
153
- private showBackdrop(combinedConfig: ModalOptions): void {
154
- const isBackdropEnabled = combinedConfig.backdrop === true || combinedConfig.backdrop === 'static';
155
- const isBackdropInDOM = this.backdropRef != null;
156
- if (isBackdropEnabled && !isBackdropInDOM) {
157
- this.backdropLoader
158
- .attach(ModalBackdropComponent)
159
- .to('body')
160
- .show({ animationsEnabled: combinedConfig.animated, backdropLoader: this.backdropLoader });
161
- this.backdropRef = this.backdropLoader.componentRef;
162
- }
163
- }
164
-
165
- private hideBackdrop(): void {
166
- if (!this.backdropRef) {
167
- return;
168
- }
169
- this.backdropRef.instance.hide();
170
- this.backdropRef = void 0;
171
- }
172
-
173
- private removeLoaders(id?: number | string): void {
174
- if (id != null) {
175
- const indexToRemove = this.loaders.findIndex((loader) => loader.instance?.config.id === id);
176
- if (indexToRemove >= 0) {
177
- this.loaders.splice(indexToRemove, 1);
178
- this.loaders.forEach((loader: ComponentLoader<ModalContainerComponent>, i: number) => {
179
- if (loader.instance) {
180
- loader.instance.level = i + 1;
181
- }
182
- });
183
- }
184
- } else {
185
- this.loaders.splice(0, this.loaders.length);
186
- }
187
- }
188
-
189
- private addBodyPadding() {
190
- if (this.modalsCount === 1) {
191
- const width = this.getScrollbarWidth();
192
- if (this.isScrollBarPresent(width)) {
193
- this.initialPadding = this.document.body.style.paddingRight;
194
- const actualPadding = parseFloat(window.getComputedStyle(this.document.body).paddingRight);
195
- this.document.body.style.paddingRight = `${actualPadding + width}px`;
196
- }
197
- }
198
- }
199
-
200
- private revertScrollbar() {
201
- this.document.body.style.paddingRight = this.initialPadding;
202
- }
203
-
204
- private getScrollbarWidth(): number {
205
- const measurer = this.document.createElement('div');
206
- measurer.className = 'modal-scrollbar-measure';
207
-
208
- const body = this.document.body;
209
- body.appendChild(measurer);
210
- const width = measurer.getBoundingClientRect().width - measurer.clientWidth;
211
- body.removeChild(measurer);
212
-
213
- return width;
214
- }
215
-
216
- private isScrollBarPresent(scrollbarWidth: number) {
217
- const rect = this.document.body.getBoundingClientRect();
218
- const bodyToViewportGap = window.innerWidth - (rect.left + rect.right);
219
- const uncertainty = 0.1 * scrollbarWidth;
220
- return bodyToViewportGap >= scrollbarWidth - uncertainty;
221
- }
222
-
223
- private createLoaders(): void {
224
- const loader = this.clf.createLoader<ModalContainerComponent>();
225
- this.copyEvent(loader.onBeforeShow, this.onBeforeShow);
226
- this.copyEvent(loader.onShown, this.onShown);
227
- this.copyEvent(loader.onBeforeHide, this.onBeforeHide);
228
- this.copyEvent(loader.onHidden, this.onHidden);
229
- this.loaders.push(loader);
230
- }
231
-
232
- private copyEvent(from: Subject<unknown>, to: Subject<unknown>) {
233
- from.subscribe((data) => {
234
- to.next(data);
235
- });
236
- }
237
- }
@@ -1,11 +0,0 @@
1
- export const cssClassNames = {
2
- backdrop: 'modal-backdrop',
3
- show: 'show',
4
- fade: 'fade',
5
- modalOpen: 'modal-open'
6
- };
7
-
8
- export const animationTime = {
9
- backdrop: 150,
10
- modal: 300,
11
- };
@@ -1,45 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { Subject } from 'rxjs';
3
-
4
- /**
5
- * Modal class.
6
- * @remarks
7
- * This is returned from {@link ModalService.show}.
8
- * @public
9
- */
10
- @Injectable()
11
- export class Modal<T = any> {
12
- /**
13
- * Event that is fired when the modal behind the ref starts hiding.
14
- * @returns
15
- * Modal component instance.
16
- */
17
- onBeforeHide?: Subject<unknown>;
18
- /**
19
- * Event that is fired when the modal behind the ref finishes hiding.
20
- * @returns
21
- * An object containing the id of the closed modal and result.
22
- */
23
- onHidden?: Subject<unknown>;
24
- /**
25
- * Id of this modal.
26
- */
27
- id?: number | string;
28
-
29
- /**
30
- * Reference to a component inside the modal. Null if modal's been created with TemplateRef.
31
- * @remarks
32
- * You can use this to do nasty stuff with opened modal instance.
33
- */
34
- content?: T;
35
-
36
- /**
37
- * Hides the modal
38
- * @param result - A result to the observers.
39
- */
40
- hide: (result?: any) => void = () => void 0;
41
- /**
42
- * Sets new class to modal window.
43
- */
44
- setClass: (newClass: string) => void = () => void 0;
45
- }
@@ -1,10 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
-
3
- @Injectable({
4
- providedIn: 'root'
5
- })
6
- export class ShellStateService {
7
-
8
- constructor() { }
9
-
10
- }
@@ -1,23 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { BehaviorSubject, Observable } from 'rxjs';
3
- import { filter } from 'rxjs/operators';
4
- import { Toast, ToastType, NULL_TOAST } from '../types';
5
-
6
- @Injectable({
7
- providedIn: 'root'
8
- })
9
- export class ToasterService {
10
-
11
- private subject: BehaviorSubject<Toast>;
12
- public toast$: Observable<Toast>;
13
-
14
- constructor() {
15
- this.subject = new BehaviorSubject<Toast>(NULL_TOAST);
16
- this.toast$ = this.subject.asObservable()
17
- .pipe(filter( toast => toast !== null && toast.title !== NULL_TOAST.title ));
18
- }
19
-
20
- public show(type: ToastType, title?: string, body?: string, delay?: number): void {
21
- this.subject.next({ type, title, body, delay } as Toast);
22
- }
23
- }
@@ -1,40 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { IValidationProblemDetails } from '../types';
3
-
4
-
5
- @Injectable({
6
- providedIn: 'root'
7
- })
8
- export class UtilitiesService {
9
- constructor() { }
10
-
11
- public problemDetails?: IValidationProblemDetails;
12
-
13
- public get validationErrors(): string[] {
14
- const messages: string[] = [];
15
- const errors = this.problemDetails && this.problemDetails.errors;
16
- for (const property in errors) {
17
- if (property) {
18
- const propertyMessages = errors[property];
19
- propertyMessages.forEach((message: string) => {
20
- messages.push(message);
21
- });
22
- } else {
23
- Object.values(errors || {}).forEach(message => {
24
- message.forEach(x => {
25
- messages.push(x);
26
- });
27
- });
28
- }
29
- }
30
- return messages;
31
- }
32
-
33
- public getValidationProblemDetails(problemDetails: IValidationProblemDetails): string[] {
34
- this.problemDetails = problemDetails;
35
- if (this.validationErrors.length === 0 && this.problemDetails.title) {
36
- return new Array<string>(1).fill(this.problemDetails.title);
37
- }
38
- return this.validationErrors;
39
- }
40
- }
package/src/lib/tokens.ts DELETED
@@ -1,6 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { IAppLinks, IShellConfig } from './types';
3
-
4
- export const APP_LINKS = new InjectionToken<IAppLinks>('APP_LINKS');
5
- export const APP_NOTIFICATIONS = new InjectionToken<IAppLinks>('APP_NOTIFICATIONS');
6
- export const SHELL_CONFIG = new InjectionToken<IShellConfig>('SHELL_CONFIG');
package/src/lib/types.ts DELETED
@@ -1,210 +0,0 @@
1
- import { Observable } from 'rxjs';
2
-
3
-
4
- export interface IAppNotifications {
5
- messages: Observable<IResultSet<NavLink>>;
6
- inboxAction?: () => void | undefined;
7
- }
8
-
9
- export interface IAppLinks {
10
- public: Observable<NavLink[]>;
11
- main: Observable<NavLink[]>;
12
- profile: Observable<NavLink[]>;
13
- profileActions: Observable<NavLink[]>;
14
- legal: Observable<NavLink[]>;
15
- brand: Observable<NavLink[]>;
16
- notifications?: Observable<NavLink>;
17
- }
18
-
19
-
20
- export class NavLink {
21
- constructor(text: string, path: string, exact: boolean = false, external: boolean = false, icon?: string, data?: any) {
22
- this.text = text;
23
- this.path = path;
24
- this.exact = exact;
25
- this.external = external;
26
- this.icon = icon;
27
- this.data = data;
28
- }
29
- public text: string;
30
- public path: string;
31
- public exact: boolean;
32
- public external: boolean;
33
- public icon: string | undefined;
34
- public type = 'router';
35
- public data: any | undefined;
36
- }
37
-
38
- export class ExternalNavLink extends NavLink {
39
- constructor(text: string, path: string, openInNewTab?: boolean, icon?: string) {
40
- super(text, path, true, openInNewTab, icon);
41
- }
42
- public type = 'external';
43
- }
44
-
45
- export class FragmentNavLink extends NavLink {
46
- constructor(text: string, path: string, icon?: string) {
47
- super(text, path, true, true, icon);
48
- }
49
- public type = 'fragment';
50
- }
51
-
52
- export class NotificationNavLink extends NavLink {
53
- constructor(text: string, path: string, public isRead: boolean, public creationDate?: Date) {
54
- super(text, path, true, false, undefined);
55
- }
56
- }
57
-
58
- export class ViewAction {
59
- public type: string;
60
- public key: string | null;
61
- public param: any;
62
- public icon: string;
63
- public tooltip: string | null;
64
-
65
- constructor(type: string, key: string | null, param: any, icon: string, tooltip: string | null) {
66
- this.type = type;
67
- this.key = key;
68
- this.param = param;
69
- this.icon = icon;
70
- this.tooltip = tooltip;
71
- }
72
- }
73
-
74
- export class ListViewType {
75
- public static Tiles = 'tiles';
76
- public static Table = 'table';
77
- public static Map = 'map';
78
- public static Gallery = 'gallery';
79
- }
80
-
81
- export class RouterViewAction extends ViewAction {
82
- public outlet: string | null = null;
83
- public link: string | null = null;
84
- constructor(icon: string, link: string, outlet: string | null, tooltip: string | null) {
85
- super('router-link', null, null, icon, tooltip);
86
- this.outlet = outlet;
87
- this.link = link;
88
- }
89
- }
90
-
91
-
92
- export class SwitchViewAction extends ViewAction {
93
- constructor(view: string, icon: string, tooltip: string | null) {
94
- super('switch-view', null, view, icon, tooltip);
95
- }
96
- }
97
-
98
- export interface IResultSet<T> {
99
- count: number;
100
- items: T[];
101
- }
102
-
103
- export class HeaderMetaItem {
104
- public key: string | null = null;
105
- public icon: string | null = null;
106
- public text: string | null = null;
107
- }
108
-
109
- export class MenuOption {
110
- constructor(text: string, value: any, description?: string, data?: any, icon?: string) {
111
- this.text = text;
112
- this.value = value;
113
- this.description = description;
114
- this.data = data;
115
- this.icon = icon;
116
- }
117
- public text: string;
118
- public value: any;
119
- public description: string | undefined;
120
- public data: any | undefined;
121
- public icon: string | undefined;
122
- }
123
-
124
- export interface IAddress {
125
- id?: string;
126
- street?: string | null;
127
- streetNumber?: string | null;
128
- city?: string | null;
129
- region?: string | null;
130
- postalCode?: string | null;
131
- country?: string | null;
132
- }
133
-
134
- export interface IShellConfig {
135
- appLogo: string;
136
- appLogoAlt: string;
137
- showHeader: boolean;
138
- showUserNameOnHeader?: boolean;
139
- showAlertsOnHeader?: boolean;
140
- customHeaderComponent?: any;
141
- showFooter: boolean;
142
- customFooterComponent?: any;
143
- fluid: boolean;
144
- langs?: string[];
145
-
146
- }
147
-
148
- export class DefaultShellConfig implements IShellConfig {
149
- appLogo = 'https://tailwindui.com/img/logos/workflow-mark.svg?color=white';
150
- appLogoAlt = 'your app name here';
151
- showHeader = true;
152
- showUserNameOnHeader = false;
153
- showAlertsOnHeader = false;
154
- showFooter = true;
155
- fluid = false;
156
- }
157
-
158
- export enum SCREEN_SIZE {
159
- XS,
160
- SM,
161
- MD,
162
- LG,
163
- XL
164
- }
165
-
166
- export interface IScreenSize {
167
- id: SCREEN_SIZE;
168
- name: string;
169
- css: string;
170
- }
171
-
172
- export enum ToastType {
173
- Info = 'info',
174
- Success = 'success',
175
- Error = 'error',
176
- Warning = 'warning'
177
- }
178
-
179
- export const NULL_TOAST = { title : '_____NULL_____' } as Toast;
180
-
181
- export interface Toast {
182
- type: ToastType;
183
- title: string;
184
- body: string;
185
- delay: number;
186
- }
187
-
188
- export enum SidePaneSize {
189
- Default = '',
190
- Small25 = '25%',
191
- Medium50 = '50%',
192
- Large75 = '75%'
193
- }
194
-
195
- export enum SidePaneOverlayType {
196
- Default = '',
197
- None = '-opacity-0',
198
- Light = '',
199
- Dark = '-opacity-50'
200
- }
201
-
202
-
203
- export interface IValidationProblemDetails {
204
- type?: string | undefined;
205
- title?: string | undefined;
206
- status?: number | undefined;
207
- detail?: string | undefined;
208
- instance?: string | undefined;
209
- errors?: { [key: string]: string[]; } | undefined;
210
- }
package/src/test.ts DELETED
@@ -1,28 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'zone.js';
4
- import 'zone.js/testing';
5
- import { getTestBed } from '@angular/core/testing';
6
- import {
7
- BrowserDynamicTestingModule,
8
- platformBrowserDynamicTesting
9
- } from '@angular/platform-browser-dynamic/testing';
10
-
11
- declare const require: {
12
- context(path: string, deep?: boolean, filter?: RegExp): {
13
- keys(): string[];
14
- <T>(id: string): T;
15
- };
16
- };
17
-
18
- // First, initialize the Angular testing environment.
19
- getTestBed().initTestEnvironment(
20
- BrowserDynamicTestingModule,
21
- platformBrowserDynamicTesting(), {
22
- teardown: { destroyAfterEach: false }
23
- }
24
- );
25
- // Then we find all the tests.
26
- const context = require.context('./', true, /\.spec\.ts$/);
27
- // And load the modules.
28
- context.keys().map(context);
package/tsconfig.lib.json DELETED
@@ -1,26 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/lib",
6
- "target": "es2015",
7
- "declaration": true,
8
- "declarationMap": true,
9
- "inlineSources": true,
10
- "types": [],
11
- "lib": [
12
- "dom",
13
- "es2018"
14
- ]
15
- },
16
- "angularCompilerOptions": {
17
- "compilationMode": "partial",
18
- "skipTemplateCodegen": true,
19
- "strictMetadataEmit": true,
20
- "enableResourceInlining": true
21
- },
22
- "exclude": [
23
- "src/test.ts",
24
- "**/*.spec.ts"
25
- ]
26
- }
@@ -1,10 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.lib.json",
4
- "compilerOptions": {
5
- "declarationMap": false
6
- },
7
- "angularCompilerOptions": {
8
- "compilationMode": "partial"
9
- }
10
- }
@@ -1,17 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/spec",
6
- "types": [
7
- "jasmine"
8
- ]
9
- },
10
- "files": [
11
- "src/test.ts"
12
- ],
13
- "include": [
14
- "**/*.spec.ts",
15
- "**/*.d.ts"
16
- ]
17
- }
package/tslint.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "../../tslint.json",
3
- "rules": {
4
- "directive-selector": [
5
- true,
6
- "attribute",
7
- "lib",
8
- "camelCase"
9
- ],
10
- "component-selector": [
11
- true,
12
- "element",
13
- "lib",
14
- "kebab-case"
15
- ]
16
- }
17
- }