@porscheinformatik/material-addons 10.4.1 → 14.0.0-beta.0

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 (246) hide show
  1. package/esm2020/lib/button/button.mjs +7 -0
  2. package/esm2020/lib/button/button.module.mjs +26 -0
  3. package/esm2020/lib/button/danger-button/danger-button.component.mjs +28 -0
  4. package/esm2020/lib/button/flat-button/link-button.component.mjs +28 -0
  5. package/esm2020/lib/button/icon-button/icon-button.component.mjs +28 -0
  6. package/esm2020/lib/button/mad-basic-button.mjs +39 -0
  7. package/esm2020/lib/button/outline-button/outline-button.component.mjs +28 -0
  8. package/esm2020/lib/button/primary-button/primary-button.component.mjs +28 -0
  9. package/esm2020/lib/card/card.component.mjs +129 -0
  10. package/esm2020/lib/card/card.mjs +2 -0
  11. package/esm2020/lib/card/card.module.mjs +23 -0
  12. package/esm2020/lib/content-panel/content-header/content-header.component.mjs +11 -0
  13. package/esm2020/lib/content-panel/content-panel-container/content-panel-container.component.mjs +11 -0
  14. package/esm2020/lib/content-panel/content-panel-container-content/content-panel-container-content.component.mjs +11 -0
  15. package/esm2020/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.mjs +11 -0
  16. package/esm2020/lib/content-panel/content-panel.module.mjs +42 -0
  17. package/esm2020/lib/content-panel/main-container/main-container.component.mjs +11 -0
  18. package/esm2020/lib/data-table/data-table-action-type.mjs +6 -0
  19. package/esm2020/lib/data-table/data-table-action.mjs +2 -0
  20. package/esm2020/lib/data-table/data-table-column-definition.mjs +2 -0
  21. package/esm2020/lib/data-table/data-table-column.mjs +2 -0
  22. package/esm2020/lib/data-table/data-table-columns-modal/data-table-columns-modal.component.mjs +103 -0
  23. package/esm2020/lib/data-table/data-table.component.mjs +504 -0
  24. package/esm2020/lib/data-table/data-table.mjs +3 -0
  25. package/esm2020/lib/data-table/data-table.module.mjs +81 -0
  26. package/esm2020/lib/flowbar/flowbar.component.mjs +190 -0
  27. package/esm2020/lib/flowbar/flowbar.module.mjs +19 -0
  28. package/esm2020/lib/material-action-button/material-action-button.component.mjs +34 -0
  29. package/esm2020/lib/material-action-button/material-action-button.module.mjs +22 -0
  30. package/esm2020/lib/material-addons.module.mjs +45 -0
  31. package/esm2020/lib/numeric-field/number-format.service.mjs +139 -0
  32. package/esm2020/lib/numeric-field/numeric-field.directive.mjs +295 -0
  33. package/esm2020/lib/numeric-field/numeric-field.mjs +2 -0
  34. package/esm2020/lib/numeric-field/numeric-field.module.mjs +24 -0
  35. package/esm2020/lib/quick-list/base-quick-list.component.mjs +101 -0
  36. package/esm2020/lib/quick-list/quick-list-compact/quick-list-compact.component.mjs +20 -0
  37. package/esm2020/lib/quick-list/quick-list.component.mjs +21 -0
  38. package/esm2020/lib/quick-list/quick-list.mjs +4 -0
  39. package/esm2020/lib/quick-list/quick-list.module.mjs +23 -0
  40. package/esm2020/lib/readonly/readonly-form-field/readonly-form-field.component.mjs +155 -0
  41. package/esm2020/lib/readonly/readonly-form-field-wrapper/readonly-form-field-wrapper.component.mjs +185 -0
  42. package/esm2020/lib/readonly/readonly-form-field.module.mjs +24 -0
  43. package/esm2020/lib/stepper/mad-stepper-animation.mjs +13 -0
  44. package/esm2020/lib/stepper/step-header/step-header.component.mjs +78 -0
  45. package/esm2020/lib/stepper/stepper.component.mjs +160 -0
  46. package/esm2020/lib/stepper/stepper.module.mjs +23 -0
  47. package/esm2020/lib/table/column-header.mjs +2 -0
  48. package/esm2020/lib/table/table-action.mjs +2 -0
  49. package/esm2020/lib/table/table.component.mjs +130 -0
  50. package/esm2020/lib/table/table.mjs +2 -0
  51. package/esm2020/lib/table/table.module.mjs +56 -0
  52. package/esm2020/lib/throttle-click/throttle-click.directive.mjs +38 -0
  53. package/esm2020/lib/throttle-click/throttle-click.module.mjs +18 -0
  54. package/esm2020/lib/toolbar/toolbar-action.interface.mjs +2 -0
  55. package/esm2020/lib/toolbar/toolbar.component.mjs +78 -0
  56. package/esm2020/lib/toolbar/toolbar.module.mjs +56 -0
  57. package/esm2020/lib/toolbar/toolbar.service.mjs +124 -0
  58. package/esm2020/porscheinformatik-material-addons.mjs +5 -0
  59. package/esm2020/public_api.mjs +41 -0
  60. package/fesm2015/porscheinformatik-material-addons.mjs +2984 -0
  61. package/fesm2015/porscheinformatik-material-addons.mjs.map +1 -0
  62. package/fesm2020/porscheinformatik-material-addons.mjs +2962 -0
  63. package/fesm2020/porscheinformatik-material-addons.mjs.map +1 -0
  64. package/index.d.ts +6 -0
  65. package/lib/button/button.d.ts +7 -0
  66. package/lib/button/button.d.ts.map +1 -0
  67. package/lib/button/button.module.d.ts +15 -0
  68. package/lib/button/button.module.d.ts.map +1 -0
  69. package/lib/button/danger-button/danger-button.component.d.ts +4 -0
  70. package/lib/button/danger-button/danger-button.component.d.ts.map +1 -0
  71. package/lib/button/flat-button/link-button.component.d.ts +4 -0
  72. package/lib/button/flat-button/link-button.component.d.ts.map +1 -0
  73. package/lib/button/icon-button/icon-button.component.d.ts +4 -0
  74. package/lib/button/icon-button/icon-button.component.d.ts.map +1 -0
  75. package/lib/button/mad-basic-button.d.ts +5 -1
  76. package/lib/button/mad-basic-button.d.ts.map +1 -0
  77. package/lib/button/outline-button/outline-button.component.d.ts +4 -0
  78. package/lib/button/outline-button/outline-button.component.d.ts.map +1 -0
  79. package/lib/button/primary-button/primary-button.component.d.ts +4 -0
  80. package/lib/button/primary-button/primary-button.component.d.ts.map +1 -0
  81. package/lib/card/card.component.d.ts +4 -0
  82. package/lib/card/card.component.d.ts.map +1 -0
  83. package/lib/card/card.d.ts +2 -0
  84. package/lib/card/card.d.ts.map +1 -0
  85. package/lib/card/card.module.d.ts +12 -0
  86. package/lib/card/card.module.d.ts.map +1 -0
  87. package/lib/content-panel/content-header/content-header.component.d.ts +4 -0
  88. package/lib/content-panel/content-header/content-header.component.d.ts.map +1 -0
  89. package/lib/content-panel/content-panel-container/content-panel-container.component.d.ts +4 -0
  90. package/lib/content-panel/content-panel-container/content-panel-container.component.d.ts.map +1 -0
  91. package/lib/content-panel/content-panel-container-content/content-panel-container-content.component.d.ts +4 -0
  92. package/lib/content-panel/content-panel-container-content/content-panel-container-content.component.d.ts.map +1 -0
  93. package/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.d.ts +4 -0
  94. package/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.d.ts.map +1 -0
  95. package/lib/content-panel/content-panel.module.d.ts +11 -0
  96. package/lib/content-panel/content-panel.module.d.ts.map +1 -0
  97. package/lib/content-panel/main-container/main-container.component.d.ts +4 -0
  98. package/lib/content-panel/main-container/main-container.component.d.ts.map +1 -0
  99. package/lib/data-table/data-table-action-type.d.ts +1 -0
  100. package/lib/data-table/data-table-action-type.d.ts.map +1 -0
  101. package/lib/data-table/data-table-action.d.ts +1 -0
  102. package/lib/data-table/data-table-action.d.ts.map +1 -0
  103. package/lib/data-table/data-table-column-definition.d.ts +1 -0
  104. package/lib/data-table/data-table-column-definition.d.ts.map +1 -0
  105. package/lib/data-table/data-table-column.d.ts +1 -0
  106. package/lib/data-table/data-table-column.d.ts.map +1 -0
  107. package/lib/data-table/data-table-columns-modal/data-table-columns-modal.component.d.ts +4 -0
  108. package/lib/data-table/data-table-columns-modal/data-table-columns-modal.component.d.ts.map +1 -0
  109. package/lib/data-table/data-table.component.d.ts +4 -0
  110. package/lib/data-table/data-table.component.d.ts.map +1 -0
  111. package/lib/data-table/data-table.d.ts +3 -0
  112. package/lib/data-table/data-table.d.ts.map +1 -0
  113. package/lib/data-table/data-table.module.d.ts +23 -0
  114. package/lib/data-table/data-table.module.d.ts.map +1 -0
  115. package/lib/flowbar/flowbar.component.d.ts +4 -0
  116. package/lib/flowbar/flowbar.component.d.ts.map +1 -0
  117. package/lib/flowbar/flowbar.module.d.ts +8 -0
  118. package/lib/flowbar/flowbar.module.d.ts.map +1 -0
  119. package/lib/material-action-button/material-action-button.component.d.ts +4 -0
  120. package/lib/material-action-button/material-action-button.component.d.ts.map +1 -0
  121. package/lib/material-action-button/material-action-button.module.d.ts +11 -0
  122. package/lib/material-action-button/material-action-button.module.d.ts.map +1 -0
  123. package/lib/material-addons.module.d.ts +13 -0
  124. package/lib/material-addons.module.d.ts.map +1 -0
  125. package/lib/numeric-field/number-format.service.d.ts +4 -0
  126. package/lib/numeric-field/number-format.service.d.ts.map +1 -0
  127. package/lib/numeric-field/numeric-field.d.ts +2 -0
  128. package/lib/numeric-field/numeric-field.d.ts.map +1 -0
  129. package/lib/numeric-field/numeric-field.directive.d.ts +4 -0
  130. package/lib/numeric-field/numeric-field.directive.d.ts.map +1 -0
  131. package/lib/numeric-field/numeric-field.module.d.ts +6 -0
  132. package/lib/numeric-field/numeric-field.module.d.ts.map +1 -0
  133. package/lib/quick-list/base-quick-list.component.d.ts +4 -0
  134. package/lib/quick-list/base-quick-list.component.d.ts.map +1 -0
  135. package/lib/quick-list/quick-list-compact/quick-list-compact.component.d.ts +4 -0
  136. package/lib/quick-list/quick-list-compact/quick-list-compact.component.d.ts.map +1 -0
  137. package/lib/quick-list/quick-list.component.d.ts +4 -0
  138. package/lib/quick-list/quick-list.component.d.ts.map +1 -0
  139. package/lib/quick-list/quick-list.d.ts +4 -0
  140. package/lib/quick-list/quick-list.d.ts.map +1 -0
  141. package/lib/quick-list/quick-list.module.d.ts +12 -0
  142. package/lib/quick-list/quick-list.module.d.ts.map +1 -0
  143. package/lib/readonly/readonly-form-field/readonly-form-field.component.d.ts +4 -0
  144. package/lib/readonly/readonly-form-field/readonly-form-field.component.d.ts.map +1 -0
  145. package/lib/readonly/readonly-form-field-wrapper/readonly-form-field-wrapper.component.d.ts +4 -0
  146. package/lib/readonly/readonly-form-field-wrapper/readonly-form-field-wrapper.component.d.ts.map +1 -0
  147. package/lib/readonly/readonly-form-field.module.d.ts +13 -0
  148. package/lib/readonly/readonly-form-field.module.d.ts.map +1 -0
  149. package/lib/stepper/mad-stepper-animation.d.ts +1 -0
  150. package/lib/stepper/mad-stepper-animation.d.ts.map +1 -0
  151. package/lib/stepper/step-header/step-header.component.d.ts +4 -0
  152. package/lib/stepper/step-header/step-header.component.d.ts.map +1 -0
  153. package/lib/stepper/stepper.component.d.ts +7 -1
  154. package/lib/stepper/stepper.component.d.ts.map +1 -0
  155. package/lib/stepper/stepper.module.d.ts +12 -0
  156. package/lib/stepper/stepper.module.d.ts.map +1 -0
  157. package/lib/table/column-header.d.ts +1 -0
  158. package/lib/table/column-header.d.ts.map +1 -0
  159. package/lib/table/table-action.d.ts +1 -0
  160. package/lib/table/table-action.d.ts.map +1 -0
  161. package/lib/table/table.component.d.ts +4 -0
  162. package/lib/table/table.component.d.ts.map +1 -0
  163. package/lib/table/table.d.ts +2 -0
  164. package/lib/table/table.d.ts.map +1 -0
  165. package/lib/table/table.module.d.ts +16 -0
  166. package/lib/table/table.module.d.ts.map +1 -0
  167. package/lib/throttle-click/throttle-click.directive.d.ts +4 -0
  168. package/lib/throttle-click/throttle-click.directive.d.ts.map +1 -0
  169. package/lib/throttle-click/throttle-click.module.d.ts +7 -0
  170. package/lib/throttle-click/throttle-click.module.d.ts.map +1 -0
  171. package/lib/toolbar/toolbar-action.interface.d.ts +1 -0
  172. package/lib/toolbar/toolbar-action.interface.d.ts.map +1 -0
  173. package/lib/toolbar/toolbar.component.d.ts +4 -0
  174. package/lib/toolbar/toolbar.component.d.ts.map +1 -0
  175. package/lib/toolbar/toolbar.module.d.ts +16 -0
  176. package/lib/toolbar/toolbar.module.d.ts.map +1 -0
  177. package/lib/toolbar/toolbar.service.d.ts +4 -0
  178. package/lib/toolbar/toolbar.service.d.ts.map +1 -0
  179. package/package.json +35 -20
  180. package/porscheinformatik-material-addons.d.ts.map +1 -0
  181. package/{public-api.d.ts → public_api.d.ts} +5 -0
  182. package/public_api.d.ts.map +1 -0
  183. package/themes/common/styles.scss +23 -22
  184. package/bundles/porscheinformatik-material-addons.umd.js +0 -3301
  185. package/bundles/porscheinformatik-material-addons.umd.js.map +0 -1
  186. package/bundles/porscheinformatik-material-addons.umd.min.js +0 -17
  187. package/bundles/porscheinformatik-material-addons.umd.min.js.map +0 -1
  188. package/esm2015/lib/button/button.module.js +0 -21
  189. package/esm2015/lib/button/danger-button/danger-button.component.js +0 -25
  190. package/esm2015/lib/button/flat-button/link-button.component.js +0 -25
  191. package/esm2015/lib/button/icon-button/icon-button.component.js +0 -25
  192. package/esm2015/lib/button/mad-basic-button.js +0 -28
  193. package/esm2015/lib/button/outline-button/outline-button.component.js +0 -25
  194. package/esm2015/lib/button/primary-button/primary-button.component.js +0 -25
  195. package/esm2015/lib/card/card.component.js +0 -86
  196. package/esm2015/lib/card/card.module.js +0 -18
  197. package/esm2015/lib/content-panel/content-header/content-header.component.js +0 -11
  198. package/esm2015/lib/content-panel/content-panel-container/content-panel-container.component.js +0 -11
  199. package/esm2015/lib/content-panel/content-panel-container-content/content-panel-container-content.component.js +0 -11
  200. package/esm2015/lib/content-panel/content-panel-container-footer/content-panel-container-footer.component.js +0 -11
  201. package/esm2015/lib/content-panel/content-panel.module.js +0 -29
  202. package/esm2015/lib/content-panel/main-container/main-container.component.js +0 -11
  203. package/esm2015/lib/data-table/data-table-action-type.js +0 -6
  204. package/esm2015/lib/data-table/data-table-action.js +0 -1
  205. package/esm2015/lib/data-table/data-table-column-definition.js +0 -1
  206. package/esm2015/lib/data-table/data-table-column.js +0 -1
  207. package/esm2015/lib/data-table/data-table-columns-modal/data-table-columns-modal.component.js +0 -93
  208. package/esm2015/lib/data-table/data-table.component.js +0 -459
  209. package/esm2015/lib/data-table/data-table.js +0 -1
  210. package/esm2015/lib/data-table/data-table.module.js +0 -46
  211. package/esm2015/lib/flowbar/flowbar.component.js +0 -182
  212. package/esm2015/lib/flowbar/flowbar.module.js +0 -14
  213. package/esm2015/lib/material-action-button/material-action-button.component.js +0 -25
  214. package/esm2015/lib/material-action-button/material-action-button.module.js +0 -17
  215. package/esm2015/lib/material-addons.module.js +0 -26
  216. package/esm2015/lib/numeric-field/number-format.service.js +0 -137
  217. package/esm2015/lib/numeric-field/numeric-field.directive.js +0 -275
  218. package/esm2015/lib/numeric-field/numeric-field.module.js +0 -19
  219. package/esm2015/lib/quick-list/base-quick-list.component.js +0 -91
  220. package/esm2015/lib/quick-list/quick-list-compact/quick-list-compact.component.js +0 -18
  221. package/esm2015/lib/quick-list/quick-list.component.js +0 -19
  222. package/esm2015/lib/quick-list/quick-list.module.js +0 -18
  223. package/esm2015/lib/readonly/readonly-form-field/readonly-form-field.component.js +0 -131
  224. package/esm2015/lib/readonly/readonly-form-field-wrapper/readonly-form-field-wrapper.component.js +0 -164
  225. package/esm2015/lib/readonly/readonly-form-field.module.js +0 -19
  226. package/esm2015/lib/stepper/mad-stepper-animation.js +0 -13
  227. package/esm2015/lib/stepper/step-header/step-header.component.js +0 -75
  228. package/esm2015/lib/stepper/stepper.component.js +0 -169
  229. package/esm2015/lib/stepper/stepper.module.js +0 -18
  230. package/esm2015/lib/table/column-header.js +0 -1
  231. package/esm2015/lib/table/table-action.js +0 -1
  232. package/esm2015/lib/table/table.component.js +0 -106
  233. package/esm2015/lib/table/table.js +0 -1
  234. package/esm2015/lib/table/table.module.js +0 -33
  235. package/esm2015/lib/throttle-click/throttle-click.directive.js +0 -32
  236. package/esm2015/lib/throttle-click/throttle-click.module.js +0 -13
  237. package/esm2015/lib/toolbar/toolbar-action.interface.js +0 -1
  238. package/esm2015/lib/toolbar/toolbar.component.js +0 -71
  239. package/esm2015/lib/toolbar/toolbar.module.js +0 -33
  240. package/esm2015/lib/toolbar/toolbar.service.js +0 -127
  241. package/esm2015/porscheinformatik-material-addons.js +0 -19
  242. package/esm2015/public-api.js +0 -37
  243. package/fesm2015/porscheinformatik-material-addons.js +0 -2658
  244. package/fesm2015/porscheinformatik-material-addons.js.map +0 -1
  245. package/porscheinformatik-material-addons.d.ts +0 -19
  246. package/porscheinformatik-material-addons.metadata.json +0 -1
@@ -1,3301 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@angular/material/button'), require('@angular/material/icon'), require('@angular/material/tooltip'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/forms'), require('@angular/platform-browser'), require('@ngx-translate/core'), require('rxjs'), require('@angular/cdk/layout'), require('rxjs/operators'), require('@angular/material/menu'), require('@angular/material/toolbar'), require('@angular/material/badge'), require('@angular/material/card'), require('@angular/animations'), require('@angular/material/table'), require('@angular/material/sort'), require('@angular/material/paginator'), require('@angular/cdk/collections'), require('uuid'), require('@angular/material/dialog'), require('@angular/cdk/drag-drop'), require('@angular/material/checkbox'), require('@angular/material/progress-spinner'), require('@angular/cdk/bidi'), require('@angular/cdk/stepper'), require('@angular/cdk/a11y'), require('@angular/flex-layout'), require('@angular/material/stepper')) :
3
- typeof define === 'function' && define.amd ? define('@porscheinformatik/material-addons', ['exports', '@angular/core', '@angular/common', '@angular/router', '@angular/material/button', '@angular/material/icon', '@angular/material/tooltip', '@angular/material/form-field', '@angular/material/input', '@angular/forms', '@angular/platform-browser', '@ngx-translate/core', 'rxjs', '@angular/cdk/layout', 'rxjs/operators', '@angular/material/menu', '@angular/material/toolbar', '@angular/material/badge', '@angular/material/card', '@angular/animations', '@angular/material/table', '@angular/material/sort', '@angular/material/paginator', '@angular/cdk/collections', 'uuid', '@angular/material/dialog', '@angular/cdk/drag-drop', '@angular/material/checkbox', '@angular/material/progress-spinner', '@angular/cdk/bidi', '@angular/cdk/stepper', '@angular/cdk/a11y', '@angular/flex-layout', '@angular/material/stepper'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.porscheinformatik = global.porscheinformatik || {}, global.porscheinformatik['material-addons'] = {}), global.ng.core, global.ng.common, global.ng.router, global.ng.material.button, global.ng.material.icon, global.ng.material.tooltip, global.ng.material.formField, global.ng.material.input, global.ng.forms, global.ng.platformBrowser, global.i2, global.rxjs, global.ng.cdk.layout, global.rxjs.operators, global.ng.material.menu, global.ng.material.toolbar, global.ng.material.badge, global.ng.material.card, global.ng.animations, global.ng.material.table, global.ng.material.sort, global.ng.material.paginator, global.ng.cdk.collections, global.uuid, global.ng.material.dialog, global.ng.cdk.dragDrop, global.ng.material.checkbox, global.ng.material.progressSpinner, global.ng.cdk.bidi, global.ng.cdk.stepper, global.ng.cdk.a11y, global.ng.flexLayout, global.ng.material.stepper));
5
- }(this, (function (exports, i0, common, i1, button, icon, tooltip, formField, input, forms, platformBrowser, i2, rxjs, layout, operators, menu, toolbar, badge, card, animations, table, sort, paginator, collections, uuid, dialog, dragDrop, checkbox, progressSpinner, bidi, stepper, a11y, flexLayout, stepper$1) { 'use strict';
6
-
7
- var MaterialActionButtonComponent = /** @class */ (function () {
8
- function MaterialActionButtonComponent() {
9
- this.icon = 'add';
10
- // Sets the lower padding higher providing some bottom space for a fixed paginator
11
- this.liftHigher = true;
12
- this.liftHigher2 = false;
13
- }
14
- return MaterialActionButtonComponent;
15
- }());
16
- MaterialActionButtonComponent.decorators = [
17
- { type: i0.Component, args: [{
18
- selector: 'mad-material-action-button',
19
- template: "<div class=\"material-action-button {{ liftHigher ? 'lift-higher' : '' }} {{ liftHigher2 ? 'lift-higher-2' : '' }}\">\n <a [routerLink]=\"routerLink\">\n <button [id]=\"id\" mat-fab [matTooltipPosition]=\"'left'\" [matTooltip]=\"actionName\" color=\"primary\" *ngIf=\"!liftHigher2\">\n <mat-icon>{{ icon }}</mat-icon>\n </button>\n <button [id]=\"id\" mat-mini-fab [matTooltipPosition]=\"'left'\" [matTooltip]=\"actionName\" color=\"accent\" *ngIf=\"liftHigher2\">\n <mat-icon>{{ icon }}</mat-icon>\n </button>\n </a>\n</div>\n",
20
- styles: [".material-action-button{align-items:center;bottom:20px;display:flex;flex-direction:column-reverse;position:fixed;right:20px;z-index:100}.lift-higher{bottom:61px}.lift-higher-2{bottom:121px;right:28px}"]
21
- },] }
22
- ];
23
- MaterialActionButtonComponent.propDecorators = {
24
- actionName: [{ type: i0.Input }],
25
- id: [{ type: i0.Input }],
26
- icon: [{ type: i0.Input }],
27
- routerLink: [{ type: i0.Input }],
28
- liftHigher: [{ type: i0.Input }],
29
- liftHigher2: [{ type: i0.Input }]
30
- };
31
-
32
- var MaterialActionButtonModule = /** @class */ (function () {
33
- function MaterialActionButtonModule() {
34
- }
35
- return MaterialActionButtonModule;
36
- }());
37
- MaterialActionButtonModule.decorators = [
38
- { type: i0.NgModule, args: [{
39
- declarations: [MaterialActionButtonComponent],
40
- imports: [common.CommonModule, i1.RouterModule, button.MatButtonModule, icon.MatIconModule, tooltip.MatTooltipModule],
41
- exports: [MaterialActionButtonComponent],
42
- },] }
43
- ];
44
-
45
- /*! *****************************************************************************
46
- Copyright (c) Microsoft Corporation.
47
-
48
- Permission to use, copy, modify, and/or distribute this software for any
49
- purpose with or without fee is hereby granted.
50
-
51
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
52
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
53
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
54
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
55
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
56
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
57
- PERFORMANCE OF THIS SOFTWARE.
58
- ***************************************************************************** */
59
- /* global Reflect, Promise */
60
- var extendStatics = function (d, b) {
61
- extendStatics = Object.setPrototypeOf ||
62
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
63
- function (d, b) { for (var p in b)
64
- if (Object.prototype.hasOwnProperty.call(b, p))
65
- d[p] = b[p]; };
66
- return extendStatics(d, b);
67
- };
68
- function __extends(d, b) {
69
- if (typeof b !== "function" && b !== null)
70
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
71
- extendStatics(d, b);
72
- function __() { this.constructor = d; }
73
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
74
- }
75
- var __assign = function () {
76
- __assign = Object.assign || function __assign(t) {
77
- for (var s, i = 1, n = arguments.length; i < n; i++) {
78
- s = arguments[i];
79
- for (var p in s)
80
- if (Object.prototype.hasOwnProperty.call(s, p))
81
- t[p] = s[p];
82
- }
83
- return t;
84
- };
85
- return __assign.apply(this, arguments);
86
- };
87
- function __rest(s, e) {
88
- var t = {};
89
- for (var p in s)
90
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
91
- t[p] = s[p];
92
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
93
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
94
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
95
- t[p[i]] = s[p[i]];
96
- }
97
- return t;
98
- }
99
- function __decorate(decorators, target, key, desc) {
100
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
101
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
102
- r = Reflect.decorate(decorators, target, key, desc);
103
- else
104
- for (var i = decorators.length - 1; i >= 0; i--)
105
- if (d = decorators[i])
106
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
107
- return c > 3 && r && Object.defineProperty(target, key, r), r;
108
- }
109
- function __param(paramIndex, decorator) {
110
- return function (target, key) { decorator(target, key, paramIndex); };
111
- }
112
- function __metadata(metadataKey, metadataValue) {
113
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
114
- return Reflect.metadata(metadataKey, metadataValue);
115
- }
116
- function __awaiter(thisArg, _arguments, P, generator) {
117
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
118
- return new (P || (P = Promise))(function (resolve, reject) {
119
- function fulfilled(value) { try {
120
- step(generator.next(value));
121
- }
122
- catch (e) {
123
- reject(e);
124
- } }
125
- function rejected(value) { try {
126
- step(generator["throw"](value));
127
- }
128
- catch (e) {
129
- reject(e);
130
- } }
131
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
132
- step((generator = generator.apply(thisArg, _arguments || [])).next());
133
- });
134
- }
135
- function __generator(thisArg, body) {
136
- var _ = { label: 0, sent: function () { if (t[0] & 1)
137
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
138
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
139
- function verb(n) { return function (v) { return step([n, v]); }; }
140
- function step(op) {
141
- if (f)
142
- throw new TypeError("Generator is already executing.");
143
- while (_)
144
- try {
145
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
146
- return t;
147
- if (y = 0, t)
148
- op = [op[0] & 2, t.value];
149
- switch (op[0]) {
150
- case 0:
151
- case 1:
152
- t = op;
153
- break;
154
- case 4:
155
- _.label++;
156
- return { value: op[1], done: false };
157
- case 5:
158
- _.label++;
159
- y = op[1];
160
- op = [0];
161
- continue;
162
- case 7:
163
- op = _.ops.pop();
164
- _.trys.pop();
165
- continue;
166
- default:
167
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
168
- _ = 0;
169
- continue;
170
- }
171
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
172
- _.label = op[1];
173
- break;
174
- }
175
- if (op[0] === 6 && _.label < t[1]) {
176
- _.label = t[1];
177
- t = op;
178
- break;
179
- }
180
- if (t && _.label < t[2]) {
181
- _.label = t[2];
182
- _.ops.push(op);
183
- break;
184
- }
185
- if (t[2])
186
- _.ops.pop();
187
- _.trys.pop();
188
- continue;
189
- }
190
- op = body.call(thisArg, _);
191
- }
192
- catch (e) {
193
- op = [6, e];
194
- y = 0;
195
- }
196
- finally {
197
- f = t = 0;
198
- }
199
- if (op[0] & 5)
200
- throw op[1];
201
- return { value: op[0] ? op[1] : void 0, done: true };
202
- }
203
- }
204
- var __createBinding = Object.create ? (function (o, m, k, k2) {
205
- if (k2 === undefined)
206
- k2 = k;
207
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
208
- }) : (function (o, m, k, k2) {
209
- if (k2 === undefined)
210
- k2 = k;
211
- o[k2] = m[k];
212
- });
213
- function __exportStar(m, o) {
214
- for (var p in m)
215
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
216
- __createBinding(o, m, p);
217
- }
218
- function __values(o) {
219
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
220
- if (m)
221
- return m.call(o);
222
- if (o && typeof o.length === "number")
223
- return {
224
- next: function () {
225
- if (o && i >= o.length)
226
- o = void 0;
227
- return { value: o && o[i++], done: !o };
228
- }
229
- };
230
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
231
- }
232
- function __read(o, n) {
233
- var m = typeof Symbol === "function" && o[Symbol.iterator];
234
- if (!m)
235
- return o;
236
- var i = m.call(o), r, ar = [], e;
237
- try {
238
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
239
- ar.push(r.value);
240
- }
241
- catch (error) {
242
- e = { error: error };
243
- }
244
- finally {
245
- try {
246
- if (r && !r.done && (m = i["return"]))
247
- m.call(i);
248
- }
249
- finally {
250
- if (e)
251
- throw e.error;
252
- }
253
- }
254
- return ar;
255
- }
256
- /** @deprecated */
257
- function __spread() {
258
- for (var ar = [], i = 0; i < arguments.length; i++)
259
- ar = ar.concat(__read(arguments[i]));
260
- return ar;
261
- }
262
- /** @deprecated */
263
- function __spreadArrays() {
264
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
265
- s += arguments[i].length;
266
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
267
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
268
- r[k] = a[j];
269
- return r;
270
- }
271
- function __spreadArray(to, from, pack) {
272
- if (pack || arguments.length === 2)
273
- for (var i = 0, l = from.length, ar; i < l; i++) {
274
- if (ar || !(i in from)) {
275
- if (!ar)
276
- ar = Array.prototype.slice.call(from, 0, i);
277
- ar[i] = from[i];
278
- }
279
- }
280
- return to.concat(ar || Array.prototype.slice.call(from));
281
- }
282
- function __await(v) {
283
- return this instanceof __await ? (this.v = v, this) : new __await(v);
284
- }
285
- function __asyncGenerator(thisArg, _arguments, generator) {
286
- if (!Symbol.asyncIterator)
287
- throw new TypeError("Symbol.asyncIterator is not defined.");
288
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
289
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
290
- function verb(n) { if (g[n])
291
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
292
- function resume(n, v) { try {
293
- step(g[n](v));
294
- }
295
- catch (e) {
296
- settle(q[0][3], e);
297
- } }
298
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
299
- function fulfill(value) { resume("next", value); }
300
- function reject(value) { resume("throw", value); }
301
- function settle(f, v) { if (f(v), q.shift(), q.length)
302
- resume(q[0][0], q[0][1]); }
303
- }
304
- function __asyncDelegator(o) {
305
- var i, p;
306
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
307
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
308
- }
309
- function __asyncValues(o) {
310
- if (!Symbol.asyncIterator)
311
- throw new TypeError("Symbol.asyncIterator is not defined.");
312
- var m = o[Symbol.asyncIterator], i;
313
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
314
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
315
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
316
- }
317
- function __makeTemplateObject(cooked, raw) {
318
- if (Object.defineProperty) {
319
- Object.defineProperty(cooked, "raw", { value: raw });
320
- }
321
- else {
322
- cooked.raw = raw;
323
- }
324
- return cooked;
325
- }
326
- ;
327
- var __setModuleDefault = Object.create ? (function (o, v) {
328
- Object.defineProperty(o, "default", { enumerable: true, value: v });
329
- }) : function (o, v) {
330
- o["default"] = v;
331
- };
332
- function __importStar(mod) {
333
- if (mod && mod.__esModule)
334
- return mod;
335
- var result = {};
336
- if (mod != null)
337
- for (var k in mod)
338
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
339
- __createBinding(result, mod, k);
340
- __setModuleDefault(result, mod);
341
- return result;
342
- }
343
- function __importDefault(mod) {
344
- return (mod && mod.__esModule) ? mod : { default: mod };
345
- }
346
- function __classPrivateFieldGet(receiver, state, kind, f) {
347
- if (kind === "a" && !f)
348
- throw new TypeError("Private accessor was defined without a getter");
349
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
350
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
351
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
352
- }
353
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
354
- if (kind === "m")
355
- throw new TypeError("Private method is not writable");
356
- if (kind === "a" && !f)
357
- throw new TypeError("Private accessor was defined without a setter");
358
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
359
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
360
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
361
- }
362
-
363
- var MadBasicButton = /** @class */ (function () {
364
- function MadBasicButton() {
365
- this.disableClick = function (e) { return e.stopPropagation(); };
366
- }
367
- Object.defineProperty(MadBasicButton.prototype, "pointerEvent", {
368
- get: function () {
369
- return this.disabled ? 'none' : 'auto';
370
- },
371
- enumerable: false,
372
- configurable: true
373
- });
374
- Object.defineProperty(MadBasicButton.prototype, "opacity", {
375
- get: function () {
376
- return this.disabled ? '0.35' : '1';
377
- },
378
- enumerable: false,
379
- configurable: true
380
- });
381
- MadBasicButton.prototype.ngOnChanges = function () {
382
- this.disableButton();
383
- };
384
- MadBasicButton.prototype.disableButton = function () {
385
- if (this.disabled) {
386
- this.button.nativeElement.addEventListener('click', this.disableClick);
387
- }
388
- else {
389
- this.button.nativeElement.removeEventListener('click', this.disableClick);
390
- }
391
- };
392
- return MadBasicButton;
393
- }());
394
- MadBasicButton.propDecorators = {
395
- pointerEvent: [{ type: i0.HostBinding, args: ['style.pointer-events',] }],
396
- opacity: [{ type: i0.HostBinding, args: ['style.opacity',] }]
397
- };
398
-
399
- var PrimaryButtonComponent = /** @class */ (function (_super) {
400
- __extends(PrimaryButtonComponent, _super);
401
- function PrimaryButtonComponent() {
402
- var _this = _super.call(this) || this;
403
- _this.title = '';
404
- _super.prototype.button = _this.button;
405
- _super.prototype.disabled = _this.disabled;
406
- return _this;
407
- }
408
- return PrimaryButtonComponent;
409
- }(MadBasicButton));
410
- PrimaryButtonComponent.decorators = [
411
- { type: i0.Component, args: [{
412
- selector: 'mad-primary-button',
413
- template: "<button mat-raised-button color=\"primary\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n",
414
- styles: [""]
415
- },] }
416
- ];
417
- PrimaryButtonComponent.ctorParameters = function () { return []; };
418
- PrimaryButtonComponent.propDecorators = {
419
- type: [{ type: i0.Input }],
420
- disabled: [{ type: i0.Input }],
421
- title: [{ type: i0.Input }],
422
- button: [{ type: i0.ViewChild, args: ['btn', { read: i0.ElementRef, static: true },] }]
423
- };
424
-
425
- var OutlineButtonComponent = /** @class */ (function (_super) {
426
- __extends(OutlineButtonComponent, _super);
427
- function OutlineButtonComponent() {
428
- var _this = _super.call(this) || this;
429
- _this.title = '';
430
- _super.prototype.button = _this.button;
431
- _super.prototype.disabled = _this.disabled;
432
- return _this;
433
- }
434
- return OutlineButtonComponent;
435
- }(MadBasicButton));
436
- OutlineButtonComponent.decorators = [
437
- { type: i0.Component, args: [{
438
- selector: 'mad-outline-button',
439
- template: "<button mat-stroked-button color=\"primary\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n",
440
- styles: [""]
441
- },] }
442
- ];
443
- OutlineButtonComponent.ctorParameters = function () { return []; };
444
- OutlineButtonComponent.propDecorators = {
445
- type: [{ type: i0.Input }],
446
- disabled: [{ type: i0.Input }],
447
- title: [{ type: i0.Input }],
448
- button: [{ type: i0.ViewChild, args: ['btn', { read: i0.ElementRef, static: true },] }]
449
- };
450
-
451
- var LinkButtonComponent = /** @class */ (function (_super) {
452
- __extends(LinkButtonComponent, _super);
453
- function LinkButtonComponent() {
454
- var _this = _super.call(this) || this;
455
- _this.title = '';
456
- _super.prototype.button = _this.button;
457
- _super.prototype.disabled = _this.disabled;
458
- return _this;
459
- }
460
- return LinkButtonComponent;
461
- }(MadBasicButton));
462
- LinkButtonComponent.decorators = [
463
- { type: i0.Component, args: [{
464
- selector: 'mad-link-button',
465
- template: "<button [title]=\"title\" [type]=\"type\" color=\"primary\" #btn mat-button>\n <ng-content></ng-content>\n</button>\n",
466
- styles: [""]
467
- },] }
468
- ];
469
- LinkButtonComponent.ctorParameters = function () { return []; };
470
- LinkButtonComponent.propDecorators = {
471
- type: [{ type: i0.Input }],
472
- disabled: [{ type: i0.Input }],
473
- title: [{ type: i0.Input }],
474
- button: [{ type: i0.ViewChild, args: ['btn', { read: i0.ElementRef, static: true },] }]
475
- };
476
-
477
- var IconButtonComponent = /** @class */ (function (_super) {
478
- __extends(IconButtonComponent, _super);
479
- function IconButtonComponent() {
480
- var _this = _super.call(this) || this;
481
- _this.title = '';
482
- _super.prototype.button = _this.button;
483
- _super.prototype.disabled = _this.disabled;
484
- return _this;
485
- }
486
- return IconButtonComponent;
487
- }(MadBasicButton));
488
- IconButtonComponent.decorators = [
489
- { type: i0.Component, args: [{
490
- selector: 'mad-icon-button',
491
- template: "<button mat-icon-button color=\"primary\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n",
492
- styles: [""]
493
- },] }
494
- ];
495
- IconButtonComponent.ctorParameters = function () { return []; };
496
- IconButtonComponent.propDecorators = {
497
- type: [{ type: i0.Input }],
498
- disabled: [{ type: i0.Input }],
499
- title: [{ type: i0.Input }],
500
- button: [{ type: i0.ViewChild, args: ['btn', { read: i0.ElementRef, static: true },] }]
501
- };
502
-
503
- var DangerButtonComponent = /** @class */ (function (_super) {
504
- __extends(DangerButtonComponent, _super);
505
- function DangerButtonComponent() {
506
- var _this = _super.call(this) || this;
507
- _this.title = '';
508
- _super.prototype.button = _this.button;
509
- _super.prototype.disabled = _this.disabled;
510
- return _this;
511
- }
512
- return DangerButtonComponent;
513
- }(MadBasicButton));
514
- DangerButtonComponent.decorators = [
515
- { type: i0.Component, args: [{
516
- selector: 'mad-danger-button',
517
- template: "<button mat-raised-button color=\"warn\" [type]=\"type\" [title]=\"title\" #btn>\n <ng-content></ng-content>\n</button>\n",
518
- styles: [""]
519
- },] }
520
- ];
521
- DangerButtonComponent.ctorParameters = function () { return []; };
522
- DangerButtonComponent.propDecorators = {
523
- type: [{ type: i0.Input }],
524
- disabled: [{ type: i0.Input }],
525
- title: [{ type: i0.Input }],
526
- button: [{ type: i0.ViewChild, args: ['btn', { read: i0.ElementRef, static: true },] }]
527
- };
528
-
529
- var ButtonModule = /** @class */ (function () {
530
- function ButtonModule() {
531
- }
532
- return ButtonModule;
533
- }());
534
- ButtonModule.decorators = [
535
- { type: i0.NgModule, args: [{
536
- declarations: [PrimaryButtonComponent, OutlineButtonComponent, LinkButtonComponent, DangerButtonComponent, IconButtonComponent],
537
- imports: [common.CommonModule, i1.RouterModule, button.MatButtonModule, icon.MatIconModule, tooltip.MatTooltipModule],
538
- exports: [PrimaryButtonComponent, OutlineButtonComponent, LinkButtonComponent, DangerButtonComponent, IconButtonComponent],
539
- },] }
540
- ];
541
-
542
- /**
543
- * Wraps a mat-form-field to replace it by a readOnly representation if necessary
544
- *
545
- * @author Stefan Laesser
546
- */
547
- var ReadOnlyFormFieldWrapperComponent = /** @class */ (function () {
548
- function ReadOnlyFormFieldWrapperComponent(changeDetector, elementRef) {
549
- this.changeDetector = changeDetector;
550
- this.elementRef = elementRef;
551
- /**
552
- * If set to "false", the contained mat-form-field is rendered in all it's glory.
553
- * If set to "true", a readonly representation of the value is shown using the mat-form-fields label.
554
- */
555
- this.readonly = true;
556
- this.textAlign = 'left';
557
- this.formatNumber = false;
558
- this.decimalPlaces = 2;
559
- this.roundValue = false;
560
- this.autofillDecimals = false;
561
- this.unit = null;
562
- this.unitPosition = 'left';
563
- this.errorMessage = null;
564
- /**
565
- * If set to "false", a readonly input will be rendered.
566
- * If set to "true", a readonly textarea will be rendered instead.
567
- */
568
- this.multiline = false;
569
- /**
570
- * Defines the rows for the readonly textarea.
571
- */
572
- this.rows = 3;
573
- /**
574
- * If shrinkIfEmpty is set to "false", nothing changes
575
- * If set to "true" and multiline is also "true", the textarea will
576
- * shrink to one row, if value is empty/null/undefined.
577
- * Otherwise, the defined rows-value will be used
578
- */
579
- this.shrinkIfEmpty = false;
580
- this.toolTipForInputEnabled = false;
581
- }
582
- ReadOnlyFormFieldWrapperComponent.prototype.ngOnInit = function () {
583
- this.doRendering();
584
- };
585
- ReadOnlyFormFieldWrapperComponent.prototype.ngAfterViewInit = function () {
586
- this.setReadonlyFieldStyle();
587
- this.doRendering();
588
- };
589
- ReadOnlyFormFieldWrapperComponent.prototype.ngAfterViewChecked = function () {
590
- this.setReadonlyFieldStyle();
591
- this.setTooltipForOverflownField();
592
- };
593
- ReadOnlyFormFieldWrapperComponent.prototype.ngOnChanges = function (_) {
594
- this.doRendering();
595
- };
596
- ReadOnlyFormFieldWrapperComponent.prototype.getLabel = function () {
597
- if (!this.label) {
598
- this.extractLabel();
599
- }
600
- return this.label;
601
- };
602
- ReadOnlyFormFieldWrapperComponent.prototype.doRendering = function () {
603
- if (!this.originalContent) {
604
- return;
605
- }
606
- if (!this.readonly) {
607
- this.correctWidth();
608
- return;
609
- }
610
- this.changeDetector.detectChanges();
611
- };
612
- ReadOnlyFormFieldWrapperComponent.prototype.extractLabel = function () {
613
- if (!this.originalContent || !this.originalContent.nativeElement) {
614
- return null;
615
- }
616
- var labelElement = this.originalContent.nativeElement.querySelector('mat-label');
617
- this.label = labelElement ? labelElement.innerHTML : 'mat-label is missing!';
618
- };
619
- ReadOnlyFormFieldWrapperComponent.prototype.correctWidth = function () {
620
- var formField = this.originalContent.nativeElement.querySelector('mat-form-field');
621
- if (formField) {
622
- formField.setAttribute('style', 'width:100%');
623
- }
624
- };
625
- ReadOnlyFormFieldWrapperComponent.prototype.setReadonlyFieldStyle = function () {
626
- var _a, _b;
627
- var input = (_b = (_a = this.readOnlyContentWrapper) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.querySelector('input');
628
- if (input) {
629
- var textOverFlowStyleValue = this.getTextOverFlowStyleValue();
630
- if (textOverFlowStyleValue) {
631
- input.setAttribute('style', 'text-overflow: ' + textOverFlowStyleValue);
632
- }
633
- }
634
- };
635
- // Ellipsis is enabled by default as text-overflow behaviour
636
- ReadOnlyFormFieldWrapperComponent.prototype.getTextOverFlowStyleValue = function () {
637
- var _a, _b;
638
- // it works only if the style is added to the component directly. Should find a way for get it from the calculated
639
- // style. Than it would be possible to define the text-overflow in css for the whole application
640
- var textOverflow = (_b = (_a = this.elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.style.textOverflow;
641
- if (!textOverflow) {
642
- return 'ellipsis';
643
- }
644
- return textOverflow;
645
- };
646
- ReadOnlyFormFieldWrapperComponent.prototype.setTooltipForOverflownField = function () {
647
- var _a, _b;
648
- if (this.isEllipsisForTextOverflowEnabled()) {
649
- var input = (_b = (_a = this.readOnlyContentWrapper) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.querySelector('input');
650
- if (input) {
651
- this.toolTipForInputEnabled = this.isTextOverflown(input);
652
- if (this.toolTipForInputEnabled) {
653
- this.toolTipText = this.calculateToolTipText();
654
- }
655
- this.changeDetector.detectChanges();
656
- }
657
- }
658
- };
659
- ReadOnlyFormFieldWrapperComponent.prototype.isEllipsisForTextOverflowEnabled = function () {
660
- return this.getTextOverFlowStyleValue() === 'ellipsis';
661
- };
662
- ReadOnlyFormFieldWrapperComponent.prototype.isTextOverflown = function (input) {
663
- if (input) {
664
- return input.offsetWidth < input.scrollWidth;
665
- }
666
- return false;
667
- };
668
- ReadOnlyFormFieldWrapperComponent.prototype.calculateToolTipText = function () {
669
- if (!this.unit) {
670
- return this.value;
671
- }
672
- return this.unitPosition === 'left' ? this.unit + ' ' + this.value : this.value + ' ' + this.unit;
673
- };
674
- return ReadOnlyFormFieldWrapperComponent;
675
- }());
676
- ReadOnlyFormFieldWrapperComponent.decorators = [
677
- { type: i0.Component, args: [{
678
- selector: 'mad-readonly-form-field-wrapper',
679
- template: "<div #contentWrapper [hidden]=\"readonly\">\n <ng-content></ng-content>\n</div>\n\n<div #readOnlyContentWrapper>\n <ng-container *ngIf=\"!!readonly\">\n <mad-readonly-form-field\n [label]=\"getLabel()\"\n [value]=\"value\"\n [textAlign]=\"textAlign\"\n [formatNumber]=\"formatNumber\"\n [decimalPlaces]=\"decimalPlaces\"\n [roundDisplayValue]=\"roundValue\"\n [autofillDecimals]=\"autofillDecimals\"\n [unit]=\"unit\"\n [unitPosition]=\"unitPosition\"\n [errorMessage]=\"errorMessage\"\n [multiline]=\"multiline\"\n [rows]=\"rows\"\n [shrinkIfEmpty]=\"shrinkIfEmpty\"\n [id]=\"id\"\n matTooltip=\"{{toolTipText}}\"\n matTooltipPosition=\"right\"\n matTooltipClass=\"custom-tooltip\"\n matTooltipDisabled=\"{{!toolTipForInputEnabled}}\">\n </mad-readonly-form-field>\n </ng-container>\n</div>\n",
680
- styles: ["div,mat-form-field{width:inherit}::ng-deep .custom-tooltip{font-size:14px!important;white-space:normal!important;word-break:break-all!important}"]
681
- },] }
682
- ];
683
- ReadOnlyFormFieldWrapperComponent.ctorParameters = function () { return [
684
- { type: i0.ChangeDetectorRef },
685
- { type: i0.ElementRef }
686
- ]; };
687
- ReadOnlyFormFieldWrapperComponent.propDecorators = {
688
- originalContent: [{ type: i0.ViewChild, args: ['contentWrapper', { static: false },] }],
689
- readOnlyContentWrapper: [{ type: i0.ViewChild, args: ['readOnlyContentWrapper', { static: false },] }],
690
- readonly: [{ type: i0.Input }],
691
- value: [{ type: i0.Input, args: ['value',] }],
692
- textAlign: [{ type: i0.Input, args: ['textAlign',] }],
693
- formatNumber: [{ type: i0.Input, args: ['formatNumber',] }],
694
- decimalPlaces: [{ type: i0.Input, args: ['decimalPlaces',] }],
695
- roundValue: [{ type: i0.Input, args: ['roundDisplayValue',] }],
696
- autofillDecimals: [{ type: i0.Input, args: ['autofillDecimals',] }],
697
- unit: [{ type: i0.Input, args: ['unit',] }],
698
- unitPosition: [{ type: i0.Input, args: ['unitPosition',] }],
699
- errorMessage: [{ type: i0.Input, args: ['errorMessage',] }],
700
- id: [{ type: i0.Input }],
701
- multiline: [{ type: i0.Input }],
702
- rows: [{ type: i0.Input }],
703
- shrinkIfEmpty: [{ type: i0.Input }]
704
- };
705
-
706
- var NumberFormatService = /** @class */ (function () {
707
- function NumberFormatService(locale) {
708
- this.allowedKeys = [];
709
- // try to get the current formatting
710
- var localeDecimalSeparator = (1.1).toLocaleString(locale).charAt(1);
711
- this.decimalSeparator = localeDecimalSeparator === ',' ? ',' : '.';
712
- this.groupingSeparator = localeDecimalSeparator === ',' ? '.' : ',';
713
- this.allowedKeys = __spread(NumberFormatService.NUMBERS, [NumberFormatService.NEGATIVE, this.decimalSeparator]);
714
- }
715
- NumberFormatService.valueIsSet = function (value) {
716
- return typeof value !== 'undefined' && value !== null && (typeof value !== 'string' || value.length !== 0);
717
- };
718
- NumberFormatService.prototype.format = function (value, options) {
719
- return NumberFormatService.valueIsSet(value)
720
- ? this.formatNumber(value.toString().replace(new RegExp('[.]', 'g'), this.decimalSeparator), options)
721
- : '';
722
- };
723
- NumberFormatService.prototype.formatNumber = function (value, options) {
724
- var autofillDecimals = this.valueOrDefault(options === null || options === void 0 ? void 0 : options.autofillDecimals, NumberFormatService.DEFAULT_AUTOFILL_DECIMALS);
725
- var decimalPlaces = this.valueOrDefault(options === null || options === void 0 ? void 0 : options.decimalPlaces, NumberFormatService.DEFAULT_DECIMAL_PLACES);
726
- var finalFormatting = this.valueOrDefault(options === null || options === void 0 ? void 0 : options.finalFormatting, NumberFormatService.DEFAULT_FINAL_FORMATTING);
727
- var result = this.strip(value, { decimalPlaces: decimalPlaces, removeLeadingZeros: finalFormatting });
728
- /* add grouping separator */
729
- var decimalIndex = result.indexOf(this.decimalSeparator);
730
- var isNegative = result.startsWith(NumberFormatService.NEGATIVE);
731
- var i = decimalIndex > -1 ? decimalIndex : result.length;
732
- while (i > (isNegative ? 4 : 3)) {
733
- i -= 3;
734
- result = result.substring(0, i) + this.groupingSeparator + result.substring(i, result.length);
735
- }
736
- if (finalFormatting) {
737
- if (decimalPlaces > 0 && !!result) {
738
- /* autofill decimal places */
739
- var actualDecimalIndex = result.indexOf(this.decimalSeparator);
740
- if (autofillDecimals) {
741
- if (actualDecimalIndex === -1) {
742
- actualDecimalIndex = result.length;
743
- result += this.decimalSeparator;
744
- }
745
- result = this.addMissingLeadingZero(result, actualDecimalIndex);
746
- actualDecimalIndex = result.indexOf(this.decimalSeparator);
747
- var actualDecimalPlaces = result.length - actualDecimalIndex - 1;
748
- for (var j = 0; j < decimalPlaces - actualDecimalPlaces; j++) {
749
- result += '0';
750
- }
751
- }
752
- else {
753
- result = this.addMissingLeadingZero(result, actualDecimalIndex);
754
- }
755
- }
756
- }
757
- return result;
758
- };
759
- NumberFormatService.prototype.strip = function (value, options) {
760
- var e_1, _a;
761
- var decimalPlaces = this.valueOrDefault(options === null || options === void 0 ? void 0 : options.decimalPlaces, NumberFormatService.DEFAULT_DECIMAL_PLACES);
762
- var removeLeadingZeros = this.valueOrDefault(options === null || options === void 0 ? void 0 : options.removeLeadingZeros, NumberFormatService.DEFAULT_REMOVE_LEADING_ZEROS);
763
- var result = '';
764
- var indexDecimalSep = -1;
765
- var j = -1;
766
- var ignoredChars = 0;
767
- try {
768
- for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
769
- var char = value_1_1.value;
770
- j++;
771
- if (this.allowedKeys.includes(char)) {
772
- if (char === this.decimalSeparator) {
773
- if (decimalPlaces === 0) {
774
- /* dismiss content after a decimal separator, when no places allowed */
775
- break;
776
- }
777
- else if (indexDecimalSep > -1) {
778
- /* ignore subsequent decimal separators */
779
- continue;
780
- }
781
- indexDecimalSep = j;
782
- }
783
- if (char === '0' && removeLeadingZeros) {
784
- /* remove leading zero only if it's not the only zero in the 'value' string */
785
- if ((result.length === 0 && j + 1 !== value.length) || result === NumberFormatService.NEGATIVE) {
786
- ignoredChars++;
787
- continue;
788
- }
789
- }
790
- if (char === NumberFormatService.NEGATIVE && j > 0) {
791
- /* dismiss content after a negative sign not on first position */
792
- break;
793
- }
794
- if (indexDecimalSep > -1 && result.length + ignoredChars > indexDecimalSep + decimalPlaces) {
795
- /* dismiss content after maximum decimal places reached */
796
- break;
797
- }
798
- result += char;
799
- }
800
- else if (char === this.groupingSeparator) {
801
- if (indexDecimalSep === -1) {
802
- ignoredChars++;
803
- }
804
- }
805
- else {
806
- /* dismiss content after a invalid character */
807
- break;
808
- }
809
- }
810
- }
811
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
812
- finally {
813
- try {
814
- if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);
815
- }
816
- finally { if (e_1) throw e_1.error; }
817
- }
818
- return result;
819
- };
820
- NumberFormatService.prototype.addMissingLeadingZero = function (result, actualDecimalIndex) {
821
- var isNegative = result.startsWith(NumberFormatService.NEGATIVE);
822
- /* autoadd a zero before decimal separator, when it's missing */
823
- if (actualDecimalIndex === 0) {
824
- result = '0' + result;
825
- }
826
- /* autoadd a zero before decimal separator, when it's missing, for negative values */
827
- if (actualDecimalIndex === 1 && isNegative) {
828
- result = result[0] + '0' + result.substring(1, result.length);
829
- }
830
- return result;
831
- };
832
- NumberFormatService.prototype.valueOrDefault = function (value, defaultValue) {
833
- return NumberFormatService.valueIsSet(value) ? value : defaultValue;
834
- };
835
- return NumberFormatService;
836
- }());
837
- NumberFormatService.NEGATIVE = '-';
838
- NumberFormatService.NUMBERS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
839
- NumberFormatService.DEFAULT_FINAL_FORMATTING = true;
840
- NumberFormatService.DEFAULT_DECIMAL_PLACES = 2;
841
- NumberFormatService.DEFAULT_AUTOFILL_DECIMALS = false;
842
- NumberFormatService.DEFAULT_REMOVE_LEADING_ZEROS = false;
843
- NumberFormatService.ɵprov = i0.ɵɵdefineInjectable({ factory: function NumberFormatService_Factory() { return new NumberFormatService(i0.ɵɵinject(i0.LOCALE_ID)); }, token: NumberFormatService, providedIn: "any" });
844
- NumberFormatService.decorators = [
845
- { type: i0.Injectable, args: [{
846
- providedIn: 'any',
847
- },] }
848
- ];
849
- NumberFormatService.ctorParameters = function () { return [
850
- { type: String, decorators: [{ type: i0.Inject, args: [i0.LOCALE_ID,] }] }
851
- ]; };
852
-
853
- /**
854
- * Read-only mat-form-field representation of provided value
855
- *
856
- * @author Stefan Laesser
857
- */
858
- var ReadOnlyFormFieldComponent = /** @class */ (function () {
859
- function ReadOnlyFormFieldComponent(changeDetector, renderer, numberFormatService) {
860
- var _this = this;
861
- this.changeDetector = changeDetector;
862
- this.renderer = renderer;
863
- this.numberFormatService = numberFormatService;
864
- this.textAlign = 'left';
865
- this.formatNumber = false;
866
- this.decimalPlaces = 2;
867
- this.roundValue = false;
868
- this.autofillDecimals = false;
869
- this.unit = null;
870
- this.unitPosition = 'left';
871
- this.errorMessage = null;
872
- this.multiline = false;
873
- this.rows = 3;
874
- /*
875
- * If shrinkIfEmpty is set to "false", nothing changes
876
- * If set to "true" and multiline is also "true", the textarea will
877
- * shrink to one row, if value is empty/null/undefined.
878
- * Otherwise, the defined rows-value will be used
879
- */
880
- this.shrinkIfEmpty = false;
881
- this.errorMatcher = {
882
- isErrorState: function () { return !!_this.errorMessage; },
883
- };
884
- }
885
- ReadOnlyFormFieldComponent.prototype.ngOnChanges = function (_) {
886
- if (!NumberFormatService.valueIsSet(this.value)) {
887
- this.value = '-';
888
- if (this.shrinkIfEmpty) {
889
- this.rows = 1;
890
- }
891
- }
892
- else if (this.formatNumber && typeof this.value === 'number') {
893
- this.value = this.numberFormatService.format(this.value, {
894
- decimalPlaces: this.decimalPlaces,
895
- finalFormatting: true,
896
- autofillDecimals: this.autofillDecimals,
897
- });
898
- }
899
- this.changeDetector.detectChanges();
900
- };
901
- // TODO direct copy from NumericFieldDirective
902
- ReadOnlyFormFieldComponent.prototype.ngAfterViewChecked = function () {
903
- this.injectUnitSymbol();
904
- };
905
- ReadOnlyFormFieldComponent.prototype.injectUnitSymbol = function () {
906
- // Need to inject the unit symbol when the input element width is set to its actual value,
907
- // otherwise the icon wont show in the correct position
908
- if (!!this.unit && !this.unitSpan && this.inputEl.nativeElement.offsetWidth !== 0) {
909
- // Get the input wrapper and apply necessary styles
910
- var inputWrapper = this.inputEl.nativeElement.parentNode.parentNode;
911
- // Create the span with unit symbol and apply necessary styles
912
- this.unitSpan = this.renderer.createElement('span');
913
- if (this.unitPosition === 'left') {
914
- this.renderer.setAttribute(this.unitSpan, 'matPrefix', '');
915
- this.renderer.setStyle(this.unitSpan, 'padding-right', '5px');
916
- this.renderer.insertBefore(inputWrapper, this.unitSpan, inputWrapper.children[0]);
917
- }
918
- else {
919
- this.renderer.setAttribute(this.unitSpan, 'matSuffix', '');
920
- this.renderer.setStyle(this.unitSpan, 'padding-left', '5px');
921
- this.renderer.appendChild(inputWrapper, this.unitSpan);
922
- }
923
- }
924
- // special handling to move unit symbol along with display value
925
- if (!!this.unitSpan && this.textAlign === 'left' && this.unitPosition === 'right') {
926
- var inputStyles = window.getComputedStyle(this.inputEl.nativeElement.parentElement, null);
927
- this.unitSpan.style.position = 'absolute';
928
- this.unitSpan.style.marginTop = inputStyles.getPropertyValue('border-top-width');
929
- this.unitSpan.style.paddingTop = inputStyles.getPropertyValue('padding-top');
930
- this.unitSpan.style.paddingBottom = inputStyles.getPropertyValue('padding-bottom');
931
- if (!this.textSpan) {
932
- this.textSpan = document.createElement('span');
933
- document.body.appendChild(this.textSpan);
934
- this.textSpan.style.font = inputStyles.getPropertyValue('font');
935
- this.textSpan.style.fontSize = inputStyles.getPropertyValue('font-size');
936
- this.textSpan.style.height = 'auto';
937
- this.textSpan.style.width = 'auto';
938
- this.textSpan.style.position = 'absolute';
939
- this.textSpan.style.top = '0';
940
- this.textSpan.style.whiteSpace = 'no-wrap';
941
- this.textSpan.style.visibility = 'hidden';
942
- }
943
- this.textSpan.innerHTML = this.value;
944
- var width = Math.min(this.inputEl.nativeElement.clientWidth - this.unitSpan.clientWidth, Math.ceil(this.textSpan.clientWidth));
945
- this.unitSpan.style.left = width + 'px';
946
- }
947
- // always reset unit symbol
948
- if (!!this.unitSpan) {
949
- this.unitSpan.textContent = this.unit;
950
- }
951
- };
952
- return ReadOnlyFormFieldComponent;
953
- }());
954
- ReadOnlyFormFieldComponent.decorators = [
955
- { type: i0.Component, args: [{
956
- selector: 'mad-readonly-form-field',
957
- template: "<mat-form-field class=\"form-group\" appearance=\"none\">\n <mat-label>{{ label }}</mat-label>\n <input\n *ngIf=\"!multiline\"\n [ngModel]=\"value\"\n [ngClass]=\"'text-' + textAlign\"\n [errorStateMatcher]=\"errorMatcher\"\n [id]=\"id\"\n readonly\n matInput\n #inputEl\n />\n\n <textarea\n *ngIf=\"multiline\"\n [rows]=\"rows\"\n [ngModel]=\"value\"\n class=\"multiline\"\n [errorStateMatcher]=\"errorMatcher\"\n [id]=\"id\"\n readonly\n matInput\n ></textarea>\n <mat-error>{{ errorMessage }}</mat-error>\n</mat-form-field>\n",
958
- styles: ["mat-form-field{width:100%;width:-moz-available;width:-webkit-fill-available;width:stretch}mat-label{line-height:1.4}span[matPrefix]{padding-right:5px}span[matSuffix]{padding-left:5px}.text-left{text-align:left}.text-right{text-align:right}.multiline{resize:none}"]
959
- },] }
960
- ];
961
- ReadOnlyFormFieldComponent.ctorParameters = function () { return [
962
- { type: i0.ChangeDetectorRef },
963
- { type: i0.Renderer2 },
964
- { type: NumberFormatService }
965
- ]; };
966
- ReadOnlyFormFieldComponent.propDecorators = {
967
- value: [{ type: i0.Input, args: ['value',] }],
968
- label: [{ type: i0.Input, args: ['label',] }],
969
- textAlign: [{ type: i0.Input, args: ['textAlign',] }],
970
- formatNumber: [{ type: i0.Input, args: ['formatNumber',] }],
971
- decimalPlaces: [{ type: i0.Input, args: ['decimalPlaces',] }],
972
- roundValue: [{ type: i0.Input, args: ['roundDisplayValue',] }],
973
- autofillDecimals: [{ type: i0.Input, args: ['autofillDecimals',] }],
974
- unit: [{ type: i0.Input, args: ['unit',] }],
975
- unitPosition: [{ type: i0.Input, args: ['unitPosition',] }],
976
- errorMessage: [{ type: i0.Input, args: ['errorMessage',] }],
977
- multiline: [{ type: i0.Input }],
978
- rows: [{ type: i0.Input }],
979
- id: [{ type: i0.Input }],
980
- shrinkIfEmpty: [{ type: i0.Input }],
981
- inputEl: [{ type: i0.ViewChild, args: ['inputEl',] }]
982
- };
983
-
984
- var ReadOnlyFormFieldModule = /** @class */ (function () {
985
- function ReadOnlyFormFieldModule() {
986
- }
987
- return ReadOnlyFormFieldModule;
988
- }());
989
- ReadOnlyFormFieldModule.decorators = [
990
- { type: i0.NgModule, args: [{
991
- declarations: [ReadOnlyFormFieldComponent, ReadOnlyFormFieldWrapperComponent],
992
- imports: [common.CommonModule, i1.RouterModule, formField.MatFormFieldModule, input.MatInputModule, forms.FormsModule, tooltip.MatTooltipModule],
993
- exports: [ReadOnlyFormFieldComponent, ReadOnlyFormFieldWrapperComponent],
994
- },] }
995
- ];
996
-
997
- var ToolbarService = /** @class */ (function () {
998
- function ToolbarService(router, translate) {
999
- var _this = this;
1000
- this.router = router;
1001
- this.translate = translate;
1002
- this.mainActions = []; // shown on the left, next to title, as big buttons
1003
- this.toolbarActions = []; // shown on the right as icons
1004
- this.toolbarActionsAlwaysAsMenu = false; // show the mobile view (burger menu) for toolbar actions
1005
- this.toolbarActionsMenuTitle = 'More'; // title of the burger menu
1006
- this.routerSubscription = this.router.events.subscribe(function (routingEvent) {
1007
- if (routingEvent instanceof i1.NavigationEnd) {
1008
- if (_this.currentUrl !== routingEvent.urlAfterRedirects) {
1009
- _this.clearToolbarActions();
1010
- _this.clearMainActions();
1011
- delete _this.backAction;
1012
- delete _this.dataTitle;
1013
- }
1014
- _this.currentUrl = router.url;
1015
- }
1016
- });
1017
- }
1018
- Object.defineProperty(ToolbarService.prototype, "toolbarTitle", {
1019
- get: function () {
1020
- return this.title;
1021
- },
1022
- set: function (toolbarTitle) {
1023
- this.title = toolbarTitle;
1024
- },
1025
- enumerable: false,
1026
- configurable: true
1027
- });
1028
- ToolbarService.prototype.ngOnDestroy = function () {
1029
- if (this.routerSubscription) {
1030
- this.routerSubscription.unsubscribe();
1031
- }
1032
- };
1033
- ToolbarService.prototype.getToolbarActions = function () {
1034
- return this.toolbarActions;
1035
- };
1036
- ToolbarService.prototype.addToolbarAction = function (action) {
1037
- var _this = this;
1038
- this.translate
1039
- .get(action.i18nActionKey)
1040
- .toPromise()
1041
- .then(function (translated) {
1042
- action.actionName = translated;
1043
- _this.toolbarActions.push(action);
1044
- });
1045
- };
1046
- ToolbarService.prototype.setDataTitle = function (dataTitle) {
1047
- this.dataTitle = dataTitle;
1048
- };
1049
- ToolbarService.prototype.setToolbarActionsAlwaysAsMenu = function (toolbarActionsAlwaysAsMenu) {
1050
- this.toolbarActionsAlwaysAsMenu = toolbarActionsAlwaysAsMenu;
1051
- };
1052
- ToolbarService.prototype.getToolbarActionsAlwaysAsMenu = function () {
1053
- return this.toolbarActionsAlwaysAsMenu;
1054
- };
1055
- ToolbarService.prototype.getDataTitle = function () {
1056
- return this.dataTitle;
1057
- };
1058
- ToolbarService.prototype.clearToolbarActions = function () {
1059
- this.toolbarActions = [];
1060
- };
1061
- ToolbarService.prototype.getMainActions = function () {
1062
- return this.mainActions;
1063
- };
1064
- ToolbarService.prototype.getBackAction = function () {
1065
- return this.backAction;
1066
- };
1067
- ToolbarService.prototype.setToolbarActionsMenuTitle = function (toolbarActionsMenuTitle) {
1068
- this.toolbarActionsMenuTitle = toolbarActionsMenuTitle;
1069
- };
1070
- ToolbarService.prototype.getToolbarActionsMenuTitle = function () {
1071
- return this.toolbarActionsMenuTitle;
1072
- };
1073
- ToolbarService.prototype.addMainAction = function (mainAction) {
1074
- var _this = this;
1075
- this.translate
1076
- .get(mainAction.i18nActionKey)
1077
- .toPromise()
1078
- .then(function (translated) {
1079
- mainAction.actionName = translated;
1080
- _this.mainActions.push(mainAction);
1081
- });
1082
- };
1083
- /**
1084
- * Per default the goBackRoute is a routerLink. But if a href should be used (for absolute browser routing) then isAbsoluteUrl can be set to true.
1085
- */
1086
- ToolbarService.prototype.addBackAction = function (goBackRoute, isAbsoluteUrl) {
1087
- if (isAbsoluteUrl === void 0) { isAbsoluteUrl = false; }
1088
- this.backAction = {
1089
- matIcon: 'keyboard_backspace',
1090
- i18nActionKey: '',
1091
- };
1092
- if (!isAbsoluteUrl) {
1093
- this.backAction.routerLink = goBackRoute;
1094
- }
1095
- else {
1096
- this.backAction.href = goBackRoute;
1097
- }
1098
- };
1099
- ToolbarService.prototype.addSimpleBackButton = function (overrideIfPresent) {
1100
- if (overrideIfPresent === void 0) { overrideIfPresent = false; }
1101
- if (this.getBackAction() && !overrideIfPresent) {
1102
- return;
1103
- }
1104
- this.backAction = {
1105
- matIcon: 'keyboard_backspace',
1106
- i18nActionKey: '',
1107
- action: function () {
1108
- window.history.back();
1109
- },
1110
- };
1111
- };
1112
- ToolbarService.prototype.clearMainActions = function () {
1113
- this.mainActions = [];
1114
- };
1115
- return ToolbarService;
1116
- }());
1117
- ToolbarService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ToolbarService_Factory() { return new ToolbarService(i0.ɵɵinject(i1.Router), i0.ɵɵinject(i2.TranslateService)); }, token: ToolbarService, providedIn: "root" });
1118
- ToolbarService.decorators = [
1119
- { type: i0.Injectable, args: [{
1120
- providedIn: 'root',
1121
- },] }
1122
- ];
1123
- ToolbarService.ctorParameters = function () { return [
1124
- { type: i1.Router },
1125
- { type: i2.TranslateService }
1126
- ]; };
1127
-
1128
- var ToolbarComponent = /** @class */ (function () {
1129
- function ToolbarComponent(breakpointObserver, titleService, toolbarService) {
1130
- this.breakpointObserver = breakpointObserver;
1131
- this.titleService = titleService;
1132
- this.toolbarService = toolbarService;
1133
- this.isHandset$ = this.breakpointObserver.observe([layout.Breakpoints.Handset]).pipe(operators.map(function (result) { return result.matches; }));
1134
- }
1135
- ToolbarComponent.prototype.getTitle = function () {
1136
- var dataTitle = this.toolbarService.getDataTitle();
1137
- var toolbarTitle = this.toolbarService.toolbarTitle;
1138
- var title = !toolbarTitle || toolbarTitle.length <= 0 ? this.titleService.getTitle() : toolbarTitle;
1139
- return !dataTitle || dataTitle.length <= 0 ? title : title + ': ' + dataTitle;
1140
- };
1141
- ToolbarComponent.prototype.getToolbarActions = function () {
1142
- return this.toolbarService.getToolbarActions();
1143
- };
1144
- ToolbarComponent.prototype.getMainActions = function () {
1145
- return this.toolbarService.getMainActions();
1146
- };
1147
- ToolbarComponent.prototype.hasPermission = function (action) {
1148
- if (!action || !action.showIf) {
1149
- return rxjs.of(true);
1150
- }
1151
- return action.showIf;
1152
- };
1153
- ToolbarComponent.prototype.isRouterLink = function () {
1154
- return this.toolbarService.getBackAction() && !!this.toolbarService.getBackAction().routerLink;
1155
- };
1156
- ToolbarComponent.prototype.isAbsoluteLink = function () {
1157
- return this.toolbarService.getBackAction() && !!this.toolbarService.getBackAction().href;
1158
- };
1159
- ToolbarComponent.prototype.isAction = function () {
1160
- return this.toolbarService.getBackAction() && !!this.toolbarService.getBackAction().action;
1161
- };
1162
- ToolbarComponent.prototype.getBackAction = function () {
1163
- return this.toolbarService.getBackAction();
1164
- };
1165
- ToolbarComponent.prototype.getToolbarActionsAlwaysAsMenu = function () {
1166
- return this.toolbarService.getToolbarActionsAlwaysAsMenu();
1167
- };
1168
- ToolbarComponent.prototype.getToolbarActionsMenuTitle = function () {
1169
- return this.toolbarService.getToolbarActionsMenuTitle();
1170
- };
1171
- ToolbarComponent.prototype.showBadgeForMenu = function () {
1172
- return (this.getToolbarActions()
1173
- .slice(1) // the first icon is not shown in menu
1174
- .filter(function (value) { return value.badge && value.badge.value; }).length > 0);
1175
- };
1176
- ToolbarComponent.prototype.hasImportantToolbarActions = function () {
1177
- return this.getToolbarActions().filter(function (value) { return !!value.importantAction; }).length > 0;
1178
- };
1179
- return ToolbarComponent;
1180
- }());
1181
- ToolbarComponent.decorators = [
1182
- { type: i0.Component, args: [{
1183
- selector: 'mad-toolbar',
1184
- template: "<mat-toolbar class=\"content-toolbar\">\n <a [routerLink]=\"getBackAction().routerLink\" *ngIf=\"isRouterLink()\">\n <button [id]=\"'go-back'\" color=\"primary\" mat-icon-button class=\"go-back-button\">\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n <a [href]=\"getBackAction().href\" *ngIf=\"isAbsoluteLink()\">\n <button [id]=\"'go-back'\" class=\"go-back-button\" color=\"primary\" mat-icon-button>\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n <a (click)=\"getBackAction().action()\" *ngIf=\"isAction()\">\n <button [id]=\"'go-back'\" color=\"primary\" mat-icon-button class=\"go-back-button\">\n <mat-icon>{{ getBackAction().matIcon }}</mat-icon>\n </button>\n </a>\n\n <span class=\"toolbar-title\">{{ getTitle() }}</span>\n\n <ng-container *ngFor=\"let mainAction of getMainActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(mainAction) | async\">\n <div *ngIf=\"!(isHandset$ | async)\">\n <a [routerLink]=\"mainAction.routerLink\">\n <mad-primary-button [id]=\"mainAction.matIcon\" style=\"margin-left: 56px\">\n <mat-icon>{{ mainAction.matIcon }}</mat-icon>\n {{ mainAction.actionName }}\n </mad-primary-button>\n </a>\n </div>\n <div *ngIf=\"isHandset$ | async\">\n <mad-material-action-button\n [actionName]=\"mainAction.actionName\"\n [icon]=\"mainAction.matIcon\"\n [liftHigher]=\"mainAction.liftHigherOnMobile\"\n [liftHigher2]=\"i > 0\"\n [routerLink]=\"mainAction.routerLink\"\n [id]=\"mainAction.matIcon\"\n >\n </mad-material-action-button>\n </div>\n </ng-container>\n </ng-container>\n\n <div class=\"right-aligned no-print\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <mad-icon-button\n (click)=\"action.action()\"\n *ngIf=\"(!(isHandset$ | async) && !getToolbarActionsAlwaysAsMenu()) || i < (getToolbarActions().length > 2 ? (hasImportantToolbarActions() ? 0:1) : 2) || !!action.importantAction\"\n [id]=\"action.matIcon\"\n [matTooltip]=\"action.actionName\"\n type=\"button\">\n <mat-icon\n [matBadgeColor]=\"action.badge ? action.badge.color : 'primary'\"\n matBadgePosition=\"below after\"\n [matBadge]=\"action.badge ? action.badge.value : null\"\n >{{ action.matIcon }}</mat-icon>\n </mad-icon-button>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"(isHandset$ | async) || getToolbarActionsAlwaysAsMenu()\">\n <ng-container *ngIf=\"getToolbarActions().length > 2\">\n <mad-icon-button type=\"button\" [matMenuTriggerFor]=\"burgerMenu\" [matTooltip]=\"getToolbarActionsMenuTitle()\">\n <mat-icon\n matBadgeColor=\"warn\"\n [matBadge]=\"showBadgeForMenu() ? '&#8288;' : null\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >more_vert\n </mat-icon>\n </mad-icon-button>\n <mat-menu #burgerMenu=\"matMenu\" class=\"no-print\">\n <ng-container *ngFor=\"let action of getToolbarActions(); let i = index\">\n <ng-container *ngIf=\"!action.importantAction\">\n <ng-container *ngIf=\"hasPermission(action) | async\">\n <button *ngIf=\"i >= (hasImportantToolbarActions() ? 0:1)\" mat-menu-item (click)=\"action.action()\">\n <mat-icon\n color=\"primary\"\n [matBadgeColor]=\"action.badge ? action.badge.color : 'primary'\"\n [matBadge]=\"action.badge ? action.badge.value : null\"\n matBadgePosition=\"below after\"\n >{{ action.matIcon }}</mat-icon\n >\n {{ action.actionName }}\n </button>\n </ng-container>\n </ng-container>\n </ng-container>\n </mat-menu>\n </ng-container>\n </ng-container>\n </div>\n</mat-toolbar>\n",
1185
- styles: ["mat-toolbar{background:#fff}.content-toolbar{border-bottom:1px solid #dcdcdc;height:57px}.right-aligned{margin-left:auto;margin-right:0;overflow:hidden}.go-back-button{padding-left:0;padding-right:0}.toolbar-title{margin-right:72px}::ng-deep.mat-badge-content{bottom:-7px!important;right:-7px!important}"]
1186
- },] }
1187
- ];
1188
- ToolbarComponent.ctorParameters = function () { return [
1189
- { type: layout.BreakpointObserver },
1190
- { type: platformBrowser.Title },
1191
- { type: ToolbarService }
1192
- ]; };
1193
-
1194
- var ToolbarModule = /** @class */ (function () {
1195
- function ToolbarModule() {
1196
- }
1197
- return ToolbarModule;
1198
- }());
1199
- ToolbarModule.decorators = [
1200
- { type: i0.NgModule, args: [{
1201
- declarations: [ToolbarComponent],
1202
- imports: [
1203
- common.CommonModule,
1204
- i1.RouterModule,
1205
- menu.MatMenuModule,
1206
- button.MatButtonModule,
1207
- toolbar.MatToolbarModule,
1208
- icon.MatIconModule,
1209
- MaterialActionButtonModule,
1210
- tooltip.MatTooltipModule,
1211
- ButtonModule,
1212
- badge.MatBadgeModule,
1213
- ],
1214
- exports: [ToolbarComponent],
1215
- },] }
1216
- ];
1217
-
1218
- /*
1219
- * Copyright (c) 2018-2020 Porsche Informatik. All Rights Reserved.
1220
- * This software is released under MIT license.
1221
- * The full license information can be found in LICENSE in the root directory of this project.
1222
- */
1223
- var BACK_KEYCODE = 8;
1224
- var SPACE_KEYCODE = 32;
1225
- var DEL_KEYCODE = 46;
1226
- var CONTROL_KEYCODES_UPPER_BORDER = 46;
1227
- var OTHER_CONTROL_KEYS = new Set([224, 91, 93]);
1228
- var NumericFieldDirective = /** @class */ (function () {
1229
- function NumericFieldDirective(renderer, inputEl, numberFormatService) {
1230
- this.renderer = renderer;
1231
- this.inputEl = inputEl;
1232
- this.numberFormatService = numberFormatService;
1233
- this.textAlign = 'right';
1234
- this.decimalPlaces = 2;
1235
- this.roundValue = false;
1236
- this.autofillDecimals = false;
1237
- this.unit = null;
1238
- this.unitPosition = 'right';
1239
- this.numericValueChanged = new i0.EventEmitter();
1240
- this.displayValue = '';
1241
- this.originalValue = NaN;
1242
- /* Control Values Accessor Stuff below */
1243
- // eslint-disable-next-line
1244
- this.onChange = function () { };
1245
- // eslint-disable-next-line
1246
- this.onTouched = function () { };
1247
- }
1248
- Object.defineProperty(NumericFieldDirective.prototype, "numericValue", {
1249
- set: function (value) {
1250
- if (this._numericValue !== value && !(isNaN(this._numericValue) && (isNaN(value) || value === null))) {
1251
- this.originalValue = value;
1252
- // Don't roundOrTruncate if value was set to empty otherwise input value will be set to 0 instead of empty
1253
- // which happens when an input is being reset
1254
- this._numericValue = value === null || value === undefined ? value : this.roundOrTruncate(value); // eslint-disable-line
1255
- this.handleInputChanged();
1256
- }
1257
- },
1258
- enumerable: false,
1259
- configurable: true
1260
- });
1261
- NumericFieldDirective.prototype.registerOnChange = function (fn) {
1262
- this.onChange = fn;
1263
- };
1264
- NumericFieldDirective.prototype.registerOnTouched = function (fn) {
1265
- this.onTouched = fn;
1266
- };
1267
- NumericFieldDirective.prototype.setDisabledState = function () {
1268
- // Dont need to implement since its just a directive
1269
- };
1270
- NumericFieldDirective.prototype.writeValue = function (value) {
1271
- this.numericValue = value;
1272
- };
1273
- NumericFieldDirective.prototype.ngOnInit = function () {
1274
- var _this = this;
1275
- /* needs to be parsed as number explicitly as it comes as string from user input */
1276
- this.decimalPlaces = parseInt(this.decimalPlaces.toString(), 10);
1277
- this.inputChangeListener = this.renderer.listen(this.inputEl.nativeElement, 'blur', function (event) {
1278
- _this.formatInput(event.target, true);
1279
- });
1280
- this.keyupListener = this.renderer.listen(this.inputEl.nativeElement, 'keyup', function (event) {
1281
- if (event.keyCode === BACK_KEYCODE || (event.keyCode >= CONTROL_KEYCODES_UPPER_BORDER && !OTHER_CONTROL_KEYS.has(event.keyCode))) {
1282
- _this.formatInput(event.target, false);
1283
- }
1284
- });
1285
- this.keydownListener = this.renderer.listen(this.inputEl.nativeElement, 'keydown', function (event) {
1286
- var value = event.target.value;
1287
- if (_this.numberFormatService.allowedKeys.includes(event.key) ||
1288
- (event.keyCode <= CONTROL_KEYCODES_UPPER_BORDER && event.keyCode > 0 && event.keyCode !== SPACE_KEYCODE) ||
1289
- event.metaKey ||
1290
- event.ctrlKey ||
1291
- event.altKey) {
1292
- /* allow negative sign only as first character and none exists outside of text selection */
1293
- var indexNegativeSign = value.indexOf(NumberFormatService.NEGATIVE);
1294
- if (event.key === NumberFormatService.NEGATIVE &&
1295
- (event.target.selectionStart > 0 || indexNegativeSign > -1) &&
1296
- (event.target.selectionStart === event.target.selectionEnd ||
1297
- !(indexNegativeSign >= event.target.selectionStart && indexNegativeSign <= event.target.selectionEnd))) {
1298
- return false;
1299
- }
1300
- /* no duplicate decimal separators */
1301
- var indexDecimalSep = value.indexOf(_this.numberFormatService.decimalSeparator);
1302
- if (event.key === _this.numberFormatService.decimalSeparator &&
1303
- (indexDecimalSep > -1 || _this.decimalPlaces === 0) &&
1304
- (event.target.selectionStart === event.target.selectionEnd ||
1305
- !(indexDecimalSep >= event.target.selectionStart && indexDecimalSep <= event.target.selectionEnd))) {
1306
- return false;
1307
- }
1308
- /* prevent too many decimal places */
1309
- if (NumberFormatService.NUMBERS.includes(event.key) &&
1310
- indexDecimalSep > -1 &&
1311
- indexDecimalSep < event.target.selectionStart &&
1312
- event.target.selectionStart === event.target.selectionEnd &&
1313
- value.length > indexDecimalSep + _this.decimalPlaces) {
1314
- return false;
1315
- }
1316
- /* when deleting thousand separator, remove the digit before or after it */
1317
- var cursorStart = event.target.selectionStart;
1318
- if (cursorStart === event.target.selectionEnd) {
1319
- if (event.keyCode === BACK_KEYCODE && value.substr(cursorStart - 1, 1) === _this.numberFormatService.groupingSeparator) {
1320
- event.target.value = value.substring(0, cursorStart - 2) + value.substring(cursorStart - 1, value.length);
1321
- event.target.selectionStart = event.target.selectionEnd = cursorStart - 1;
1322
- return false;
1323
- }
1324
- else if (event.keyCode === DEL_KEYCODE && value.substr(cursorStart, 1) === _this.numberFormatService.groupingSeparator) {
1325
- event.target.value = value.substring(0, cursorStart + 1) + value.substring(cursorStart + 2, value.length);
1326
- event.target.selectionStart = event.target.selectionEnd = cursorStart + 1;
1327
- return false;
1328
- }
1329
- }
1330
- _this.originalValue = NaN;
1331
- }
1332
- else {
1333
- return false;
1334
- }
1335
- return true;
1336
- });
1337
- };
1338
- NumericFieldDirective.prototype.ngOnDestroy = function () {
1339
- this.detachListener();
1340
- };
1341
- NumericFieldDirective.prototype.ngAfterViewChecked = function () {
1342
- this.injectUnitSymbol();
1343
- };
1344
- NumericFieldDirective.prototype.handleInputChanged = function () {
1345
- var _this = this;
1346
- // Call in set timeout to avoid Expression has changed after it has been checked error.
1347
- // Sometimes the value changes because we cut off decimal places
1348
- setTimeout(function () {
1349
- _this.updateInput(_this.numberFormatService.format(_this._numericValue, {
1350
- decimalPlaces: _this.decimalPlaces,
1351
- finalFormatting: false,
1352
- autofillDecimals: _this.autofillDecimals,
1353
- }));
1354
- }, 1);
1355
- };
1356
- NumericFieldDirective.prototype.formatInput = function (element, finalFormatting) {
1357
- var cursorPos = element.selectionStart;
1358
- var length = element.value.length;
1359
- var setCursor = this.displayValue !== element.value;
1360
- var textFormatted = this.numberFormatService.formatNumber(element.value, {
1361
- decimalPlaces: this.decimalPlaces,
1362
- finalFormatting: finalFormatting,
1363
- autofillDecimals: this.autofillDecimals,
1364
- });
1365
- // special handling to move unit symbol along with display value
1366
- if (this.textAlign === 'left' && this.unitPosition === 'right') {
1367
- var inputStyles = window.getComputedStyle(this.inputEl.nativeElement.parentElement, null);
1368
- this.unitSpan.style.position = 'absolute';
1369
- this.unitSpan.style.marginTop = inputStyles.getPropertyValue('border-top-width');
1370
- this.unitSpan.style.paddingTop = inputStyles.getPropertyValue('padding-top');
1371
- this.unitSpan.style.paddingBottom = inputStyles.getPropertyValue('padding-bottom');
1372
- if (!this.textSpan) {
1373
- this.textSpan = document.createElement('span');
1374
- document.body.appendChild(this.textSpan);
1375
- this.textSpan.style.font = inputStyles.getPropertyValue('font');
1376
- this.textSpan.style.fontSize = inputStyles.getPropertyValue('font-size');
1377
- this.textSpan.style.height = 'auto';
1378
- this.textSpan.style.width = 'auto';
1379
- this.textSpan.style.position = 'absolute';
1380
- this.textSpan.style.top = '0';
1381
- this.textSpan.style.whiteSpace = 'no-wrap';
1382
- this.textSpan.style.visibility = 'hidden';
1383
- }
1384
- this.textSpan.innerHTML = textFormatted;
1385
- var width = Math.min(this.inputEl.nativeElement.clientWidth - this.unitSpan.clientWidth, Math.ceil(this.textSpan.clientWidth));
1386
- this.unitSpan.style.left = width + 'px';
1387
- }
1388
- this.updateInput(textFormatted);
1389
- if (setCursor) {
1390
- element.selectionStart = element.selectionEnd = Math.max(cursorPos + element.value.length - length, 0);
1391
- }
1392
- };
1393
- NumericFieldDirective.prototype.updateInput = function (value) {
1394
- this.displayValue = value;
1395
- this.inputEl.nativeElement.value = value;
1396
- this._numericValue = parseFloat(this.numberFormatService.strip(value, { decimalPlaces: this.decimalPlaces }).replace(this.numberFormatService.decimalSeparator, '.'));
1397
- if (this._numericValue !== this.roundOrTruncate(this.originalValue)) {
1398
- this.originalValue = this._numericValue;
1399
- this.numericValueChanged.emit(this._numericValue);
1400
- }
1401
- };
1402
- NumericFieldDirective.prototype.getValueForFormControl = function () {
1403
- this.formatInput(this.inputEl.nativeElement, false);
1404
- if (isNaN(this._numericValue)) {
1405
- // Return undefined instead of NaN to support the default required validator.
1406
- return undefined; // eslint-disable-line
1407
- }
1408
- return this._numericValue;
1409
- };
1410
- NumericFieldDirective.prototype.injectUnitSymbol = function () {
1411
- // Need to inject the unit symbol when the input element width is set to its actual value,
1412
- // otherwise the icon wont show in the correct position
1413
- if (!!this.unit && !this.unitSpan && this.inputEl.nativeElement.offsetWidth !== 0) {
1414
- // Get the input wrapper and apply necessary styles
1415
- var inputWrapper = this.inputEl.nativeElement.parentNode.parentNode;
1416
- // Create the span with unit symbol and apply necessary styles
1417
- this.unitSpan = this.renderer.createElement('span');
1418
- if (this.unitPosition === 'left') {
1419
- this.renderer.setAttribute(this.unitSpan, 'matPrefix', '');
1420
- this.renderer.setStyle(this.unitSpan, 'padding-right', '5px');
1421
- this.renderer.insertBefore(inputWrapper, this.unitSpan, inputWrapper.children[0]);
1422
- }
1423
- else {
1424
- this.renderer.setAttribute(this.unitSpan, 'matSuffix', '');
1425
- this.renderer.setStyle(this.unitSpan, 'padding-left', '5px');
1426
- this.renderer.appendChild(inputWrapper, this.unitSpan);
1427
- }
1428
- }
1429
- // do not display unit symbol if the unit should move along display value
1430
- if (!!this.unitSpan && this.textAlign === 'left' && this.unitPosition === 'right') {
1431
- if (NumberFormatService.valueIsSet(this.displayValue)) {
1432
- this.unitSpan.style.display = 'unset';
1433
- }
1434
- else {
1435
- this.unitSpan.style.display = 'none';
1436
- }
1437
- }
1438
- // always reset unit symbol
1439
- if (!!this.unitSpan) {
1440
- this.unitSpan.textContent = this.unit;
1441
- }
1442
- };
1443
- NumericFieldDirective.prototype.detachListener = function () {
1444
- if (this.inputChangeListener) {
1445
- this.inputChangeListener();
1446
- delete this.inputChangeListener;
1447
- }
1448
- if (this.keydownListener) {
1449
- this.keydownListener();
1450
- delete this.keydownListener;
1451
- }
1452
- if (this.keyupListener) {
1453
- this.keyupListener();
1454
- delete this.keyupListener;
1455
- }
1456
- };
1457
- NumericFieldDirective.prototype.roundOrTruncate = function (value) {
1458
- var method = this.roundValue ? 'round' : value < 0 ? 'ceil' : 'floor';
1459
- return Math[method](value * Math.pow(10, this.decimalPlaces)) / Math.pow(10, this.decimalPlaces);
1460
- };
1461
- return NumericFieldDirective;
1462
- }());
1463
- NumericFieldDirective.decorators = [
1464
- { type: i0.Directive, args: [{
1465
- selector: '[madNumericField]',
1466
- host: {
1467
- '[class.text-right]': 'textAlign === "right"',
1468
- '(change)': 'onChange(getValueForFormControl())',
1469
- '(input)': 'onChange(getValueForFormControl())',
1470
- '(blur)': 'onTouched()',
1471
- },
1472
- providers: [
1473
- {
1474
- provide: forms.NG_VALUE_ACCESSOR,
1475
- useExisting: i0.forwardRef(function () { return NumericFieldDirective; }),
1476
- multi: true,
1477
- },
1478
- ],
1479
- },] }
1480
- ];
1481
- NumericFieldDirective.ctorParameters = function () { return [
1482
- { type: i0.Renderer2 },
1483
- { type: i0.ElementRef },
1484
- { type: NumberFormatService }
1485
- ]; };
1486
- NumericFieldDirective.propDecorators = {
1487
- textAlign: [{ type: i0.Input, args: ['textAlign',] }],
1488
- decimalPlaces: [{ type: i0.Input, args: ['decimalPlaces',] }],
1489
- roundValue: [{ type: i0.Input, args: ['roundDisplayValue',] }],
1490
- autofillDecimals: [{ type: i0.Input, args: ['autofillDecimals',] }],
1491
- unit: [{ type: i0.Input, args: ['unit',] }],
1492
- unitPosition: [{ type: i0.Input, args: ['unitPosition',] }],
1493
- numericValueChanged: [{ type: i0.Output, args: ['numericValueChange',] }],
1494
- numericValue: [{ type: i0.Input, args: ['numericValue',] }]
1495
- };
1496
-
1497
- var NumericFieldModule = /** @class */ (function () {
1498
- function NumericFieldModule() {
1499
- }
1500
- NumericFieldModule.forRoot = function () {
1501
- return {
1502
- ngModule: NumericFieldModule,
1503
- providers: [NumberFormatService],
1504
- };
1505
- };
1506
- return NumericFieldModule;
1507
- }());
1508
- NumericFieldModule.decorators = [
1509
- { type: i0.NgModule, args: [{
1510
- providers: [NumberFormatService],
1511
- declarations: [NumericFieldDirective],
1512
- exports: [NumericFieldDirective],
1513
- },] }
1514
- ];
1515
-
1516
- var CardComponent = /** @class */ (function () {
1517
- function CardComponent() {
1518
- this.cancelDisabled = false;
1519
- this.cancelText = 'NOT SET';
1520
- this.readonly = true;
1521
- this.editText = 'NOT SET';
1522
- this.expandable = true;
1523
- this.expanded = true;
1524
- this.saveDisabled = false;
1525
- this.saveText = 'NOT SET';
1526
- this.editMode = false;
1527
- this.additionalActionText = '';
1528
- this.edit = new i0.EventEmitter();
1529
- this.cancel = new i0.EventEmitter();
1530
- this.save = new i0.EventEmitter();
1531
- this.additionalAction = new i0.EventEmitter();
1532
- }
1533
- CardComponent.prototype.onCancel = function () {
1534
- this.cancel.emit(undefined);
1535
- };
1536
- CardComponent.prototype.onEdit = function () {
1537
- this.edit.emit(undefined);
1538
- this.expanded = true;
1539
- };
1540
- CardComponent.prototype.onSave = function () {
1541
- this.save.emit(undefined);
1542
- };
1543
- CardComponent.prototype.toggleCollapse = function () {
1544
- this.expanded = !this.expanded;
1545
- };
1546
- CardComponent.prototype.additionalActionClicked = function () {
1547
- this.additionalAction.emit(undefined);
1548
- };
1549
- return CardComponent;
1550
- }());
1551
- CardComponent.decorators = [
1552
- { type: i0.Component, args: [{
1553
- selector: 'mad-card',
1554
- template: "<mat-card>\n <mat-card-header>\n <mat-card-title>\n {{ title }}\n <mad-icon-button (click)=\"toggleCollapse()\" *ngIf=\"expandable && !editMode\">\n <mat-icon [@rotateIcon]=\"!expanded\">keyboard_arrow_down</mat-icon>\n </mad-icon-button>\n </mat-card-title>\n <span>\n <mad-icon-button (click)=\"additionalActionClicked()\" *ngIf=\"additionalActionIcon\" [title]=\"additionalActionText\" type=\"button\">\n <mat-icon>{{additionalActionIcon}}</mat-icon>\n </mad-icon-button>\n <mad-icon-button [title]=\"editText\" (click)=\"onEdit()\" *ngIf=\"!readonly && !editMode\">\n <mat-icon>create</mat-icon>\n </mad-icon-button>\n </span>\n </mat-card-header>\n <mat-card-content [@collapseExpandAnimation] *ngIf=\"expanded\">\n <ng-content></ng-content>\n </mat-card-content>\n <mat-card-actions *ngIf=\"!readonly && editMode\">\n <mad-primary-button [title]=\"saveText\" [disabled]=\"saveDisabled\" (throttleClick)=\"onSave()\" madThrottleClick>\n {{ saveText }}\n </mad-primary-button>\n <mad-outline-button [title]=\"cancelText\" [disabled]=\"cancelDisabled\" (click)=\"onCancel()\">\n {{ cancelText }}\n </mad-outline-button>\n </mat-card-actions>\n</mat-card>\n",
1555
- animations: [
1556
- animations.trigger('collapseExpandAnimation', [
1557
- animations.transition(':enter', [
1558
- animations.style({ opacity: 0, height: 0, overflow: 'hidden' }),
1559
- animations.animate('100ms', animations.style({
1560
- opacity: 1,
1561
- height: '*',
1562
- })),
1563
- ]),
1564
- animations.transition(':leave', [
1565
- animations.style({ opacity: 1, height: '*', overflow: 'hidden' }),
1566
- animations.animate('100ms', animations.style({
1567
- opacity: 0,
1568
- height: 0,
1569
- })),
1570
- ]),
1571
- ]),
1572
- animations.trigger('rotateIcon', [
1573
- animations.state('true', animations.style({ transform: 'rotate(0)' })),
1574
- animations.state('false', animations.style({ transform: 'rotate(180deg)' })),
1575
- animations.transition('true => false', animations.animate('100ms ease-out')),
1576
- animations.transition('false => true', animations.animate('100ms ease-in')),
1577
- ]),
1578
- ],
1579
- styles: ["mat-card-header{display:flex;flex-direction:row}mat-card-header,mat-card-header mat-card-title{justify-content:space-between}mat-card-header mat-card-title:hover{background:unset!important}mat-card-header h3{float:left;font-weight:700;line-height:40px;margin:0 .25em 0 0}.mat-card-actions{margin-left:0;margin-right:0}.mat-card>.mat-card-actions:last-child{margin-bottom:0}"]
1580
- },] }
1581
- ];
1582
- CardComponent.propDecorators = {
1583
- cancelDisabled: [{ type: i0.Input }],
1584
- cancelText: [{ type: i0.Input }],
1585
- readonly: [{ type: i0.Input }],
1586
- editText: [{ type: i0.Input }],
1587
- expandable: [{ type: i0.Input }],
1588
- expanded: [{ type: i0.Input }],
1589
- saveDisabled: [{ type: i0.Input }],
1590
- saveText: [{ type: i0.Input }],
1591
- title: [{ type: i0.Input }],
1592
- editMode: [{ type: i0.Input }],
1593
- additionalActionIcon: [{ type: i0.Input }],
1594
- additionalActionText: [{ type: i0.Input }],
1595
- edit: [{ type: i0.Output }],
1596
- cancel: [{ type: i0.Output }],
1597
- save: [{ type: i0.Output }],
1598
- additionalAction: [{ type: i0.Output }]
1599
- };
1600
-
1601
- var ThrottleClickDirective = /** @class */ (function () {
1602
- function ThrottleClickDirective() {
1603
- this.throttleTime = 300;
1604
- this.throttleClick = new i0.EventEmitter();
1605
- this.clicks = new rxjs.Subject();
1606
- }
1607
- ThrottleClickDirective.prototype.clickEvent = function (event) {
1608
- event.preventDefault();
1609
- event.stopPropagation();
1610
- this.clicks.next(event);
1611
- };
1612
- ThrottleClickDirective.prototype.ngOnInit = function () {
1613
- var _this = this;
1614
- this.subscription = this.clicks.pipe(operators.throttleTime(this.throttleTime)).subscribe(function (e) { return _this.throttleClick.emit(e); });
1615
- };
1616
- ThrottleClickDirective.prototype.ngOnDestroy = function () {
1617
- this.subscription.unsubscribe();
1618
- };
1619
- return ThrottleClickDirective;
1620
- }());
1621
- ThrottleClickDirective.decorators = [
1622
- { type: i0.Directive, args: [{
1623
- selector: '[madThrottleClick]',
1624
- },] }
1625
- ];
1626
- ThrottleClickDirective.propDecorators = {
1627
- throttleTime: [{ type: i0.Input }],
1628
- throttleClick: [{ type: i0.Output }],
1629
- clickEvent: [{ type: i0.HostListener, args: ['click', ['$event'],] }]
1630
- };
1631
-
1632
- var ThrottleClickModule = /** @class */ (function () {
1633
- function ThrottleClickModule() {
1634
- }
1635
- return ThrottleClickModule;
1636
- }());
1637
- ThrottleClickModule.decorators = [
1638
- { type: i0.NgModule, args: [{
1639
- declarations: [ThrottleClickDirective],
1640
- imports: [common.CommonModule],
1641
- exports: [ThrottleClickDirective],
1642
- },] }
1643
- ];
1644
-
1645
- var CardModule = /** @class */ (function () {
1646
- function CardModule() {
1647
- }
1648
- return CardModule;
1649
- }());
1650
- CardModule.decorators = [
1651
- { type: i0.NgModule, args: [{
1652
- declarations: [CardComponent],
1653
- imports: [common.CommonModule, card.MatCardModule, icon.MatIconModule, ButtonModule, button.MatButtonModule, ThrottleClickModule],
1654
- exports: [CardComponent],
1655
- },] }
1656
- ];
1657
-
1658
- var BaseQuickListComponent = /** @class */ (function () {
1659
- function BaseQuickListComponent(changeDetectorRef) {
1660
- this.changeDetectorRef = changeDetectorRef;
1661
- this.allItems = [];
1662
- this.addLabel = 'NOT SET';
1663
- this.addPossible = true;
1664
- this.removePossible = true;
1665
- this.blankItem = {};
1666
- this.added = new i0.EventEmitter();
1667
- this.removed = new i0.EventEmitter();
1668
- }
1669
- BaseQuickListComponent.prototype.ngOnInit = function () {
1670
- this.addEventFunction = this.addItem.bind(this);
1671
- if (this.minItems) {
1672
- for (var n = this.allItems.length; n < this.minItems; n++) {
1673
- this.interalAddItem();
1674
- }
1675
- }
1676
- };
1677
- BaseQuickListComponent.prototype.ngAfterViewInit = function () {
1678
- var _this = this;
1679
- setTimeout(function () { return _this.setFocusOnAdd(); }, 1);
1680
- };
1681
- BaseQuickListComponent.prototype.addItem = function () {
1682
- var newItem = this.interalAddItem();
1683
- if (!!newItem) {
1684
- this.added.emit(newItem);
1685
- }
1686
- };
1687
- BaseQuickListComponent.prototype.removeItem = function (item) {
1688
- if (this.isDeleteAllowed()) {
1689
- this.allItems.splice(this.allItems.indexOf(item), 1);
1690
- this.removed.emit(item);
1691
- }
1692
- };
1693
- BaseQuickListComponent.prototype.setFocusOnAdd = function () {
1694
- var _this = this;
1695
- this.rowCountFocus = this.itemRows.length;
1696
- this.itemRows.changes.subscribe(function (els) {
1697
- if (els.length > _this.rowCountFocus && !!els.last) {
1698
- var firstFocusable = els.last.nativeElement.querySelector("button, a, input, select, textarea, [tabindex]:not([tabindex='-1'])");
1699
- if (firstFocusable) {
1700
- firstFocusable.focus();
1701
- }
1702
- }
1703
- _this.rowCountFocus = els.length;
1704
- });
1705
- };
1706
- BaseQuickListComponent.prototype.isAddAllowed = function () {
1707
- return this.addPossible && (!this.maxItems || this.allItems.length < this.maxItems);
1708
- };
1709
- BaseQuickListComponent.prototype.isDeleteAllowed = function () {
1710
- return this.removePossible && (!this.minItems || this.allItems.length > this.minItems);
1711
- };
1712
- BaseQuickListComponent.prototype.interalAddItem = function () {
1713
- if (this.isAddAllowed()) {
1714
- var newItem = Object.assign({}, this.blankItem);
1715
- // creates ids in the form of "n5kdz1pljl8"
1716
- newItem.id = Math.random()
1717
- .toString(36)
1718
- .substring(2);
1719
- this.allItems.push(newItem);
1720
- this.changeDetectorRef.detectChanges();
1721
- return newItem;
1722
- }
1723
- return null;
1724
- };
1725
- return BaseQuickListComponent;
1726
- }());
1727
- BaseQuickListComponent.decorators = [
1728
- { type: i0.Component, args: [{
1729
- selector: 'mad-base-quick-list',
1730
- template: ''
1731
- },] }
1732
- ];
1733
- BaseQuickListComponent.ctorParameters = function () { return [
1734
- { type: i0.ChangeDetectorRef }
1735
- ]; };
1736
- BaseQuickListComponent.propDecorators = {
1737
- allItems: [{ type: i0.Input }],
1738
- addLabel: [{ type: i0.Input }],
1739
- addPossible: [{ type: i0.Input }],
1740
- removePossible: [{ type: i0.Input }],
1741
- blankItem: [{ type: i0.Input }],
1742
- readonly: [{ type: i0.Input }],
1743
- maxItems: [{ type: i0.Input }],
1744
- minItems: [{ type: i0.Input }],
1745
- added: [{ type: i0.Output }],
1746
- removed: [{ type: i0.Output }],
1747
- itemTemplate: [{ type: i0.ContentChild, args: [i0.TemplateRef,] }],
1748
- itemRows: [{ type: i0.ViewChildren, args: ['row',] }]
1749
- };
1750
-
1751
- var QuickListComponent = /** @class */ (function (_super) {
1752
- __extends(QuickListComponent, _super);
1753
- function QuickListComponent(changeDetectorRef) {
1754
- var _this = _super.call(this, changeDetectorRef) || this;
1755
- _this.changeDetectorRef = changeDetectorRef;
1756
- return _this;
1757
- }
1758
- return QuickListComponent;
1759
- }(BaseQuickListComponent));
1760
- QuickListComponent.decorators = [
1761
- { type: i0.Component, args: [{
1762
- selector: 'mad-quick-list',
1763
- template: "<h3>\n <ng-content select=\"label\"></ng-content>\n</h3>\n<ng-container *ngFor=\"let item of allItems\">\n <div *ngIf=\"itemTemplate\" #row>\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n <mad-icon-button *ngIf=\"!readonly && isDeleteAllowed()\" (click)=\"removeItem(item)\">\n <mat-icon>delete</mat-icon>\n </mad-icon-button>\n </div>\n</ng-container>\n<mad-link-button *ngIf=\"!readonly\" (click)=\"addItem()\"\n [disabled]=\"!addPossible || !isAddAllowed()\">\n {{ addLabel }}\n</mad-link-button>\n"
1764
- },] }
1765
- ];
1766
- QuickListComponent.ctorParameters = function () { return [
1767
- { type: i0.ChangeDetectorRef }
1768
- ]; };
1769
-
1770
- var QuickListCompactComponent = /** @class */ (function (_super) {
1771
- __extends(QuickListCompactComponent, _super);
1772
- function QuickListCompactComponent(changeDetectorRef) {
1773
- var _this = _super.call(this, changeDetectorRef) || this;
1774
- _this.changeDetectorRef = changeDetectorRef;
1775
- return _this;
1776
- }
1777
- return QuickListCompactComponent;
1778
- }(BaseQuickListComponent));
1779
- QuickListCompactComponent.decorators = [
1780
- { type: i0.Component, args: [{
1781
- selector: 'mad-quick-list-compact',
1782
- template: "<h3>\n <ng-content select=\"label\"></ng-content>\n</h3>\n<ng-container *ngFor=\"let item of allItems; let isLast = last;\">\n <div class=\"flex-container\" *ngIf=\"itemTemplate\" #row>\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n <mad-icon-button *ngIf=\"!readonly && isDeleteAllowed()\" (click)=\"removeItem(item)\">\n <mat-icon>delete</mat-icon>\n </mad-icon-button>\n <mad-icon-button *ngIf=\"!readonly && isLast\" [disabled]=\"!isAddAllowed()\" (click)=\"addItem()\">\n <mat-icon>add_circle_outline</mat-icon>\n </mad-icon-button>\n </div>\n</ng-container>\n<mad-link-button *ngIf=\"!readonly && !this.allItems.length\"\n (click)=\"addItem()\"\n [disabled]=\"!isAddAllowed()\">\n {{ addLabel }}\n</mad-link-button>\n"
1783
- },] }
1784
- ];
1785
- QuickListCompactComponent.ctorParameters = function () { return [
1786
- { type: i0.ChangeDetectorRef }
1787
- ]; };
1788
-
1789
- var QuickListModule = /** @class */ (function () {
1790
- function QuickListModule() {
1791
- }
1792
- return QuickListModule;
1793
- }());
1794
- QuickListModule.decorators = [
1795
- { type: i0.NgModule, args: [{
1796
- declarations: [QuickListComponent, BaseQuickListComponent, QuickListCompactComponent],
1797
- imports: [common.CommonModule, button.MatButtonModule, icon.MatIconModule, ButtonModule],
1798
- exports: [QuickListComponent, QuickListCompactComponent, BaseQuickListComponent],
1799
- },] }
1800
- ];
1801
-
1802
- var TableComponent = /** @class */ (function () {
1803
- function TableComponent() {
1804
- var _a;
1805
- this.columns = [];
1806
- this.filterLabel = 'NOT SET';
1807
- this.filterPlaceholder = 'NOT SET';
1808
- this.pageSizeOptions = [5, 10, 15];
1809
- this.defaultPageSize = ((_a = this.pageSizeOptions) === null || _a === void 0 ? void 0 : _a[0]) || 10;
1810
- this.rowActions = [];
1811
- this.tableActions = [];
1812
- this.tableAction = new i0.EventEmitter();
1813
- this.rowAction = new i0.EventEmitter();
1814
- this.sortEvent = new i0.EventEmitter();
1815
- this.ACTION_COLUMN_NAME = '__action__';
1816
- this.isFilterEnabled = false;
1817
- this.isPaginationEnabled = false;
1818
- }
1819
- Object.defineProperty(TableComponent.prototype, "displayedData", {
1820
- set: function (data) {
1821
- if (!this.dataSource) {
1822
- this.dataSource = new table.MatTableDataSource(data);
1823
- }
1824
- else {
1825
- this.dataSource.data = data;
1826
- }
1827
- },
1828
- enumerable: false,
1829
- configurable: true
1830
- });
1831
- Object.defineProperty(TableComponent.prototype, "paginationEnabled", {
1832
- set: function (isPaginationEnabled) {
1833
- this.isPaginationEnabled = isPaginationEnabled;
1834
- // eslint-disable-next-line
1835
- var pageSize = this.isPaginationEnabled ? this.defaultPageSize : Number.MAX_VALUE;
1836
- if (this.dataSource.paginator) {
1837
- this.dataSource.paginator._changePageSize(pageSize);
1838
- }
1839
- },
1840
- enumerable: false,
1841
- configurable: true
1842
- });
1843
- Object.defineProperty(TableComponent.prototype, "filterEnabled", {
1844
- set: function (isFilterEnabled) {
1845
- this.isFilterEnabled = isFilterEnabled;
1846
- this.setFilterValue(undefined);
1847
- },
1848
- enumerable: false,
1849
- configurable: true
1850
- });
1851
- TableComponent.prototype.ngOnInit = function () {
1852
- this.columnNames = this.columns.map(function (column) { return column.label; });
1853
- this.isRowClickable = this.rowActions.length > 0;
1854
- if (this.isRowClickable) {
1855
- this.columnNames.unshift(this.ACTION_COLUMN_NAME);
1856
- this.defaultAction = this.rowActions[0];
1857
- }
1858
- };
1859
- TableComponent.prototype.ngAfterViewInit = function () {
1860
- this.dataSource.paginator = this.paginator;
1861
- this.dataSource.sort = this.sort;
1862
- // set custom filter predicate to enable search for multiple search strings:
1863
- // e.g. "one two three"
1864
- this.dataSource.filterPredicate = function (data, filter) { return !filter || filter.split(/\s+/).every(function (term) { return !!Object.keys(data).find(function (key) { return data[key].includes(term); }); }); };
1865
- };
1866
- TableComponent.prototype.onFilter = function (value) {
1867
- this.setFilterValue(value);
1868
- };
1869
- TableComponent.prototype.onRowEvent = function (event, row, action) {
1870
- if (action === void 0) { action = this.defaultAction; }
1871
- if (!!action && !this.isClickOnRowMenuIcon(event)) {
1872
- this.rowAction.emit(Object.assign(Object.assign({}, action), { outputRow: row }));
1873
- }
1874
- };
1875
- TableComponent.prototype.onSortingEvent = function (sortingParams) {
1876
- this.sortEvent.emit(sortingParams);
1877
- };
1878
- TableComponent.prototype.onTableAction = function (tableAction) {
1879
- if (!!tableAction) {
1880
- this.tableAction.emit(tableAction);
1881
- }
1882
- };
1883
- TableComponent.prototype.setFilterValue = function (value) {
1884
- this.dataSource.filter = value === null || value === void 0 ? void 0 : value.trim().toLowerCase();
1885
- };
1886
- TableComponent.prototype.isClickOnRowMenuIcon = function (event) {
1887
- var _a;
1888
- return (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.classList.contains('mat-icon');
1889
- };
1890
- return TableComponent;
1891
- }());
1892
- TableComponent.decorators = [
1893
- { type: i0.Component, args: [{
1894
- selector: 'mad-table',
1895
- template: "<!-- Table actions -->\n<div *ngIf=\"tableActions?.length\">\n <mad-primary-button class=\"table-action\" *ngFor=\"let tableAction of tableActions\" (click)=\"onTableAction(tableAction)\">\n {{ tableAction.label }}\n </mad-primary-button>\n</div>\n\n<!-- Row action buttons -->\n<mat-menu #menu=\"matMenu\">\n <ng-template matMenuContent let-element=\"element\">\n <button *ngFor=\"let rowAction of rowActions\" mat-menu-item class=\"row-action\" (click)=\"onRowEvent($event, element, rowAction)\">\n {{ rowAction.label }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- Table filter -->\n<mat-form-field *ngIf=\"isFilterEnabled\">\n <mat-label>{{ filterLabel }}</mat-label>\n <input matInput (keyup)=\"onFilter($event?.target?.value)\" placeholder=\"{{ filterPlaceholder }}\" />\n</mat-form-field>\n\n<!-- Table -->\n<div *ngIf=\"dataSource?.data?.length > 0; else noData\" class=\"mad-table\">\n <table mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"onSortingEvent($event)\">\n <!-- Row actions column -->\n <ng-container [matColumnDef]=\"ACTION_COLUMN_NAME\" *ngIf=\"rowActions?.length\" sticky>\n <th mat-header-cell *matHeaderCellDef class=\"row-action-button\"></th>\n <td mat-cell *matCellDef=\"let element\" class=\"row-action-button\">\n <mad-icon-button [matMenuTriggerData]=\"{ element: element }\" [matMenuTriggerFor]=\"menu\">\n <mat-icon>more_vert</mat-icon>\n </mad-icon-button>\n </td>\n </ng-container>\n <!-- Columns with data -->\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.label\" [sticky]=\"column.isSticky\">\n <ng-container *ngIf=\"column.isSortable; else noSort\">\n <th\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header=\"{{ column.label }}\"\n [arrowPosition]=\"column.isRightAligned ? 'before' : 'after'\"\n [class.text-right]=\"column.isRightAligned\"\n >\n {{ column.label }}\n </th>\n </ng-container>\n <ng-template #noSort>\n <th mat-header-cell *matHeaderCellDef [class.text-right]=\"column.isRightAligned\">\n {{ column.label }}\n </th>\n </ng-template>\n <td mat-cell *matCellDef=\"let element\" [class.text-right]=\"column.isRightAligned\">\n {{ element[column.dataPropertyName] }}\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"columnNames\"></tr>\n <tr\n mat-row\n [class.clickable-table-row]=\"isRowClickable\"\n (click)=\"onRowEvent($event, row)\"\n *matRowDef=\"let row; columns: columnNames\"\n ></tr>\n </table>\n</div>\n<!-- Pagination -->\n<mat-paginator\n [style.display]=\"isPaginationEnabled ? 'block' : 'none'\"\n [pageSize]=\"defaultPageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n showFirstLastButtons\n>\n</mat-paginator>\n\n<!-- No data alert -->\n<ng-template #noData>\n <div class=\"noDataText\">\n {{ noDataText }}\n </div>\n</ng-template>\n",
1896
- styles: [".text-right{text-align:right!important}.table-action{margin-bottom:.5em;margin-right:.5em}.row-action-button{width:10px}.noDataText{text-align:center;width:100%}.mad-table{overflow-x:auto;width:100%}"]
1897
- },] }
1898
- ];
1899
- TableComponent.propDecorators = {
1900
- columns: [{ type: i0.Input }],
1901
- filterLabel: [{ type: i0.Input }],
1902
- filterPlaceholder: [{ type: i0.Input }],
1903
- noDataText: [{ type: i0.Input }],
1904
- pageSizeOptions: [{ type: i0.Input }],
1905
- defaultPageSize: [{ type: i0.Input }],
1906
- rowActions: [{ type: i0.Input }],
1907
- tableActions: [{ type: i0.Input }],
1908
- tableAction: [{ type: i0.Output }],
1909
- rowAction: [{ type: i0.Output }],
1910
- sortEvent: [{ type: i0.Output }],
1911
- paginator: [{ type: i0.ViewChild, args: [paginator.MatPaginator, { static: false },] }],
1912
- sort: [{ type: i0.ViewChild, args: [sort.MatSort, { static: true },] }],
1913
- displayedData: [{ type: i0.Input }],
1914
- paginationEnabled: [{ type: i0.Input }],
1915
- filterEnabled: [{ type: i0.Input }]
1916
- };
1917
-
1918
- var TableModule = /** @class */ (function () {
1919
- function TableModule() {
1920
- }
1921
- return TableModule;
1922
- }());
1923
- TableModule.decorators = [
1924
- { type: i0.NgModule, args: [{
1925
- declarations: [TableComponent],
1926
- imports: [
1927
- common.CommonModule,
1928
- button.MatButtonModule,
1929
- icon.MatIconModule,
1930
- formField.MatFormFieldModule,
1931
- input.MatInputModule,
1932
- menu.MatMenuModule,
1933
- paginator.MatPaginatorModule,
1934
- sort.MatSortModule,
1935
- table.MatTableModule,
1936
- ButtonModule,
1937
- ],
1938
- exports: [TableComponent],
1939
- },] }
1940
- ];
1941
-
1942
- var DataTableActionType = /** @class */ (function () {
1943
- function DataTableActionType() {
1944
- }
1945
- return DataTableActionType;
1946
- }());
1947
- DataTableActionType.SINGLE = 'SINGLE';
1948
- DataTableActionType.BATCH = 'BATCH';
1949
- DataTableActionType.NONE = 'NONE';
1950
-
1951
- var DataTableColumnsModalComponent = /** @class */ (function () {
1952
- function DataTableColumnsModalComponent(dialogRef, data) {
1953
- this.dialogRef = dialogRef;
1954
- this.data = data;
1955
- this.selectedColumns = [];
1956
- this.availableColumns = [];
1957
- this.filteredAvailableColumns = [];
1958
- }
1959
- DataTableColumnsModalComponent.prototype.ngOnInit = function () {
1960
- var e_1, _b;
1961
- this.definition = this.data.definition;
1962
- try {
1963
- for (var _c = __values(this.data.allColumns), _d = _c.next(); !_d.done; _d = _c.next()) {
1964
- var column = _d.value;
1965
- var columnId = column.id;
1966
- var selectedColumnIds = this.definition.displayedColumns.map(function (col) { return col.id; });
1967
- if (selectedColumnIds.includes(columnId)) {
1968
- this.selectedColumns.push(column);
1969
- }
1970
- else {
1971
- this.availableColumns.push(column);
1972
- }
1973
- }
1974
- }
1975
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1976
- finally {
1977
- try {
1978
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
1979
- }
1980
- finally { if (e_1) throw e_1.error; }
1981
- }
1982
- this.clearFilterValue();
1983
- };
1984
- DataTableColumnsModalComponent.prototype.onDrop = function (event) {
1985
- if (event.previousContainer === event.container) {
1986
- dragDrop.moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
1987
- }
1988
- else {
1989
- var itemIndex = this.findMatchingItemIndex(event.previousContainer, event.item);
1990
- dragDrop.transferArrayItem(event.previousContainer.data, event.container.data, itemIndex, event.currentIndex);
1991
- this.clearFilterValue();
1992
- this.availableColumns.sort(function (a, b) { return a.label.localeCompare(b.label); });
1993
- }
1994
- };
1995
- DataTableColumnsModalComponent.prototype.onSave = function () {
1996
- this.definition.displayedColumns = this.selectedColumns;
1997
- var saveChange = {
1998
- action: 'SAVE',
1999
- definition: this.definition,
2000
- };
2001
- this.dialogRef.close(saveChange);
2002
- };
2003
- DataTableColumnsModalComponent.prototype.onDelete = function () {
2004
- var deleteChange = {
2005
- action: 'DELETE',
2006
- definition: this.definition,
2007
- };
2008
- this.dialogRef.close(deleteChange);
2009
- };
2010
- DataTableColumnsModalComponent.prototype.onCancel = function () {
2011
- this.dialogRef.close();
2012
- };
2013
- DataTableColumnsModalComponent.prototype.updateFilterValue = function () {
2014
- var _this = this;
2015
- var _a;
2016
- if (((_a = this.searchFilter) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2017
- this.filteredAvailableColumns = this.availableColumns.filter(function (c) { return c.label.toLowerCase().includes(_this.searchFilter.toLowerCase()); });
2018
- }
2019
- else {
2020
- this.filteredAvailableColumns = __spread(this.availableColumns);
2021
- }
2022
- };
2023
- DataTableColumnsModalComponent.prototype.findMatchingItemIndex = function (previousContainer, item) {
2024
- var itemId = item.element.nativeElement.id;
2025
- var previousContainerItems = __spread(previousContainer.data);
2026
- if ((previousContainerItems === null || previousContainerItems === void 0 ? void 0 : previousContainerItems.length) < 1) {
2027
- return 0;
2028
- }
2029
- for (var itemIndex = 0; itemIndex < previousContainerItems.length; itemIndex++) {
2030
- if (previousContainerItems[itemIndex].id === itemId) {
2031
- return itemIndex;
2032
- }
2033
- }
2034
- return 0;
2035
- };
2036
- DataTableColumnsModalComponent.prototype.clearFilterValue = function () {
2037
- this.searchFilter = '';
2038
- this.filteredAvailableColumns = __spread(this.availableColumns);
2039
- };
2040
- return DataTableColumnsModalComponent;
2041
- }());
2042
- DataTableColumnsModalComponent.decorators = [
2043
- { type: i0.Component, args: [{
2044
- selector: 'mad-data-table-columns-modal.component',
2045
- template: "<h1 mat-dialog-title>{{ data?.titleLabel | translate }}</h1>\n<div mat-dialog-content>\n <div class=\"column-drag-main-content\">\n <div class=\"column-drag-container\">\n <div class=\"column-drag-info-area\">{{ data?.infoTextLabel | translate }}</div>\n <div class=\"column-drag-container-header\">{{ data?.selectedLabel | translate }}</div>\n <div\n cdkDropList\n #selectedList=\"cdkDropList\"\n [cdkDropListData]=\"selectedColumns\"\n [cdkDropListConnectedTo]=\"[availableList]\"\n class=\"column-drag-list selected-drag-list\"\n (cdkDropListDropped)=\"onDrop($event)\">\n <div class=\"column-drag-box\"\n *ngFor=\"let selectedColumn of selectedColumns; let i = index\"\n cdkDrag\n [id]=\"selectedColumn.id\"\n >\n {{i + 1}}. {{selectedColumn.label | translate }}\n </div>\n </div>\n </div>\n\n <div class=\"column-drag-container\">\n <div class=\"column-drag-info-area\">\n <!-- Table filter -->\n <mat-form-field>\n <mat-label>{{ data?.filterColumnsLabel | translate }}</mat-label>\n <input matInput autocomplete=\"off\" (keyup)=\"updateFilterValue()\"\n placeholder=\"{{ data?.filterColumnsPlaceHolder | translate }}\" [(ngModel)]=\"searchFilter\"/>\n <button *ngIf=\"searchFilter\" matSuffix mat-icon-button aria-label=\"Clear\" (click)=\"clearFilterValue()\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n </div>\n <div class=\"column-drag-container-header\">{{ data?.availableLabel | translate }}</div>\n <div\n cdkDropList\n cdkDropListSortingDisabled\n #availableList=\"cdkDropList\"\n [cdkDropListData]=\"availableColumns\"\n [cdkDropListConnectedTo]=\"[selectedList]\"\n class=\"column-drag-list\"\n (cdkDropListDropped)=\"onDrop($event)\">\n <div *ngFor=\"let availableColumn of filteredAvailableColumns\" class=\"column-drag-box\" cdkDrag [id]=\"availableColumn.id\">\n {{availableColumn.label}}\n </div>\n </div>\n </div>\n </div>\n\n</div>\n<div mat-dialog-actions [align]=\"'end'\">\n <mad-outline-button (click)=\"onCancel()\">\n {{ data?.cancelLabel | translate }}\n </mad-outline-button>\n <mad-danger-button *ngIf=\"data?.deleteDefinitionAllowed\" (click)=\"onDelete()\">\n {{ data?.deleteLabel | translate }}\n </mad-danger-button>\n <mad-primary-button (click)=\"onSave()\" [disabled]=\"!(this.selectedColumns?.length > 0)\">\n {{ data?.saveLabel | translate }}\n </mad-primary-button>\n</div>\n",
2046
- styles: [".column-drag-main-content{border-bottom:1px solid #f5f5f5;display:flex;flex-direction:row;justify-content:space-between;margin-bottom:16px;padding:8px 8px 16px;width:544px}.column-drag-container{display:inline-block;font-size:small;max-width:100%;vertical-align:top;width:256px}.info-box{margin-bottom:16px}.column-drag-info-area,.info-box{color:rgba(0,0,0,.66);font-size:small;width:100%}.column-drag-info-area{align-items:stretch;display:flex;flex-direction:column;height:36px;justify-content:right;margin-bottom:32px}.column-drag-list{background:#fff;border:1px solid #ccc;border-radius:4px;box-sizing:border-box;display:block;height:200px;overflow:auto}.column-drag-container-header{font-weight:700;margin-bottom:4px}.column-drag-box{align-items:center;background:#fff;border-bottom:1px solid #ccc;box-sizing:border-box;color:rgba(0,0,0,.87);cursor:move;display:flex;flex-direction:row;font-size:14px;height:40px;justify-content:space-between;padding:12px 10px}.cdk-drag-preview{border-radius:4px;box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12);box-sizing:border-box}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.column-drag-box:last-child{border:none}.column-drag-list.cdk-drop-list-dragging .column-drag-box:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}"]
2047
- },] }
2048
- ];
2049
- DataTableColumnsModalComponent.ctorParameters = function () { return [
2050
- { type: dialog.MatDialogRef },
2051
- { type: undefined, decorators: [{ type: i0.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
2052
- ]; };
2053
-
2054
- var DataTableComponent = /** @class */ (function () {
2055
- function DataTableComponent(matDialog) {
2056
- this.matDialog = matDialog;
2057
- // Translations
2058
- this.filterLabel = 'Filter';
2059
- this.filterPlaceholder = '';
2060
- this.filterColumnsLabel = 'Filter';
2061
- this.filterColumnsPlaceHolder = 'Filter available columns';
2062
- this.noDataText = 'No matching data found';
2063
- this.columnSettingsModalTitleLabel = 'Column settings';
2064
- this.selectedLabel = 'Selected columns';
2065
- this.availableLabel = 'Available columns';
2066
- this.saveLabel = 'Save';
2067
- this.deleteLabel = 'Delete';
2068
- this.cancelLabel = 'Cancel';
2069
- this.infoTextLabel = 'Drag and drop a column to select or reorder it.';
2070
- this.pageSizeOptions = [5, 10, 15];
2071
- this.actions = [];
2072
- this.deleteDefinitionAllowed = false;
2073
- this.useAsync = false;
2074
- this.sortEvent = new i0.EventEmitter();
2075
- this.actionEvent = new i0.EventEmitter();
2076
- this.pageEvent = new i0.EventEmitter();
2077
- this.allColumnsEvent = new i0.EventEmitter();
2078
- this.columnDefinitionChangeEvent = new i0.EventEmitter();
2079
- this.viewDefinitionChangeEvent = new i0.EventEmitter();
2080
- this.ACTION_COLUMN_NAME = '__action__';
2081
- this.SINGLE = DataTableActionType.SINGLE;
2082
- this.BATCH = DataTableActionType.BATCH;
2083
- this.NONE = DataTableActionType.NONE;
2084
- this.tableActions = [];
2085
- this.rowActions = [];
2086
- this.columns = [];
2087
- this.allSelected = false;
2088
- this.displayedDataMap = new Map();
2089
- this.actualDataMap = new Map();
2090
- this.selectionModel = new collections.SelectionModel(true);
2091
- this.allColumnDefinitions = [];
2092
- this.isFilterEnabled = false;
2093
- this.isPaginationEnabled = false;
2094
- this.mode = this.NONE;
2095
- this.isRowClickable = false;
2096
- this.showColumnModal = false;
2097
- this.isLoading = false;
2098
- this.paginatorLength = 0;
2099
- this.paginatorPageIndex = 0;
2100
- this.paginatorPageSize = 50;
2101
- }
2102
- Object.defineProperty(DataTableComponent.prototype, "displayedColumns", {
2103
- set: function (cols) {
2104
- if (!this.displayedColumnDefinition) {
2105
- this.columns = cols ? __spread(cols) : [];
2106
- this.columnIds = this.columns.map(function (column) { return column.id; });
2107
- this.columnIds.unshift(this.ACTION_COLUMN_NAME);
2108
- }
2109
- },
2110
- enumerable: false,
2111
- configurable: true
2112
- });
2113
- Object.defineProperty(DataTableComponent.prototype, "displayedColumnDefinition", {
2114
- set: function (def) {
2115
- this.selectedColumnDefinion = def;
2116
- this.columns = def.displayedColumns;
2117
- this.columnIds = this.columns.map(function (column) { return column.id; });
2118
- this.columnIds.unshift(this.ACTION_COLUMN_NAME);
2119
- },
2120
- enumerable: false,
2121
- configurable: true
2122
- });
2123
- Object.defineProperty(DataTableComponent.prototype, "tableData", {
2124
- set: function (data) {
2125
- if (!this.dataSource) {
2126
- this.dataSource = new table.MatTableDataSource(data);
2127
- }
2128
- this.createDataMapsAndSetDisplayedDataSourceData(data);
2129
- },
2130
- enumerable: false,
2131
- configurable: true
2132
- });
2133
- Object.defineProperty(DataTableComponent.prototype, "page", {
2134
- set: function (page) {
2135
- this.paginatorPageIndex = page.pageIndex;
2136
- this.paginatorPageSize = page.pageSize;
2137
- this.paginatorLength = page.length;
2138
- },
2139
- enumerable: false,
2140
- configurable: true
2141
- });
2142
- Object.defineProperty(DataTableComponent.prototype, "columnDefinitions", {
2143
- set: function (definitions) {
2144
- var e_1, _b;
2145
- var _a;
2146
- this.editableColumnDefinitions = [];
2147
- this.viewableColumnDefinitions = [];
2148
- this.allColumnDefinitions = __spread(definitions);
2149
- try {
2150
- for (var definitions_1 = __values(definitions), definitions_1_1 = definitions_1.next(); !definitions_1_1.done; definitions_1_1 = definitions_1.next()) {
2151
- var definition = definitions_1_1.value;
2152
- if (definition.editable) {
2153
- this.editableColumnDefinitions.push(definition);
2154
- }
2155
- if (((_a = definition.displayedColumns) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2156
- this.viewableColumnDefinitions.push(definition);
2157
- }
2158
- }
2159
- }
2160
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2161
- finally {
2162
- try {
2163
- if (definitions_1_1 && !definitions_1_1.done && (_b = definitions_1.return)) _b.call(definitions_1);
2164
- }
2165
- finally { if (e_1) throw e_1.error; }
2166
- }
2167
- },
2168
- enumerable: false,
2169
- configurable: true
2170
- });
2171
- Object.defineProperty(DataTableComponent.prototype, "loading", {
2172
- set: function (isLoading) {
2173
- this.isLoading = isLoading;
2174
- },
2175
- enumerable: false,
2176
- configurable: true
2177
- });
2178
- Object.defineProperty(DataTableComponent.prototype, "defaultPageSize", {
2179
- set: function (defaultSize) {
2180
- this.paginatorPageSize = defaultSize;
2181
- },
2182
- enumerable: false,
2183
- configurable: true
2184
- });
2185
- Object.defineProperty(DataTableComponent.prototype, "externalPaginator", {
2186
- set: function (paginator) {
2187
- this.extPaginator = paginator;
2188
- },
2189
- enumerable: false,
2190
- configurable: true
2191
- });
2192
- Object.defineProperty(DataTableComponent.prototype, "paginationEnabled", {
2193
- set: function (isPaginationEnabled) {
2194
- this.isPaginationEnabled = isPaginationEnabled;
2195
- this.unsetPageSizeIfNecessary();
2196
- },
2197
- enumerable: false,
2198
- configurable: true
2199
- });
2200
- Object.defineProperty(DataTableComponent.prototype, "allColumns", {
2201
- set: function (allColumns) {
2202
- this.allAvailableColumns = allColumns;
2203
- if (allColumns && this.showColumnModal) {
2204
- this.openColumnModal();
2205
- }
2206
- },
2207
- enumerable: false,
2208
- configurable: true
2209
- });
2210
- Object.defineProperty(DataTableComponent.prototype, "filterEnabled", {
2211
- set: function (isFilterEnabled) {
2212
- this.isFilterEnabled = !this.useAsync ? isFilterEnabled : false;
2213
- this.setFilterValue(undefined);
2214
- },
2215
- enumerable: false,
2216
- configurable: true
2217
- });
2218
- Object.defineProperty(DataTableComponent.prototype, "forceMode", {
2219
- set: function (mode) {
2220
- if (mode === this.SINGLE || mode === this.BATCH || mode === this.NONE) {
2221
- this._forceMode = mode;
2222
- this.mode = mode;
2223
- this.setActions();
2224
- }
2225
- },
2226
- enumerable: false,
2227
- configurable: true
2228
- });
2229
- DataTableComponent.compare = function (a, b, sort) {
2230
- var x = a[sort.active];
2231
- var y = b[sort.active];
2232
- var ascending = sort.direction === 'asc';
2233
- switch (typeof x) {
2234
- case 'number':
2235
- return DataTableComponent.compareNumber(x, y, ascending);
2236
- case 'string':
2237
- return DataTableComponent.compareString(x, y, ascending);
2238
- case 'boolean':
2239
- return DataTableComponent.compareBoolean(x, y, ascending);
2240
- default:
2241
- // cannot compare -> return equal
2242
- return 0;
2243
- }
2244
- };
2245
- DataTableComponent.compareNumber = function (x, y, ascending) {
2246
- return ascending ? x - y : y - x;
2247
- };
2248
- DataTableComponent.compareString = function (x, y, ascending) {
2249
- return ascending ? x.localeCompare(y) : y.localeCompare(x);
2250
- };
2251
- DataTableComponent.compareBoolean = function (x, y, ascending) {
2252
- if (x === y) {
2253
- return 0;
2254
- }
2255
- if (ascending) {
2256
- // true first
2257
- return x ? -1 : 1;
2258
- }
2259
- else {
2260
- // false first
2261
- return x ? 1 : -1;
2262
- }
2263
- };
2264
- DataTableComponent.transformData = function (value, transformer, transformerParams) {
2265
- if (!transformer || !(transformer instanceof Function)) {
2266
- return value;
2267
- }
2268
- return transformer(value, transformerParams);
2269
- };
2270
- DataTableComponent.generateRowId = function () {
2271
- return uuid.v4();
2272
- };
2273
- DataTableComponent.isClickOnRowMenuIcon = function (event) {
2274
- var _a;
2275
- return (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.classList.contains('mat-icon');
2276
- };
2277
- DataTableComponent.prototype.ngOnInit = function () {
2278
- this.mode = this.getTableMode();
2279
- this.setActions();
2280
- if (this.mode !== this.NONE) {
2281
- this.isRowClickable = true;
2282
- this.defaultAction = this.rowActions[0];
2283
- }
2284
- };
2285
- DataTableComponent.prototype.ngAfterViewInit = function () {
2286
- this.dataSource.paginator = this.paginator;
2287
- this.dataSource.sort = this.sort;
2288
- };
2289
- DataTableComponent.prototype.onColumnSettings = function (definition) {
2290
- this.showColumnModal = true;
2291
- this.selectedDefinition = definition ? definition : this.allColumnDefinitions[0];
2292
- if (this.allAvailableColumns) {
2293
- this.openColumnModal();
2294
- }
2295
- else {
2296
- // if no complete definitions have been loaded yet send an event so the app can load it
2297
- this.allColumnsEvent.emit();
2298
- }
2299
- };
2300
- DataTableComponent.prototype.onViewDefinition = function (definition) {
2301
- this.selectedDefinition = definition;
2302
- this.viewDefinitionChangeEvent.emit(definition);
2303
- };
2304
- DataTableComponent.prototype.isCurrentDefinition = function (definition) {
2305
- return this.selectedDefinition && this.selectedDefinition.id === definition.id;
2306
- };
2307
- Object.defineProperty(DataTableComponent.prototype, "selectedCount", {
2308
- get: function () {
2309
- var _a;
2310
- return ((_a = this.selectionModel) === null || _a === void 0 ? void 0 : _a.selected) ? this.selectionModel.selected.length : 0;
2311
- },
2312
- enumerable: false,
2313
- configurable: true
2314
- });
2315
- Object.defineProperty(DataTableComponent.prototype, "rowCount", {
2316
- get: function () {
2317
- return this.getAllDataSourceRowsOfCurrentPage() ? this.getAllDataSourceRowsOfCurrentPage().length : 0;
2318
- },
2319
- enumerable: false,
2320
- configurable: true
2321
- });
2322
- DataTableComponent.prototype.getAllDataSourceRowsOfCurrentPage = function () {
2323
- var _a;
2324
- return (_a = this.dataSource) === null || _a === void 0 ? void 0 : _a._pageData(this.dataSource.data);
2325
- };
2326
- DataTableComponent.prototype.getSelectedCount = function (actionType) {
2327
- var count = this.selectedCount;
2328
- if (actionType !== this.BATCH || count < 2) {
2329
- return '';
2330
- }
2331
- return ' (' + count + ')';
2332
- };
2333
- DataTableComponent.prototype.isDisabled = function (actionType) {
2334
- switch (actionType) {
2335
- case this.SINGLE:
2336
- return this.selectedCount !== 1;
2337
- case this.BATCH:
2338
- return this.selectedCount < 1;
2339
- default:
2340
- return false;
2341
- }
2342
- };
2343
- DataTableComponent.prototype.onToggleSelectAll = function () {
2344
- var _this = this;
2345
- // clear all selection first
2346
- this.selectionModel.clear();
2347
- // toggle all checkbox
2348
- this.allSelected = !this.allSelected;
2349
- if (this.allSelected) {
2350
- // select all rows of the current page
2351
- this.getAllDataSourceRowsOfCurrentPage().forEach(function (row) {
2352
- _this.selectionModel.select('' + row.rowId);
2353
- });
2354
- }
2355
- };
2356
- DataTableComponent.prototype.isSelected = function (rowId) {
2357
- return this.selectionModel.isSelected(rowId);
2358
- };
2359
- DataTableComponent.prototype.setFilterValue = function (value) {
2360
- this.dataSource.filter = value === null || value === void 0 ? void 0 : value.trim().toLowerCase();
2361
- };
2362
- DataTableComponent.prototype.onRowCheckbox = function (event, row) {
2363
- event.stopPropagation(); // no click event on row
2364
- this.selectionModel.toggle(row.rowId);
2365
- };
2366
- DataTableComponent.prototype.onRowEvent = function (event, row, action) {
2367
- if (action === void 0) { action = this.defaultAction; }
2368
- switch (this.mode) {
2369
- case this.BATCH:
2370
- this.onRowCheckbox(event, row);
2371
- break;
2372
- case this.SINGLE:
2373
- // emit the default action if the row (not the icon!) was clicked
2374
- if (!!action && !DataTableComponent.isClickOnRowMenuIcon(event)) {
2375
- var selected = [];
2376
- // if ID-generator is provided, return the ID, else return the ACTUAL data
2377
- selected.push(this.idGenerator ? row.rowId : this.actualDataMap.get(row.rowId));
2378
- this.emitTableAction(action, selected);
2379
- }
2380
- break;
2381
- default:
2382
- // do nothing if mode is NONE (or null)
2383
- return;
2384
- }
2385
- };
2386
- DataTableComponent.prototype.onSortingEvent = function (sort) {
2387
- if (this.useAsync) {
2388
- this.sortEvent.emit(sort);
2389
- }
2390
- else {
2391
- this.internalSort(sort);
2392
- }
2393
- };
2394
- DataTableComponent.prototype.onPageEvent = function (event) {
2395
- if (this.useAsync) {
2396
- this.pageEvent.emit(event);
2397
- }
2398
- };
2399
- DataTableComponent.prototype.onTableAction = function (tableAction) {
2400
- var e_2, _b;
2401
- if (!!tableAction) {
2402
- var selection = [];
2403
- try {
2404
- for (var _c = __values(this.selectionModel.selected), _d = _c.next(); !_d.done; _d = _c.next()) {
2405
- var selected = _d.value;
2406
- selection.push(this.idGenerator ? selected : this.actualDataMap.get(selected));
2407
- }
2408
- }
2409
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2410
- finally {
2411
- try {
2412
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2413
- }
2414
- finally { if (e_2) throw e_2.error; }
2415
- }
2416
- tableAction.selected = selection;
2417
- this.actionEvent.emit(tableAction);
2418
- }
2419
- };
2420
- DataTableComponent.prototype.emitTableAction = function (action, selected) {
2421
- var emitAction = Object.assign({}, action);
2422
- if (action.type !== this.NONE) {
2423
- emitAction.selected = __spread(selected);
2424
- }
2425
- this.actionEvent.emit(emitAction);
2426
- };
2427
- DataTableComponent.prototype.generateDisplayedDataElement = function (rowId, actualDataElement) {
2428
- var e_3, _b;
2429
- var displayedDataElement = {};
2430
- displayedDataElement.rowId = rowId;
2431
- try {
2432
- for (var _c = __values(this.columns), _d = _c.next(); !_d.done; _d = _c.next()) {
2433
- var column = _d.value;
2434
- var actualValue = actualDataElement[column.dataPropertyName];
2435
- displayedDataElement[column.dataPropertyName] = DataTableComponent.transformData(actualValue, column.transformer, column.transformerParams);
2436
- }
2437
- }
2438
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2439
- finally {
2440
- try {
2441
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2442
- }
2443
- finally { if (e_3) throw e_3.error; }
2444
- }
2445
- return displayedDataElement;
2446
- };
2447
- DataTableComponent.prototype.internalSort = function (sort) {
2448
- var sortedData = __spread(this.dataSource.data).sort(function (a, b) { return DataTableComponent.compare(a, b, sort); });
2449
- this.dataSource.data = __spread(sortedData);
2450
- };
2451
- DataTableComponent.prototype.setActions = function () {
2452
- var e_4, _b;
2453
- this.rowActions = [];
2454
- this.tableActions = [];
2455
- try {
2456
- for (var _c = __values(this.actions), _d = _c.next(); !_d.done; _d = _c.next()) {
2457
- var action = _d.value;
2458
- if (this.mode !== action.hiddenInMode) {
2459
- switch (action.type) {
2460
- case this.SINGLE:
2461
- if (this.mode === this.SINGLE) {
2462
- this.rowActions.push(action);
2463
- }
2464
- else {
2465
- this.tableActions.push(action);
2466
- }
2467
- break;
2468
- case this.BATCH:
2469
- if (this.mode !== this.SINGLE) {
2470
- this.tableActions.push(action);
2471
- }
2472
- break;
2473
- default:
2474
- this.tableActions.push(action);
2475
- }
2476
- }
2477
- }
2478
- }
2479
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
2480
- finally {
2481
- try {
2482
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2483
- }
2484
- finally { if (e_4) throw e_4.error; }
2485
- }
2486
- };
2487
- DataTableComponent.prototype.createDataMapsAndSetDisplayedDataSourceData = function (data) {
2488
- var e_5, _b;
2489
- var displayedDataList = [];
2490
- this.actualDataMap.clear();
2491
- this.displayedDataMap.clear();
2492
- if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
2493
- try {
2494
- for (var data_1 = __values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
2495
- var dataEntry = data_1_1.value;
2496
- var rowId = this.idGenerator ? this.idGenerator(dataEntry) : DataTableComponent.generateRowId();
2497
- this.actualDataMap.set(rowId, dataEntry);
2498
- var displayedDataElement = this.generateDisplayedDataElement(rowId, dataEntry);
2499
- this.displayedDataMap.set(rowId, displayedDataElement);
2500
- displayedDataList.push(displayedDataElement);
2501
- }
2502
- }
2503
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
2504
- finally {
2505
- try {
2506
- if (data_1_1 && !data_1_1.done && (_b = data_1.return)) _b.call(data_1);
2507
- }
2508
- finally { if (e_5) throw e_5.error; }
2509
- }
2510
- }
2511
- this.dataSource.data = displayedDataList;
2512
- this.unsetPageSizeIfNecessary();
2513
- };
2514
- DataTableComponent.prototype.openColumnModal = function () {
2515
- var _this = this;
2516
- var dialogData = {
2517
- allColumns: this.allAvailableColumns,
2518
- definition: this.selectedDefinition,
2519
- deleteDefinitionAllowed: this.deleteDefinitionAllowed,
2520
- filterColumnsLabel: this.filterColumnsLabel,
2521
- filterColumnsPlaceHolder: this.filterColumnsPlaceHolder,
2522
- noDataText: this.noDataText,
2523
- titleLabel: this.columnSettingsModalTitleLabel,
2524
- selectedLabel: this.selectedLabel,
2525
- availableLabel: this.availableLabel,
2526
- saveLabel: this.saveLabel,
2527
- deleteLabel: this.deleteLabel,
2528
- cancelLabel: this.cancelLabel,
2529
- infoTextLabel: this.infoTextLabel,
2530
- };
2531
- var dialog = this.matDialog.open(DataTableColumnsModalComponent, { data: dialogData });
2532
- dialog.afterClosed().subscribe(function (result) {
2533
- // no event on CANCEL
2534
- if (result) {
2535
- _this.columnDefinitionChangeEvent.emit(result);
2536
- }
2537
- });
2538
- };
2539
- DataTableComponent.prototype.getTableMode = function () {
2540
- var e_6, _b;
2541
- if (this._forceMode) {
2542
- return this._forceMode;
2543
- }
2544
- if (!this.actions) {
2545
- return this.NONE;
2546
- }
2547
- var distinctActionTypes = new Set();
2548
- try {
2549
- for (var _c = __values(this.actions), _d = _c.next(); !_d.done; _d = _c.next()) {
2550
- var rowAction = _d.value;
2551
- distinctActionTypes.add(rowAction.type);
2552
- }
2553
- }
2554
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
2555
- finally {
2556
- try {
2557
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2558
- }
2559
- finally { if (e_6) throw e_6.error; }
2560
- }
2561
- if (distinctActionTypes.has(this.BATCH)) {
2562
- return this.BATCH;
2563
- }
2564
- if (distinctActionTypes.has(this.SINGLE)) {
2565
- return this.SINGLE;
2566
- }
2567
- return this.NONE;
2568
- };
2569
- DataTableComponent.prototype.unsetPageSizeIfNecessary = function () {
2570
- if (!this.useAsync && !this.isPaginationEnabled) {
2571
- var dataCount = this.dataSource.data ? this.dataSource.data.length : 0;
2572
- this.paginatorPageSize = dataCount;
2573
- this.paginatorLength = dataCount;
2574
- }
2575
- };
2576
- return DataTableComponent;
2577
- }());
2578
- DataTableComponent.decorators = [
2579
- { type: i0.Component, args: [{
2580
- selector: 'mad-data-table',
2581
- template: "<div class=\"mad-datatable-action-bar\">\n <!-- Table actions: displayed before the table -->\n <div *ngIf=\"tableActions?.length\">\n <mad-outline-button\n [disabled]=\"isDisabled(tableAction.type)\"\n class=\"table-action\"\n *ngFor=\"let tableAction of tableActions\"\n (click)=\"onTableAction(tableAction)\">\n {{ tableAction.label | translate }} {{ getSelectedCount(tableAction.type) }}\n </mad-outline-button>\n </div>\n <!-- Table filter -->\n <mat-form-field *ngIf=\"isFilterEnabled\">\n <mat-label>{{ filterLabel | translate }}</mat-label>\n <input matInput autocomplete=\"off\" (keyup)=\"setFilterValue($event?.target?.value)\"\n placeholder=\"{{ filterPlaceholder }}\" />\n </mat-form-field>\n</div>\n\n\n<!-- Row action menu -->\n<mat-menu #rowActionMenu=\"matMenu\">\n <ng-template matMenuContent let-element=\"element\">\n <button *ngFor=\"let rowAction of rowActions\" mat-menu-item class=\"row-action\"\n (click)=\"onRowEvent($event, element, rowAction)\">\n {{ rowAction.label | translate }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- editable definition menu -->\n<mat-menu #editableDefinitionMenu=\"matMenu\">\n <ng-template matMenuContent>\n <button *ngFor=\"let definition of editableColumnDefinitions\"\n mat-menu-item\n class=\"row-action\"\n (click)=\"onColumnSettings(definition)\"\n [ngClass]=\"{'active-column-definition': isCurrentDefinition(definition)}\"\n >\n {{ definition.label | translate }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- viewable definition menu -->\n<mat-menu #viewableDefinitionMenu=\"matMenu\">\n <ng-template matMenuContent>\n <button *ngFor=\"let definition of viewableColumnDefinitions\"\n mat-menu-item\n class=\"row-action\"\n (click)=\"onViewDefinition(definition)\"\n [ngClass]=\"{'active-column-definition': isCurrentDefinition(definition)}\"\n >\n {{ definition.label | translate }}\n </button>\n </ng-template>\n</mat-menu>\n\n<!-- Table -->\n<div *ngIf=\"rowCount > 0; else noData\" class=\"datatable\" [class]=\"tableClass\">\n <div class=\"mad-datatable-spinner-wrapper\" *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"50\" [strokeWidth]=\"3\"></mat-spinner>\n </div>\n\n <table mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"onSortingEvent($event)\">\n <!-- Row actions column-->\n <ng-container [matColumnDef]=\"ACTION_COLUMN_NAME\">\n <th scope=\"col\" mat-header-cell *matHeaderCellDef class=\"row-action-button\">\n <!-- BATCH: master checkbox -->\n <div *ngIf=\"mode === BATCH\" class=\"mad-datatable-checkbox-container\">\n <mat-checkbox\n (change)=\"onToggleSelectAll()\"\n [checked]=\"allSelected\"\n >\n </mat-checkbox>\n </div>\n <!-- SINGLE / NONE: nothing in header row -->\n </th>\n <td mat-cell *matCellDef=\"let element\" class=\"row-action-button\">\n <!-- BATCH: row checkbox -->\n <div *ngIf=\"mode === BATCH\" class=\"mad-datatable-checkbox-container\">\n <mat-checkbox\n (click)=\"onRowCheckbox($event, element.rowId)\"\n [checked]=\"isSelected(element.rowId)\"\n >\n </mat-checkbox>\n </div>\n <!-- SINGLE: row action menu icon -->\n <mad-icon-button\n *ngIf=\"mode === SINGLE\"\n [matMenuTriggerData]=\"{ element: element }\" [matMenuTriggerFor]=\"rowActionMenu\"\n >\n <mat-icon>more_vert</mat-icon>\n </mad-icon-button>\n <!-- NONE: nothing -->\n </td>\n </ng-container>\n <!-- Columns with data -->\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.id\">\n <ng-container *ngIf=\"column.isSortable; else noSort\">\n <th\n scope=\"col\"\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header=\"{{ column.orderByName? column.orderByName : column.dataPropertyName }}\"\n [arrowPosition]=\"column.isRightAligned ? 'before' : 'after'\"\n [class.text-right]=\"column.isRightAligned\"\n >\n {{ column.label | translate }}\n </th>\n </ng-container>\n <ng-template #noSort>\n <th scope=\"col\" mat-header-cell *matHeaderCellDef [class.text-right]=\"column.isRightAligned\">\n {{ column.label | translate }}\n </th>\n </ng-template>\n <td mat-cell *matCellDef=\"let element\" [class.text-right]=\"column.isRightAligned\" [ngSwitch]=\"column.transformer\">\n <span>\n {{ element[column.dataPropertyName] }}\n </span>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"columnIds\"></tr>\n <tr\n mat-row\n [class.clickable-table-row]=\"isRowClickable\"\n (click)=\"onRowEvent($event, row)\"\n *matRowDef=\"let row; columns: columnIds\"\n ></tr>\n </table>\n</div>\n<div class=\"mad-data-table-bottom-area\">\n <div class=\"mad-data-table-bottom-info-area\">\n <!-- column settings: 1 definition -->\n <mad-icon-button\n *ngIf=\"this.editableColumnDefinitions?.length == 1\"\n (click)=\"onColumnSettings()\"\n >\n <mat-icon class=\"material-icons-outlined\">view_column</mat-icon>\n </mad-icon-button>\n <!-- column settings: multiple definitions -->\n <mad-icon-button\n *ngIf=\"this.editableColumnDefinitions?.length > 0\" [matMenuTriggerFor]=\"editableDefinitionMenu\"\n >\n <mat-icon>view_column</mat-icon>\n </mad-icon-button>\n <!-- column view: multiple definitions -->\n <mad-icon-button\n *ngIf=\"this.viewableColumnDefinitions?.length > 0\" [matMenuTriggerFor]=\"viewableDefinitionMenu\"\n >\n <mat-icon>preview</mat-icon>\n </mad-icon-button>\n </div>\n\n <!-- Pagination -->\n <mat-paginator\n [style.display]=\"isPaginationEnabled ? 'block' : 'none'\"\n [length]=\"paginatorLength\"\n [pageIndex]=\"paginatorPageIndex\"\n [pageSize]=\"paginatorPageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n (page)=\"onPageEvent($event)\"\n showFirstLastButtons\n >\n </mat-paginator>\n</div>\n\n<!-- No data alert -->\n<ng-template #noData>\n <div class=\"noDataText\">\n <div class=\"mad-datatable-spinner-wrapper\" *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"50\" [strokeWidth]=\"3\"></mat-spinner>\n </div>\n {{ noDataText }}\n </div>\n</ng-template>\n",
2582
- styles: [":host{background-color:#fff;display:flex;flex:1 1 auto;flex-direction:column;min-height:112px}.datatable-vertical-stretch-to-parent{display:flex;flex:1;flex-direction:column;max-height:100%;width:100%}.datatable-max-height-500{max-height:500px}.datatable-max-height-300{max-height:300px}.datatable-max-height,.datatable-max-height-300,.datatable-max-height-500{display:flex;flex:1;flex-direction:column;width:100%}.datatable{flex:1 1 auto;height:100%;overflow:auto;position:relative;width:100%}.datatable table{max-height:100%;width:100%}.datatable td,.datatable th{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:auto}.text-right{padding-right:24px!important;text-align:right!important}.table-action{margin-bottom:.5em;margin-right:.5em}.row-action-button{width:10px}.noDataText{position:relative;text-align:center;width:100%}.mad-datatable-action-bar{align-items:baseline;display:flex;justify-content:space-between}.mad-datatable-checkbox-container{margin-right:16px}.mad-datatable-spinner-wrapper{align-items:center;background-color:#fff;display:flex;height:100%;justify-content:center;left:0;opacity:.8;pointer-events:unset;position:absolute;top:0;width:100%;z-index:99999}.mad-data-table-bottom-area{display:flex;flex-direction:row}.mad-data-table-bottom-area .mad-data-table-bottom-info-area{display:flex;flex:1}.mat-header-row th{background-color:#fff;position:-webkit-sticky;position:sticky;top:0;z-index:1}.active-column-definition{background-color:#f5f5f5;color:#000}"]
2583
- },] }
2584
- ];
2585
- DataTableComponent.ctorParameters = function () { return [
2586
- { type: dialog.MatDialog }
2587
- ]; };
2588
- DataTableComponent.propDecorators = {
2589
- filterLabel: [{ type: i0.Input }],
2590
- filterPlaceholder: [{ type: i0.Input }],
2591
- filterColumnsLabel: [{ type: i0.Input }],
2592
- filterColumnsPlaceHolder: [{ type: i0.Input }],
2593
- noDataText: [{ type: i0.Input }],
2594
- columnSettingsModalTitleLabel: [{ type: i0.Input }],
2595
- selectedLabel: [{ type: i0.Input }],
2596
- availableLabel: [{ type: i0.Input }],
2597
- saveLabel: [{ type: i0.Input }],
2598
- deleteLabel: [{ type: i0.Input }],
2599
- cancelLabel: [{ type: i0.Input }],
2600
- infoTextLabel: [{ type: i0.Input }],
2601
- tableClass: [{ type: i0.Input }],
2602
- pageSizeOptions: [{ type: i0.Input }],
2603
- externalFilter: [{ type: i0.Input }],
2604
- actions: [{ type: i0.Input }],
2605
- idGenerator: [{ type: i0.Input }],
2606
- deleteDefinitionAllowed: [{ type: i0.Input }],
2607
- useAsync: [{ type: i0.Input }],
2608
- displayedColumns: [{ type: i0.Input }],
2609
- displayedColumnDefinition: [{ type: i0.Input }],
2610
- tableData: [{ type: i0.Input }],
2611
- page: [{ type: i0.Input }],
2612
- columnDefinitions: [{ type: i0.Input }],
2613
- loading: [{ type: i0.Input }],
2614
- defaultPageSize: [{ type: i0.Input }],
2615
- externalPaginator: [{ type: i0.Input }],
2616
- paginationEnabled: [{ type: i0.Input }],
2617
- allColumns: [{ type: i0.Input }],
2618
- filterEnabled: [{ type: i0.Input }],
2619
- forceMode: [{ type: i0.Input }],
2620
- sortEvent: [{ type: i0.Output }],
2621
- actionEvent: [{ type: i0.Output }],
2622
- pageEvent: [{ type: i0.Output }],
2623
- allColumnsEvent: [{ type: i0.Output }],
2624
- columnDefinitionChangeEvent: [{ type: i0.Output }],
2625
- viewDefinitionChangeEvent: [{ type: i0.Output }],
2626
- paginator: [{ type: i0.ViewChild, args: [paginator.MatPaginator, { static: false },] }],
2627
- sort: [{ type: i0.ViewChild, args: [sort.MatSort, { static: true },] }]
2628
- };
2629
-
2630
- var DataTableModule = /** @class */ (function () {
2631
- function DataTableModule() {
2632
- }
2633
- return DataTableModule;
2634
- }());
2635
- DataTableModule.decorators = [
2636
- { type: i0.NgModule, args: [{
2637
- declarations: [DataTableComponent, DataTableColumnsModalComponent],
2638
- imports: [
2639
- common.CommonModule,
2640
- button.MatButtonModule,
2641
- icon.MatIconModule,
2642
- formField.MatFormFieldModule,
2643
- input.MatInputModule,
2644
- menu.MatMenuModule,
2645
- paginator.MatPaginatorModule,
2646
- sort.MatSortModule,
2647
- table.MatTableModule,
2648
- progressSpinner.MatProgressSpinnerModule,
2649
- ButtonModule,
2650
- i2.TranslateModule,
2651
- checkbox.MatCheckboxModule,
2652
- badge.MatBadgeModule,
2653
- dragDrop.DragDropModule,
2654
- forms.FormsModule,
2655
- ],
2656
- exports: [DataTableComponent, DataTableColumnsModalComponent],
2657
- },] }
2658
- ];
2659
-
2660
- var StepHeaderComponent = /** @class */ (function (_super) {
2661
- __extends(StepHeaderComponent, _super);
2662
- function StepHeaderComponent(_focusMonitor, _elementRef) {
2663
- var _this = _super.call(this, _elementRef) || this;
2664
- _this._focusMonitor = _focusMonitor;
2665
- return _this;
2666
- }
2667
- StepHeaderComponent.prototype.ngAfterViewInit = function () {
2668
- this._focusMonitor.monitor(this._elementRef, true);
2669
- };
2670
- StepHeaderComponent.prototype.ngOnDestroy = function () {
2671
- this._focusMonitor.stopMonitoring(this._elementRef);
2672
- };
2673
- /** Focuses the step header. */
2674
- StepHeaderComponent.prototype.focus = function (origin, options) {
2675
- if (origin) {
2676
- this._focusMonitor.focusVia(this._elementRef, origin, options);
2677
- }
2678
- else {
2679
- this._elementRef.nativeElement.focus(options);
2680
- }
2681
- };
2682
- StepHeaderComponent.prototype.getCssForState = function () {
2683
- if (this.state === stepper.STEP_STATE.NUMBER && !this.completed && !this.hasError) {
2684
- return 'step-state-neutral'; //initiale state is 'number'
2685
- }
2686
- else if (this.completed) {
2687
- return 'step-state-complete';
2688
- }
2689
- else if (this.hasError) {
2690
- return 'step-state-error';
2691
- }
2692
- };
2693
- StepHeaderComponent.prototype.getIcon = function () {
2694
- if (this.completed) {
2695
- return 'check_circle_outline';
2696
- }
2697
- else if (this.hasError) {
2698
- return 'error_outline';
2699
- }
2700
- return '';
2701
- };
2702
- return StepHeaderComponent;
2703
- }(stepper.CdkStepHeader));
2704
- StepHeaderComponent.decorators = [
2705
- { type: i0.Component, args: [{
2706
- selector: 'mad-step-header',
2707
- template: "<div\n class=\"header\"\n fxLayout=\"row\"\n fxLayoutGap=\"1em\"\n [style.background]=\"this.selected && !this.closed ? '#d8e2e9' : '#ffffff'\"\n [ngClass]=\"this.hasError ? 'error-border' : 'check-border'\"\n>\n <div [ngClass]=\"this.getCssForState()\"></div>\n <div class=\"header-label\">\n <mat-icon class=\"material-icons-outlined\">\n {{ this.selected && !this.closed ? 'keyboard_arrow_down' : 'keyboard_arrow_right' }}\n </mat-icon>\n </div>\n <div *ngIf=\"this.completed || this.hasError\" class=\"header-label\">\n <mat-icon [ngClass]=\"this.completed ? 'green-check' : 'red-error'\">\n {{ getIcon() }}\n </mat-icon>\n </div>\n <span *ngIf=\"!this.hasError && !this.completed\" class=\"header-label\">{{ this.index + 1 + '.' }}</span>\n <div class=\"header-label\">{{ this.label }}</div>\n</div>\n",
2708
- inputs: ['color'],
2709
- host: {
2710
- class: 'mad-step-header',
2711
- role: 'tab',
2712
- },
2713
- encapsulation: i0.ViewEncapsulation.None,
2714
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
2715
- styles: [".header{-webkit-tap-highlight-color:transparent;border:1px solid #d3d3d3;box-sizing:content-box;cursor:pointer;height:62px;outline:var(--warn-color);overflow:hidden;width:100%}.header-label{align-items:center;display:flex}.step-state-complete{background:green;width:5px}.step-state-error{background:var(--warn-color);width:5px}.step-state-neutral{background:#d3d3d3;width:5px}.green-check{color:green}.red-error{color:var(--warn-color)}.check-border{border-color:#d3d3d3}.error-border{border-color:var(--warn-color)}"]
2716
- },] }
2717
- ];
2718
- StepHeaderComponent.ctorParameters = function () { return [
2719
- { type: a11y.FocusMonitor },
2720
- { type: i0.ElementRef }
2721
- ]; };
2722
- StepHeaderComponent.propDecorators = {
2723
- index: [{ type: i0.Input }],
2724
- label: [{ type: i0.Input }],
2725
- state: [{ type: i0.Input }],
2726
- errorMessage: [{ type: i0.Input }],
2727
- selected: [{ type: i0.Input }],
2728
- active: [{ type: i0.Input }],
2729
- optional: [{ type: i0.Input }],
2730
- hasError: [{ type: i0.Input }],
2731
- completed: [{ type: i0.Input }],
2732
- closed: [{ type: i0.Input }]
2733
- };
2734
-
2735
- /**
2736
- * Animations used by the MAD stepper.
2737
- */
2738
- var madStepperAnimations = {
2739
- verticalStepTransition: animations.trigger('stepTransition', [
2740
- animations.state('previous', animations.style({ height: '0px', visibility: 'hidden' })),
2741
- animations.state('next', animations.style({ height: '0px', visibility: 'hidden' })),
2742
- animations.state('current', animations.style({ height: '*', visibility: 'visible' })),
2743
- animations.transition('* <=> current', animations.animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
2744
- ]),
2745
- };
2746
-
2747
- var StepComponent = /** @class */ (function (_super) {
2748
- __extends(StepComponent, _super);
2749
- function StepComponent(stepper, _viewContainerRef) {
2750
- var _this = _super.call(this, stepper) || this;
2751
- _this.stepper = stepper;
2752
- _this._viewContainerRef = _viewContainerRef;
2753
- /** Action event for the next button. If not set the StepComponent will handle the step navigation */
2754
- _this.onNext = new i0.EventEmitter();
2755
- /** Action event for the done button. If not set the StepComponent will handle the step navigation */
2756
- _this.onDone = new i0.EventEmitter();
2757
- /*** Action event when the header is clicked. If not set the StepComponent will handle the step navigation*/
2758
- _this.onHeaderClick = new i0.EventEmitter();
2759
- _this.stepClosed = false;
2760
- _this._isSelected = rxjs.Subscription.EMPTY;
2761
- return _this;
2762
- }
2763
- StepComponent.prototype.ngAfterContentInit = function () {
2764
- var _this = this;
2765
- this._isSelected = this._stepper.steps.changes
2766
- .pipe(operators.switchMap(function () { return _this._stepper.selectionChange.pipe(operators.map(function (event) { return event.selectedStep === _this; }), operators.tap(function () { return (_this.stepClosed = false); }), operators.startWith(_this._stepper.selected === _this)); }))
2767
- .subscribe();
2768
- };
2769
- StepComponent.prototype.ngOnDestroy = function () {
2770
- this._isSelected.unsubscribe();
2771
- };
2772
- StepComponent.prototype.next = function (markFormAsTouched) {
2773
- if (markFormAsTouched === void 0) { markFormAsTouched = true; }
2774
- this.stepValidation(markFormAsTouched);
2775
- if (this.onNext.observers.length <= 0) {
2776
- this.stepper.next();
2777
- }
2778
- this.onNext.emit();
2779
- };
2780
- StepComponent.prototype.selectAndMarkAsTouched = function (index) {
2781
- var _a, _b;
2782
- //Mark current selected step as touched before selecting to display errors in the from
2783
- (_b = (_a = this._stepper.selected) === null || _a === void 0 ? void 0 : _a.stepControl) === null || _b === void 0 ? void 0 : _b.markAllAsTouched();
2784
- this.stepClosed = false;
2785
- if (this.onHeaderClick.observers.length <= 0) {
2786
- this.select();
2787
- }
2788
- this.onHeaderClick.emit(index);
2789
- };
2790
- StepComponent.prototype.completeLast = function () {
2791
- this.stepValidation(true);
2792
- this.stepClosed = true;
2793
- if (this.onDone.observers.length <= 0) {
2794
- this.stepper.next();
2795
- }
2796
- this.onDone.emit();
2797
- };
2798
- StepComponent.prototype.resetValidations = function () {
2799
- this.hasError = false;
2800
- this.completed = true;
2801
- this.state = stepper.STEP_STATE.DONE;
2802
- };
2803
- StepComponent.prototype.stepValidation = function (markFormAsTouched) {
2804
- var _a, _b;
2805
- if (markFormAsTouched) {
2806
- (_a = this.stepControl) === null || _a === void 0 ? void 0 : _a.markAllAsTouched();
2807
- }
2808
- if ((_b = this.stepControl) === null || _b === void 0 ? void 0 : _b.valid) {
2809
- this.hasError = false;
2810
- this.completed = true;
2811
- this.state = stepper.STEP_STATE.DONE;
2812
- }
2813
- else {
2814
- this.completed = false;
2815
- this.hasError = true;
2816
- this.state = stepper.STEP_STATE.ERROR;
2817
- }
2818
- };
2819
- return StepComponent;
2820
- }(stepper.CdkStep));
2821
- StepComponent.decorators = [
2822
- { type: i0.Component, args: [{
2823
- selector: 'mad-step',
2824
- template: "<ng-template let-last=\"last\" let-nextBtnLbl=\"nextBtnLbl\" let-doneBtnLbl=\"doneBtnLbl\">\n <div class=\"step-container\" fxLayout=\"column\">\n <div class=\"step-content\">\n <ng-content></ng-content>\n </div>\n <div class=\"step-buttons\">\n <div *ngIf=\"!last\">\n <button mat-stroked-button color=\"primary\" (click)=\"next()\">{{nextBtnLbl}}</button>\n </div>\n <div *ngIf=\"last\">\n <button mat-stroked-button color=\"primary\" (click)=\"completeLast()\">{{doneBtnLbl}}</button>\n </div>\n </div>\n </div>\n</ng-template>\n",
2825
- providers: [{ provide: stepper.CdkStep, useExisting: StepComponent }],
2826
- encapsulation: i0.ViewEncapsulation.None,
2827
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
2828
- styles: [".stepper-vertical{display:block}.mat-vertical-stepper-header{align-items:center;border:none!important;display:flex;height:10px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}.vertical-content-container{border:none}[dir=rtl] .vertical-content-container{margin-left:0;margin-right:36px}.vertical-stepper-content{outline:0;overflow:hidden}.vertical-content{padding:0 24px}.step-container{border-bottom:1px solid #d3d3d3;border-left:1px solid #d3d3d3;border-right:1px solid #d3d3d3}.step-buttons,.step-content{padding:2em}"]
2829
- },] }
2830
- ];
2831
- StepComponent.ctorParameters = function () { return [
2832
- { type: StepperComponent, decorators: [{ type: i0.Inject, args: [i0.forwardRef(function () { return StepperComponent; }),] }] },
2833
- { type: i0.ViewContainerRef }
2834
- ]; };
2835
- StepComponent.propDecorators = {
2836
- onNext: [{ type: i0.Output }],
2837
- onDone: [{ type: i0.Output }],
2838
- onHeaderClick: [{ type: i0.Output }]
2839
- };
2840
- var StepperComponent = /** @class */ (function (_super) {
2841
- __extends(StepperComponent, _super);
2842
- function StepperComponent(dir, changeDetectorRef, elementRef, _document) {
2843
- var _this = _super.call(this, dir, changeDetectorRef, elementRef, _document) || this;
2844
- /** Event emitted when the current step is done transitioning in. */
2845
- _this.animationDone = new i0.EventEmitter();
2846
- /** Steps that belong to the current stepper, excluding ones from nested steppers. */
2847
- _this.steps = new i0.QueryList();
2848
- _this._animationDone = new rxjs.Subject();
2849
- _this._orientation = 'vertical';
2850
- return _this;
2851
- }
2852
- StepperComponent.prototype.ngOnInit = function () {
2853
- // Only linear stepper implementation is supported
2854
- _super.prototype.linear = true;
2855
- };
2856
- StepperComponent.prototype.ngAfterContentInit = function () {
2857
- var _this = this;
2858
- _super.prototype.ngAfterContentInit.call(this);
2859
- this.steps.changes.pipe(operators.takeUntil(this._destroyed)).subscribe(function () {
2860
- _this._stateChanged();
2861
- });
2862
- this._animationDone
2863
- .pipe(operators.distinctUntilChanged(function (x, y) { return x.fromState === y.fromState && x.toState === y.toState; }), operators.takeUntil(this._destroyed))
2864
- .subscribe(function (event) {
2865
- if (event.toState === 'current') {
2866
- _this.animationDone.emit();
2867
- }
2868
- });
2869
- };
2870
- /**
2871
- * Method patched to enable the closing of the last step.
2872
- */
2873
- StepperComponent.prototype._getAnimationDirection = function (index) {
2874
- var _a, _b;
2875
- var closeLastStep = this.selectedIndex === this.steps.length - 1 && ((_a = this._steps.last) === null || _a === void 0 ? void 0 : _a.completed) && ((_b = this._steps.last) === null || _b === void 0 ? void 0 : _b.stepClosed);
2876
- if (closeLastStep) {
2877
- return 'next';
2878
- }
2879
- return _super.prototype._getAnimationDirection.call(this, index);
2880
- };
2881
- StepperComponent.prototype._stepIsNavigable = function (index, step) {
2882
- return step.completed || this.selectedIndex === index || !this.linear;
2883
- };
2884
- return StepperComponent;
2885
- }(stepper.CdkStepper));
2886
- StepperComponent.decorators = [
2887
- { type: i0.Component, args: [{
2888
- selector: 'mad-stepper',
2889
- template: "<!-- Vertical stepper -->\n<ng-container>\n <div *ngFor=\"let step of steps; let i = index; let isLast = last; let isFirst = first\">\n <ng-container\n [ngTemplateOutlet]=\"stepTemplate\"\n [ngTemplateOutletContext]=\"{step: step, i: i}\"></ng-container>\n <div class=\"vertical-content-container\" [class.mat-stepper-vertical-line]=\"!isLast\">\n <div class=\"vertical-stepper-content\" role=\"tabpanel\"\n [@stepTransition]=\"_getAnimationDirection(i)\"\n (@stepTransition.done)=\"_animationDone.next($event)\"\n [id]=\"_getStepContentId(i)\"\n [attr.aria-labelledby]=\"_getStepLabelId(i)\"\n [attr.aria-expanded]=\"selectedIndex === i\">\n <div class=\"vertical-content\">\n <ng-container [ngTemplateOutlet]=\"step.content\"\n [ngTemplateOutletContext]=\"{step: step, i: i, last: isLast, first: isFirst, nextBtnLbl: this.nextButtonLabel, doneBtnLbl: this.doneButtonLabel}\"></ng-container>\n </div>\n </div>\n </div>\n </div>\n</ng-container>\n\n<ng-template let-step=\"step\" let-i=\"i\" #stepTemplate>\n <mad-step-header\n class=\"mat-vertical-stepper-header\"\n (click)=\"step.selectAndMarkAsTouched(i)\"\n (keydown)=\"_onKeydown($event)\"\n [tabIndex]=\"_getFocusIndex() === i ? 0 : -1\"\n [id]=\"_getStepLabelId(i)\"\n [attr.aria-posinset]=\"i + 1\"\n [attr.aria-setsize]=\"steps.length\"\n [attr.aria-controls]=\"_getStepContentId(i)\"\n [attr.aria-selected]=\"selectedIndex == i\"\n [attr.aria-label]=\"step.ariaLabel || null\"\n [attr.aria-labelledby]=\"(!step.ariaLabel && step.ariaLabelledby) ? step.ariaLabelledby : null\"\n [attr.aria-disabled]=\"_stepIsNavigable(i, step) ? null : true\"\n [index]=\"i\"\n [completed]=\"step.completed\"\n [hasError]=\"step.hasError\"\n [state]=\"_getIndicatorType(i, step.state)\"\n [label]=\"step.stepLabel || step.label\"\n [selected]=\"selectedIndex === i\"\n [active]=\"_stepIsNavigable(i, step)\"\n [optional]=\"step.optional\"\n [closed]=\"step.stepClosed\"\n [errorMessage]=\"step.errorMessage\"></mad-step-header>\n</ng-template>\n",
2890
- host: {
2891
- '[class.stepper-vertical]': 'true',
2892
- '[attr.aria-orientation]': '"vertical"',
2893
- role: 'tablist',
2894
- },
2895
- animations: [madStepperAnimations.verticalStepTransition],
2896
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
2897
- providers: [{ provide: stepper.CdkStepper, useExisting: StepperComponent }],
2898
- encapsulation: i0.ViewEncapsulation.None,
2899
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
2900
- styles: [".stepper-vertical{display:block}.mat-vertical-stepper-header{align-items:center;border:none!important;display:flex;height:10px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}.vertical-content-container{border:none}[dir=rtl] .vertical-content-container{margin-left:0;margin-right:36px}.vertical-stepper-content{outline:0;overflow:hidden}.vertical-content{padding:0 24px}.step-container{border-bottom:1px solid #d3d3d3;border-left:1px solid #d3d3d3;border-right:1px solid #d3d3d3}.step-buttons,.step-content{padding:2em}"]
2901
- },] }
2902
- ];
2903
- StepperComponent.ctorParameters = function () { return [
2904
- { type: bidi.Directionality, decorators: [{ type: i0.Optional }] },
2905
- { type: i0.ChangeDetectorRef },
2906
- { type: i0.ElementRef },
2907
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
2908
- ]; };
2909
- StepperComponent.propDecorators = {
2910
- animationDone: [{ type: i0.Output }],
2911
- nextButtonLabel: [{ type: i0.Input }],
2912
- doneButtonLabel: [{ type: i0.Input }],
2913
- _stepHeader: [{ type: i0.ViewChildren, args: [StepHeaderComponent,] }],
2914
- _steps: [{ type: i0.ContentChildren, args: [StepComponent, { descendants: true },] }]
2915
- };
2916
-
2917
- var StepperModule = /** @class */ (function () {
2918
- function StepperModule() {
2919
- }
2920
- return StepperModule;
2921
- }());
2922
- StepperModule.decorators = [
2923
- { type: i0.NgModule, args: [{
2924
- declarations: [StepperComponent, StepHeaderComponent, StepComponent],
2925
- imports: [common.CommonModule, button.MatButtonModule, icon.MatIconModule, stepper.CdkStepperModule, flexLayout.FlexModule],
2926
- exports: [StepperComponent, StepHeaderComponent, StepComponent],
2927
- },] }
2928
- ];
2929
-
2930
- var ContentHeaderComponent = /** @class */ (function () {
2931
- function ContentHeaderComponent() {
2932
- }
2933
- return ContentHeaderComponent;
2934
- }());
2935
- ContentHeaderComponent.decorators = [
2936
- { type: i0.Component, args: [{
2937
- selector: 'mad-content-header',
2938
- template: "<div class=\"content-header\">\n <ng-content></ng-content>\n</div>\n",
2939
- styles: [".content-header{padding-right:.5rem}"]
2940
- },] }
2941
- ];
2942
-
2943
- var ContentPanelContainerComponent = /** @class */ (function () {
2944
- function ContentPanelContainerComponent() {
2945
- }
2946
- return ContentPanelContainerComponent;
2947
- }());
2948
- ContentPanelContainerComponent.decorators = [
2949
- { type: i0.Component, args: [{
2950
- selector: 'mad-content-panel-container',
2951
- template: "<div class=\"content-panel-outer-wrapper\">\n <ng-content select=\"mad-content-panel-container-content\"></ng-content>\n <ng-content select=\"mad-content-panel-container-footer\"></ng-content>\n</div>\n",
2952
- styles: [":host{display:flex;flex:1 1 auto;min-height:.05rem;overflow:hidden;position:relative}.content-panel-outer-wrapper{display:flex;flex:1 1 auto;flex-direction:column}"]
2953
- },] }
2954
- ];
2955
-
2956
- var ContentPanelContainerContentComponent = /** @class */ (function () {
2957
- function ContentPanelContainerContentComponent() {
2958
- }
2959
- return ContentPanelContainerContentComponent;
2960
- }());
2961
- ContentPanelContainerContentComponent.decorators = [
2962
- { type: i0.Component, args: [{
2963
- selector: 'mad-content-panel-container-content',
2964
- template: "<ng-content></ng-content>",
2965
- styles: [":host{border-top:.05rem solid #ccc;flex:1 1 auto;height:1rem;overflow-y:auto;padding:1rem}"]
2966
- },] }
2967
- ];
2968
-
2969
- var ContentPanelContainerFooterComponent = /** @class */ (function () {
2970
- function ContentPanelContainerFooterComponent() {
2971
- }
2972
- return ContentPanelContainerFooterComponent;
2973
- }());
2974
- ContentPanelContainerFooterComponent.decorators = [
2975
- { type: i0.Component, args: [{
2976
- selector: 'mad-content-panel-container-footer',
2977
- template: "<ng-content></ng-content>",
2978
- styles: [":host{align-items:center;border-top:.05rem solid #ccc;display:flex;flex:0 0 auto;min-height:2rem;padding:.25rem 1rem}"]
2979
- },] }
2980
- ];
2981
-
2982
- var MainContainerComponent = /** @class */ (function () {
2983
- function MainContainerComponent() {
2984
- }
2985
- return MainContainerComponent;
2986
- }());
2987
- MainContainerComponent.decorators = [
2988
- { type: i0.Component, args: [{
2989
- selector: 'mad-main-container',
2990
- template: "<div class=\"main-container\">\n <ng-content select=\"mad-content-header\"></ng-content>\n <ng-content select=\"mad-flowbar\"></ng-content>\n <ng-content select=\"mad-content-panel-container\"></ng-content>\n</div>\n",
2991
- styles: [".main-container{display:flex;flex-direction:column;height:100%}"]
2992
- },] }
2993
- ];
2994
-
2995
- var ContentPanelModule = /** @class */ (function () {
2996
- function ContentPanelModule() {
2997
- }
2998
- return ContentPanelModule;
2999
- }());
3000
- ContentPanelModule.decorators = [
3001
- { type: i0.NgModule, args: [{
3002
- declarations: [
3003
- ContentHeaderComponent,
3004
- ContentPanelContainerComponent,
3005
- ContentPanelContainerContentComponent,
3006
- ContentPanelContainerFooterComponent,
3007
- MainContainerComponent,
3008
- ],
3009
- imports: [common.CommonModule],
3010
- exports: [
3011
- ContentHeaderComponent,
3012
- ContentPanelContainerComponent,
3013
- ContentPanelContainerContentComponent,
3014
- ContentPanelContainerFooterComponent,
3015
- MainContainerComponent,
3016
- ],
3017
- },] }
3018
- ];
3019
-
3020
- var FlowbarComponent = /** @class */ (function () {
3021
- function FlowbarComponent() {
3022
- this._steps = [];
3023
- this._activeStepChange = new i0.EventEmitter(true);
3024
- /**
3025
- * Event emitted when a step header is clicked.
3026
- * When defined header navigation has to be implemented programmatically.
3027
- * e.g. {@see changeActiveStepOnHeader}
3028
- */
3029
- this._headerClick = new i0.EventEmitter(true);
3030
- }
3031
- Object.defineProperty(FlowbarComponent.prototype, "currentStepLabel", {
3032
- get: function () {
3033
- return this._activeStep.label;
3034
- },
3035
- enumerable: false,
3036
- configurable: true
3037
- });
3038
- Object.defineProperty(FlowbarComponent.prototype, "currentSubStepLabel", {
3039
- get: function () {
3040
- var _a;
3041
- return (_a = this._activeStep.activeSubStep) === null || _a === void 0 ? void 0 : _a.label;
3042
- },
3043
- enumerable: false,
3044
- configurable: true
3045
- });
3046
- FlowbarComponent.prototype.ngOnInit = function () {
3047
- // If no active step is set as input or the active step is not enabled, select the first enabled step
3048
- if (!this._activeStep || !this._activeStep.enabled) {
3049
- this._activeStep = this._steps.find(function (step) { return step.enabled; });
3050
- if (this._activeStep) {
3051
- // If sub steps exist then set the first non disabled sub step per default
3052
- if (this.activeTabHasSubSteps()) {
3053
- this._activeStep.activeSubStep = this._activeStep.subSteps.find(function (step) { return step.enabled; });
3054
- }
3055
- this._activeStepChange.emit(this._activeStep);
3056
- }
3057
- }
3058
- };
3059
- FlowbarComponent.prototype.ngAfterViewInit = function () {
3060
- this.stepper._getIndicatorType = function () { return 'number'; };
3061
- };
3062
- FlowbarComponent.prototype.getIndexForActiveStep = function () {
3063
- var selectedIndex = this._steps.indexOf(this._activeStep);
3064
- return selectedIndex === -1 ? 0 : selectedIndex;
3065
- };
3066
- FlowbarComponent.prototype.changeActiveStep = function (step) {
3067
- var previousIndex = this._steps.indexOf(this._activeStep);
3068
- this._activeStep = step;
3069
- if (this.activeTabHasSubSteps()) {
3070
- if (previousIndex < this._steps.indexOf(this._activeStep)) {
3071
- this._activeStep.activeSubStep = this._activeStep.subSteps[0];
3072
- }
3073
- else {
3074
- this._activeStep.activeSubStep = this._activeStep.subSteps[this._activeStep.subSteps.length - 1];
3075
- }
3076
- }
3077
- this._activeStepChange.emit(this._activeStep);
3078
- };
3079
- FlowbarComponent.prototype.changeActiveStepOnHeader = function (step) {
3080
- var stepIndex = this._steps.indexOf(step);
3081
- this._activeStep = step;
3082
- this.stepper.selected = this.stepper._steps.find(function (_, i) { return i === stepIndex; });
3083
- };
3084
- FlowbarComponent.prototype.changeActiveSubStep = function (subStep) {
3085
- this._activeStep.activeSubStep = subStep;
3086
- };
3087
- FlowbarComponent.prototype.previous = function () {
3088
- if (this.isPreviousAvailable()) {
3089
- // If active step has no sub steps or first sub step is selected -> go to previous main step
3090
- if (!this.activeTabHasSubSteps() || this.isFirstSubStep()) {
3091
- var previousEnabledStep = this.findPreviousEnabledStep();
3092
- this.changeActiveStep(previousEnabledStep);
3093
- this.stepper.selectedIndex = this._steps.indexOf(previousEnabledStep);
3094
- }
3095
- else {
3096
- var subStepIndex = this._activeStep.subSteps.indexOf(this._activeStep.activeSubStep);
3097
- this._activeStep.activeSubStep = this._activeStep.subSteps[subStepIndex - 1];
3098
- }
3099
- }
3100
- };
3101
- FlowbarComponent.prototype.next = function () {
3102
- if (this.isNextAvailable()) {
3103
- // If active step has no sub steps or last sub step is selected -> go to next main step
3104
- if (!this.activeTabHasSubSteps() || this.isLastSubStep()) {
3105
- var nextEnabledStep = this.findNextEnabledStep();
3106
- this.changeActiveStep(nextEnabledStep);
3107
- this.stepper.selectedIndex = this._steps.indexOf(nextEnabledStep);
3108
- }
3109
- else {
3110
- var subStepIndex = this._activeStep.subSteps.indexOf(this._activeStep.activeSubStep);
3111
- this._activeStep.activeSubStep = this._activeStep.subSteps[subStepIndex + 1];
3112
- }
3113
- }
3114
- };
3115
- FlowbarComponent.prototype.isPreviousAvailable = function () {
3116
- if (this._activeStep) {
3117
- if (!this.activeTabHasSubSteps() || this.isFirstSubStep()) {
3118
- var index = this.getCurrentIndex();
3119
- return index > 0 && this.isAnyPreviousStepEnabled(index);
3120
- }
3121
- else {
3122
- return true;
3123
- }
3124
- }
3125
- return false;
3126
- };
3127
- FlowbarComponent.prototype.isNextAvailable = function () {
3128
- if (this._activeStep) {
3129
- if (!this.activeTabHasSubSteps() || this.isLastSubStep()) {
3130
- var index = this.getCurrentIndex();
3131
- return index < this._steps.length - 1 && this.isAnyFollowingStepEnabled(index);
3132
- }
3133
- else {
3134
- return true;
3135
- }
3136
- }
3137
- return false;
3138
- };
3139
- FlowbarComponent.prototype.isLastStep = function () {
3140
- if (this.getCurrentIndex() === this._steps.length - 1) {
3141
- if (this.activeTabHasSubSteps()) {
3142
- return this.isLastSubStep();
3143
- }
3144
- else {
3145
- return true;
3146
- }
3147
- }
3148
- return false;
3149
- };
3150
- FlowbarComponent.prototype.getCurrentIndex = function () {
3151
- var _this = this;
3152
- return this._steps.findIndex(function (value) { return value === _this._activeStep; });
3153
- };
3154
- FlowbarComponent.prototype.getCurrentSubStepIndex = function () {
3155
- var _this = this;
3156
- return this._activeStep.subSteps.findIndex(function (value) { return value === _this._activeStep.activeSubStep; });
3157
- };
3158
- FlowbarComponent.prototype.triggerClick = function () {
3159
- var selectedStep = this._steps[this.stepper.selectedIndex];
3160
- this.changeActiveStep(selectedStep);
3161
- };
3162
- FlowbarComponent.prototype.headerClick = function (event, step) {
3163
- event.stopPropagation(); //stop processing current header click event
3164
- this._headerClick.emit(step);
3165
- };
3166
- FlowbarComponent.prototype.activeTabHasSubSteps = function () {
3167
- return this._activeStep.subSteps && this._activeStep.subSteps.length > 0;
3168
- };
3169
- FlowbarComponent.prototype.isFirstSubStep = function () {
3170
- return this._activeStep.activeSubStep === this._activeStep.subSteps[0];
3171
- };
3172
- FlowbarComponent.prototype.isLastSubStep = function () {
3173
- return this._activeStep.activeSubStep === this._activeStep.subSteps[this._activeStep.subSteps.length - 1];
3174
- };
3175
- FlowbarComponent.prototype.isAnyPreviousStepEnabled = function (index) {
3176
- // eslint-disable-next-line id-blacklist
3177
- return this._steps.slice(0, index).find(function (step) { return step.enabled; }) !== undefined;
3178
- };
3179
- FlowbarComponent.prototype.isAnyFollowingStepEnabled = function (index) {
3180
- // eslint-disable-next-line id-blacklist
3181
- return this._steps.slice(index + 1, this._steps.length).find(function (step) { return step.enabled; }) !== undefined;
3182
- };
3183
- FlowbarComponent.prototype.findPreviousEnabledStep = function () {
3184
- var index = this.getCurrentIndex();
3185
- return this._steps
3186
- .slice(0, index)
3187
- .reverse()
3188
- .find(function (step) { return step.enabled; });
3189
- };
3190
- FlowbarComponent.prototype.findNextEnabledStep = function () {
3191
- var index = this.getCurrentIndex();
3192
- return this._steps.slice(index + 1, this._steps.length).find(function (step) { return step.enabled; });
3193
- };
3194
- return FlowbarComponent;
3195
- }());
3196
- FlowbarComponent.decorators = [
3197
- { type: i0.Component, args: [{
3198
- selector: 'mad-flowbar',
3199
- template: "<div class=\"stepper-container\">\n <mat-horizontal-stepper #stepper [selectedIndex]=\"this.getIndexForActiveStep()\" (click)=\"triggerClick()\">\n <mat-step *ngFor=\"let step of _steps\" [aria-labelledby]=\"!step.enabled ? 'disabled' : null\">\n <ng-template matStepLabel>\n <div class=\"step-header-overlay\" *ngIf=\"this._headerClick.observers.length > 0\" (click)=\"headerClick($event, step)\"></div>\n <span>{{step.label}}</span>\n </ng-template>\n </mat-step>\n </mat-horizontal-stepper>\n</div>\n",
3200
- styles: [".stepper-container{display:flex;padding:0 1rem}::ng-deep .mat-stepper-horizontal .mat-horizontal-stepper-header{height:auto;padding:0}::ng-deep .mat-step-header[aria-labelledby=disabled]{cursor:not-allowed;pointer-events:none!important}::ng-deep .mat-stepper-horizontal .mat-horizontal-content-container{padding:0 0 10px}::ng-deep .mat-stepper-horizontal .mat-stepper-horizontal-line{border-top-width:4px;margin:0 5px}.step-header-overlay{height:100%;position:absolute;right:0;top:0;width:100%}"]
3201
- },] }
3202
- ];
3203
- FlowbarComponent.propDecorators = {
3204
- _steps: [{ type: i0.Input, args: ['steps',] }],
3205
- _activeStep: [{ type: i0.Input, args: ['activeStep',] }],
3206
- _activeStepChange: [{ type: i0.Output, args: ['activeStepChange',] }],
3207
- _headerClick: [{ type: i0.Output, args: ['headerClick',] }],
3208
- stepper: [{ type: i0.ViewChild, args: ['stepper',] }]
3209
- };
3210
-
3211
- var FlowbarModule = /** @class */ (function () {
3212
- function FlowbarModule() {
3213
- }
3214
- return FlowbarModule;
3215
- }());
3216
- FlowbarModule.decorators = [
3217
- { type: i0.NgModule, args: [{
3218
- declarations: [FlowbarComponent],
3219
- imports: [common.CommonModule, stepper$1.MatStepperModule],
3220
- exports: [FlowbarComponent],
3221
- },] }
3222
- ];
3223
-
3224
- var MaterialAddonsModule = /** @class */ (function () {
3225
- function MaterialAddonsModule() {
3226
- }
3227
- return MaterialAddonsModule;
3228
- }());
3229
- MaterialAddonsModule.decorators = [
3230
- { type: i0.NgModule, args: [{
3231
- exports: [
3232
- ReadOnlyFormFieldModule,
3233
- ButtonModule,
3234
- ToolbarModule,
3235
- MaterialActionButtonModule,
3236
- NumericFieldModule,
3237
- CardModule,
3238
- QuickListModule,
3239
- ThrottleClickModule,
3240
- ],
3241
- },] }
3242
- ];
3243
-
3244
- /*
3245
- * Public API Surface of material-addons
3246
- */
3247
-
3248
- /**
3249
- * Generated bundle index. Do not edit.
3250
- */
3251
-
3252
- exports.ButtonModule = ButtonModule;
3253
- exports.CardModule = CardModule;
3254
- exports.ContentHeaderComponent = ContentHeaderComponent;
3255
- exports.ContentPanelContainerComponent = ContentPanelContainerComponent;
3256
- exports.ContentPanelContainerContentComponent = ContentPanelContainerContentComponent;
3257
- exports.ContentPanelContainerFooterComponent = ContentPanelContainerFooterComponent;
3258
- exports.ContentPanelModule = ContentPanelModule;
3259
- exports.DataTableModule = DataTableModule;
3260
- exports.FlowbarComponent = FlowbarComponent;
3261
- exports.FlowbarModule = FlowbarModule;
3262
- exports.MainContainerComponent = MainContainerComponent;
3263
- exports.MaterialActionButtonComponent = MaterialActionButtonComponent;
3264
- exports.MaterialActionButtonModule = MaterialActionButtonModule;
3265
- exports.MaterialAddonsModule = MaterialAddonsModule;
3266
- exports.NumberFormatService = NumberFormatService;
3267
- exports.NumericFieldModule = NumericFieldModule;
3268
- exports.QuickListModule = QuickListModule;
3269
- exports.ReadOnlyFormFieldComponent = ReadOnlyFormFieldComponent;
3270
- exports.ReadOnlyFormFieldModule = ReadOnlyFormFieldModule;
3271
- exports.ReadOnlyFormFieldWrapperComponent = ReadOnlyFormFieldWrapperComponent;
3272
- exports.StepComponent = StepComponent;
3273
- exports.StepHeaderComponent = StepHeaderComponent;
3274
- exports.StepperComponent = StepperComponent;
3275
- exports.StepperModule = StepperModule;
3276
- exports.TableModule = TableModule;
3277
- exports.ThrottleClickDirective = ThrottleClickDirective;
3278
- exports.ThrottleClickModule = ThrottleClickModule;
3279
- exports.ToolbarComponent = ToolbarComponent;
3280
- exports.ToolbarModule = ToolbarModule;
3281
- exports.ToolbarService = ToolbarService;
3282
- exports.madStepperAnimations = madStepperAnimations;
3283
- exports.ɵb = PrimaryButtonComponent;
3284
- exports.ɵc = MadBasicButton;
3285
- exports.ɵd = OutlineButtonComponent;
3286
- exports.ɵe = LinkButtonComponent;
3287
- exports.ɵf = DangerButtonComponent;
3288
- exports.ɵg = IconButtonComponent;
3289
- exports.ɵh = NumericFieldDirective;
3290
- exports.ɵi = CardComponent;
3291
- exports.ɵj = QuickListComponent;
3292
- exports.ɵk = BaseQuickListComponent;
3293
- exports.ɵl = QuickListCompactComponent;
3294
- exports.ɵm = TableComponent;
3295
- exports.ɵn = DataTableComponent;
3296
- exports.ɵo = DataTableColumnsModalComponent;
3297
-
3298
- Object.defineProperty(exports, '__esModule', { value: true });
3299
-
3300
- })));
3301
- //# sourceMappingURL=porscheinformatik-material-addons.umd.js.map