@indice/ng-components 0.2.138-beta → 0.2.139

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 (226) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +4 -4
  3. package/karma.conf.js +44 -0
  4. package/ng-package.json +10 -0
  5. package/package.json +18 -9
  6. package/scripts/css-bundle.ts +33 -0
  7. package/src/_styles.css +36 -0
  8. package/src/_tests/utilities.service.spec.ts +16 -0
  9. package/src/assets/styles/avatar-initials.css +37 -0
  10. package/src/assets/styles/base.css +46 -0
  11. package/src/assets/styles/cards.css +71 -0
  12. package/src/assets/styles/collapsible-panel.css +25 -0
  13. package/src/assets/styles/components.css +34 -0
  14. package/src/assets/styles/date-picker.component.css +0 -0
  15. package/src/assets/styles/drop-down-menu.css +50 -0
  16. package/src/assets/styles/form-layout.css +49 -0
  17. package/{_styles.css → src/assets/styles/indice-ng-icons-inline.css} +2286 -3504
  18. package/src/assets/styles/list-view-empty-state.css +0 -0
  19. package/src/assets/styles/list-view.css +64 -0
  20. package/{modal.css → src/assets/styles/modal.css} +157 -157
  21. package/src/assets/styles/model-view-layout.css +45 -0
  22. package/src/assets/styles/nav-links.css +35 -0
  23. package/src/assets/styles/notifications-indicator.component.css +43 -0
  24. package/src/assets/styles/pager.css +29 -0
  25. package/src/assets/styles/shell-layout.css +232 -0
  26. package/src/assets/styles/side-pane.css +46 -0
  27. package/src/assets/styles/side-view-layout.css +58 -0
  28. package/src/assets/styles/toast.css +72 -0
  29. package/src/assets/styles/toggle.css +26 -0
  30. package/src/assets/styles/view-layout.css +58 -0
  31. package/src/lib/controls/avatar-initials/avatar-initials.component.html +3 -0
  32. package/src/lib/controls/avatar-initials/avatar-initials.component.ts +47 -0
  33. package/src/lib/controls/collapsible-panel/collapsible-panel.component.html +15 -0
  34. package/src/lib/controls/collapsible-panel/collapsible-panel.component.ts +16 -0
  35. package/src/lib/controls/date-picker/date-picker.component.html +133 -0
  36. package/src/lib/controls/date-picker/date-picker.component.ts +258 -0
  37. package/src/lib/controls/drop-down-menu/drop-down-menu.component.html +61 -0
  38. package/src/lib/controls/drop-down-menu/drop-down-menu.component.ts +59 -0
  39. package/src/lib/controls/kpi-tile/kpi-tile.component.html +18 -0
  40. package/src/lib/controls/kpi-tile/kpi-tile.component.ts +26 -0
  41. package/src/lib/controls/list-view/list-column.component.ts +10 -0
  42. package/src/lib/controls/list-view/list-details-section.component.ts +8 -0
  43. package/src/lib/controls/list-view/list-tile.component.ts +8 -0
  44. package/src/lib/controls/list-view/list-view-empty-state.component.html +20 -0
  45. package/src/lib/controls/list-view/list-view-empty-state.component.ts +19 -0
  46. package/src/lib/controls/list-view/list-view.component.html +151 -0
  47. package/src/lib/controls/list-view/list-view.component.ts +146 -0
  48. package/src/lib/controls/nav-links-list/nav-links-list.component.html +27 -0
  49. package/src/lib/controls/nav-links-list/nav-links-list.component.ts +25 -0
  50. package/src/lib/controls/notifications-indicator/notifications-indicator.component.html +78 -0
  51. package/src/lib/controls/notifications-indicator/notifications-indicator.component.ts +75 -0
  52. package/src/lib/controls/pager/pager.component.html +33 -0
  53. package/src/lib/controls/pager/pager.component.ts +106 -0
  54. package/src/lib/controls/side-pane/side-pane.component.html +10 -0
  55. package/src/lib/controls/side-pane/side-pane.component.ts +59 -0
  56. package/src/lib/controls/skeleton-loader/skeleton-loader.component.html +112 -0
  57. package/src/lib/controls/skeleton-loader/skeleton-loader.component.ts +20 -0
  58. package/src/lib/controls/toaster/toaster-container.component.html +1 -0
  59. package/src/lib/controls/toaster/toaster-container.component.ts +27 -0
  60. package/src/lib/controls/toaster/toaster.component.html +103 -0
  61. package/src/lib/controls/toaster/toaster.component.ts +26 -0
  62. package/src/lib/controls/toggle/toggle.component.html +15 -0
  63. package/src/lib/controls/toggle/toggle.component.ts +58 -0
  64. package/src/lib/directives/click-outside.directive.ts +196 -0
  65. package/src/lib/directives/dynamic-component-host.directive.ts +7 -0
  66. package/src/lib/directives/screen-size.directive.ts +67 -0
  67. package/src/lib/helpers/base-list.component.ts +204 -0
  68. package/src/lib/icons.ts +39 -0
  69. package/src/lib/layouts/shell/shell-footer/shell-footer.component.html +71 -0
  70. package/src/lib/layouts/shell/shell-footer/shell-footer.component.ts +14 -0
  71. package/src/lib/layouts/shell/shell-header/shell-header.component.html +199 -0
  72. package/src/lib/layouts/shell/shell-header/shell-header.component.ts +111 -0
  73. package/src/lib/layouts/shell/shell-layout/shell-layout.component.html +36 -0
  74. package/src/lib/layouts/shell/shell-layout/shell-layout.component.ts +91 -0
  75. package/src/lib/layouts/views/form-layout/form-layout.component.html +67 -0
  76. package/src/lib/layouts/views/form-layout/form-layout.component.ts +66 -0
  77. package/src/lib/layouts/views/model-view-layout/model-view-layout.component.html +43 -0
  78. package/src/lib/layouts/views/model-view-layout/model-view-layout.component.ts +37 -0
  79. package/src/lib/layouts/views/side-view-layout/side-view-layout.component.html +36 -0
  80. package/src/lib/layouts/views/side-view-layout/side-view-layout.component.ts +67 -0
  81. package/src/lib/layouts/views/view-layout/view-layout.component.html +68 -0
  82. package/src/lib/layouts/views/view-layout/view-layout.component.ts +82 -0
  83. package/src/lib/ng-components.module.ts +135 -0
  84. package/src/lib/pages/auth/auth-callback/auth-callback.component.html +1 -0
  85. package/src/lib/pages/auth/auth-callback/auth-callback.component.ts +22 -0
  86. package/src/lib/pages/auth/auth-renew/auth-renew.component.ts +20 -0
  87. package/src/lib/pages/auth/logged-out/logged-out.component.html +1 -0
  88. package/src/lib/pages/auth/logged-out/logged-out.component.ts +22 -0
  89. package/src/lib/pages/http-status/error/error.component.html +13 -0
  90. package/src/lib/pages/http-status/error/error.component.ts +13 -0
  91. package/src/lib/pages/http-status/page-not-found/page-not-found.component.html +14 -0
  92. package/src/lib/pages/http-status/page-not-found/page-not-found.component.ts +14 -0
  93. package/src/lib/pages/http-status/unauthorized/unauthorized.component.html +15 -0
  94. package/src/lib/pages/http-status/unauthorized/unauthorized.component.ts +11 -0
  95. package/src/lib/pipes/address.pipe.ts +17 -0
  96. package/src/lib/pipes/duration-format.pipe.ts +67 -0
  97. package/src/lib/services/component-loader/component-loader-options.class.ts +31 -0
  98. package/src/lib/services/component-loader/component-loader.class.ts +226 -0
  99. package/src/lib/services/component-loader/component-loader.factory.ts +27 -0
  100. package/src/lib/services/component-loader/content-ref.class.ts +10 -0
  101. package/src/lib/services/interceptors/bad-request.interceptor.ts +34 -0
  102. package/src/lib/services/modal-service/modal-backdrop-component.ts +40 -0
  103. package/src/lib/services/modal-service/modal-container-component.ts +125 -0
  104. package/src/lib/services/modal-service/modal-options.class.ts +92 -0
  105. package/src/lib/services/modal-service/modal-service.ts +237 -0
  106. package/src/lib/services/modal-service/modal-styles.class.ts +11 -0
  107. package/src/lib/services/modal-service/modal.class.ts +45 -0
  108. package/src/lib/services/shell-state-service.service.ts +10 -0
  109. package/src/lib/services/toaster.service.ts +23 -0
  110. package/src/lib/services/utilities.service.ts +40 -0
  111. package/src/lib/tokens.ts +6 -0
  112. package/src/lib/types.ts +210 -0
  113. package/{public-api.d.ts → src/public-api.ts} +60 -43
  114. package/src/test.ts +28 -0
  115. package/tsconfig.lib.json +26 -0
  116. package/tsconfig.lib.prod.json +10 -0
  117. package/tsconfig.spec.json +17 -0
  118. package/tslint.json +17 -0
  119. package/webpack.config.js +36 -0
  120. package/bundles/indice-ng-components.umd.js +0 -3784
  121. package/bundles/indice-ng-components.umd.js.map +0 -1
  122. package/esm2015/indice-ng-components.js +0 -5
  123. package/esm2015/lib/controls/avatar-initials/avatar-initials.component.js +0 -51
  124. package/esm2015/lib/controls/collapsible-panel/collapsible-panel.component.js +0 -23
  125. package/esm2015/lib/controls/date-picker/date-picker.component.js +0 -269
  126. package/esm2015/lib/controls/drop-down-menu/drop-down-menu.component.js +0 -72
  127. package/esm2015/lib/controls/kpi-tile/kpi-tile.component.js +0 -39
  128. package/esm2015/lib/controls/list-view/list-column.component.js +0 -25
  129. package/esm2015/lib/controls/list-view/list-details-section.component.js +0 -17
  130. package/esm2015/lib/controls/list-view/list-tile.component.js +0 -17
  131. package/esm2015/lib/controls/list-view/list-view-empty-state.component.js +0 -32
  132. package/esm2015/lib/controls/list-view/list-view.component.js +0 -186
  133. package/esm2015/lib/controls/pager/pager.component.js +0 -133
  134. package/esm2015/lib/controls/side-pane/side-pane.component.js +0 -76
  135. package/esm2015/lib/controls/skeleton-loader/skeleton-loader.component.js +0 -29
  136. package/esm2015/lib/controls/toaster/toaster-container.component.js +0 -31
  137. package/esm2015/lib/controls/toaster/toaster.component.js +0 -34
  138. package/esm2015/lib/controls/toggle/toggle.component.js +0 -68
  139. package/esm2015/lib/directives/click-outside.directive.js +0 -189
  140. package/esm2015/lib/directives/dynamic-component-host.directive.js +0 -17
  141. package/esm2015/lib/helpers/base-list.component.js +0 -182
  142. package/esm2015/lib/icons.js +0 -32
  143. package/esm2015/lib/layouts/shell/shell-footer/shell-footer.component.js +0 -22
  144. package/esm2015/lib/layouts/shell/shell-header/shell-header.component.js +0 -142
  145. package/esm2015/lib/layouts/shell/shell-layout/shell-layout.component.js +0 -101
  146. package/esm2015/lib/layouts/views/form-layout/form-layout.component.js +0 -86
  147. package/esm2015/lib/layouts/views/model-view-layout/model-view-layout.component.js +0 -55
  148. package/esm2015/lib/layouts/views/side-view-layout/side-view-layout.component.js +0 -101
  149. package/esm2015/lib/layouts/views/view-layout/view-layout.component.js +0 -110
  150. package/esm2015/lib/ng-components.module.js +0 -220
  151. package/esm2015/lib/pages/auth/auth-callback/auth-callback.component.js +0 -34
  152. package/esm2015/lib/pages/auth/auth-renew/auth-renew.component.js +0 -31
  153. package/esm2015/lib/pages/auth/logged-out/logged-out.component.js +0 -32
  154. package/esm2015/lib/pages/http-status/error/error.component.js +0 -20
  155. package/esm2015/lib/pages/http-status/page-not-found/page-not-found.component.js +0 -18
  156. package/esm2015/lib/pages/http-status/unauthorized/unauthorized.component.js +0 -17
  157. package/esm2015/lib/pipes/address.pipe.js +0 -21
  158. package/esm2015/lib/pipes/duration-format.pipe.js +0 -64
  159. package/esm2015/lib/pipes/obs-with-status.pipe.js +0 -26
  160. package/esm2015/lib/services/component-loader/component-loader-options.class.js +0 -8
  161. package/esm2015/lib/services/component-loader/component-loader.class.js +0 -192
  162. package/esm2015/lib/services/component-loader/component-loader.factory.js +0 -32
  163. package/esm2015/lib/services/component-loader/content-ref.class.js +0 -13
  164. package/esm2015/lib/services/modal-service/modal-backdrop-component.js +0 -44
  165. package/esm2015/lib/services/modal-service/modal-container-component.js +0 -128
  166. package/esm2015/lib/services/modal-service/modal-options.class.js +0 -35
  167. package/esm2015/lib/services/modal-service/modal-service.js +0 -220
  168. package/esm2015/lib/services/modal-service/modal-styles.class.js +0 -11
  169. package/esm2015/lib/services/modal-service/modal.class.js +0 -27
  170. package/esm2015/lib/services/toaster.service.js +0 -24
  171. package/esm2015/lib/tokens.js +0 -4
  172. package/esm2015/lib/types.js +0 -114
  173. package/esm2015/public-api.js +0 -53
  174. package/fesm2015/indice-ng-components.js +0 -3247
  175. package/fesm2015/indice-ng-components.js.map +0 -1
  176. package/indice-ng-components.d.ts +0 -5
  177. package/lib/controls/avatar-initials/avatar-initials.component.d.ts +0 -14
  178. package/lib/controls/collapsible-panel/collapsible-panel.component.d.ts +0 -10
  179. package/lib/controls/date-picker/date-picker.component.d.ts +0 -48
  180. package/lib/controls/drop-down-menu/drop-down-menu.component.d.ts +0 -25
  181. package/lib/controls/kpi-tile/kpi-tile.component.d.ts +0 -13
  182. package/lib/controls/list-view/list-column.component.d.ts +0 -9
  183. package/lib/controls/list-view/list-details-section.component.d.ts +0 -7
  184. package/lib/controls/list-view/list-tile.component.d.ts +0 -7
  185. package/lib/controls/list-view/list-view-empty-state.component.d.ts +0 -11
  186. package/lib/controls/list-view/list-view.component.d.ts +0 -55
  187. package/lib/controls/pager/pager.component.d.ts +0 -36
  188. package/lib/controls/side-pane/side-pane.component.d.ts +0 -18
  189. package/lib/controls/skeleton-loader/skeleton-loader.component.d.ts +0 -11
  190. package/lib/controls/toaster/toaster-container.component.d.ts +0 -13
  191. package/lib/controls/toaster/toaster.component.d.ts +0 -15
  192. package/lib/controls/toggle/toggle.component.d.ts +0 -19
  193. package/lib/directives/click-outside.directive.d.ts +0 -40
  194. package/lib/directives/dynamic-component-host.directive.d.ts +0 -9
  195. package/lib/helpers/base-list.component.d.ts +0 -42
  196. package/lib/icons.d.ts +0 -30
  197. package/lib/layouts/shell/shell-footer/shell-footer.component.d.ts +0 -8
  198. package/lib/layouts/shell/shell-header/shell-header.component.d.ts +0 -45
  199. package/lib/layouts/shell/shell-layout/shell-layout.component.d.ts +0 -27
  200. package/lib/layouts/views/form-layout/form-layout.component.d.ts +0 -25
  201. package/lib/layouts/views/model-view-layout/model-view-layout.component.d.ts +0 -25
  202. package/lib/layouts/views/side-view-layout/side-view-layout.component.d.ts +0 -28
  203. package/lib/layouts/views/view-layout/view-layout.component.d.ts +0 -31
  204. package/lib/ng-components.module.d.ts +0 -45
  205. package/lib/pages/auth/auth-callback/auth-callback.component.d.ts +0 -13
  206. package/lib/pages/auth/auth-renew/auth-renew.component.d.ts +0 -12
  207. package/lib/pages/auth/logged-out/logged-out.component.d.ts +0 -12
  208. package/lib/pages/http-status/error/error.component.d.ts +0 -8
  209. package/lib/pages/http-status/page-not-found/page-not-found.component.d.ts +0 -8
  210. package/lib/pages/http-status/unauthorized/unauthorized.component.d.ts +0 -8
  211. package/lib/pipes/address.pipe.d.ts +0 -8
  212. package/lib/pipes/duration-format.pipe.d.ts +0 -8
  213. package/lib/pipes/obs-with-status.pipe.d.ts +0 -13
  214. package/lib/services/component-loader/component-loader-options.class.d.ts +0 -30
  215. package/lib/services/component-loader/component-loader.class.d.ts +0 -92
  216. package/lib/services/component-loader/component-loader.factory.d.ts +0 -24
  217. package/lib/services/component-loader/content-ref.class.d.ts +0 -12
  218. package/lib/services/modal-service/modal-backdrop-component.d.ts +0 -20
  219. package/lib/services/modal-service/modal-container-component.d.ts +0 -33
  220. package/lib/services/modal-service/modal-options.class.d.ts +0 -81
  221. package/lib/services/modal-service/modal-service.d.ts +0 -58
  222. package/lib/services/modal-service/modal-styles.class.d.ts +0 -10
  223. package/lib/services/modal-service/modal.class.d.ts +0 -43
  224. package/lib/services/toaster.service.d.ts +0 -11
  225. package/lib/tokens.d.ts +0 -4
  226. package/lib/types.d.ts +0 -135
@@ -0,0 +1,151 @@
1
+ <div class="px-2">
2
+
3
+ <lib-pager *ngIf="showPager"
4
+ [page]="page"
5
+ [page-size]="pageSize"
6
+ [count]="count"
7
+ [sort-options]="sortOptions"
8
+ [sort]="sort"
9
+ [sort-dir]="sortdir"
10
+ [busy]="busy"
11
+ (pageChanged)="emitPageChanged($event)"
12
+ (pageSizeChanged)="emitPageSizeChanged($event)"
13
+ (sortChanged)="emitSortChanged($event)"
14
+ (sortdirChanged)="emitSortdirChanged($event)">
15
+ </lib-pager>
16
+ </div>
17
+
18
+ <ng-container *ngIf="!busy && items && items.length === 0">
19
+ <div class="cards-deck-1">
20
+ <lib-list-view-empty-state></lib-list-view-empty-state>
21
+ </div>
22
+ </ng-container>
23
+
24
+ <ng-container [ngSwitch]="view">
25
+
26
+ <ng-container *ngSwitchCase="'tiles'">
27
+ <div [class]="tilesDeckClass">
28
+
29
+ <lib-skeleton-loader *ngIf="busy" [count]="5" [type]="'tiles'"></lib-skeleton-loader>
30
+
31
+ <ng-container *ngIf="items && items.length > 0">
32
+ <ng-container *ngFor="let item of items">
33
+ <span *ngIf="!tileTemplate || !tileTemplate.template">template missing..</span>
34
+ <ng-template [ngTemplateOutlet]="tileTemplate.template"
35
+ [ngTemplateOutletContext]="{ $implicit: item }"></ng-template>
36
+ </ng-container>
37
+ </ng-container>
38
+
39
+ </div>
40
+ </ng-container>
41
+
42
+
43
+ <!-- *ngSwitchCase="'gallery'" -->
44
+ <ng-container *ngSwitchCase="'gallery'">
45
+ <ul role="list" [class]="tilesDeckClass">
46
+
47
+ <lib-skeleton-loader *ngIf="busy" [count]="5" [type]="'tiles'"></lib-skeleton-loader>
48
+
49
+ <ng-container *ngIf="!busy && items && items.length > 0">
50
+ <ng-container *ngFor="let item of items">
51
+ <span *ngIf="!tileTemplate || !tileTemplate.template">template missing..</span>
52
+ <ng-template [ngTemplateOutlet]="tileTemplate.template"
53
+ [ngTemplateOutletContext]="{ $implicit: item }"></ng-template>
54
+ </ng-container>
55
+ </ng-container>
56
+ </ul>
57
+ </ng-container>
58
+
59
+ <!-- *ngSwitchCase="'table'" -->
60
+ <ng-container *ngSwitchDefault>
61
+
62
+ <div class="list-view-container">
63
+ <div class="list-view-container-inner">
64
+ <table class="list-view-table">
65
+ <thead class="list-view-thead">
66
+ <tr>
67
+ <ng-container *ngIf="detailsSectionSupported">
68
+ <th class="list-view-th-details"></th>
69
+ </ng-container>
70
+ <ng-container *ngFor="let col of columns">
71
+ <th scope="col"
72
+ [class]="col.fullWidth ? fullWidthTHClass : 'list-view-th'">
73
+ {{col.title}}
74
+ </th>
75
+ </ng-container>
76
+ </tr>
77
+ </thead>
78
+ <tbody class="list-view-tbody" *ngIf="busy">
79
+ <ng-container *ngFor="let item of loaderItems;let i=index">
80
+ <tr class="list-view-tr">
81
+ <ng-container *ngIf="detailsSectionSupported">
82
+ <td class="list-view-td-details"
83
+ *ngIf="detailsSectionPropertyCount !== null ? item[detailsSectionPropertyCount] !== 0 : true; else hiddenDetailsButton">
84
+ <button disabled
85
+ type="button"
86
+ class="expand-collapse-button">
87
+ <!-- Heroicon name: solid/plus -->
88
+ <i [class]="item.detailsExpanded ? collapseIcon : expandIcon"></i>
89
+ </button>
90
+ </td>
91
+ <ng-template #hiddenDetailsButton>
92
+ <td class="list-view-td-details"></td>
93
+ </ng-template>
94
+ </ng-container>
95
+ <td *ngFor="let col of columns"
96
+ [class]="col.fullWidth ? fullWidthTDClass : 'list-view-td'">
97
+ <div class="w-full animate-pulse h-8 bg-gray-200 rounded"></div>
98
+ </td>
99
+ </tr>
100
+ <ng-container *ngIf="detailsSectionSupported">
101
+ <tr *ngIf="item.detailsExpanded">
102
+ <td [colSpan]="columns.length + 1"
103
+ class="list-view-td bg-gray-100">
104
+ <ng-template [ngTemplateOutlet]="detailsTemplate.template"
105
+ [ngTemplateOutletContext]="{ $implicit: item }"></ng-template>
106
+ </td>
107
+ </tr>
108
+ </ng-container>
109
+ </ng-container>
110
+ </tbody>
111
+ <tbody class="list-view-tbody" *ngIf="!busy">
112
+ <ng-container *ngFor="let item of items;let i=index">
113
+ <tr class="list-view-tr">
114
+ <ng-container *ngIf="detailsSectionSupported">
115
+ <td class="list-view-td-details"
116
+ *ngIf="detailsSectionPropertyCount !== null ? item[detailsSectionPropertyCount] !== 0 : true; else hiddenDetailsButton">
117
+ <button (click)="toggleDetails(item)"
118
+ type="button"
119
+ class="expand-collapse-button">
120
+ <!-- Heroicon name: solid/plus -->
121
+ <i [class]="item.detailsExpanded ? collapseIcon : expandIcon"></i>
122
+ </button>
123
+ </td>
124
+ <ng-template #hiddenDetailsButton>
125
+ <td class="list-view-td-details"></td>
126
+ </ng-template>
127
+ </ng-container>
128
+ <td *ngFor="let col of columns"
129
+ [class]="col.fullWidth ? fullWidthTDClass : 'list-view-td'">
130
+ <ng-template [ngTemplateOutlet]="col.template"
131
+ [ngTemplateOutletContext]="{ $implicit: item }"></ng-template>
132
+ </td>
133
+ </tr>
134
+ <ng-container *ngIf="detailsSectionSupported">
135
+ <tr *ngIf="item.detailsExpanded">
136
+ <td [colSpan]="columns.length + 1"
137
+ class="list-view-td bg-gray-100">
138
+ <ng-template [ngTemplateOutlet]="detailsTemplate.template"
139
+ [ngTemplateOutletContext]="{ $implicit: item }"></ng-template>
140
+ </td>
141
+ </tr>
142
+ </ng-container>
143
+ </ng-container>
144
+ </tbody>
145
+ </table>
146
+ </div>
147
+ </div>
148
+ </ng-container>
149
+ </ng-container>
150
+
151
+ <ng-content></ng-content>
@@ -0,0 +1,146 @@
1
+ import { Component, ContentChild, ContentChildren, EventEmitter, Input, Output, QueryList, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { MenuOption, ListViewType } from '../../types';
3
+ import { ListTileComponent } from './list-tile.component';
4
+ import { ListColumnComponent } from './list-column.component';
5
+ import { ListDetailsSectionComponent } from './list-details-section.component';
6
+ import { Icons } from '../../icons';
7
+
8
+ @Component({
9
+ selector: 'lib-list-view',
10
+ templateUrl: './list-view.component.html'
11
+ })
12
+ export class ListViewComponent implements OnChanges {
13
+ // BUSY STATE
14
+ @Input() busy = false;
15
+ public expandIcon = Icons.Expand;
16
+ public collapseIcon = Icons.Collapse;
17
+ // DATA SOURCE!
18
+ @Input() items: any[] | null | undefined;
19
+ // tslint:disable-next-line:no-input-rename
20
+ @Input('show-pager') showPager = true;
21
+
22
+ // PAGING - pass through for pager component
23
+ @Input() count: number | null = null;
24
+ @Input() page = 1;
25
+ // tslint:disable-next-line:no-input-rename
26
+ @Input('page-size') pageSize = 20;
27
+ // tslint:disable-next-line:no-input-rename
28
+ @Input('page-size-options') pageSizeOptions: MenuOption[] = [];
29
+ @Output() pageChanged: EventEmitter<number> = new EventEmitter<number>();
30
+ @Output() pageSizeChanged: EventEmitter<number> = new EventEmitter<number>();
31
+ @Output() detailsOpened: EventEmitter<{ item: any, open: boolean }> = new EventEmitter<{ item: any, open: boolean }>();
32
+
33
+ public tableViewSupported = false;
34
+ private multipleFullWidth = false;
35
+ public fullWidthTHClass = 'list-view-th-full';
36
+ public fullWidthTDClass = 'list-view-td-full';
37
+ public tilesViewSupported = false;
38
+ public detailsSectionSupported = false;
39
+ public loaderItems: any[] = [];
40
+
41
+ // DETAILS SECTION
42
+ // Check if details section and button should be displayed according to the count of the value given
43
+ // tslint:disable-next-line:no-input-rename
44
+ @Input('details-section-property-count') detailsSectionPropertyCount: string | null = null;
45
+
46
+
47
+ // SORTING - pass through for pager component
48
+ // tslint:disable-next-line:no-input-rename
49
+ @Input('sort-options') sortOptions: MenuOption[] = [];
50
+ @Input() sort: string | null = null;
51
+ // tslint:disable-next-line:no-input-rename
52
+ @Input('sort-dir') sortdir: string | null = '-';
53
+ @Output() sortChanged: EventEmitter<string> = new EventEmitter<string>();
54
+ @Output() sortdirChanged: EventEmitter<string> = new EventEmitter<string>();
55
+
56
+ @Input() view = ListViewType.Table;
57
+
58
+ // COLUMNS
59
+ public columns: any[] = [];
60
+ @ContentChildren(ListColumnComponent, { read: ListColumnComponent })
61
+ set cols(refs: QueryList<ListColumnComponent>) {
62
+ this.columns = refs?.toArray();
63
+ if (this.columns && this.columns.length > 0) {
64
+ this.tableViewSupported = true;
65
+ }
66
+ this.multipleFullWidth = this.columns.filter(c => c.fullWidth).length > 1;
67
+ this.fullWidthTHClass = this.multipleFullWidth ? 'list-view-th-half' : 'list-view-th-full';
68
+ this.fullWidthTDClass = this.multipleFullWidth ? 'list-view-td-half' : 'list-view-td-full';
69
+ }
70
+
71
+ public tilesDeckClass = 'cards-deck-4';
72
+ // tslint:disable-next-line:no-input-rename
73
+ @Input('tiles-count') tilesCount = 4;
74
+
75
+ public tileTemplate: any | null | undefined = null;
76
+ @ContentChild(ListTileComponent, { read: ListTileComponent })
77
+ set tiles(ref: ListTileComponent) {
78
+ this.tileTemplate = ref;
79
+ if (this.tileTemplate) {
80
+ this.tilesViewSupported = true;
81
+ }
82
+ }
83
+
84
+ public detailsTemplate: any | null | undefined = null;
85
+ @ContentChild(ListDetailsSectionComponent, { read: ListDetailsSectionComponent })
86
+ set details(ref: ListDetailsSectionComponent) {
87
+ this.detailsTemplate = ref;
88
+ if (this.detailsTemplate) {
89
+ this.detailsSectionSupported = true;
90
+ }
91
+ }
92
+
93
+ constructor() {
94
+ for (let i = 0; i < 5; i++) {
95
+ this.loaderItems.push({});
96
+ }
97
+ }
98
+
99
+ ngOnChanges(changes: SimpleChanges): void {
100
+ const tilesCountChange = changes['tiles-count'] || changes.tilesCount;
101
+ if (tilesCountChange) {
102
+ this.setTilesDeckClass(tilesCountChange.currentValue);
103
+ }
104
+ }
105
+
106
+ // events
107
+ public emitPageChanged($event: number): void {
108
+ this.pageChanged.emit($event);
109
+ }
110
+
111
+ public emitPageSizeChanged($event: number): void {
112
+ this.pageSizeChanged.emit($event);
113
+ }
114
+
115
+ public emitSortChanged($event: string): void {
116
+ this.sortChanged.emit($event);
117
+ }
118
+ public emitSortdirChanged($event: string): void {
119
+ this.sortdirChanged.emit($event);
120
+ }
121
+
122
+ public toggleDetails(item: any): void {
123
+ item.detailsExpanded = !item.detailsExpanded;
124
+ this.detailsOpened.emit({ item, open: item.detailsExpanded });
125
+ }
126
+
127
+ // helpers
128
+ private setTilesDeckClass(tiles: number): void {
129
+ if (tiles >= 1 && tiles <= 4) {
130
+ this.tilesDeckClass =
131
+ this.view !== ListViewType.Gallery
132
+ ? `cards-deck-${tiles}`
133
+ : this.items && this.items.length > 0
134
+ ? `gallery-deck-${tiles}`
135
+ : 'gallery-deck';
136
+ } else {
137
+ this.tilesDeckClass =
138
+ this.view !== ListViewType.Gallery
139
+ ? 'cards-deck-3'
140
+ : this.items && this.items.length > 0
141
+ ? 'gallery-deck-3'
142
+ : 'gallery-deck';
143
+ }
144
+ }
145
+
146
+ }
@@ -0,0 +1,27 @@
1
+ <div [class]="containerClass">
2
+ <ng-container *ngFor="let link of links | async">
3
+ <ng-container [ngSwitch]="link.type">
4
+ <a *ngSwitchCase="'router'"
5
+ href="#"
6
+ [routerLink]="[link.path]"
7
+ [routerLinkActive]="navLinkActiveClass"
8
+ [routerLinkActiveOptions]="{ exact: link.exact }"
9
+ [class]="navLinkClass">
10
+ {{ link.text }}
11
+ </a>
12
+ <a *ngSwitchCase="'external'"
13
+ [href]="link.path"
14
+ [attr.target]="link.external ? '_blank' : '_self'"
15
+ class="nav-link">
16
+ {{ link.text }}
17
+ </a>
18
+ <a *ngSwitchCase="'fragment'"
19
+ routerLink="."
20
+ [fragment]="link.path"
21
+ [class.active]="(activeFragment | async) === link.path"
22
+ class="nav-link">
23
+ {{ link.text }}
24
+ </a>
25
+ </ng-container>
26
+ </ng-container>
27
+ </div>
@@ -0,0 +1,25 @@
1
+ import { Observable } from 'rxjs';
2
+ import { Component, Input, OnInit } from '@angular/core';
3
+ import { NavLink } from '../../types';
4
+
5
+ @Component({
6
+ selector: 'lib-nav-links-list',
7
+ templateUrl: './nav-links-list.component.html'
8
+ })
9
+ export class NavLinksListComponent implements OnInit {
10
+
11
+ @Input() links: Observable<NavLink[]> | undefined;
12
+ // tslint:disable-next-line:no-input-rename
13
+ @Input('active-fragment') activeFragment: Observable<string> | undefined;
14
+ // tslint:disable-next-line:no-input-rename
15
+ @Input('link-class') navLinkClass: string | string = 'nav-link';
16
+ // tslint:disable-next-line:no-input-rename
17
+ @Input('link-active-class') navLinkActiveClass: string | string[] = 'nav-link-active';
18
+ // tslint:disable-next-line:no-input-rename
19
+ @Input('container-class') containerClass: string | string[] = '';
20
+ constructor() { }
21
+
22
+ ngOnInit(): void {
23
+ }
24
+
25
+ }
@@ -0,0 +1,78 @@
1
+ <div class="relative"
2
+ (clickOutside)="onClickOutside($event)">
3
+ <!-- Notifications Button -->
4
+ <button type="button"
5
+ (click)="doInboxAction()"
6
+ aria-expanded="false"
7
+ aria-haspopup="true">
8
+ <span class="sr-only">View notifications</span>
9
+ <span class="avatar-container">
10
+ <span class="avatar-text">
11
+ <i class="ms-Icon"
12
+ [class.ms-Icon--MessageFill]="unreadCount > 0"
13
+ [class.text-sky-400]="unreadCount > 0"
14
+ [class.animate-notification]="newArrival"
15
+ [class.ms-Icon--Message]="unreadCount === 0">
16
+ </i>
17
+ </span>
18
+ <span
19
+ *ngIf="unreadCount > 0"
20
+ [class.animate-pulse]="newArrival"
21
+ class="absolute top-0 right-0 inline-flex items-center justify-center -mt-1 ml-1 text-xs leading-none text-gray-100 ordinal">
22
+ {{ unreadCount }}
23
+ </span>
24
+ </span>
25
+ </button>
26
+
27
+ <!-- Notifications dropdown -->
28
+ <div *ngIf="menuExpanded" class="header-notifications-dropdown-with-username" role="menu" aria-orientation="vertical" aria-labelledby="messages-menu">
29
+ <div class="max-h-64 overflow-y-auto notification-messages min-h">
30
+ <ng-container *ngIf="!items; else messagesDropDown" class="py-5">
31
+ <div class="notifications-nav-link hover:bg-transparent">Δεν έχετε νέες ειδοποιήσεις</div>
32
+ </ng-container>
33
+ <ng-template #messagesDropDown>
34
+ <ul class="pr-1.5">
35
+ <ng-container *ngIf="items; else loading">
36
+ <ng-container *ngIf="items.length <= 0" class="py-5">
37
+ <div class="notifications-nav-link hover:bg-transparent">Δεν έχετε νέες ειδοποιήσεις</div>
38
+ </ng-container>
39
+ <ng-container *ngFor="let message of items; let i = index">
40
+ <li class="mb-2" [ngClass]="{ 'border-l-2 border-blue-500 bg-blue-50 hover:bg-blue-50': !message.data.isRead }">
41
+ <div class="flex justify-between">
42
+ <div class="flex-grow">
43
+ <a
44
+ [routerLink]="message.path"
45
+ (click)="removeItem(i)"
46
+ class="notifications-nav-link grid"
47
+ [ngClass]="!message.data.isRead ? ' hover:bg-blue-50' : 'border-b border-gray-100'"
48
+ >
49
+ <div class="flex flex-col">
50
+ <div class="font-thin tracking-tighter">
51
+ {{ message.data.creationDate | date: "EEE, d MMMM" }}
52
+ </div>
53
+ <div class="font-bold">
54
+ {{ message.data.text }}
55
+ </div>
56
+ </div>
57
+ </a>
58
+ </div>
59
+ </div>
60
+ </li>
61
+ </ng-container>
62
+ </ng-container>
63
+
64
+ <ng-template #loading>
65
+ <div class="h-32 flex items-center justify-center">
66
+ <div class="animate-pulse text-s text-gray-600">Loading...</div>
67
+ </div>
68
+ </ng-template>
69
+ </ul>
70
+ </ng-template>
71
+ </div>
72
+ <div class="p-1 rounded-sm">
73
+ <a [routerLink]="allNotificationsLink!.path">
74
+ <button type="button" class="header-notifications-dropdown-view-all-button">{{allNotificationsLink!.text}}</button>
75
+ </a>
76
+ </div>
77
+ </div>
78
+ </div>
@@ -0,0 +1,75 @@
1
+ import { IAppNotifications, NavLink } from './../../types';
2
+ import { Component, Inject, OnInit, OnDestroy } from '@angular/core';
3
+ import { Observable, of, Subscription } from 'rxjs';
4
+ import { APP_LINKS, APP_NOTIFICATIONS } from '../../tokens';
5
+
6
+ @Component({
7
+ selector: 'lib-notifications-indicator',
8
+ templateUrl: './notifications-indicator.component.html'
9
+ })
10
+ export class NotificationsIndicatorComponent implements OnInit, OnDestroy {
11
+
12
+ public menuExpanded = false;
13
+ public unreadCount = 0;
14
+ public items: any[] = [];
15
+ public allNotificationsLink?: NavLink;
16
+ private notificationsSub$: Subscription | undefined;
17
+ private inboxAction: any | undefined = undefined;
18
+ public newArrival = false;
19
+ constructor(@Inject(APP_NOTIFICATIONS) public notifications: IAppNotifications, @Inject(APP_LINKS) public links: any) { }
20
+
21
+ ngOnDestroy(): void {
22
+ if (this.notificationsSub$) {
23
+ this.notificationsSub$.unsubscribe();
24
+ }
25
+ }
26
+
27
+ ngOnInit(): void {
28
+ (this.links['notifications'] as Observable<NavLink>).subscribe(notificationsLink => {
29
+ this.allNotificationsLink = notificationsLink;
30
+ });
31
+ this.notificationsSub$ = this.notifications.messages.subscribe(result => {
32
+ if (result.items){
33
+ this.newArrival = true;
34
+ this.unreadCount = result.count;
35
+ this.items = result.items;
36
+ setTimeout( () => { this.newArrival = false; }, 1000 );
37
+ }
38
+ });
39
+ }
40
+
41
+ public toggleMenu(): void {
42
+ this.menuExpanded = !this.menuExpanded;
43
+ this.unreadCount = 0;
44
+ }
45
+
46
+ public doInboxAction(): void {
47
+ if (this.notifications.inboxAction) {
48
+ this.notifications.inboxAction();
49
+ } else {
50
+ this.menuExpanded = true;
51
+ }
52
+ this.unreadCount = 0;
53
+ }
54
+
55
+ public removeItem(index:number){
56
+ this.items.splice(index,1);
57
+ }
58
+
59
+ // this.notificationsSub$ = this.links.notifications?.pipe(map(result => {
60
+ // this.allItemsLink = result.allNotifications;
61
+ // this.items = result.items;
62
+ // this.unreadCount = result.count;
63
+ // }));
64
+
65
+ // [this.notificationsLinksPath] as Observable<NotificationNavLink[]>;
66
+ // this.allNotificationsLink = this.links[this.allNotificationsLinkPath] as Observable<NavLink>;
67
+ // this.unreadNotificationsCountObs = this.links[this.notificationsCounterLinksPath] as Observable<number>;
68
+ // this.getUnreadNotificationsCount();
69
+
70
+ // tslint:disable-next-line:typedef
71
+ public onClickOutside($event: any) {
72
+ this.menuExpanded = false;
73
+ }
74
+
75
+ }
@@ -0,0 +1,33 @@
1
+ <div class="pager-container">
2
+ <div class="pager-container-inner">
3
+ <div class="inline-flex" *ngIf="sortOptions && sortOptions.length > 0">
4
+ <lib-drop-down-menu [options]="sortOptions" [selected]="sort" (selectedChanged)="sortOptionChanged($event)"></lib-drop-down-menu>
5
+ <button (click)="toggleSortdir()" [disabled]="!sort || busy" class="pager-icon-button">
6
+ <span class="sr-only">sort direction</span>
7
+ <span class="inline-block relative">
8
+ <i [class]="sortdirIcon"></i>
9
+ </span>
10
+ </button>
11
+ </div>
12
+ <div class="pager-pages-container">
13
+ <lib-drop-down-menu [options]="pageSizeOptions" [selected]="pageSize" (selectedChanged)="pageSizeOptionChanged($event)"></lib-drop-down-menu>
14
+ <div class="mx-2" *ngIf="count !== null && count > pageSize">
15
+ <button [disabled]="!canPreviousPage || busy" (click)="previousPage()"
16
+ class="pager-arrow-button-left">
17
+ <span class="sr-only">Previous</span>
18
+ <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
19
+ <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
20
+ </svg>
21
+ </button>
22
+ <button [disabled]="!canNextPage || busy" (click)="nextPage()"
23
+ class="pager-arrow-button-right">
24
+ <span class="sr-only">Next</span>
25
+ <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
26
+ <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
27
+ </svg>
28
+ </button>
29
+ </div>
30
+ <lib-drop-down-menu *ngIf="(pages && pages.length > 0) && (count !== null && count > pageSize)" [options]="pages" [selected]="page" (selectedChanged)="pageOptionChanged($event)"></lib-drop-down-menu>
31
+ </div>
32
+ </div>
33
+ </div>
@@ -0,0 +1,106 @@
1
+ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
2
+ import { Router } from '@angular/router';
3
+ import { Icons } from '../../icons';
4
+ import { MenuOption } from '../../types';
5
+
6
+ @Component({
7
+ selector: 'lib-pager',
8
+ templateUrl: './pager.component.html'
9
+ })
10
+ export class PagerComponent implements OnInit, OnChanges {
11
+ // BUSY STATE
12
+ @Input() busy = false;
13
+ // PAGING
14
+ @Input() count: number | null = null;
15
+ @Input() page = 1;
16
+ // tslint:disable-next-line:no-input-rename
17
+ @Input('page-size') pageSize = 20;
18
+ // tslint:disable-next-line:no-input-rename
19
+ @Input('page-size-options') pageSizeOptions: MenuOption[] = [
20
+ new MenuOption('10', 10),
21
+ new MenuOption('20', 20),
22
+ new MenuOption('30', 30),
23
+ new MenuOption('50', 50),
24
+ new MenuOption('100', 100)
25
+ ];
26
+ public pages: MenuOption[] = [];
27
+ @Output() pageChanged: EventEmitter<number> = new EventEmitter<number>();
28
+ @Output() pageSizeChanged: EventEmitter<number> = new EventEmitter<number>();
29
+ public canPreviousPage = false;
30
+ public canNextPage = false;
31
+
32
+ // SORTING
33
+ // tslint:disable-next-line:no-input-rename
34
+ @Input('sort-options') sortOptions: MenuOption[] = [];
35
+ // tslint:disable-next-line:no-input-rename
36
+ @Input('sort') sort: string | null = null;
37
+ // tslint:disable-next-line:no-input-rename
38
+ @Input('sort-dir') sortdir: string | null = 'desc';
39
+ @Output() sortChanged: EventEmitter<string> = new EventEmitter<string>();
40
+ @Output() sortdirChanged: EventEmitter<string> = new EventEmitter<string>();
41
+ public sortdirIcon = Icons.SortDesc;
42
+
43
+ constructor(private router: Router) { }
44
+
45
+ ngOnChanges(changes: SimpleChanges): void {
46
+ this.calcPages();
47
+ }
48
+
49
+ ngOnInit(): void {
50
+ }
51
+
52
+ private calcPages(): void {
53
+ this.pages = [];
54
+ if (this.count && this.count > 0) {
55
+ const pageCount = this.count / this.pageSize;
56
+ for (let i = 0; i < pageCount; i++) {
57
+ this.pages.push(new MenuOption(i + 1 + '', i + 1));
58
+ }
59
+ }
60
+ this.canPreviousPage = this.page > 1;
61
+ this.canNextPage = this.page < this.pages.length;
62
+ }
63
+
64
+ public nextPage(): void {
65
+ const next = this.page + 1;
66
+ this.gotoPage(next);
67
+ }
68
+
69
+ public previousPage(): void {
70
+ const previous = this.page - 1;
71
+ this.gotoPage(previous);
72
+ }
73
+
74
+ public gotoPage(page: number): void {
75
+ this.page = page;
76
+ this.pageChanged.emit(page);
77
+ this.calcPages();
78
+ }
79
+
80
+ public pageSizeOptionChanged(pageSize: number): void {
81
+ this.pageSizeChanged.emit(pageSize);
82
+ this.calcPages();
83
+ }
84
+
85
+ public pageOptionChanged(page: number): void {
86
+ this.pageChanged.emit(page);
87
+ this.calcPages();
88
+ }
89
+
90
+ public sortOptionChanged(sort: string): void {
91
+ this.sortChanged.emit(sort);
92
+ }
93
+
94
+ public toggleSortdir(): void {
95
+ let sortdir = 'desc';
96
+ if (this.sortdir === 'desc') {
97
+ sortdir = 'asc';
98
+ this.sortdirIcon = Icons.SortAsc;
99
+ } else {
100
+ sortdir = 'desc';
101
+ this.sortdirIcon = Icons.SortDesc;
102
+ }
103
+ this.sortdirChanged.emit(sortdir);
104
+ }
105
+
106
+ }
@@ -0,0 +1,10 @@
1
+ <div *ngIf="showPane" class="side-pane-outer-container" aria-labelledby="slide-over" role="dialog" aria-modal="true">
2
+ <div [class]="showPane ? overlayStyle : 'hidden'" aria-hidden="true"></div>
3
+ <div [class]="showPane ? 'side-pane-container' : 'hidden'">
4
+ <div [class]="sizeContainerStyle">
5
+ <div class="side-pane">
6
+ <ng-content></ng-content>
7
+ </div>
8
+ </div>
9
+ </div>
10
+ </div>