@coolon/angular-ui-powerups 1.10.0 → 1.11.1

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 (231) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/assets/styles.scss +7 -67
  3. package/bundles/coolon-angular-ui-powerups.umd.js +2649 -1623
  4. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js +2 -2
  6. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  7. package/coolon-angular-ui-powerups.d.ts +57 -44
  8. package/coolon-angular-ui-powerups.metadata.json +1 -1
  9. package/esm2015/coolon-angular-ui-powerups.js +55 -42
  10. package/esm2015/coolon-angular-ui-powerups.js.map +1 -1
  11. package/esm2015/coolon-angular-ui-powerups.metadata.json +1 -1
  12. package/esm2015/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
  13. package/esm2015/lib/components/card-container/card-container.component.js +1 -1
  14. package/esm2015/lib/components/card-container/card-container.component.metadata.json +1 -1
  15. package/esm2015/lib/components/components.module.js +37 -6
  16. package/esm2015/lib/components/components.module.js.map +1 -1
  17. package/esm2015/lib/components/components.module.metadata.json +1 -1
  18. package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
  19. package/esm2015/lib/components/forms/abstract-input-activity.js +47 -0
  20. package/esm2015/lib/components/forms/abstract-input-activity.js.map +1 -0
  21. package/esm2015/lib/components/forms/abstract-input-activity.metadata.json +1 -0
  22. package/esm2015/lib/components/forms/abstract-input-activity.ngfactory.js.map +1 -0
  23. package/esm2015/lib/components/forms/abstract-input.component.js +6 -1
  24. package/esm2015/lib/components/forms/abstract-input.component.js.map +1 -1
  25. package/esm2015/lib/components/forms/abstract-input.component.metadata.json +1 -1
  26. package/esm2015/lib/components/forms/number-input/number-input.component.js +1 -1
  27. package/esm2015/lib/components/forms/number-input/number-input.component.metadata.json +1 -1
  28. package/esm2015/lib/components/forms/password-input/password-input.component.js +1 -1
  29. package/esm2015/lib/components/forms/password-input/password-input.component.metadata.json +1 -1
  30. package/esm2015/lib/components/forms/string-input/string-input-activity.js +22 -0
  31. package/esm2015/lib/components/forms/string-input/string-input-activity.js.map +1 -0
  32. package/esm2015/lib/components/forms/string-input/string-input-activity.metadata.json +1 -0
  33. package/esm2015/lib/components/forms/string-input/string-input-activity.ngfactory.js.map +1 -0
  34. package/esm2015/lib/components/forms/string-input/string-input.component.js +1 -1
  35. package/esm2015/lib/components/forms/string-input/string-input.component.metadata.json +1 -1
  36. package/esm2015/lib/components/forms/text-input/text-input.component.js +1 -1
  37. package/esm2015/lib/components/forms/text-input/text-input.component.metadata.json +1 -1
  38. package/esm2015/lib/components/index.js +13 -0
  39. package/esm2015/lib/components/index.js.map +1 -1
  40. package/esm2015/lib/components/index.metadata.json +1 -1
  41. package/esm2015/lib/components/table/cell-editor.component.js +1 -0
  42. package/esm2015/lib/components/table/cell-editor.component.js.map +1 -0
  43. package/esm2015/lib/components/table/cell-editor.component.metadata.json +1 -0
  44. package/esm2015/lib/components/table/cell-renderer.js +1 -0
  45. package/esm2015/lib/components/table/cell-renderer.js.map +1 -0
  46. package/esm2015/lib/components/table/cell-renderer.metadata.json +1 -0
  47. package/esm2015/lib/components/table/column-model.js +160 -0
  48. package/esm2015/lib/components/table/column-model.js.map +1 -0
  49. package/esm2015/lib/components/table/column-model.metadata.json +1 -0
  50. package/esm2015/lib/components/table/column-template/column-template.directive.js +24 -0
  51. package/esm2015/lib/components/table/column-template/column-template.directive.js.map +1 -0
  52. package/esm2015/lib/components/table/column-template/column-template.directive.metadata.json +1 -0
  53. package/esm2015/lib/components/table/column-template/column-template.directive.ngfactory.js.map +1 -0
  54. package/esm2015/lib/components/table/column-text-properties.js +1 -0
  55. package/esm2015/lib/components/table/column-text-properties.js.map +1 -0
  56. package/esm2015/lib/components/table/column-text-properties.metadata.json +1 -0
  57. package/esm2015/lib/components/table/default-cell-renderer/default-cell-renderer.component.js +27 -0
  58. package/esm2015/lib/components/table/default-cell-renderer/default-cell-renderer.component.js.map +1 -0
  59. package/esm2015/lib/components/table/default-cell-renderer/default-cell-renderer.component.metadata.json +1 -0
  60. package/esm2015/lib/components/table/default-cell-renderer/default-cell-renderer.component.ngfactory.js.map +1 -0
  61. package/esm2015/lib/components/table/default-cell-renderer/default-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  62. package/esm2015/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.js +21 -0
  63. package/esm2015/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.js.map +1 -0
  64. package/esm2015/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.metadata.json +1 -0
  65. package/esm2015/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.ngfactory.js.map +1 -0
  66. package/esm2015/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  67. package/esm2015/lib/components/table/edit-row-controls/edit-row-controls.component.js +50 -0
  68. package/esm2015/lib/components/table/edit-row-controls/edit-row-controls.component.js.map +1 -0
  69. package/esm2015/lib/components/table/edit-row-controls/edit-row-controls.component.metadata.json +1 -0
  70. package/esm2015/lib/components/table/edit-row-controls/edit-row-controls.component.ngfactory.js.map +1 -0
  71. package/esm2015/lib/components/table/edit-row-controls/edit-row-controls.component.scss.shim.ngstyle.js.map +1 -0
  72. package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.js +40 -0
  73. package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.js.map +1 -0
  74. package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.metadata.json +1 -0
  75. package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.ngfactory.js.map +1 -0
  76. package/esm2015/lib/components/table/select-cell-renderer/select-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  77. package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js +32 -0
  78. package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js.map +1 -0
  79. package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.metadata.json +1 -0
  80. package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.ngfactory.js.map +1 -0
  81. package/esm2015/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  82. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +64 -0
  83. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -0
  84. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.metadata.json +1 -0
  85. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.ngfactory.js.map +1 -0
  86. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  87. package/esm2015/lib/components/table/table-def.js +1 -0
  88. package/esm2015/lib/components/table/table-def.js.map +1 -0
  89. package/esm2015/lib/components/table/table-def.metadata.json +1 -0
  90. package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js +32 -0
  91. package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js.map +1 -0
  92. package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.metadata.json +1 -0
  93. package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.ngfactory.js.map +1 -0
  94. package/esm2015/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  95. package/esm2015/lib/components/table/table-model.js +197 -0
  96. package/esm2015/lib/components/table/table-model.js.map +1 -0
  97. package/esm2015/lib/components/table/table-model.metadata.json +1 -0
  98. package/esm2015/lib/components/table/table.component.js +60 -0
  99. package/esm2015/lib/components/table/table.component.js.map +1 -0
  100. package/esm2015/lib/components/table/table.component.metadata.json +1 -0
  101. package/esm2015/lib/components/table/table.component.ngfactory.js.map +1 -0
  102. package/esm2015/lib/components/table/table.component.scss.shim.ngstyle.js.map +1 -0
  103. package/esm2015/lib/interaction/activity.js +7 -1
  104. package/esm2015/lib/interaction/activity.js.map +1 -1
  105. package/esm2015/lib/interaction/activity.metadata.json +1 -1
  106. package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js +87 -0
  107. package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js.map +1 -0
  108. package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.metadata.json +1 -0
  109. package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.ngfactory.js.map +1 -0
  110. package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.scss.shim.ngstyle.js.map +1 -0
  111. package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.js +86 -0
  112. package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.js.map +1 -0
  113. package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.metadata.json +1 -0
  114. package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.ngfactory.js.map +1 -0
  115. package/esm2015/lib/interaction/index.js +2 -0
  116. package/esm2015/lib/interaction/index.js.map +1 -1
  117. package/esm2015/lib/interaction/index.metadata.json +1 -1
  118. package/esm2015/lib/interaction/interaction.module.js +12 -3
  119. package/esm2015/lib/interaction/interaction.module.js.map +1 -1
  120. package/esm2015/lib/interaction/interaction.module.metadata.json +1 -1
  121. package/esm2015/lib/interaction/interaction.module.ngfactory.js.map +1 -1
  122. package/esm5/coolon-angular-ui-powerups.js +55 -42
  123. package/esm5/coolon-angular-ui-powerups.js.map +1 -1
  124. package/esm5/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
  125. package/esm5/lib/components/card-container/card-container.component.js +1 -1
  126. package/esm5/lib/components/components.module.js +37 -6
  127. package/esm5/lib/components/components.module.js.map +1 -1
  128. package/esm5/lib/components/components.module.ngfactory.js.map +1 -1
  129. package/esm5/lib/components/forms/abstract-input-activity.js +50 -0
  130. package/esm5/lib/components/forms/abstract-input-activity.js.map +1 -0
  131. package/esm5/lib/components/forms/abstract-input-activity.ngfactory.js.map +1 -0
  132. package/esm5/lib/components/forms/abstract-input.component.js +6 -1
  133. package/esm5/lib/components/forms/abstract-input.component.js.map +1 -1
  134. package/esm5/lib/components/forms/number-input/number-input.component.js +1 -1
  135. package/esm5/lib/components/forms/password-input/password-input.component.js +1 -1
  136. package/esm5/lib/components/forms/string-input/string-input-activity.js +18 -0
  137. package/esm5/lib/components/forms/string-input/string-input-activity.js.map +1 -0
  138. package/esm5/lib/components/forms/string-input/string-input-activity.ngfactory.js.map +1 -0
  139. package/esm5/lib/components/forms/string-input/string-input.component.js +1 -1
  140. package/esm5/lib/components/forms/text-input/text-input.component.js +1 -1
  141. package/esm5/lib/components/index.js +13 -0
  142. package/esm5/lib/components/index.js.map +1 -1
  143. package/esm5/lib/components/table/cell-editor.component.js +1 -0
  144. package/esm5/lib/components/table/cell-editor.component.js.map +1 -0
  145. package/esm5/lib/components/table/cell-renderer.js +1 -0
  146. package/esm5/lib/components/table/cell-renderer.js.map +1 -0
  147. package/esm5/lib/components/table/column-model.js +196 -0
  148. package/esm5/lib/components/table/column-model.js.map +1 -0
  149. package/esm5/lib/components/table/column-template/column-template.directive.js +25 -0
  150. package/esm5/lib/components/table/column-template/column-template.directive.js.map +1 -0
  151. package/esm5/lib/components/table/column-template/column-template.directive.ngfactory.js.map +1 -0
  152. package/esm5/lib/components/table/column-text-properties.js +1 -0
  153. package/esm5/lib/components/table/column-text-properties.js.map +1 -0
  154. package/esm5/lib/components/table/default-cell-renderer/default-cell-renderer.component.js +32 -0
  155. package/esm5/lib/components/table/default-cell-renderer/default-cell-renderer.component.js.map +1 -0
  156. package/esm5/lib/components/table/default-cell-renderer/default-cell-renderer.component.ngfactory.js.map +1 -0
  157. package/esm5/lib/components/table/default-cell-renderer/default-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  158. package/esm5/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.js +22 -0
  159. package/esm5/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.js.map +1 -0
  160. package/esm5/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.ngfactory.js.map +1 -0
  161. package/esm5/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  162. package/esm5/lib/components/table/edit-row-controls/edit-row-controls.component.js +57 -0
  163. package/esm5/lib/components/table/edit-row-controls/edit-row-controls.component.js.map +1 -0
  164. package/esm5/lib/components/table/edit-row-controls/edit-row-controls.component.ngfactory.js.map +1 -0
  165. package/esm5/lib/components/table/edit-row-controls/edit-row-controls.component.scss.shim.ngstyle.js.map +1 -0
  166. package/esm5/lib/components/table/select-cell-renderer/select-cell-renderer.component.js +47 -0
  167. package/esm5/lib/components/table/select-cell-renderer/select-cell-renderer.component.js.map +1 -0
  168. package/esm5/lib/components/table/select-cell-renderer/select-cell-renderer.component.ngfactory.js.map +1 -0
  169. package/esm5/lib/components/table/select-cell-renderer/select-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  170. package/esm5/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js +35 -0
  171. package/esm5/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.js.map +1 -0
  172. package/esm5/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.ngfactory.js.map +1 -0
  173. package/esm5/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  174. package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js +66 -0
  175. package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -0
  176. package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.ngfactory.js.map +1 -0
  177. package/esm5/lib/components/table/table-cell-renderer/table-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  178. package/esm5/lib/components/table/table-def.js +1 -0
  179. package/esm5/lib/components/table/table-def.js.map +1 -0
  180. package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js +33 -0
  181. package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.js.map +1 -0
  182. package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.ngfactory.js.map +1 -0
  183. package/esm5/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  184. package/esm5/lib/components/table/table-model.js +213 -0
  185. package/esm5/lib/components/table/table-model.js.map +1 -0
  186. package/esm5/lib/components/table/table.component.js +62 -0
  187. package/esm5/lib/components/table/table.component.js.map +1 -0
  188. package/esm5/lib/components/table/table.component.ngfactory.js.map +1 -0
  189. package/esm5/lib/components/table/table.component.scss.shim.ngstyle.js.map +1 -0
  190. package/esm5/lib/interaction/activity.js +7 -2
  191. package/esm5/lib/interaction/activity.js.map +1 -1
  192. package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js +95 -0
  193. package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js.map +1 -0
  194. package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.ngfactory.js.map +1 -0
  195. package/esm5/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.scss.shim.ngstyle.js.map +1 -0
  196. package/esm5/lib/interaction/directives/interaction-context-trigger-for.directive.js +90 -0
  197. package/esm5/lib/interaction/directives/interaction-context-trigger-for.directive.js.map +1 -0
  198. package/esm5/lib/interaction/directives/interaction-context-trigger-for.directive.ngfactory.js.map +1 -0
  199. package/esm5/lib/interaction/index.js +2 -0
  200. package/esm5/lib/interaction/index.js.map +1 -1
  201. package/esm5/lib/interaction/interaction.module.js +12 -3
  202. package/esm5/lib/interaction/interaction.module.js.map +1 -1
  203. package/esm5/lib/interaction/interaction.module.ngfactory.js.map +1 -1
  204. package/fesm2015/coolon-angular-ui-powerups.js +2280 -1372
  205. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  206. package/fesm5/coolon-angular-ui-powerups.js +2561 -1567
  207. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  208. package/lib/components/forms/abstract-input-activity.d.ts +18 -0
  209. package/lib/components/forms/abstract-input.component.d.ts +1 -0
  210. package/lib/components/forms/string-input/string-input-activity.d.ts +3 -0
  211. package/lib/components/index.d.ts +17 -0
  212. package/lib/components/table/cell-editor.component.d.ts +5 -0
  213. package/lib/components/table/cell-renderer.d.ts +3 -0
  214. package/lib/components/table/column-model.d.ts +84 -0
  215. package/lib/components/table/column-template/column-template.directive.d.ts +7 -0
  216. package/lib/components/table/column-text-properties.d.ts +3 -0
  217. package/lib/components/table/default-cell-renderer/default-cell-renderer.component.d.ts +6 -0
  218. package/lib/components/table/default-header-cell-renderer/default-header-cell-renderer.component.d.ts +5 -0
  219. package/lib/components/table/edit-row-controls/edit-row-controls.component.d.ts +14 -0
  220. package/lib/components/table/select-cell-renderer/select-cell-renderer.component.d.ts +11 -0
  221. package/lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.d.ts +9 -0
  222. package/lib/components/table/table-cell-renderer/table-cell-renderer.component.d.ts +18 -0
  223. package/lib/components/table/table-def.d.ts +7 -0
  224. package/lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.d.ts +8 -0
  225. package/lib/components/table/table-model.d.ts +114 -0
  226. package/lib/components/table/table.component.d.ts +40 -0
  227. package/lib/interaction/activity.d.ts +1 -0
  228. package/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.d.ts +21 -0
  229. package/lib/interaction/directives/interaction-context-trigger-for.directive.d.ts +17 -0
  230. package/lib/interaction/index.d.ts +2 -0
  231. package/package.json +3 -2
@@ -1,11 +1,12 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/icon'), require('@coolon/pectin'), require('@angular/cdk/portal'), require('@angular/flex-layout'), require('@angular/material/dialog'), require('@angular/router'), require('lodash'), require('resize-observer-polyfill'), require('@coolon/typescript-utilities'), require('@angular/material/progress-spinner'), require('@angular/material/list'), require('@angular/material/tooltip'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations'), require('rxjs')) :
3
- typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/tabs', '@angular/platform-browser/animations', '@angular/material/button', '@angular/material/checkbox', '@angular/material/icon', '@coolon/pectin', '@angular/cdk/portal', '@angular/flex-layout', '@angular/material/dialog', '@angular/router', 'lodash', 'resize-observer-polyfill', '@coolon/typescript-utilities', '@angular/material/progress-spinner', '@angular/material/list', '@angular/material/tooltip', '@typescript-plus/fast-memoize-decorator/dist/src', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations', 'rxjs'], factory) :
4
- (global = global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.tabs, global.ng.platformBrowser.animations, global.ng.material.button, global.ng.material.checkbox, global.ng.material.icon, global.pectin, global.ng.cdk.portal, global.ng.flexLayout, global.ng.material.dialog, global.ng.router, global.___default, global.ResizeObserver, global.typescriptUtilities, global.ng.material.progressSpinner, global.ng.material.list, global.ng.material.tooltip, global.src, global.fastMemoizeDecorator, null, global.ng.animations, global.rxjs));
5
- }(this, (function (exports, common, core, forms, formField, input, select, tabs, animations, button, checkbox, icon, pectin, portal, flexLayout, dialog, router, ___default, ResizeObserver, typescriptUtilities, progressSpinner, list, tooltip, src, fastMemoizeDecorator, reflectMetadata, animations$1, rxjs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@angular/cdk/portal'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/icon'), require('@angular/material/table'), require('@coolon/pectin'), require('@angular/flex-layout'), require('@angular/material/dialog'), require('@angular/router'), require('lodash'), require('resize-observer-polyfill'), require('@coolon/typescript-utilities'), require('@angular/cdk/overlay'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('immer'), require('@angular/material/progress-spinner'), require('@angular/material/list'), require('@angular/material/tooltip'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations'), require('rxjs')) :
3
+ typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/tabs', '@angular/platform-browser/animations', '@angular/cdk/portal', '@angular/material/button', '@angular/material/checkbox', '@angular/material/icon', '@angular/material/table', '@coolon/pectin', '@angular/flex-layout', '@angular/material/dialog', '@angular/router', 'lodash', 'resize-observer-polyfill', '@coolon/typescript-utilities', '@angular/cdk/overlay', '@typescript-plus/fast-memoize-decorator/dist/src', 'immer', '@angular/material/progress-spinner', '@angular/material/list', '@angular/material/tooltip', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations', 'rxjs'], factory) :
4
+ (global = global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.tabs, global.ng.platformBrowser.animations, global.ng.cdk.portal, global.ng.material.button, global.ng.material.checkbox, global.ng.material.icon, global.ng.material.table, global.pectin, global.ng.flexLayout, global.ng.material.dialog, global.ng.router, global.___default, global.ResizeObserver, global.typescriptUtilities, global.ng.cdk.overlay, global.src, global.produce, global.ng.material.progressSpinner, global.ng.material.list, global.ng.material.tooltip, global.fastMemoizeDecorator, null, global.ng.animations, global.rxjs));
5
+ }(this, (function (exports, common, core, forms, formField, input, select, tabs, animations, portal, button, checkbox, icon, table, pectin, flexLayout, dialog, router, ___default, ResizeObserver, typescriptUtilities, overlay, src, produce, progressSpinner, list, tooltip, fastMemoizeDecorator, reflectMetadata, animations$1, rxjs) { 'use strict';
6
6
 
7
7
  var ___default__default = 'default' in ___default ? ___default['default'] : ___default;
8
8
  ResizeObserver = ResizeObserver && Object.prototype.hasOwnProperty.call(ResizeObserver, 'default') ? ResizeObserver['default'] : ResizeObserver;
9
+ produce = produce && Object.prototype.hasOwnProperty.call(produce, 'default') ? produce['default'] : produce;
9
10
 
10
11
  /*! *****************************************************************************
11
12
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -539,45 +540,6 @@
539
540
  return DirectivesModule;
540
541
  }());
541
542
 
542
- var FocusContainerComponent = /** @class */ (function (_super) {
543
- __extends(FocusContainerComponent, _super);
544
- function FocusContainerComponent(focusManager) {
545
- var _this = _super.call(this) || this;
546
- _this.focusManager = focusManager;
547
- _this.restoreFocusCommand = pectin.Command.create(function () {
548
- _this.restoreFocus();
549
- });
550
- _this.tabIndex = -1;
551
- return _this;
552
- }
553
- FocusContainerComponent.prototype.ngOnInit = function () {
554
- };
555
- // @Trace()
556
- FocusContainerComponent.prototype.restoreFocus = function () {
557
- this.focusManager.restoreFocus();
558
- };
559
- FocusContainerComponent.ctorParameters = function () { return [
560
- { type: pectin.FocusManager, decorators: [{ type: core.Self }] }
561
- ]; };
562
- __decorate([
563
- core.HostBinding('attr.tabindex'),
564
- __metadata("design:type", Object)
565
- ], FocusContainerComponent.prototype, "tabIndex", void 0);
566
- FocusContainerComponent = __decorate([
567
- core.Component({
568
- selector: 'aup-focus-container',
569
- template: "<ng-content></ng-content>\n",
570
- providers: [
571
- { provide: pectin.FocusManager }
572
- ],
573
- styles: [":host{display:block}"]
574
- }),
575
- __param(0, core.Self()),
576
- __metadata("design:paramtypes", [pectin.FocusManager])
577
- ], FocusContainerComponent);
578
- return FocusContainerComponent;
579
- }(DisposableComponent));
580
-
581
543
  var FocusableComponent = /** @class */ (function (_super) {
582
544
  __extends(FocusableComponent, _super);
583
545
  function FocusableComponent(el, focusManager, focusBindingFactory) {
@@ -643,1840 +605,2785 @@
643
605
  return FocusableComponent;
644
606
  }(DisposableComponent));
645
607
 
646
- var AbstractInputComponent = /** @class */ (function (_super) {
647
- __extends(AbstractInputComponent, _super);
648
- function AbstractInputComponent() {
649
- var _this = _super.call(this) || this;
650
- /**
651
- * A backing model for all our @Input() valueModel properties which should be defined as follows.
652
- *
653
- * @Input() @TrackExternal({useExisting: "delegatingFormValueModel"})
654
- * valueModel: FormValueModel<string> | MutableValueModel<string>;
655
- *
656
- * This approach allows the input to accept plain or form models but all backed by a form
657
- * friendly delegate. We have to use an existing delegate for union types as pectin just
658
- * gets told it's an Object and can't scan for a base type annotated with @DelegateUsing(..).
659
- */
660
- // We have to register it as a disposable so it ditches any listeners when we're disposed.
661
- _this.delegatingFormValueModel = _this.registerDisposable(new pectin.DelegatingFormValueModel());
662
- // TODO: fix this.
663
- // tslint:disable-next-line:no-output-native
664
- _this.focus = new core.EventEmitter();
665
- // tslint:disable-next-line:no-output-native
666
- _this.blur = new core.EventEmitter();
667
- // tslint:disable-next-line:no-output-native
668
- _this.enterKey = new core.EventEmitter();
669
- // tslint:disable-next-line:no-output-native
670
- _this.escapeKey = new core.EventEmitter();
671
- var self = _this;
672
- _this.errorStateMatcher = {
673
- isErrorState: function (control, form) {
674
- return self.hasErrors();
675
- }
676
- };
677
- return _this;
608
+ var Dimension = /** @class */ (function () {
609
+ function Dimension(width, height) {
610
+ this.width = width;
611
+ this.height = height;
678
612
  }
679
- AbstractInputComponent.prototype.notifyClick = function () {
680
- this.safelyInvoke(this.clickCommand);
681
- };
682
- AbstractInputComponent.prototype.notifyFocusIn = function () {
683
- this.safelyInvoke(this.focusCommand);
684
- this.focus.emit();
685
- };
686
- AbstractInputComponent.prototype.notifyFocusOut = function () {
687
- this.safelyInvoke(this.blurCommand);
688
- this.blur.emit();
689
- };
690
- AbstractInputComponent.prototype.notifyEnterKey = function () {
691
- this.safelyInvoke(this.enterCommand);
692
- this.enterKey.emit();
613
+ return Dimension;
614
+ }());
615
+
616
+ var Point = /** @class */ (function () {
617
+ function Point(x, y) {
618
+ this.x = x;
619
+ this.y = y;
620
+ }
621
+ Point.from = function (data) {
622
+ return new Point(data.x, data.y);
693
623
  };
694
- AbstractInputComponent.prototype.notifyEscapeKey = function () {
695
- this.safelyInvoke(this.escapeCommand);
696
- this.escapeKey.emit();
624
+ Point.prototype.translate = function (x, y) {
625
+ return new Point(this.x + x, this.y + y);
697
626
  };
698
- AbstractInputComponent.prototype.safelyInvoke = function (command) {
699
- if (command && command.enabled.value) {
700
- command.execute();
627
+ return Point;
628
+ }());
629
+
630
+ exports.Bounds = /** @class */ (function (_super) {
631
+ __extends(Bounds, _super);
632
+ function Bounds(top, left, width, height) {
633
+ var _this = _super.call(this, width, height) || this;
634
+ _this.top = top;
635
+ _this.left = left;
636
+ _this.width = width;
637
+ _this.height = height;
638
+ return _this;
639
+ }
640
+ Bounds.prototype.relativePositionOf = function (point) {
641
+ if (point instanceof MouseEvent) {
642
+ return new Point(point.clientX - this.left, point.clientY - this.top);
643
+ }
644
+ else {
645
+ return new Point(point.x - this.left, point.y - this.top);
701
646
  }
702
647
  };
703
- AbstractInputComponent.prototype.ngOnInit = function () {
704
- };
705
- AbstractInputComponent.prototype.isEnabled = function () {
706
- return this.enabled.value;
648
+ return Bounds;
649
+ }(Dimension));
650
+ (function (Bounds) {
651
+ function ofElement(element) {
652
+ var rect = element.getBoundingClientRect();
653
+ return new Bounds(rect.top, rect.left, rect.width, rect.height);
654
+ }
655
+ Bounds.ofElement = ofElement;
656
+ })(exports.Bounds || (exports.Bounds = {}));
657
+
658
+ var ResizeAwareComponent = /** @class */ (function (_super) {
659
+ __extends(ResizeAwareComponent, _super);
660
+ function ResizeAwareComponent(elementRef, ngZone) {
661
+ var _this = _super.call(this) || this;
662
+ _this.elementRef = elementRef;
663
+ _this.ngZone = ngZone;
664
+ _this._boundsModel = new pectin.MutableValueModel(new exports.Bounds(0, 0, 0, 0));
665
+ return _this;
666
+ }
667
+ ResizeAwareComponent.prototype.ngAfterViewInit = function () {
668
+ var _this = this;
669
+ this.updateBounds();
670
+ var element = this.elementRef.nativeElement;
671
+ var ro = new ResizeObserver(function (entries, observer) {
672
+ _this.ngZone.run(function () { return _this.updateBounds(); });
673
+ });
674
+ ro.observe(element);
675
+ this.onDispose(function () { return ro.disconnect(); });
707
676
  };
708
- Object.defineProperty(AbstractInputComponent.prototype, "enabled", {
677
+ Object.defineProperty(ResizeAwareComponent.prototype, "boundsModel", {
709
678
  get: function () {
710
- return this.delegatingFormValueModel.enabled;
679
+ return this._boundsModel.readonly;
711
680
  },
712
681
  enumerable: true,
713
682
  configurable: true
714
683
  });
715
- AbstractInputComponent.prototype.hasErrors = function () {
716
- return !this.errorList.query().isEmpty();
717
- };
718
- Object.defineProperty(AbstractInputComponent.prototype, "errorList", {
684
+ Object.defineProperty(ResizeAwareComponent.prototype, "nativeElement", {
719
685
  get: function () {
720
- return this.delegatingFormValueModel.errorList;
686
+ return this.elementRef.nativeElement;
721
687
  },
722
688
  enumerable: true,
723
689
  configurable: true
724
690
  });
725
- Object.defineProperty(AbstractInputComponent.prototype, "firstError", {
691
+ // TODO: Make this handle body scroll
692
+ ResizeAwareComponent.prototype.relativePositionOf = function (point) {
693
+ return this.bounds.relativePositionOf(point);
694
+ };
695
+ Object.defineProperty(ResizeAwareComponent.prototype, "bounds", {
726
696
  get: function () {
727
- return this.hasErrors() ? this.errorList.value[0] : null;
697
+ return this._boundsModel.value;
728
698
  },
729
699
  enumerable: true,
730
700
  configurable: true
731
701
  });
702
+ ResizeAwareComponent.prototype.updateBounds = function () {
703
+ this._boundsModel.value = exports.Bounds.ofElement(this.nativeElement);
704
+ };
705
+ ResizeAwareComponent.ctorParameters = function () { return [
706
+ { type: core.ElementRef },
707
+ { type: core.NgZone }
708
+ ]; };
709
+ ResizeAwareComponent = __decorate([
710
+ core.Directive(),
711
+ __metadata("design:paramtypes", [core.ElementRef, core.NgZone])
712
+ ], ResizeAwareComponent);
713
+ return ResizeAwareComponent;
714
+ }(DisposableComponent));
715
+
716
+ /**
717
+ * @example
718
+ * // CSS Vars
719
+ * aup-card-container {
720
+ * --card-gap: var(--card-gap, 16px);
721
+ * --card-width: var(--card-width, 300px);
722
+ * --card-height: var(--card-height, auto);
723
+ * --card-min-height: var(--card-min-height, auto);
724
+ * --card-background: var(--card-background, #fcfcfb);
725
+ * }
726
+ *
727
+ * // Content Templates:
728
+ * #addCardTemplate
729
+ * <ng-template #addCardTemplate>
730
+ * This is a new card template, it will the the size of the other cards.
731
+ * </nav-template>
732
+ *
733
+ */
734
+ var CardContainerComponent = /** @class */ (function (_super) {
735
+ __extends(CardContainerComponent, _super);
736
+ function CardContainerComponent() {
737
+ return _super.call(this) || this;
738
+ }
739
+ CardContainerComponent.prototype.ngOnInit = function () {
740
+ };
732
741
  __decorate([
733
742
  core.Input(),
734
- __metadata("design:type", String)
735
- ], AbstractInputComponent.prototype, "label", void 0);
736
- __decorate([
737
- core.Input(),
738
- __metadata("design:type", String)
739
- ], AbstractInputComponent.prototype, "floatLabel", void 0);
740
- __decorate([
741
- core.Input(),
742
- __metadata("design:type", String)
743
- ], AbstractInputComponent.prototype, "hint", void 0);
744
- __decorate([
745
- core.Input(),
746
- __metadata("design:type", String)
747
- ], AbstractInputComponent.prototype, "placeholder", void 0);
748
- __decorate([
749
- core.Input('command.focus'),
750
- __metadata("design:type", pectin.Command)
751
- ], AbstractInputComponent.prototype, "focusCommand", void 0);
752
- __decorate([
753
- core.Input('command.blur'),
754
- __metadata("design:type", pectin.Command)
755
- ], AbstractInputComponent.prototype, "blurCommand", void 0);
756
- __decorate([
757
- core.Input('command.enter'),
758
- __metadata("design:type", pectin.Command)
759
- ], AbstractInputComponent.prototype, "enterCommand", void 0);
760
- __decorate([
761
- core.Input('command.escape'),
762
- __metadata("design:type", pectin.Command)
763
- ], AbstractInputComponent.prototype, "escapeCommand", void 0);
764
- __decorate([
765
- core.Input('command.click'),
743
+ pectin.TrackExternal(),
766
744
  __metadata("design:type", pectin.Command)
767
- ], AbstractInputComponent.prototype, "clickCommand", void 0);
768
- __decorate([
769
- core.Output(),
770
- __metadata("design:type", Object)
771
- ], AbstractInputComponent.prototype, "focus", void 0);
745
+ ], CardContainerComponent.prototype, "addCardCommand", void 0);
772
746
  __decorate([
773
- core.Output(),
774
- __metadata("design:type", Object)
775
- ], AbstractInputComponent.prototype, "blur", void 0);
776
- __decorate([
777
- core.Output(),
778
- __metadata("design:type", Object)
779
- ], AbstractInputComponent.prototype, "enterKey", void 0);
780
- __decorate([
781
- core.Output(),
782
- __metadata("design:type", Object)
783
- ], AbstractInputComponent.prototype, "escapeKey", void 0);
784
- __decorate([
785
- core.HostListener('click'),
786
- __metadata("design:type", Function),
787
- __metadata("design:paramtypes", []),
788
- __metadata("design:returntype", void 0)
789
- ], AbstractInputComponent.prototype, "notifyClick", null);
790
- __decorate([
791
- core.HostListener('focusin'),
792
- __metadata("design:type", Function),
793
- __metadata("design:paramtypes", []),
794
- __metadata("design:returntype", void 0)
795
- ], AbstractInputComponent.prototype, "notifyFocusIn", null);
796
- __decorate([
797
- core.HostListener('focusout'),
798
- __metadata("design:type", Function),
799
- __metadata("design:paramtypes", []),
800
- __metadata("design:returntype", void 0)
801
- ], AbstractInputComponent.prototype, "notifyFocusOut", null);
802
- AbstractInputComponent = __decorate([
803
- core.Component({ template: '' }),
747
+ core.ContentChild("addCardTemplate"),
748
+ __metadata("design:type", core.TemplateRef)
749
+ ], CardContainerComponent.prototype, "addCardTemplate", void 0);
750
+ CardContainerComponent = __decorate([
751
+ core.Component({
752
+ selector: 'aup-card-container',
753
+ template: "<div class=\"card-container\">\n <ng-content></ng-content>\n\n <div class=\"add-card-container\" *ngIf=\"addCardCommand.enabled.value\" [pectinCommand]=\"addCardCommand\">\n <mat-icon>add</mat-icon>\n </div>\n\n <div class=\"add-card-template\" *ngIf=\"addCardTemplate\">\n <ng-container [ngTemplateOutlet]=\"addCardTemplate\"></ng-container>\n </div>\n\n</div>\n",
754
+ styles: [":root{--aup-default-padding:var(--default-padding, 18px);--aup-default-background:white}.router-outlet-container>*{position:absolute;top:0;left:0;bottom:0;right:0}[no-tab-header]>mat-tab-header{display:none}[full-height-tabs] .mat-tab-body-wrapper,mat-tab-group.full-height-tabs .mat-tab-body-wrapper{flex:1}[full-height-tabs] .mat-tab-body-wrapper .mat-tab-body-content,[full-height-tabs] .mat-tab-body-wrapper mat-tab-body,mat-tab-group.full-height-tabs .mat-tab-body-wrapper .mat-tab-body-content,mat-tab-group.full-height-tabs .mat-tab-body-wrapper mat-tab-body{display:flex;flex-direction:column;justify-content:stretch}.dialog-interaction-context{max-width:95vw!important;max-height:95vh!important}.dialog-interaction-context mat-dialog-container{max-width:95vw!important;max-height:95vh!important;padding:0}.aup-popup-interaction-panel{background:var(--aup-default-background,#fff);box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12);transition:box-shadow 280ms cubic-bezier(.4,0,.2,1)}.aup-input-activity{padding:calc(var(--aup-default-padding)/2)}.aup-input-component{display:block}.aup-input-component input,.aup-input-component mat-form-field{width:100%}.aup-input-component input mat-hint.faux-error,.aup-input-component mat-form-field mat-hint.faux-error{color:#f44336}aup-table-cell-renderer>.aup-input-component .mat-form-field-flex{padding-top:0}aup-table-cell-renderer>.aup-input-component .mat-form-field-infix{width:0}aup-table-cell-renderer>.aup-input-component .mat-form-field-label-wrapper{display:none}aup-table{--default-column-gap:var(--column-gap, 24px)}aup-table aup-table-cell-renderer:not(.first-column),aup-table aup-table-header-cell-renderer:not(.first-column){padding-left:var(--default-column-gap)}:host{--resolved-card-gap:var(--card-gap, 16px);--resolved-card-width:var(--card-width, 300px);--resolved-card-height:var(--card-height, auto);--resolved-card-min-height:var(--card-min-height, auto);--resolved-card-background:var(--card-background, #fcfcfb);flex:1;display:block;background:var(--resolved-card-background)}.card-container{display:-ms-grid;display:grid;grid-template-columns:repeat(auto-fill,var(--resolved-card-width));grid-template-rows:repeat(auto-fit,minmax(0,var(--resolved-card-height)));grid-gap:var(--resolved-card-gap);box-sizing:border-box;padding:var(--resolved-card-gap);min-height:calc(var(--resolved-card-height) + 2 * var(--resolved-card-gap));min-width:calc(var(--resolved-card-width) + 2 * var(--resolved-card-gap));width:calc((var(--resolved-card-width) + var(--resolved-card-gap)) * 2 + var(--grid-gap));max-width:100%}.add-card-container{width:var(--resolved-card-width);height:var(--resolved-card-height);min-height:var(--resolved-card-min-height);display:flex;flex-direction:column;align-items:center;justify-content:center;box-sizing:border-box;border:2px dashed rgba(0,0,0,.1);border-radius:6px;font-weight:300;cursor:pointer;color:rgba(0,0,0,.54);background-color:rgba(255,255,255,.8);transition:280ms cubic-bezier(.4,0,.2,1)}.add-card-container mat-icon{font-size:200%}.add-card-container:hover{transition:280ms cubic-bezier(.4,0,.2,1);border-color:transparent;background-color:#fff;color:rgba(0,0,0,.54)}.add-card-container:hover:hover{box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)}.add-card-template-container{width:var(--resolved-card-width);height:var(--resolved-card-height);display:flex;flex-direction:column;align-items:stretch;justify-content:stretch}"]
755
+ }),
804
756
  __metadata("design:paramtypes", [])
805
- ], AbstractInputComponent);
806
- return AbstractInputComponent;
757
+ ], CardContainerComponent);
758
+ return CardContainerComponent;
807
759
  }(DisposableComponent));
808
760
 
809
- var CheckboxInputComponent = /** @class */ (function (_super) {
810
- __extends(CheckboxInputComponent, _super);
811
- function CheckboxInputComponent() {
761
+ var FocusContainerComponent = /** @class */ (function (_super) {
762
+ __extends(FocusContainerComponent, _super);
763
+ function FocusContainerComponent(focusManager) {
812
764
  var _this = _super.call(this) || this;
813
- _this.color = 'accent';
814
- _this.labelPosition = 'after';
765
+ _this.focusManager = focusManager;
766
+ _this.restoreFocusCommand = pectin.Command.create(function () {
767
+ _this.restoreFocus();
768
+ });
769
+ _this.tabIndex = -1;
815
770
  return _this;
816
771
  }
817
- CheckboxInputComponent.prototype.ngOnInit = function () {
772
+ FocusContainerComponent.prototype.ngOnInit = function () {
773
+ };
774
+ // @Trace()
775
+ FocusContainerComponent.prototype.restoreFocus = function () {
776
+ this.focusManager.restoreFocus();
818
777
  };
778
+ FocusContainerComponent.ctorParameters = function () { return [
779
+ { type: pectin.FocusManager, decorators: [{ type: core.Self }] }
780
+ ]; };
819
781
  __decorate([
820
- core.Input(), pectin.TrackExternal({ delegateTo: 'delegatingFormValueModel' }),
782
+ core.HostBinding('attr.tabindex'),
821
783
  __metadata("design:type", Object)
822
- ], CheckboxInputComponent.prototype, "valueModel", void 0);
823
- __decorate([
824
- core.Input(),
825
- __metadata("design:type", String)
826
- ], CheckboxInputComponent.prototype, "color", void 0);
827
- __decorate([
828
- core.Input(),
829
- __metadata("design:type", String)
830
- ], CheckboxInputComponent.prototype, "labelPosition", void 0);
831
- CheckboxInputComponent = __decorate([
784
+ ], FocusContainerComponent.prototype, "tabIndex", void 0);
785
+ FocusContainerComponent = __decorate([
832
786
  core.Component({
833
- selector: 'aup-checkbox-input',
834
- template: "<!-- TODO: add focus binding -->\n<mat-checkbox\n [(ngModel)]=\"valueModel.value\"\n [color]=\"color\"\n [labelPosition]=\"labelPosition\"\n [disabled]=\"!isEnabled()\"\n>{{label}}</mat-checkbox>\n<mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n<mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n",
835
- styles: [":host{display:inline-flex;flex-direction:column;margin-top:24px;margin-bottom:16px}mat-error,mat-hint{margin-top:4px;margin-left:24px;font-size:12px;font-weight:400;line-height:13.5px}"]
787
+ selector: 'aup-focus-container',
788
+ template: "<ng-content></ng-content>\n",
789
+ providers: [
790
+ { provide: pectin.FocusManager }
791
+ ],
792
+ styles: [":host{display:block}"]
836
793
  }),
837
- __metadata("design:paramtypes", [])
838
- ], CheckboxInputComponent);
839
- return CheckboxInputComponent;
840
- }(AbstractInputComponent));
794
+ __param(0, core.Self()),
795
+ __metadata("design:paramtypes", [pectin.FocusManager])
796
+ ], FocusContainerComponent);
797
+ return FocusContainerComponent;
798
+ }(DisposableComponent));
841
799
 
842
- var NumberInputComponent = /** @class */ (function (_super) {
843
- __extends(NumberInputComponent, _super);
844
- function NumberInputComponent() {
845
- var _this = _super.call(this) || this;
846
- _this.min = Number.MIN_SAFE_INTEGER;
847
- _this.max = Number.MAX_SAFE_INTEGER;
800
+ var ACTIVITY_DATA = new core.InjectionToken('InteractionActivityData');
801
+ var Activity = /** @class */ (function (_super) {
802
+ __extends(Activity, _super);
803
+ function Activity() {
804
+ var _this = _super !== null && _super.apply(this, arguments) || this;
805
+ _this._busyModel = new pectin.DelegatingValueModel().withDefault(false);
806
+ _this.class = 'aup-activity';
848
807
  return _this;
849
808
  }
850
- NumberInputComponent.prototype.ngOnInit = function () {
809
+ Activity.prototype.initialise = function (nestedInteractionContext, activityContext) {
810
+ typescriptUtilities.assert.isNil(this._activityContext);
811
+ this._activityContext = activityContext;
812
+ this._interactionContext = nestedInteractionContext;
813
+ };
814
+ Object.defineProperty(Activity.prototype, "interactionContext", {
815
+ get: function () {
816
+ typescriptUtilities.assert.isTruthy(this.isInitialised());
817
+ return this._interactionContext;
818
+ },
819
+ enumerable: true,
820
+ configurable: true
821
+ });
822
+ Activity.prototype.done = function (result) {
823
+ return this._activityContext.onDone(result);
824
+ };
825
+ Activity.prototype.cancel = function (error) {
826
+ this._activityContext.onCancel(error);
827
+ };
828
+ // @Trace()
829
+ Activity.prototype.onActivityReady = function () {
830
+ };
831
+ Object.defineProperty(Activity.prototype, "busy", {
832
+ get: function () {
833
+ return this._busyModel.readonly;
834
+ },
835
+ enumerable: true,
836
+ configurable: true
837
+ });
838
+ Activity.prototype.busyWhile = function (busyModel) {
839
+ this._busyModel.setDelegate(busyModel);
840
+ };
841
+ Activity.prototype.isBusy = function () {
842
+ return this._busyModel.value;
843
+ };
844
+ Activity.prototype.isInitialised = function () {
845
+ return !!this._activityContext;
851
846
  };
852
847
  __decorate([
853
- core.Input(), pectin.TrackExternal({ delegateTo: 'delegatingFormValueModel' }),
854
- __metadata("design:type", Object)
855
- ], NumberInputComponent.prototype, "valueModel", void 0);
856
- __decorate([
857
- core.Input(),
858
- __metadata("design:type", Object)
859
- ], NumberInputComponent.prototype, "min", void 0);
860
- __decorate([
861
- core.Input(),
848
+ core.HostBinding('class'),
862
849
  __metadata("design:type", Object)
863
- ], NumberInputComponent.prototype, "max", void 0);
864
- NumberInputComponent = __decorate([
850
+ ], Activity.prototype, "class", void 0);
851
+ return Activity;
852
+ }(DisposableComponent));
853
+
854
+ var AlertDialogComponent = /** @class */ (function (_super) {
855
+ __extends(AlertDialogComponent, _super);
856
+ function AlertDialogComponent(alert) {
857
+ var _this = _super.call(this) || this;
858
+ _this.alert = alert;
859
+ return _this;
860
+ }
861
+ AlertDialogComponent.prototype.ngOnInit = function () {
862
+ };
863
+ AlertDialogComponent.ctorParameters = function () { return [
864
+ { type: undefined, decorators: [{ type: core.Inject, args: [ACTIVITY_DATA,] }] }
865
+ ]; };
866
+ AlertDialogComponent = __decorate([
865
867
  core.Component({
866
- selector: 'aup-number-input',
867
- template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"number\"\n matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"delegatingFormValueModel?.focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n [min]=\"min\"\n [max]=\"max\"\n >\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
868
- styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
868
+ selector: 'aup-alert-dialog',
869
+ template: "<h3 matDialogTitle *ngIf=\"alert.title\">{{alert.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of alert.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</div>\n",
870
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
869
871
  }),
870
- __metadata("design:paramtypes", [])
871
- ], NumberInputComponent);
872
- return NumberInputComponent;
873
- }(AbstractInputComponent));
872
+ __param(0, core.Inject(ACTIVITY_DATA)),
873
+ __metadata("design:paramtypes", [Object])
874
+ ], AlertDialogComponent);
875
+ return AlertDialogComponent;
876
+ }(Activity));
874
877
 
875
- var PasswordInputComponent = /** @class */ (function (_super) {
876
- __extends(PasswordInputComponent, _super);
877
- function PasswordInputComponent() {
878
- return _super.call(this) || this;
878
+ var ConfirmThenDialogComponent = /** @class */ (function (_super) {
879
+ __extends(ConfirmThenDialogComponent, _super);
880
+ function ConfirmThenDialogComponent(config) {
881
+ var _this = _super.call(this) || this;
882
+ _this.config = config;
883
+ pectin.assert.notNil(config);
884
+ return _this;
879
885
  }
880
- PasswordInputComponent.prototype.ngOnInit = function () {
886
+ ConfirmThenDialogComponent.prototype.ngOnInit = function () {
881
887
  };
882
- __decorate([
883
- core.Input(), pectin.TrackExternal({ delegateTo: "delegatingFormValueModel" }),
884
- __metadata("design:type", Object)
885
- ], PasswordInputComponent.prototype, "valueModel", void 0);
886
- PasswordInputComponent = __decorate([
888
+ Object.defineProperty(ConfirmThenDialogComponent.prototype, "confirm", {
889
+ get: function () {
890
+ return this.config.confirm;
891
+ },
892
+ enumerable: true,
893
+ configurable: true
894
+ });
895
+ ConfirmThenDialogComponent.prototype.isDestructive = function () {
896
+ return this.confirm.destructive && this.confirm.destructive();
897
+ };
898
+ ConfirmThenDialogComponent.prototype.onConfirm = function () {
899
+ var _this = this;
900
+ this.interactionContext.startActivity(this.config.activityType, this.config.data)
901
+ .then(function (result) { return _this.done(result); })
902
+ .catch(function (error) { return _this.cancel(error); });
903
+ };
904
+ ConfirmThenDialogComponent.ctorParameters = function () { return [
905
+ { type: undefined, decorators: [{ type: core.Inject, args: [ACTIVITY_DATA,] }] }
906
+ ]; };
907
+ ConfirmThenDialogComponent = __decorate([
887
908
  core.Component({
888
- selector: 'aup-password-input',
889
- template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"password\"\n matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"delegatingFormValueModel.focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n\n",
890
- styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
909
+ selector: 'aup-confirmation-dialog',
910
+ template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n",
911
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
891
912
  }),
892
- __metadata("design:paramtypes", [])
893
- ], PasswordInputComponent);
894
- return PasswordInputComponent;
895
- }(AbstractInputComponent));
913
+ __param(0, core.Inject(ACTIVITY_DATA)),
914
+ __metadata("design:paramtypes", [Object])
915
+ ], ConfirmThenDialogComponent);
916
+ return ConfirmThenDialogComponent;
917
+ }(Activity));
896
918
 
897
- var SelectInputComponent = /** @class */ (function (_super) {
898
- __extends(SelectInputComponent, _super);
899
- function SelectInputComponent() {
919
+ var ConfirmationDialogComponent = /** @class */ (function (_super) {
920
+ __extends(ConfirmationDialogComponent, _super);
921
+ function ConfirmationDialogComponent(confirm) {
900
922
  var _this = _super.call(this) || this;
901
- _this.optionLabelFormat = function (option) { return (option && _this.optionLabel) ? option[_this.optionLabel] : option; };
923
+ _this.confirm = confirm;
924
+ pectin.assert.notNil(confirm);
902
925
  return _this;
903
926
  }
904
- SelectInputComponent.prototype.ngOnInit = function () {
927
+ ConfirmationDialogComponent.prototype.ngOnInit = function () {
905
928
  };
929
+ ConfirmationDialogComponent.prototype.isDestructive = function () {
930
+ return this.confirm.destructive && this.confirm.destructive();
931
+ };
932
+ ConfirmationDialogComponent.ctorParameters = function () { return [
933
+ { type: undefined, decorators: [{ type: core.Inject, args: [ACTIVITY_DATA,] }] }
934
+ ]; };
935
+ ConfirmationDialogComponent = __decorate([
936
+ core.Component({
937
+ selector: 'aup-confirmation-dialog',
938
+ template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n",
939
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
940
+ }),
941
+ __param(0, core.Inject(ACTIVITY_DATA)),
942
+ __metadata("design:paramtypes", [Object])
943
+ ], ConfirmationDialogComponent);
944
+ return ConfirmationDialogComponent;
945
+ }(Activity));
946
+
947
+ var AbstractInteractionContext = /** @class */ (function () {
948
+ function AbstractInteractionContext() {
949
+ }
950
+ AbstractInteractionContext.prototype.startActivity = function (activityType, data) {
951
+ return this.createAndLaunchActivity(activityType, data, false);
952
+ };
953
+ AbstractInteractionContext.prototype.confirm = function (confirm) {
954
+ // Important: we have to implement confirmOrReject as the main entry point
955
+ // as the canDeactivation guards need to be able to cancel an interaction
956
+ // without caring about returning a value.
957
+ return this.confirmOrReject(confirm).then(function () { return true; }).catch(function () { return false; });
958
+ };
959
+ AbstractInteractionContext.prototype.alert = function (alert) {
960
+ // TODO: Test disableClose === false
961
+ return this.createAndLaunchActivity(AlertDialogComponent, alert, false);
962
+ };
963
+ AbstractInteractionContext.prototype.confirmOrReject = function (confirm) {
964
+ return this.createAndLaunchActivity(ConfirmationDialogComponent, confirm, true);
965
+ };
966
+ /**
967
+ * Presents the confirmation to the user and runs the activity only if the user confirms.
968
+ * @param confirm:Confirm the confirmation to display.
969
+ * @param activityType the activity to run if confirmed.
970
+ * @param data the activity data.
971
+ */
972
+ AbstractInteractionContext.prototype.confirmThen = function (confirm, activityType, data) {
973
+ return this.createAndLaunchActivity(ConfirmThenDialogComponent, {
974
+ confirm: confirm,
975
+ activityType: activityType,
976
+ data: data
977
+ }, true);
978
+ };
979
+ return AbstractInteractionContext;
980
+ }());
981
+
982
+ var ActivityRef = /** @class */ (function () {
983
+ function ActivityRef(activityClass, activityData, onComplete) {
984
+ this.activityClass = activityClass;
985
+ this.activityData = activityData;
986
+ this.onComplete = onComplete;
987
+ this._complete = false;
988
+ this.deferredResult = pectin.Deferred.defer();
989
+ }
990
+ ActivityRef.prototype.isActivityRealised = function () {
991
+ return !!this._activity;
992
+ };
993
+ ActivityRef.prototype.isComplete = function () {
994
+ return this._complete;
995
+ };
996
+ Object.defineProperty(ActivityRef.prototype, "activity", {
997
+ get: function () {
998
+ pectin.assert.isTruthy(this.isActivityRealised());
999
+ return this._activity;
1000
+ },
1001
+ enumerable: true,
1002
+ configurable: true
1003
+ });
1004
+ ActivityRef.prototype.notifyActivityCreated = function (activity, nestedInteractionContext) {
1005
+ pectin.assert.isNil(this._activity);
1006
+ this._activity = activity;
1007
+ var self = this;
1008
+ this._activity.initialise(nestedInteractionContext, {
1009
+ onDone: function (result) {
1010
+ self.finishActivity(function (deferred) { return deferred.resolve(result); });
1011
+ },
1012
+ onCancel: function (error) {
1013
+ self.finishActivity(function (deferred) { return deferred.reject(error); });
1014
+ }
1015
+ });
1016
+ };
1017
+ ActivityRef.prototype.finishActivity = function (resolveOrReject) {
1018
+ pectin.assert.isFalsey(this.isComplete());
1019
+ resolveOrReject(this.deferredResult);
1020
+ this._complete = true;
1021
+ this.onComplete(this);
1022
+ };
1023
+ ActivityRef.prototype.cancel = function () {
1024
+ this.activity.cancel();
1025
+ };
1026
+ Object.defineProperty(ActivityRef.prototype, "activityResult", {
1027
+ get: function () {
1028
+ return this.deferredResult.promise;
1029
+ },
1030
+ enumerable: true,
1031
+ configurable: true
1032
+ });
1033
+ return ActivityRef;
1034
+ }());
1035
+
1036
+ /**
1037
+ * ActivityOutletComponent creates and displays an activity and delegates the interaction context functionality to an
1038
+ * external service.
1039
+ */
1040
+ var ActivityOutletComponent = /** @class */ (function () {
1041
+ function ActivityOutletComponent(componentFactoryResolver, viewContainerRef, injector) {
1042
+ this.componentFactoryResolver = componentFactoryResolver;
1043
+ this.viewContainerRef = viewContainerRef;
1044
+ this.injector = injector;
1045
+ }
1046
+ Object.defineProperty(ActivityOutletComponent.prototype, "activityRef", {
1047
+ get: function () {
1048
+ return this._activityRef;
1049
+ },
1050
+ set: function (activityRef) {
1051
+ if (this.activityRef && !this.activityRef.isComplete()) {
1052
+ typescriptUtilities.lang.illegalState("changing activity before previous one has completed");
1053
+ }
1054
+ this._activityRef = activityRef;
1055
+ this.loadActivity(activityRef);
1056
+ },
1057
+ enumerable: true,
1058
+ configurable: true
1059
+ });
1060
+ ;
1061
+ ActivityOutletComponent.prototype.ngOnInit = function () {
1062
+ };
1063
+ ActivityOutletComponent.prototype.loadActivity = function (activityRef) {
1064
+ var injector = core.Injector.create({
1065
+ providers: [
1066
+ { provide: ACTIVITY_DATA, useValue: activityRef.activityData }
1067
+ ],
1068
+ parent: this.injector
1069
+ });
1070
+ var componentFactory = this.componentFactoryResolver.resolveComponentFactory(activityRef.activityClass);
1071
+ this.viewContainerRef.clear();
1072
+ // console.log(`creating component -> ${activityRef.activityClass.name}`);
1073
+ this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
1074
+ this.activityRef.notifyActivityCreated(this.activityComponentRef.instance, this.nestedInteractionContext);
1075
+ };
1076
+ Object.defineProperty(ActivityOutletComponent.prototype, "component", {
1077
+ get: function () {
1078
+ return this.activityComponentRef.instance;
1079
+ },
1080
+ enumerable: true,
1081
+ configurable: true
1082
+ });
1083
+ ActivityOutletComponent.ctorParameters = function () { return [
1084
+ { type: core.ComponentFactoryResolver },
1085
+ { type: core.ViewContainerRef },
1086
+ { type: core.Injector }
1087
+ ]; };
906
1088
  __decorate([
907
- core.Input(), pectin.TrackExternal({ delegateTo: "delegatingFormValueModel" }),
908
- __metadata("design:type", Object)
909
- ], SelectInputComponent.prototype, "valueModel", void 0);
910
- __decorate([
911
- core.Input(), pectin.TrackExternal(),
912
- __metadata("design:type", pectin.ListModel)
913
- ], SelectInputComponent.prototype, "optionsModel", void 0);
914
- __decorate([
915
- core.Input(), pectin.StoreInListModel('optionsModel'),
916
- __metadata("design:type", Array)
917
- ], SelectInputComponent.prototype, "options", void 0);
1089
+ core.Input(),
1090
+ __metadata("design:type", Object)
1091
+ ], ActivityOutletComponent.prototype, "nestedInteractionContext", void 0);
1092
+ __decorate([
1093
+ core.Input(),
1094
+ __metadata("design:type", ActivityRef),
1095
+ __metadata("design:paramtypes", [ActivityRef])
1096
+ ], ActivityOutletComponent.prototype, "activityRef", null);
1097
+ ActivityOutletComponent = __decorate([
1098
+ core.Component({
1099
+ selector: 'aup-activity-outlet',
1100
+ template: '',
1101
+ styles: [":host{display:block}"]
1102
+ }),
1103
+ __metadata("design:paramtypes", [core.ComponentFactoryResolver,
1104
+ core.ViewContainerRef,
1105
+ core.Injector])
1106
+ ], ActivityOutletComponent);
1107
+ return ActivityOutletComponent;
1108
+ }());
1109
+
1110
+ var ActivityContainerComponent = /** @class */ (function (_super) {
1111
+ __extends(ActivityContainerComponent, _super);
1112
+ function ActivityContainerComponent() {
1113
+ var _this = _super.call(this) || this;
1114
+ _this.dynamicHeight = false;
1115
+ _this.activityTabs = [];
1116
+ _this.garbage = new pectin.GarbageCollector();
1117
+ return _this;
1118
+ }
1119
+ ActivityContainerComponent.prototype.ngOnInit = function () {
1120
+ };
1121
+ ActivityContainerComponent.prototype.ngAfterViewInit = function () {
1122
+ var _this = this;
1123
+ var _a = pectin.Dsl.disposeWith(this), chain = _a.chain, observe = _a.observe;
1124
+ // using the component directly rather than (animationDone)=.. allows us
1125
+ // to keep our callback private.
1126
+ observe.valuesFrom(this.tabs.animationDone).subscribe(function () { return _this.onAnimationFinished(); });
1127
+ };
1128
+ ActivityContainerComponent.prototype.initialise = function (identifier, api) {
1129
+ pectin.assert.isFalsey(this.isInitialised());
1130
+ pectin.assert.notNil(identifier);
1131
+ pectin.assert.notNil(api);
1132
+ this._identifier = identifier;
1133
+ this.interactionServiceApi = api;
1134
+ };
1135
+ Object.defineProperty(ActivityContainerComponent.prototype, "identifier", {
1136
+ get: function () {
1137
+ return this._identifier;
1138
+ },
1139
+ enumerable: true,
1140
+ configurable: true
1141
+ });
1142
+ ActivityContainerComponent.prototype.isInitialised = function () {
1143
+ return !!this.identifier;
1144
+ };
1145
+ /**
1146
+ * Returns true if an activity is currently running.
1147
+ */
1148
+ ActivityContainerComponent.prototype.isActive = function () {
1149
+ return this.getActiveActivityCount() > 0;
1150
+ };
1151
+ ActivityContainerComponent.prototype.registerDisposable = function (disposable) {
1152
+ return this.garbage.registerDisposable(disposable);
1153
+ };
1154
+ ActivityContainerComponent.prototype.dispose = function () {
1155
+ // TODO: think about auto cancelling any outstanding activity on dispose.
1156
+ // See NavigationState.Navigating for a use-case.
1157
+ pectin.assert.isFalsey(this.isActive());
1158
+ this.garbage.dispose();
1159
+ };
1160
+ ActivityContainerComponent.prototype.getActiveActivityRef = function () {
1161
+ if (!this.isActive()) {
1162
+ typescriptUtilities.lang.illegalState('no activity in progress');
1163
+ }
1164
+ return ___default__default.findLast(this.activityTabs, function (tab) { return !tab.isComplete(); });
1165
+ };
1166
+ /**
1167
+ * Cancels the current activity and returns true the context is no longer active, false if
1168
+ * there is still another activity running.
1169
+ */
1170
+ // @Trace()
1171
+ ActivityContainerComponent.prototype.cancelActiveActivity = function () {
1172
+ return __awaiter(this, void 0, void 0, function () {
1173
+ var activity;
1174
+ return __generator(this, function (_a) {
1175
+ activity = this.getActiveActivityRef();
1176
+ activity.cancel();
1177
+ if (this.isCleaningUp()) {
1178
+ return [2 /*return*/, this.waitForInteractionContextCleanupToFinish()];
1179
+ }
1180
+ else {
1181
+ return [2 /*return*/, !this.isActive()];
1182
+ }
1183
+ return [2 /*return*/];
1184
+ });
1185
+ });
1186
+ };
1187
+ // TODO: this handling of multiple nested activities is only used by the activity component and is not a general case.
1188
+ // @Trace()
1189
+ ActivityContainerComponent.prototype.createAndLaunchActivity = function (activityType, data, disableClose) {
1190
+ var _this = this;
1191
+ pectin.assert.isTruthy(this.isInitialised()); // make sure we've been initialised
1192
+ var activityRef = new ActivityRef(activityType, data, function () {
1193
+ var activeActivityCount = _this.getActiveActivityCount() > 0;
1194
+ if (activeActivityCount) {
1195
+ _this.triggerTabSynchronisation();
1196
+ }
1197
+ else {
1198
+ _this.finishAndStartCleanup();
1199
+ }
1200
+ });
1201
+ this.launchActivity(activityRef);
1202
+ // if this is the first activity let the interaction service know.
1203
+ if (this.activityTabs.length === 1) {
1204
+ // console.log('Now active!!!');
1205
+ this.interactionServiceApi.notifyActive(this);
1206
+ }
1207
+ return activityRef.activityResult;
1208
+ };
1209
+ ActivityContainerComponent.prototype.getActiveActivityCount = function () {
1210
+ return this.activityTabs.filter(function (ref) { return !ref.isComplete(); }).length;
1211
+ };
1212
+ /**
1213
+ * Checks if this interaction context has finished an is in the process of waiting
1214
+ * for all the infrastructure (including route updates) to be completed.
1215
+ */
1216
+ ActivityContainerComponent.prototype.isCleaningUp = function () {
1217
+ return !!this._deferredCleanUp;
1218
+ };
1219
+ ActivityContainerComponent.prototype.waitForInteractionContextCleanupToFinish = function () {
1220
+ return __awaiter(this, void 0, void 0, function () {
1221
+ return __generator(this, function (_a) {
1222
+ return [2 /*return*/, this._deferredCleanUp ?
1223
+ this._deferredCleanUp :
1224
+ true];
1225
+ });
1226
+ });
1227
+ };
1228
+ // @Trace()
1229
+ ActivityContainerComponent.prototype.finishAndStartCleanup = function () {
1230
+ var _this = this;
1231
+ if (!this._deferredCleanUp) {
1232
+ // Important:
1233
+ // Clear our tabs so the next activity triggers a tab change.
1234
+ // Without this our animation done wasn't called when a single
1235
+ // new activity followed a single tab activity (since we're tracking
1236
+ // by activity index)
1237
+ this.activityTabs = [];
1238
+ var promise = this.interactionServiceApi.notifyFinished(this);
1239
+ this._deferredCleanUp = promise
1240
+ .finally(function () {
1241
+ _this._deferredCleanUp = null;
1242
+ });
1243
+ }
1244
+ };
1245
+ // @Trace()
1246
+ ActivityContainerComponent.prototype.launchActivity = function (activityRef) {
1247
+ var cleanedTabs = this.activityTabs.filter(function (tab) { return !tab.isComplete(); });
1248
+ this.activityTabs = cleanedTabs.concat(activityRef);
1249
+ this.synchroniseSelectedTabIndex();
1250
+ };
1251
+ ActivityContainerComponent.prototype.activityIndex = function (index, activityRef) {
1252
+ return index;
1253
+ };
1254
+ ;
1255
+ ActivityContainerComponent.prototype.onAnimationFinished = function () {
1256
+ if (this.onAnimationFinishedJob) {
1257
+ this.onAnimationFinishedJob();
1258
+ this.onAnimationFinishedJob = undefined;
1259
+ }
1260
+ };
1261
+ /**
1262
+ * Synchronises the selected tab index.
1263
+ */
1264
+ ActivityContainerComponent.prototype.synchroniseSelectedTabIndex = function () {
1265
+ var _this = this;
1266
+ var previousIndex = this.tabs.selectedIndex;
1267
+ var newIndex = this.getActiveActivityCount() - 1;
1268
+ if (previousIndex !== newIndex) {
1269
+ this.tabs.selectedIndex = newIndex;
1270
+ this.onAnimationFinishedJob = function () {
1271
+ _this.getSelectedOutlet().component.onActivityReady();
1272
+ _this.activityTabs = _this.activityTabs.filter(function (tab) { return !tab.isComplete(); });
1273
+ };
1274
+ }
1275
+ };
1276
+ ActivityContainerComponent.prototype.getSelectedOutlet = function () {
1277
+ return this.activityOutlets.toArray()[this.tabs.selectedIndex];
1278
+ };
1279
+ // @Trace()
1280
+ ActivityContainerComponent.prototype.triggerTabSynchronisation = function () {
1281
+ var _this = this;
1282
+ if (this.syncSelectedTabTimeout) {
1283
+ clearTimeout(this.syncSelectedTabTimeout);
1284
+ }
1285
+ this.syncSelectedTabTimeout = setTimeout(function () {
1286
+ _this.syncSelectedTabTimeout = null;
1287
+ _this.synchroniseSelectedTabIndex();
1288
+ }, 75);
1289
+ };
1290
+ __decorate([
1291
+ core.Input(),
1292
+ __metadata("design:type", Object)
1293
+ ], ActivityContainerComponent.prototype, "dynamicHeight", void 0);
1294
+ __decorate([
1295
+ core.ViewChild('tabs', { static: true }),
1296
+ __metadata("design:type", tabs.MatTabGroup)
1297
+ ], ActivityContainerComponent.prototype, "tabs", void 0);
1298
+ __decorate([
1299
+ core.ViewChildren(ActivityOutletComponent),
1300
+ __metadata("design:type", core.QueryList)
1301
+ ], ActivityContainerComponent.prototype, "activityOutlets", void 0);
1302
+ __decorate([
1303
+ pectin.Trace(),
1304
+ __metadata("design:type", Function),
1305
+ __metadata("design:paramtypes", []),
1306
+ __metadata("design:returntype", void 0)
1307
+ ], ActivityContainerComponent.prototype, "dispose", null);
1308
+ ActivityContainerComponent = __decorate([
1309
+ core.Component({
1310
+ selector: 'aup-activity-container',
1311
+ template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\">\n <mat-tab *ngFor=\"let tab of activityTabs; trackBy: activityIndex\" >\n <aup-activity-outlet [nestedInteractionContext]=\"this\" [activityRef]=\"tab\"></aup-activity-outlet>\n </mat-tab>\n</mat-tab-group>\n",
1312
+ styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
1313
+ }),
1314
+ __metadata("design:paramtypes", [])
1315
+ ], ActivityContainerComponent);
1316
+ return ActivityContainerComponent;
1317
+ }(AbstractInteractionContext));
1318
+
1319
+ var AddItemInteractionContextComponent = /** @class */ (function (_super) {
1320
+ __extends(AddItemInteractionContextComponent, _super);
1321
+ function AddItemInteractionContextComponent() {
1322
+ var _this = _super.call(this) || this;
1323
+ _this.tabindex = 0;
1324
+ _this.clickCommand = pectin.Command.create(function (context) {
1325
+ if (_this.activityClass) {
1326
+ _this.startActivity(_this.activityClass, _this.activityData).catch(function (e) {
1327
+ // don't care.
1328
+ });
1329
+ }
1330
+ else {
1331
+ _this.addCommand.withContext(context).execute();
1332
+ }
1333
+ });
1334
+ return _this;
1335
+ }
1336
+ Object.defineProperty(AddItemInteractionContextComponent.prototype, "active", {
1337
+ get: function () {
1338
+ return this.interactionContext ? this.interactionContext.isActive() : false;
1339
+ },
1340
+ enumerable: true,
1341
+ configurable: true
1342
+ });
1343
+ AddItemInteractionContextComponent.prototype.startActivity = function (activityType, data) {
1344
+ return this.interactionContext.startActivity(activityType, data);
1345
+ };
1346
+ AddItemInteractionContextComponent.prototype.ngOnInit = function () {
1347
+ };
1348
+ __decorate([
1349
+ core.Input(),
1350
+ __metadata("design:type", String)
1351
+ ], AddItemInteractionContextComponent.prototype, "label", void 0);
1352
+ __decorate([
1353
+ core.Input(),
1354
+ __metadata("design:type", Object)
1355
+ ], AddItemInteractionContextComponent.prototype, "activityClass", void 0);
918
1356
  __decorate([
919
1357
  core.Input(),
920
1358
  __metadata("design:type", Object)
921
- ], SelectInputComponent.prototype, "optionLabel", void 0);
1359
+ ], AddItemInteractionContextComponent.prototype, "activityData", void 0);
922
1360
  __decorate([
923
1361
  core.Input(),
924
- __metadata("design:type", Boolean)
925
- ], SelectInputComponent.prototype, "allowNil", void 0);
1362
+ pectin.TrackExternal(),
1363
+ __metadata("design:type", pectin.Command)
1364
+ ], AddItemInteractionContextComponent.prototype, "addCommand", void 0);
926
1365
  __decorate([
927
- core.ContentChild("optionTemplate"),
928
- __metadata("design:type", core.TemplateRef)
929
- ], SelectInputComponent.prototype, "optionTemplateRef", void 0);
1366
+ core.ViewChild(InPlaceInteractionContextComponent),
1367
+ __metadata("design:type", InPlaceInteractionContextComponent)
1368
+ ], AddItemInteractionContextComponent.prototype, "interactionContext", void 0);
930
1369
  __decorate([
931
- core.ContentChild("nilOptionTemplate"),
932
- __metadata("design:type", core.TemplateRef)
933
- ], SelectInputComponent.prototype, "nilOptionTemplateRef", void 0);
1370
+ core.HostBinding('class.interaction-active'),
1371
+ __metadata("design:type", Boolean),
1372
+ __metadata("design:paramtypes", [])
1373
+ ], AddItemInteractionContextComponent.prototype, "active", null);
934
1374
  __decorate([
935
- core.Input(),
936
- __metadata("design:type", Function)
937
- ], SelectInputComponent.prototype, "optionLabelFormat", void 0);
938
- SelectInputComponent = __decorate([
1375
+ core.HostBinding('tabindex'),
1376
+ __metadata("design:type", Object)
1377
+ ], AddItemInteractionContextComponent.prototype, "tabindex", void 0);
1378
+ AddItemInteractionContextComponent = __decorate([
939
1379
  core.Component({
940
- selector: 'aup-select-input',
941
- template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"delegatingFormValueModel.focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-option *ngIf=\"allowNil\">{{placeholder}}</mat-option>\n <mat-option *ngFor=\"let option of optionsModel.value; let i = index\" [value]=\"option\">\n <ng-container *ngIf=\"!optionTemplateRef\">{{optionLabelFormat(option)}}</ng-container>\n <ng-container *ngIf=\"optionTemplateRef\"\n [ngTemplateOutlet]=\"optionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: i }\"\n >\n </ng-container>\n </mat-option>\n </mat-select>\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
942
- styles: [":host{display:inline-block}mat-form-field{width:100%}"]
1380
+ selector: 'aup-add-item-interaction-context',
1381
+ template: "<aup-in-place-interaction-context #interactionContext [animateFirstActivity]=\"false\">\n <a part=\"link\" class=\"link\" [pectinCommand]=\"clickCommand\"><mat-icon>add</mat-icon> {{label}}</a>\n</aup-in-place-interaction-context>\n",
1382
+ styles: [":host{--def-link-color:var(--link-color, currentColor);--def-link-backgound:var(--link-background, rgba(0, 0, 0, 0.05));--def-link-border-radius:var(--link-border-radius, 4px);--def-link-padding:var(--link-padding, calc(var(--aup-default-padding) / 2));display:flex;flex-direction:column;border-radius:var(--def-link-border-radius);box-sizing:border-box;outline:0}:host:hover{--link-background:rgba(0,0,0,0.1)}aup-in-place-interaction-context{border-radius:var(--def-link-border-radius)}a.link{display:flex;flex-direction:row;align-items:center;border-radius:var(--def-link-border-radius);color:var(--def-link-color);background:var(--def-link-backgound);padding:var(--def-link-padding);cursor:pointer;text-decoration:none}a.link mat-icon{margin-right:8px}"]
943
1383
  }),
944
1384
  __metadata("design:paramtypes", [])
945
- ], SelectInputComponent);
946
- return SelectInputComponent;
947
- }(AbstractInputComponent));
1385
+ ], AddItemInteractionContextComponent);
1386
+ return AddItemInteractionContextComponent;
1387
+ }(DisposableComponent));
948
1388
 
949
- var StringInputComponent = /** @class */ (function (_super) {
950
- __extends(StringInputComponent, _super);
951
- function StringInputComponent() {
952
- var _this = _super.call(this) || this;
953
- var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
954
- _this.clearCommand = pectin.Command.create(function () {
955
- _this.valueModel.value = null;
956
- });
957
- _this.clearCommand.disableWhile(chain.stringValue(_this.valueModel).isBlank());
958
- return _this;
1389
+ var InteractionServiceRoutingAdapter = /** @class */ (function () {
1390
+ function InteractionServiceRoutingAdapter(activeInteractionContextIds, activeModalContext, createExclusiveInteractionContext) {
1391
+ this.activeInteractionContextIds = activeInteractionContextIds;
1392
+ this.activeModalContext = activeModalContext;
1393
+ this.createExclusiveInteractionContext = createExclusiveInteractionContext;
959
1394
  }
960
- StringInputComponent.prototype.ngOnInit = function () {
1395
+ InteractionServiceRoutingAdapter.prototype.isActive = function () {
1396
+ return this.getActiveInteractionContextIds().length > 0;
961
1397
  };
962
- __decorate([
963
- core.Input(), pectin.TrackExternal({ delegateTo: 'delegatingFormValueModel' }),
964
- __metadata("design:type", Object)
965
- ], StringInputComponent.prototype, "valueModel", void 0);
966
- __decorate([
967
- core.Input(), pectin.TrackExternal({ defaultValue: false }),
968
- __metadata("design:type", pectin.ValueModel)
969
- ], StringInputComponent.prototype, "enableClearModel", void 0);
970
- __decorate([
971
- core.Input(), pectin.StoreInValueModel('enableClearModel'),
972
- __metadata("design:type", Boolean)
973
- ], StringInputComponent.prototype, "enableClear", void 0);
974
- StringInputComponent = __decorate([
975
- core.Component({
976
- selector: 'aup-string-input',
977
- template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"delegatingFormValueModel.focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n <button mat-button mat-icon-button matSuffix *ngIf=\"enableClear\" [pectinCommand]=\"clearCommand\">\n <mat-icon>close</mat-icon>\n </button>\n</mat-form-field>\n\n",
978
- styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}button[disabled]{visibility:hidden}"]
1398
+ InteractionServiceRoutingAdapter.prototype.isModalActive = function () {
1399
+ return !!this.activeModalContext.value;
1400
+ };
1401
+ // @Trace()
1402
+ InteractionServiceRoutingAdapter.prototype.isComponentInteracting = function (component) {
1403
+ return component.interactionContext && component.interactionContext.isActive();
1404
+ };
1405
+ InteractionServiceRoutingAdapter.prototype.getActiveInteractionContextIds = function () {
1406
+ return this.activeInteractionContextIds.value;
1407
+ };
1408
+ // @Trace()
1409
+ InteractionServiceRoutingAdapter.prototype.cancelCurrentModalInteraction = function () {
1410
+ return this.activeModalContext.value.cancelActiveActivity();
1411
+ };
1412
+ // @Trace()
1413
+ InteractionServiceRoutingAdapter.prototype.cancelComponentInteraction = function (component) {
1414
+ return component.interactionContext.cancelActiveActivity();
1415
+ };
1416
+ return InteractionServiceRoutingAdapter;
1417
+ }());
1418
+
1419
+ var ModalInteractionContextFactory = /** @class */ (function () {
1420
+ function ModalInteractionContextFactory() {
1421
+ }
1422
+ return ModalInteractionContextFactory;
1423
+ }());
1424
+
1425
+ var inplaceMonitorCount = 0;
1426
+ exports.ɵbw = /** @class */ (function () {
1427
+ function InteractionService(modelInteractionContextFactory) {
1428
+ this.modelInteractionContextFactory = modelInteractionContextFactory;
1429
+ this.garbage = new pectin.GarbageCollector();
1430
+ // private readonly _activeModalContext = new MutableValueModel<InteractionContext>();
1431
+ // private readonly _activeInlineContext = new MutableValueModel<InteractionContext>();
1432
+ // private readonly _activeContext: ValueModelChain<InteractionContext>;
1433
+ this._navigationInProgress = new pectin.DelegatingValueModel().withDefault(false);
1434
+ var _a = pectin.Dsl.disposeWith(this.garbage), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1435
+ this.exclusiveInteractionRegistry = new InteractionService_1.ContextRegistry();
1436
+ this.modalInteractionRegistry = new InteractionService_1.ContextRegistry();
1437
+ this.inPlaceInteractionRegistry = new InteractionService_1.ContextRegistry();
1438
+ this.modalInteractionRegistry.disableWhen(valueOf.any(this.exclusiveInteractionRegistry.active, this.modalInteractionRegistry.active).areTruthy());
1439
+ this.inPlaceInteractionRegistry.disableWhen(valueOf.any(this.exclusiveInteractionRegistry.active, this.modalInteractionRegistry.active, this.inPlaceInteractionRegistry.active).areTruthy());
1440
+ this.active = valueOf.any(this.inPlaceInteractionRegistry.active, this.modalInteractionRegistry.active).areTruthy();
1441
+ // TODO: chain.concat(listOrValueModels) would be nice.
1442
+ this.activeInteractionContextIds = chain(this.inPlaceInteractionRegistry.interactionContextIds)
1443
+ .concat(this.modalInteractionRegistry.interactionContextIds);
1444
+ this.activeModalContext = chain(this.modalInteractionRegistry.interactionContexts).first();
1445
+ this.inModalInteraction = chain(this.activeModalContext).isNotNil();
1446
+ }
1447
+ InteractionService_1 = InteractionService;
1448
+ InteractionService.prototype.isActive = function () {
1449
+ return this.active.value;
1450
+ };
1451
+ /**
1452
+ * @deprecated use #createModalInteractionContextDisposedWith instead.
1453
+ * @param disposable
1454
+ */
1455
+ InteractionService.prototype.createModalInteractionContextFor = function (disposable) {
1456
+ return this.createModalInteractionContextDisposedWith(disposable);
1457
+ };
1458
+ /**
1459
+ * Creates a new model interaction context that will be disposed along with the component.
1460
+ * @param disposable
1461
+ */
1462
+ InteractionService.prototype.createModalInteractionContextDisposedWith = function (disposable) {
1463
+ // TODO: look at making the registry the factory..
1464
+ return this.modelInteractionContextFactory.createInteractionContext('modal', new InteractionService_1.ApiAdapter(this.placeRouter, this.modalInteractionRegistry));
1465
+ };
1466
+ InteractionService.prototype.registerInplaceInteractionContext = function (interactionContext) {
1467
+ // TODO: look at making the registry the factory..
1468
+ // Todo: check for double registration.
1469
+ // Todo: allow multiple inplace interactions..
1470
+ interactionContext.initialise("ip" + ++inplaceMonitorCount, new InteractionService_1.ApiAdapter(this.placeRouter, this.inPlaceInteractionRegistry));
1471
+ };
1472
+ /**
1473
+ * Creates an interaction context that will prevent any other contexts from starting an
1474
+ * activity until it is disposed. This is intended for use by the router for passing
1475
+ * to PlaceComponent.canDeactivate(interactionContext). This ensures components don't
1476
+ * try and interact in a way that we can't track and synchronise with the browser back
1477
+ * button.
1478
+ */
1479
+ InteractionService.prototype.registerPlaceRouter = function (router) {
1480
+ var _this = this;
1481
+ typescriptUtilities.assert.isFalsey(this.placeRouter);
1482
+ this.placeRouter = router;
1483
+ this._navigationInProgress.setDelegate(this.placeRouter.navigationInProgress);
1484
+ var self = this;
1485
+ return new InteractionServiceRoutingAdapter(this.activeInteractionContextIds, this.activeModalContext, function () {
1486
+ return self.modelInteractionContextFactory.createInteractionContext('exclusive', new InteractionService_1.ApiAdapter(_this.placeRouter, _this.exclusiveInteractionRegistry));
1487
+ });
1488
+ };
1489
+ var InteractionService_1;
1490
+ InteractionService.ctorParameters = function () { return [
1491
+ { type: ModalInteractionContextFactory }
1492
+ ]; };
1493
+ InteractionService.ɵprov = core.ɵɵdefineInjectable({ factory: function InteractionService_Factory() { return new InteractionService(core.ɵɵinject(ModalInteractionContextFactory)); }, token: InteractionService, providedIn: "root" });
1494
+ InteractionService = InteractionService_1 = __decorate([
1495
+ core.Injectable({
1496
+ providedIn: 'root'
979
1497
  }),
980
- __metadata("design:paramtypes", [])
981
- ], StringInputComponent);
982
- return StringInputComponent;
983
- }(AbstractInputComponent));
1498
+ __metadata("design:paramtypes", [ModalInteractionContextFactory])
1499
+ ], InteractionService);
1500
+ return InteractionService;
1501
+ }());
1502
+ (function (InteractionService) {
1503
+ /**
1504
+ * Provides a mechanism for the service to keep track of what the API adapters are doing to
1505
+ * ensure the rules are followed, i.e. modal or in-place interaction aren't started while
1506
+ * an exclusive routing interaction is active.
1507
+ */
1508
+ var ContextRegistry = /** @class */ (function (_super) {
1509
+ __extends(ContextRegistry, _super);
1510
+ function ContextRegistry() {
1511
+ var _this = _super.call(this) || this;
1512
+ _this._interactions = new pectin.MutableListModel();
1513
+ _this._disabledDelegate = new pectin.DelegatingValueModel().withDefault(false);
1514
+ var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1515
+ _this.active = chain(_this._interactions).isNotEmpty();
1516
+ _this.interactionContextIds = chain(_this._interactions).pluck("identifier");
1517
+ return _this;
1518
+ }
1519
+ Object.defineProperty(ContextRegistry.prototype, "interactionContexts", {
1520
+ get: function () {
1521
+ return this._interactions.readonly;
1522
+ },
1523
+ enumerable: true,
1524
+ configurable: true
1525
+ });
1526
+ ContextRegistry.prototype.start = function (context) {
1527
+ this._interactions.push(context);
1528
+ };
1529
+ ContextRegistry.prototype.finish = function (context) {
1530
+ this._interactions.remove(context);
1531
+ };
1532
+ ContextRegistry.prototype.isActive = function () {
1533
+ return this.active.value;
1534
+ };
1535
+ ContextRegistry.prototype.disableWhen = function (disabled) {
1536
+ this._disabledDelegate.setDelegate(disabled);
1537
+ };
1538
+ return ContextRegistry;
1539
+ }(pectin.GarbageCollector));
1540
+ InteractionService.ContextRegistry = ContextRegistry;
1541
+ var ApiAdapter = /** @class */ (function () {
1542
+ function ApiAdapter(placeRouter, contextRegistry) {
1543
+ this.placeRouter = placeRouter;
1544
+ this.contextRegistry = contextRegistry;
1545
+ }
1546
+ // @Trace()
1547
+ ApiAdapter.prototype.notifyActive = function (context) {
1548
+ typescriptUtilities.assert.isTruthy(context.identifier);
1549
+ this.contextRegistry.start(context);
1550
+ return this.isNavigationInProgress() ? Promise.resolve() : this.placeRouter.syncInteractionContextIdsWithRouter();
1551
+ };
1552
+ // @Trace()
1553
+ ApiAdapter.prototype.isNavigationInProgress = function () {
1554
+ return this.placeRouter.navigationInProgress.value;
1555
+ };
1556
+ // @Trace()
1557
+ ApiAdapter.prototype.notifyFinished = function (context) {
1558
+ this.contextRegistry.finish(context);
1559
+ // :: Important ::
1560
+ // This method will be traversed by both the place router (during can canDeactivate guards) and user land code
1561
+ // (both when routing is idle and while it is active in PlaceComponent.canDeactivate()).
1562
+ // The result of pushInteractionIdsToRoute will not start until after the current route finishes, and the
1563
+ // current route won't finish until after this promise returns... Deadlock.
1564
+ // So in order to keep this logic out of the activities we perform the check here and ensure that
1565
+ // any interactions with the context while routing is active returns immediately.
1566
+ return this.isNavigationInProgress() ? Promise.resolve() : this.placeRouter.syncInteractionContextIdsWithRouter();
1567
+ };
1568
+ return ApiAdapter;
1569
+ }());
1570
+ InteractionService.ApiAdapter = ApiAdapter;
1571
+ })(exports.ɵbw || (exports.ɵbw = {}));
984
1572
 
985
- var TextInputComponent = /** @class */ (function (_super) {
986
- __extends(TextInputComponent, _super);
987
- function TextInputComponent() {
1573
+ var InPlaceInteractionContextComponent = /** @class */ (function (_super) {
1574
+ __extends(InPlaceInteractionContextComponent, _super);
1575
+ function InPlaceInteractionContextComponent(interactionService, tabConfig) {
988
1576
  var _this = _super.call(this) || this;
989
- _this.rows = 2;
1577
+ _this.interactionService = interactionService;
1578
+ _this.tabConfig = tabConfig;
1579
+ /**
1580
+ * If true then the first startActivity call will slide the activity into view. If false
1581
+ * the activity will replace the existing content immediately.
1582
+ */
1583
+ _this.animateFirstActivity = true;
990
1584
  return _this;
991
- // const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
992
1585
  }
993
- TextInputComponent.prototype.ngOnInit = function () {
1586
+ Object.defineProperty(InPlaceInteractionContextComponent.prototype, "animationDuration", {
1587
+ get: function () {
1588
+ var _a;
1589
+ return this.animateFirstActivity ? (((_a = this.tabConfig) === null || _a === void 0 ? void 0 : _a.animationDuration) || '500ms') : "0ms";
1590
+ },
1591
+ enumerable: true,
1592
+ configurable: true
1593
+ });
1594
+ InPlaceInteractionContextComponent.prototype.ngAfterViewInit = function () {
1595
+ this.interactionService.registerInplaceInteractionContext(this);
994
1596
  };
995
- __decorate([
996
- core.Input(), pectin.TrackExternal({ delegateTo: 'delegatingFormValueModel' }),
997
- __metadata("design:type", Object)
998
- ], TextInputComponent.prototype, "valueModel", void 0);
999
- __decorate([
1000
- core.Input(),
1001
- __metadata("design:type", Object)
1002
- ], TextInputComponent.prototype, "rows", void 0);
1003
- __decorate([
1004
- core.Input(),
1005
- __metadata("design:type", Number)
1006
- ], TextInputComponent.prototype, "cols", void 0);
1007
- TextInputComponent = __decorate([
1008
- core.Component({
1009
- selector: 'aup-text-input',
1010
- template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <textarea matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"delegatingFormValueModel.focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n [rows]=\"rows\"\n [cols]=\"cols\"\n >\n </textarea>\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n\n",
1011
- styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}button[disabled]{visibility:hidden}textarea{overflow:auto}"]
1012
- }),
1013
- __metadata("design:paramtypes", [])
1014
- ], TextInputComponent);
1015
- return TextInputComponent;
1016
- }(AbstractInputComponent));
1017
-
1018
- var NoopComponent = /** @class */ (function () {
1019
- function NoopComponent() {
1020
- }
1021
- NoopComponent = __decorate([
1022
- core.Component({
1023
- selector: 'aup-noop',
1024
- template: "",
1025
- styles: [":host{display:block}"]
1026
- }),
1027
- __metadata("design:paramtypes", [])
1028
- ], NoopComponent);
1029
- return NoopComponent;
1030
- }());
1031
-
1032
- var ScrollContainerComponent = /** @class */ (function () {
1033
- function ScrollContainerComponent() {
1034
- }
1035
- ScrollContainerComponent.prototype.ngOnInit = function () {
1597
+ InPlaceInteractionContextComponent.prototype.initialise = function (id, api) {
1598
+ this.activityContainerComponent.initialise(id, api);
1036
1599
  };
1037
- ScrollContainerComponent = __decorate([
1038
- core.Component({
1039
- selector: 'aup-scroll-container',
1040
- template: "<div class=\"container\">\n <ng-content></ng-content>\n</div>\n",
1041
- styles: [":host{display:flex;flex-direction:column;min-height:0;align-items:stretch}.container{display:flex;flex-direction:column;flex:1;flex-basis:0;overflow-y:scroll;align-items:stretch}"]
1042
- }),
1043
- __metadata("design:paramtypes", [])
1044
- ], ScrollContainerComponent);
1045
- return ScrollContainerComponent;
1046
- }());
1047
-
1048
- var SwitchCaseOption = /** @class */ (function () {
1049
- function SwitchCaseOption(templateRef) {
1050
- this.templateRef = templateRef;
1051
- }
1052
- Object.defineProperty(SwitchCaseOption.prototype, "name", {
1600
+ Object.defineProperty(InPlaceInteractionContextComponent.prototype, "identifier", {
1053
1601
  get: function () {
1054
- return this.constructor.name;
1602
+ return this.activityContainerComponent.identifier;
1055
1603
  },
1056
1604
  enumerable: true,
1057
1605
  configurable: true
1058
1606
  });
1059
- return SwitchCaseOption;
1060
- }());
1061
- var SwitchCaseWhenDirective = /** @class */ (function (_super) {
1062
- __extends(SwitchCaseWhenDirective, _super);
1063
- function SwitchCaseWhenDirective(templateRef) {
1064
- var _this = _super.call(this, templateRef) || this;
1065
- _this.isDefault = false;
1066
- return _this;
1067
- }
1068
- SwitchCaseWhenDirective_1 = SwitchCaseWhenDirective;
1069
- SwitchCaseWhenDirective.prototype.matches = function (value) {
1070
- return this.aupSwitchCaseWhen === value;
1607
+ InPlaceInteractionContextComponent.prototype.alert = function (alert) {
1608
+ return this.activityContainerComponent.alert(alert);
1071
1609
  };
1072
- var SwitchCaseWhenDirective_1;
1073
- SwitchCaseWhenDirective.ctorParameters = function () { return [
1074
- { type: core.TemplateRef }
1610
+ InPlaceInteractionContextComponent.prototype.cancelActiveActivity = function () {
1611
+ return this.activityContainerComponent.cancelActiveActivity();
1612
+ };
1613
+ InPlaceInteractionContextComponent.prototype.confirm = function (confirm) {
1614
+ return this.activityContainerComponent.confirm(confirm);
1615
+ };
1616
+ InPlaceInteractionContextComponent.prototype.confirmOrReject = function (confirm) {
1617
+ return this.activityContainerComponent.confirmOrReject(confirm);
1618
+ };
1619
+ InPlaceInteractionContextComponent.prototype.confirmThen = function (confirm, activityType, data) {
1620
+ return this.activityContainerComponent.confirmThen(confirm, activityType);
1621
+ };
1622
+ InPlaceInteractionContextComponent.prototype.isActive = function () {
1623
+ return this.activityContainerComponent.isActive();
1624
+ };
1625
+ InPlaceInteractionContextComponent.prototype.startActivity = function (activityType, data) {
1626
+ return this.activityContainerComponent.startActivity(activityType, data);
1627
+ };
1628
+ InPlaceInteractionContextComponent.ctorParameters = function () { return [
1629
+ { type: exports.ɵbw },
1630
+ { type: undefined, decorators: [{ type: core.Inject, args: [tabs.MAT_TABS_CONFIG,] }, { type: core.Optional }] }
1075
1631
  ]; };
1632
+ __decorate([
1633
+ core.ViewChild('activityContainer', { static: true }),
1634
+ __metadata("design:type", ActivityContainerComponent)
1635
+ ], InPlaceInteractionContextComponent.prototype, "activityContainerComponent", void 0);
1076
1636
  __decorate([
1077
1637
  core.Input(),
1078
1638
  __metadata("design:type", Object)
1079
- ], SwitchCaseWhenDirective.prototype, "aupSwitchCaseWhen", void 0);
1080
- SwitchCaseWhenDirective = SwitchCaseWhenDirective_1 = __decorate([
1081
- core.Directive({
1082
- selector: '[aupSwitchCaseWhen]',
1083
- providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseWhenDirective_1 }]
1084
- }),
1085
- __metadata("design:paramtypes", [core.TemplateRef])
1086
- ], SwitchCaseWhenDirective);
1087
- return SwitchCaseWhenDirective;
1088
- }(SwitchCaseOption));
1089
- var SwitchCaseDefaultDirective = /** @class */ (function (_super) {
1090
- __extends(SwitchCaseDefaultDirective, _super);
1091
- function SwitchCaseDefaultDirective(templateRef) {
1092
- var _this = _super.call(this, templateRef) || this;
1093
- _this.isDefault = true;
1094
- return _this;
1095
- }
1096
- SwitchCaseDefaultDirective_1 = SwitchCaseDefaultDirective;
1097
- SwitchCaseDefaultDirective.prototype.matches = function (value) {
1098
- return false;
1099
- };
1100
- var SwitchCaseDefaultDirective_1;
1101
- SwitchCaseDefaultDirective.ctorParameters = function () { return [
1102
- { type: core.TemplateRef }
1103
- ]; };
1104
- SwitchCaseDefaultDirective = SwitchCaseDefaultDirective_1 = __decorate([
1105
- core.Directive({
1106
- selector: '[aupSwitchCaseDefault]',
1107
- providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseDefaultDirective_1 }]
1639
+ ], InPlaceInteractionContextComponent.prototype, "animateFirstActivity", void 0);
1640
+ InPlaceInteractionContextComponent = __decorate([
1641
+ core.Component({
1642
+ selector: 'aup-in-place-interaction-context',
1643
+ template: "<mat-tab-group no-tab-header [selectedIndex]=\"isActive() ? 1 : 0\" full-height-tabs [dynamicHeight]=\"false\" [animationDuration]=\"animationDuration\">\n <mat-tab>\n <ng-content></ng-content>\n </mat-tab>\n <mat-tab>\n <aup-activity-container #activityContainer [dynamicHeight]=\"false\"></aup-activity-container>\n </mat-tab>\n</mat-tab-group>\n\n",
1644
+ styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
1108
1645
  }),
1109
- __metadata("design:paramtypes", [core.TemplateRef])
1110
- ], SwitchCaseDefaultDirective);
1111
- return SwitchCaseDefaultDirective;
1112
- }(SwitchCaseOption));
1113
- var SwitchCaseComponent = /** @class */ (function (_super) {
1114
- __extends(SwitchCaseComponent, _super);
1115
- function SwitchCaseComponent(cdr) {
1646
+ __param(1, core.Inject(tabs.MAT_TABS_CONFIG)), __param(1, core.Optional()),
1647
+ __metadata("design:paramtypes", [exports.ɵbw, Object])
1648
+ ], InPlaceInteractionContextComponent);
1649
+ return InPlaceInteractionContextComponent;
1650
+ }(DisposableComponent));
1651
+
1652
+ var PopupInteractionContextComponent = /** @class */ (function (_super) {
1653
+ __extends(PopupInteractionContextComponent, _super);
1654
+ function PopupInteractionContextComponent(_element, _overlay) {
1116
1655
  var _this = _super.call(this) || this;
1117
- _this.cdr = cdr;
1118
- _this.selectedIndex = 0;
1656
+ _this._element = _element;
1657
+ _this._overlay = _overlay;
1658
+ _this.outputPortal = new portal.ComponentPortal(InPlaceInteractionContextComponent);
1659
+ _this.anchorX = 'start';
1660
+ _this.anchorY = 'bottom';
1119
1661
  return _this;
1120
1662
  }
1121
- SwitchCaseComponent.prototype.ngOnInit = function () {
1122
- };
1123
- SwitchCaseComponent.prototype.ngAfterContentInit = function () {
1124
- var _this = this;
1125
- var subscription = this.switchCaseOptions.changes.subscribe(function (change) { return _this.updateSelection(); });
1126
- this.onDispose(function () { return subscription.unsubscribe(); });
1127
- var _a = pectin.Dsl.disposeWith(this), chain = _a.chain, when = _a.when;
1128
- when.valueOf(this.switchModel).changes(function () { return _this.updateSelection(); }, { initialValue: 'triggerChange' });
1129
- this.cdr.detectChanges();
1130
- };
1131
- SwitchCaseComponent.prototype.updateSelection = function () {
1663
+ Object.defineProperty(PopupInteractionContextComponent.prototype, "active", {
1664
+ get: function () {
1665
+ return this.isActive();
1666
+ },
1667
+ enumerable: true,
1668
+ configurable: true
1669
+ });
1670
+ PopupInteractionContextComponent.prototype.startActivity = function (activityType, data) {
1132
1671
  var _this = this;
1133
- var matchingIndicies = [];
1134
- this.switchCaseOptions.forEach(function (option, index) {
1135
- if (option.matches(_this.switchModel.value)) {
1136
- matchingIndicies.push(index);
1137
- }
1672
+ var overlayRef = this._overlay.create({
1673
+ hasBackdrop: false,
1674
+ panelClass: 'aup-popup-interaction-panel',
1675
+ positionStrategy: this._overlay.position()
1676
+ .flexibleConnectedTo(this._element)
1677
+ .withPositions(this.computePositions())
1678
+ .withGrowAfterOpen(true)
1138
1679
  });
1139
- if (matchingIndicies.length > 1) {
1140
- console.warn("found " + matchingIndicies.length + " matching case values, displaying the first.");
1141
- }
1142
- if (matchingIndicies.length === 0) {
1143
- this.switchCaseOptions.forEach(function (option, index) {
1144
- matchingIndicies.push(index);
1680
+ var componentRef = overlayRef.attach(this.outputPortal);
1681
+ this.interactionContext = componentRef.instance;
1682
+ return new Promise(function (resolve, reject) {
1683
+ // HACK: afterViewInit won't have been called yet. Need to add when.valueOf(interactionContext.ready).becomesTruthy(...)
1684
+ setTimeout(function () {
1685
+ _this.interactionContext.startActivity(activityType, data)
1686
+ .then(resolve)
1687
+ .catch(reject)
1688
+ .finally(function () { return overlayRef.dispose(); });
1145
1689
  });
1146
- if (matchingIndicies.length > 1) {
1147
- console.warn("found " + matchingIndicies.length + " default case values, displaying the first.");
1148
- }
1149
- }
1150
- if (matchingIndicies.length > 0) {
1151
- this.selectedIndex = matchingIndicies[0];
1152
- }
1153
- else {
1154
- console.warn("found no matching or default case values.");
1155
- this.selectedIndex = -1;
1156
- }
1690
+ });
1157
1691
  };
1158
- SwitchCaseComponent.ctorParameters = function () { return [
1159
- { type: core.ChangeDetectorRef }
1692
+ PopupInteractionContextComponent.prototype.computePositions = function () {
1693
+ var overlayX = this.anchorX === 'start' ? 'start' : 'end';
1694
+ var overlayY = this.anchorY === 'top' ? 'bottom' : 'top';
1695
+ return [
1696
+ { originX: this.anchorX, originY: this.anchorY, overlayX: overlayX, overlayY: overlayY }
1697
+ // TODO: compute some meaningful alternatives.
1698
+ // { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },
1699
+ // { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },
1700
+ // { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },
1701
+ // { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' }
1702
+ ];
1703
+ };
1704
+ PopupInteractionContextComponent.prototype.cancelActiveActivity = function () {
1705
+ return this.interactionContext.cancelActiveActivity();
1706
+ };
1707
+ PopupInteractionContextComponent.prototype.isActive = function () {
1708
+ return this.interactionContext && this.interactionContext.isActive();
1709
+ };
1710
+ PopupInteractionContextComponent.prototype.ngOnInit = function () {
1711
+ };
1712
+ PopupInteractionContextComponent.ctorParameters = function () { return [
1713
+ { type: core.ElementRef },
1714
+ { type: overlay.Overlay }
1160
1715
  ]; };
1161
1716
  __decorate([
1162
- core.Input(), pectin.TrackExternal(),
1163
- __metadata("design:type", pectin.ValueModel)
1164
- ], SwitchCaseComponent.prototype, "switchModel", void 0);
1717
+ core.HostBinding('class.interaction-active'),
1718
+ __metadata("design:type", Boolean),
1719
+ __metadata("design:paramtypes", [])
1720
+ ], PopupInteractionContextComponent.prototype, "active", null);
1165
1721
  __decorate([
1166
- core.Input(), pectin.StoreInValueModel('switchModel'),
1167
- __metadata("design:type", Object)
1168
- ], SwitchCaseComponent.prototype, "switch", void 0);
1722
+ core.Input(),
1723
+ __metadata("design:type", String)
1724
+ ], PopupInteractionContextComponent.prototype, "anchorX", void 0);
1169
1725
  __decorate([
1170
- core.ContentChildren(SwitchCaseOption),
1171
- __metadata("design:type", core.QueryList)
1172
- ], SwitchCaseComponent.prototype, "switchCaseOptions", void 0);
1173
- SwitchCaseComponent = __decorate([
1726
+ core.Input(),
1727
+ __metadata("design:type", String)
1728
+ ], PopupInteractionContextComponent.prototype, "anchorY", void 0);
1729
+ PopupInteractionContextComponent = __decorate([
1174
1730
  core.Component({
1175
- selector: 'aup-switch-case',
1176
- template: "<mat-tab-group class=\"content-wrapper\" no-tab-header full-height-tabs [selectedIndex]=\"selectedIndex\">\n <mat-tab *ngFor=\"let option of switchCaseOptions\">\n <ng-template [ngTemplateOutlet]=\"option.templateRef\"></ng-template>\n </mat-tab>\n</mat-tab-group>\n\n\n",
1177
- styles: [":host{display:flex;flex-direction:column;align-items:stretch}mat-tab-group{flex:1}"]
1731
+ selector: 'aup-popup-interaction-context',
1732
+ template: "<ng-content></ng-content>\n",
1733
+ styles: [":host{display:inline}:host.interaction-active{background:rgba(0,0,0,.05)}"]
1178
1734
  }),
1179
- __metadata("design:paramtypes", [core.ChangeDetectorRef])
1180
- ], SwitchCaseComponent);
1181
- return SwitchCaseComponent;
1735
+ __metadata("design:paramtypes", [core.ElementRef, overlay.Overlay])
1736
+ ], PopupInteractionContextComponent);
1737
+ return PopupInteractionContextComponent;
1182
1738
  }(DisposableComponent));
1183
1739
 
1184
- var VerticalFocusContainerComponent = /** @class */ (function (_super) {
1185
- __extends(VerticalFocusContainerComponent, _super);
1186
- function VerticalFocusContainerComponent(focusManager) {
1187
- var _this = _super.call(this, focusManager) || this;
1188
- _this.focusManager = focusManager;
1740
+ var InteractionContextTriggerFor = /** @class */ (function (_super) {
1741
+ __extends(InteractionContextTriggerFor, _super);
1742
+ function InteractionContextTriggerFor() {
1743
+ var _this = _super.call(this) || this;
1744
+ _this.activityDone = new core.EventEmitter();
1745
+ _this.activityCancelled = new core.EventEmitter();
1189
1746
  return _this;
1190
1747
  }
1191
- VerticalFocusContainerComponent.prototype.arrowLeft = function (event) {
1192
- if (this.leftArrowCommand.enabled.value) {
1193
- event.preventDefault();
1194
- event.stopPropagation();
1195
- this.leftArrowCommand.execute();
1748
+ InteractionContextTriggerFor.prototype.onEnter = function (event) {
1749
+ if (!this.aupInteractionContextTriggerFor.isActive()) {
1750
+ this.startActivity();
1751
+ }
1752
+ else {
1753
+ this.aupInteractionContextTriggerFor.cancelActiveActivity();
1196
1754
  }
1197
1755
  };
1198
- VerticalFocusContainerComponent.prototype.arrowRight = function (event) {
1199
- if (this.rightArrowCommand.enabled.value) {
1200
- event.preventDefault();
1201
- event.stopPropagation();
1202
- this.rightArrowCommand.execute();
1756
+ InteractionContextTriggerFor.prototype.onClick = function (event) {
1757
+ if (!this.aupInteractionContextTriggerFor.isActive()) {
1758
+ this.startActivity();
1759
+ }
1760
+ else {
1761
+ this.aupInteractionContextTriggerFor.cancelActiveActivity();
1203
1762
  }
1204
1763
  };
1205
- VerticalFocusContainerComponent.prototype.arrowDown = function (event) {
1206
- event.preventDefault();
1207
- event.stopPropagation();
1208
- this.focusManager.focusNext();
1209
- };
1210
- VerticalFocusContainerComponent.prototype.arrowUp = function (event) {
1211
- event.preventDefault();
1212
- event.stopPropagation();
1213
- this.focusManager.focusPrevious();
1764
+ InteractionContextTriggerFor.prototype.startActivity = function () {
1765
+ var _this = this;
1766
+ pectin.assert.isTruthy(this.aupInteractionContextTriggerFor);
1767
+ pectin.assert.isFalsey(this.aupInteractionContextTriggerFor.isActive());
1768
+ pectin.assert.isTruthy(this.activityClass);
1769
+ this.aupInteractionContextTriggerFor.startActivity(this.activityClass, this.activityData)
1770
+ .then(function (result) {
1771
+ _this.activityDone.emit(result);
1772
+ })
1773
+ .catch(function (error) {
1774
+ _this.activityCancelled.emit(error);
1775
+ });
1214
1776
  };
1215
- VerticalFocusContainerComponent.prototype.ngOnInit = function () {
1777
+ InteractionContextTriggerFor.prototype.prepareActivityData = function () {
1778
+ return ___default__default.isFunction(this.activityDataFactory()) ? this.activityDataFactory() : this.activityData;
1216
1779
  };
1217
- VerticalFocusContainerComponent.ctorParameters = function () { return [
1218
- { type: pectin.FocusManager, decorators: [{ type: core.Self }] }
1219
- ]; };
1220
1780
  __decorate([
1221
- core.Input('command.arrowRight'),
1222
- pectin.TrackExternal(),
1223
- __metadata("design:type", pectin.Command)
1224
- ], VerticalFocusContainerComponent.prototype, "rightArrowCommand", void 0);
1781
+ core.Input(),
1782
+ __metadata("design:type", Object)
1783
+ ], InteractionContextTriggerFor.prototype, "aupInteractionContextTriggerFor", void 0);
1225
1784
  __decorate([
1226
- core.Input('command.arrowLeft'),
1227
- pectin.TrackExternal(),
1228
- __metadata("design:type", pectin.Command)
1229
- ], VerticalFocusContainerComponent.prototype, "leftArrowCommand", void 0);
1785
+ core.Input(),
1786
+ __metadata("design:type", Object)
1787
+ ], InteractionContextTriggerFor.prototype, "activityClass", void 0);
1230
1788
  __decorate([
1231
- core.HostListener('keyup.arrowLeft', ['$event']),
1232
- __metadata("design:type", Function),
1233
- __metadata("design:paramtypes", [KeyboardEvent]),
1234
- __metadata("design:returntype", void 0)
1235
- ], VerticalFocusContainerComponent.prototype, "arrowLeft", null);
1789
+ core.Input(),
1790
+ __metadata("design:type", Object)
1791
+ ], InteractionContextTriggerFor.prototype, "activityData", void 0);
1236
1792
  __decorate([
1237
- core.HostListener('keyup.arrowRight', ['$event']),
1238
- __metadata("design:type", Function),
1239
- __metadata("design:paramtypes", [KeyboardEvent]),
1240
- __metadata("design:returntype", void 0)
1241
- ], VerticalFocusContainerComponent.prototype, "arrowRight", null);
1793
+ core.Input(),
1794
+ __metadata("design:type", Function)
1795
+ ], InteractionContextTriggerFor.prototype, "activityDataFactory", void 0);
1242
1796
  __decorate([
1243
- core.HostListener('keyup.arrowDown', ['$event']),
1797
+ core.Output(),
1798
+ __metadata("design:type", Object)
1799
+ ], InteractionContextTriggerFor.prototype, "activityDone", void 0);
1800
+ __decorate([
1801
+ core.Output(),
1802
+ __metadata("design:type", Object)
1803
+ ], InteractionContextTriggerFor.prototype, "activityCancelled", void 0);
1804
+ __decorate([
1805
+ core.HostListener('keyup.enter'),
1244
1806
  __metadata("design:type", Function),
1245
1807
  __metadata("design:paramtypes", [KeyboardEvent]),
1246
1808
  __metadata("design:returntype", void 0)
1247
- ], VerticalFocusContainerComponent.prototype, "arrowDown", null);
1809
+ ], InteractionContextTriggerFor.prototype, "onEnter", null);
1248
1810
  __decorate([
1249
- core.HostListener('keyup.arrowUp', ['$event']),
1811
+ core.HostListener('click'),
1250
1812
  __metadata("design:type", Function),
1251
- __metadata("design:paramtypes", [KeyboardEvent]),
1813
+ __metadata("design:paramtypes", [MouseEvent]),
1252
1814
  __metadata("design:returntype", void 0)
1253
- ], VerticalFocusContainerComponent.prototype, "arrowUp", null);
1254
- VerticalFocusContainerComponent = __decorate([
1255
- core.Component({
1256
- selector: 'aup-vertical-focus-container',
1257
- template: "<ng-content></ng-content>\n",
1258
- providers: [
1259
- { provide: pectin.FocusManager }
1260
- ],
1261
- styles: [":host{display:block}"]
1262
- }),
1263
- __param(0, core.Self()),
1264
- __metadata("design:paramtypes", [pectin.FocusManager])
1265
- ], VerticalFocusContainerComponent);
1266
- return VerticalFocusContainerComponent;
1267
- }(FocusContainerComponent));
1268
-
1269
- /**
1270
- * @example
1271
- * // CSS Vars
1272
- * aup-card-container {
1273
- * --card-gap: var(--card-gap, 16px);
1274
- * --card-width: var(--card-width, 300px);
1275
- * --card-height: var(--card-height, auto);
1276
- * --card-min-height: var(--card-min-height, auto);
1277
- * --card-background: var(--card-background, #fcfcfb);
1278
- * }
1279
- *
1280
- * // Content Templates:
1281
- * #addCardTemplate
1282
- * <ng-template #addCardTemplate>
1283
- * This is a new card template, it will the the size of the other cards.
1284
- * </nav-template>
1285
- *
1286
- */
1287
- var CardContainerComponent = /** @class */ (function (_super) {
1288
- __extends(CardContainerComponent, _super);
1289
- function CardContainerComponent() {
1290
- return _super.call(this) || this;
1291
- }
1292
- CardContainerComponent.prototype.ngOnInit = function () {
1293
- };
1294
- __decorate([
1295
- core.Input(),
1296
- pectin.TrackExternal(),
1297
- __metadata("design:type", pectin.Command)
1298
- ], CardContainerComponent.prototype, "addCardCommand", void 0);
1299
- __decorate([
1300
- core.ContentChild("addCardTemplate"),
1301
- __metadata("design:type", core.TemplateRef)
1302
- ], CardContainerComponent.prototype, "addCardTemplate", void 0);
1303
- CardContainerComponent = __decorate([
1304
- core.Component({
1305
- selector: 'aup-card-container',
1306
- template: "<div class=\"card-container\">\n <ng-content></ng-content>\n\n <div class=\"add-card-container\" *ngIf=\"addCardCommand.enabled.value\" [pectinCommand]=\"addCardCommand\">\n <mat-icon>add</mat-icon>\n </div>\n\n <div class=\"add-card-template\" *ngIf=\"addCardTemplate\">\n <ng-container [ngTemplateOutlet]=\"addCardTemplate\"></ng-container>\n </div>\n\n</div>\n",
1307
- styles: [":root{--aup-default-padding:var(--default-padding, 18px)}.dialog-interaction-context{max-width:95vw!important;max-height:95vh!important}.dialog-interaction-context mat-dialog-container{max-width:95vw!important;max-height:95vh!important;padding:0}[no-tab-header]>mat-tab-header{display:none}[full-height-tabs] .mat-tab-body-wrapper,mat-tab-group.full-height-tabs .mat-tab-body-wrapper{flex:1}[full-height-tabs] .mat-tab-body-wrapper .mat-tab-body-content,[full-height-tabs] .mat-tab-body-wrapper mat-tab-body,mat-tab-group.full-height-tabs .mat-tab-body-wrapper .mat-tab-body-content,mat-tab-group.full-height-tabs .mat-tab-body-wrapper mat-tab-body{display:flex;flex-direction:column;justify-content:stretch}.router-outlet-container>*{position:absolute;top:0;left:0;bottom:0;right:0}:host{--resolved-card-gap:var(--card-gap, 16px);--resolved-card-width:var(--card-width, 300px);--resolved-card-height:var(--card-height, auto);--resolved-card-min-height:var(--card-min-height, auto);--resolved-card-background:var(--card-background, #fcfcfb);flex:1;display:block;background:var(--resolved-card-background)}.card-container{display:-ms-grid;display:grid;grid-template-columns:repeat(auto-fill,var(--resolved-card-width));grid-template-rows:repeat(auto-fit,minmax(0,var(--resolved-card-height)));grid-gap:var(--resolved-card-gap);box-sizing:border-box;padding:var(--resolved-card-gap);min-height:calc(var(--resolved-card-height) + 2 * var(--resolved-card-gap));min-width:calc(var(--resolved-card-width) + 2 * var(--resolved-card-gap));width:calc((var(--resolved-card-width) + var(--resolved-card-gap)) * 2 + var(--grid-gap));max-width:100%}.add-card-container{width:var(--resolved-card-width);height:var(--resolved-card-height);min-height:var(--resolved-card-min-height);display:flex;flex-direction:column;align-items:center;justify-content:center;box-sizing:border-box;border:2px dashed rgba(0,0,0,.1);border-radius:6px;font-weight:300;cursor:pointer;color:rgba(0,0,0,.54);background-color:rgba(255,255,255,.8);transition:280ms cubic-bezier(.4,0,.2,1)}.add-card-container mat-icon{font-size:200%}.add-card-container:hover{transition:280ms cubic-bezier(.4,0,.2,1);border-color:transparent;background-color:#fff;color:rgba(0,0,0,.54)}.add-card-container:hover:hover{box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)}.add-card-template-container{width:var(--resolved-card-width);height:var(--resolved-card-height);display:flex;flex-direction:column;align-items:stretch;justify-content:stretch}"]
1815
+ ], InteractionContextTriggerFor.prototype, "onClick", null);
1816
+ InteractionContextTriggerFor = __decorate([
1817
+ core.Directive({
1818
+ selector: '[aupInteractionContextTriggerFor]'
1308
1819
  }),
1309
1820
  __metadata("design:paramtypes", [])
1310
- ], CardContainerComponent);
1311
- return CardContainerComponent;
1312
- }(DisposableComponent));
1313
-
1314
- var ComponentsModule = /** @class */ (function () {
1315
- function ComponentsModule() {
1316
- }
1317
- ComponentsModule = __decorate([
1318
- core.NgModule({
1319
- declarations: [
1320
- NumberInputComponent,
1321
- StringInputComponent,
1322
- TextInputComponent,
1323
- PasswordInputComponent,
1324
- SelectInputComponent,
1325
- CheckboxInputComponent,
1326
- ScrollContainerComponent,
1327
- NoopComponent,
1328
- AbstractInputComponent,
1329
- SwitchCaseComponent,
1330
- SwitchCaseWhenDirective,
1331
- SwitchCaseDefaultDirective,
1332
- FocusContainerComponent,
1333
- VerticalFocusContainerComponent,
1334
- FocusableComponent,
1335
- CardContainerComponent
1336
- ],
1337
- imports: [
1338
- common.CommonModule,
1339
- animations.BrowserAnimationsModule,
1340
- forms.FormsModule,
1341
- input.MatInputModule,
1342
- formField.MatFormFieldModule,
1343
- select.MatSelectModule,
1344
- tabs.MatTabsModule,
1345
- DirectivesModule,
1346
- icon.MatIconModule,
1347
- button.MatButtonModule,
1348
- checkbox.MatCheckboxModule
1349
- ],
1350
- exports: [
1351
- NumberInputComponent,
1352
- StringInputComponent,
1353
- TextInputComponent,
1354
- PasswordInputComponent,
1355
- CheckboxInputComponent,
1356
- SelectInputComponent,
1357
- ScrollContainerComponent,
1358
- NoopComponent,
1359
- SwitchCaseComponent,
1360
- SwitchCaseWhenDirective,
1361
- SwitchCaseDefaultDirective,
1362
- FocusContainerComponent,
1363
- VerticalFocusContainerComponent,
1364
- FocusableComponent,
1365
- CardContainerComponent
1366
- ],
1367
- providers: [
1368
- FocusBindingFactory
1369
- ]
1370
- })
1371
- ], ComponentsModule);
1372
- return ComponentsModule;
1373
- }());
1374
-
1375
- var Dimension = /** @class */ (function () {
1376
- function Dimension(width, height) {
1377
- this.width = width;
1378
- this.height = height;
1379
- }
1380
- return Dimension;
1381
- }());
1821
+ ], InteractionContextTriggerFor);
1822
+ return InteractionContextTriggerFor;
1823
+ }(pectin.GarbageCollector));
1382
1824
 
1383
- var Point = /** @class */ (function () {
1384
- function Point(x, y) {
1385
- this.x = x;
1386
- this.y = y;
1825
+ var DialogInteractionContext = /** @class */ (function (_super) {
1826
+ __extends(DialogInteractionContext, _super);
1827
+ function DialogInteractionContext(identifier, api, dialogService, config) {
1828
+ var _this = _super.call(this) || this;
1829
+ _this.identifier = identifier;
1830
+ _this.api = api;
1831
+ _this.dialogService = dialogService;
1832
+ _this.config = config;
1833
+ _this.garbage = new pectin.GarbageCollector();
1834
+ typescriptUtilities.assert.notNil(dialogService);
1835
+ return _this;
1387
1836
  }
1388
- Point.from = function (data) {
1389
- return new Point(data.x, data.y);
1837
+ DialogInteractionContext.prototype.cancelActiveActivity = function () {
1838
+ return this.activityContainer.cancelActiveActivity();
1390
1839
  };
1391
- Point.prototype.translate = function (x, y) {
1392
- return new Point(this.x + x, this.y + y);
1840
+ DialogInteractionContext.prototype.dispose = function () {
1841
+ if (this.isActive()) {
1842
+ pectin.lang.illegalState('Dispose called while active.');
1843
+ }
1844
+ this.garbage.dispose();
1845
+ };
1846
+ DialogInteractionContext.prototype.registerDisposable = function (disposable) {
1847
+ return this.garbage.registerDisposable(disposable);
1848
+ };
1849
+ DialogInteractionContext.prototype.isActive = function () {
1850
+ return !!this.activityContainer && this.activityContainer.isActive();
1851
+ };
1852
+ DialogInteractionContext.prototype.createAndLaunchActivity = function (activityType, data, disableClose) {
1853
+ var _this = this;
1854
+ typescriptUtilities.assert.isNil(this._currentActivityRef);
1855
+ var config = __assign(__assign({}, this.config), {
1856
+ disableClose: disableClose,
1857
+ panelClass: 'dialog-interaction-context'
1858
+ });
1859
+ var self = this;
1860
+ var matDialogRef = this.dialogService.open(ActivityContainerComponent, config);
1861
+ var activityContainer = this.activityContainer = matDialogRef.componentInstance;
1862
+ this.activityContainer.initialise(this.identifier, this.api);
1863
+ var activityResult = this.activityContainer.startActivity(activityType, data);
1864
+ activityResult.finally(function () { return matDialogRef.close(); });
1865
+ // we need to check if our onDone/onCancel methods above we called or if we were
1866
+ // closed by the user clicking the backdrop. If the later then we need to cancel our
1867
+ // activity.
1868
+ matDialogRef.afterClosed().subscribe(function (promiseAlreadyFinished) {
1869
+ if (activityContainer.isActive()) {
1870
+ activityContainer.cancelActiveActivity();
1871
+ }
1872
+ _this.activityContainer = null;
1873
+ });
1874
+ matDialogRef.updateSize();
1875
+ matDialogRef.afterOpened().subscribe(function (promiseAlreadyFinished) {
1876
+ matDialogRef.updateSize();
1877
+ });
1878
+ return activityResult;
1879
+ };
1880
+ return DialogInteractionContext;
1881
+ }(AbstractInteractionContext));
1882
+
1883
+ var DIALOG_INTERACTION_SERVICE_DEFAULTS = new core.InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
1884
+ var DialogInteractionContextFactory = /** @class */ (function (_super) {
1885
+ __extends(DialogInteractionContextFactory, _super);
1886
+ function DialogInteractionContextFactory(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
1887
+ var _this = _super.call(this) || this;
1888
+ _this.dialogService = dialogService;
1889
+ _this.dialogServiceDefaults = dialogServiceDefaults;
1890
+ _this.matDialogDefaultConfig = matDialogDefaultConfig;
1891
+ typescriptUtilities.assert.notNil(dialogService);
1892
+ return _this;
1893
+ }
1894
+ DialogInteractionContextFactory.prototype.createInteractionContext = function (identifier, api) {
1895
+ var config = __assign(__assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig), this.dialogServiceDefaults);
1896
+ return new DialogInteractionContext(identifier, api, this.dialogService, config);
1393
1897
  };
1394
- return Point;
1395
- }());
1898
+ DialogInteractionContextFactory.ctorParameters = function () { return [
1899
+ { type: dialog.MatDialog },
1900
+ { type: dialog.MatDialogConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
1901
+ { type: dialog.MatDialogConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [dialog.MAT_DIALOG_DEFAULT_OPTIONS,] }] }
1902
+ ]; };
1903
+ DialogInteractionContextFactory.ɵprov = core.ɵɵdefineInjectable({ factory: function DialogInteractionContextFactory_Factory() { return new DialogInteractionContextFactory(core.ɵɵinject(dialog.MatDialog), core.ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), core.ɵɵinject(dialog.MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionContextFactory, providedIn: "root" });
1904
+ DialogInteractionContextFactory = __decorate([
1905
+ core.Injectable({
1906
+ providedIn: 'root'
1907
+ }),
1908
+ __param(1, core.Optional()), __param(1, core.Inject(DIALOG_INTERACTION_SERVICE_DEFAULTS)),
1909
+ __param(2, core.Optional()), __param(2, core.Inject(dialog.MAT_DIALOG_DEFAULT_OPTIONS)),
1910
+ __metadata("design:paramtypes", [dialog.MatDialog,
1911
+ dialog.MatDialogConfig,
1912
+ dialog.MatDialogConfig])
1913
+ ], DialogInteractionContextFactory);
1914
+ return DialogInteractionContextFactory;
1915
+ }(ModalInteractionContextFactory));
1396
1916
 
1397
- exports.Bounds = /** @class */ (function (_super) {
1398
- __extends(Bounds, _super);
1399
- function Bounds(top, left, width, height) {
1400
- var _this = _super.call(this, width, height) || this;
1401
- _this.top = top;
1402
- _this.left = left;
1403
- _this.width = width;
1404
- _this.height = height;
1917
+ /**
1918
+ * @file Automatically generated by barrelsby.
1919
+ */
1920
+
1921
+ var AbstractInputActivity = /** @class */ (function (_super) {
1922
+ __extends(AbstractInputActivity, _super);
1923
+ function AbstractInputActivity(data) {
1924
+ var _this = _super.call(this) || this;
1925
+ _this.data = data;
1926
+ _this.class = 'aup-input-activity';
1927
+ var form = new pectin.Form();
1928
+ _this.valueModel = form.valueModel(_this.data.initialValue);
1929
+ _this.valueModel.validateUsing(data.validators || []);
1930
+ _this.confirmCommand = pectin.Command.create(function () {
1931
+ if (_this.valueModel.validate()) {
1932
+ if (data.save) {
1933
+ return Promise.resolve(data.save(_this.valueModel, _this.interactionContext))
1934
+ .then(function () { return _this.done(); });
1935
+ }
1936
+ else {
1937
+ _this.done(_this.valueModel.value);
1938
+ }
1939
+ }
1940
+ });
1941
+ _this.cancelCommand = pectin.Command.create(function () {
1942
+ _this.cancel();
1943
+ });
1405
1944
  return _this;
1406
1945
  }
1407
- Bounds.prototype.relativePositionOf = function (point) {
1408
- if (point instanceof MouseEvent) {
1409
- return new Point(point.clientX - this.left, point.clientY - this.top);
1410
- }
1411
- else {
1412
- return new Point(point.x - this.left, point.y - this.top);
1413
- }
1946
+ AbstractInputActivity.prototype.onActivityReady = function () {
1947
+ this.valueModel.focusContext.requestFocus();
1414
1948
  };
1415
- return Bounds;
1416
- }(Dimension));
1417
- (function (Bounds) {
1418
- function ofElement(element) {
1419
- var rect = element.getBoundingClientRect();
1420
- return new Bounds(rect.top, rect.left, rect.width, rect.height);
1421
- }
1422
- Bounds.ofElement = ofElement;
1423
- })(exports.Bounds || (exports.Bounds = {}));
1949
+ AbstractInputActivity.ctorParameters = function () { return [
1950
+ { type: undefined, decorators: [{ type: core.Inject, args: [ACTIVITY_DATA,] }] }
1951
+ ]; };
1952
+ __decorate([
1953
+ core.HostBinding('class'),
1954
+ __metadata("design:type", Object)
1955
+ ], AbstractInputActivity.prototype, "class", void 0);
1956
+ AbstractInputActivity = __decorate([
1957
+ core.Component({
1958
+ template: ""
1959
+ }),
1960
+ __param(0, core.Inject(ACTIVITY_DATA)),
1961
+ __metadata("design:paramtypes", [Object])
1962
+ ], AbstractInputActivity);
1963
+ return AbstractInputActivity;
1964
+ }(Activity));
1424
1965
 
1425
- var ResizeAwareComponent = /** @class */ (function (_super) {
1426
- __extends(ResizeAwareComponent, _super);
1427
- function ResizeAwareComponent(elementRef, ngZone) {
1966
+ var AbstractInputComponent = /** @class */ (function (_super) {
1967
+ __extends(AbstractInputComponent, _super);
1968
+ function AbstractInputComponent() {
1428
1969
  var _this = _super.call(this) || this;
1429
- _this.elementRef = elementRef;
1430
- _this.ngZone = ngZone;
1431
- _this._boundsModel = new pectin.MutableValueModel(new exports.Bounds(0, 0, 0, 0));
1970
+ /**
1971
+ * A backing model for all our @Input() valueModel properties which should be defined as follows.
1972
+ *
1973
+ * @Input() @TrackExternal({useExisting: "delegatingFormValueModel"})
1974
+ * valueModel: FormValueModel<string> | MutableValueModel<string>;
1975
+ *
1976
+ * This approach allows the input to accept plain or form models but all backed by a form
1977
+ * friendly delegate. We have to use an existing delegate for union types as pectin just
1978
+ * gets told it's an Object and can't scan for a base type annotated with @DelegateUsing(..).
1979
+ */
1980
+ // We have to register it as a disposable so it ditches any listeners when we're disposed.
1981
+ _this.delegatingFormValueModel = _this.registerDisposable(new pectin.DelegatingFormValueModel());
1982
+ // TODO: fix this.
1983
+ // tslint:disable-next-line:no-output-native
1984
+ _this.focus = new core.EventEmitter();
1985
+ // tslint:disable-next-line:no-output-native
1986
+ _this.blur = new core.EventEmitter();
1987
+ // tslint:disable-next-line:no-output-native
1988
+ _this.enterKey = new core.EventEmitter();
1989
+ // tslint:disable-next-line:no-output-native
1990
+ _this.escapeKey = new core.EventEmitter();
1991
+ _this.baseClassName = 'aup-input-component';
1992
+ var self = _this;
1993
+ _this.errorStateMatcher = {
1994
+ isErrorState: function (control, form) {
1995
+ return self.hasErrors();
1996
+ }
1997
+ };
1432
1998
  return _this;
1433
1999
  }
1434
- ResizeAwareComponent.prototype.ngAfterViewInit = function () {
1435
- var _this = this;
1436
- this.updateBounds();
1437
- var element = this.elementRef.nativeElement;
1438
- var ro = new ResizeObserver(function (entries, observer) {
1439
- _this.ngZone.run(function () { return _this.updateBounds(); });
1440
- });
1441
- ro.observe(element);
1442
- this.onDispose(function () { return ro.disconnect(); });
2000
+ AbstractInputComponent.prototype.notifyClick = function () {
2001
+ this.safelyInvoke(this.clickCommand);
1443
2002
  };
1444
- Object.defineProperty(ResizeAwareComponent.prototype, "boundsModel", {
2003
+ AbstractInputComponent.prototype.notifyFocusIn = function () {
2004
+ this.safelyInvoke(this.focusCommand);
2005
+ this.focus.emit();
2006
+ };
2007
+ AbstractInputComponent.prototype.notifyFocusOut = function () {
2008
+ this.safelyInvoke(this.blurCommand);
2009
+ this.blur.emit();
2010
+ };
2011
+ AbstractInputComponent.prototype.notifyEnterKey = function () {
2012
+ this.safelyInvoke(this.enterCommand);
2013
+ this.enterKey.emit();
2014
+ };
2015
+ AbstractInputComponent.prototype.notifyEscapeKey = function () {
2016
+ this.safelyInvoke(this.escapeCommand);
2017
+ this.escapeKey.emit();
2018
+ };
2019
+ AbstractInputComponent.prototype.safelyInvoke = function (command) {
2020
+ if (command && command.enabled.value) {
2021
+ command.execute();
2022
+ }
2023
+ };
2024
+ AbstractInputComponent.prototype.ngOnInit = function () {
2025
+ };
2026
+ AbstractInputComponent.prototype.isEnabled = function () {
2027
+ return this.enabled.value;
2028
+ };
2029
+ Object.defineProperty(AbstractInputComponent.prototype, "enabled", {
1445
2030
  get: function () {
1446
- return this._boundsModel.readonly;
2031
+ return this.delegatingFormValueModel.enabled;
1447
2032
  },
1448
2033
  enumerable: true,
1449
2034
  configurable: true
1450
2035
  });
1451
- Object.defineProperty(ResizeAwareComponent.prototype, "nativeElement", {
2036
+ AbstractInputComponent.prototype.hasErrors = function () {
2037
+ return !this.errorList.query().isEmpty();
2038
+ };
2039
+ Object.defineProperty(AbstractInputComponent.prototype, "errorList", {
1452
2040
  get: function () {
1453
- return this.elementRef.nativeElement;
2041
+ return this.delegatingFormValueModel.errorList;
1454
2042
  },
1455
2043
  enumerable: true,
1456
2044
  configurable: true
1457
2045
  });
1458
- // TODO: Make this handle body scroll
1459
- ResizeAwareComponent.prototype.relativePositionOf = function (point) {
1460
- return this.bounds.relativePositionOf(point);
1461
- };
1462
- Object.defineProperty(ResizeAwareComponent.prototype, "bounds", {
2046
+ Object.defineProperty(AbstractInputComponent.prototype, "firstError", {
1463
2047
  get: function () {
1464
- return this._boundsModel.value;
2048
+ return this.hasErrors() ? this.errorList.value[0] : null;
1465
2049
  },
1466
2050
  enumerable: true,
1467
2051
  configurable: true
1468
2052
  });
1469
- ResizeAwareComponent.prototype.updateBounds = function () {
1470
- this._boundsModel.value = exports.Bounds.ofElement(this.nativeElement);
1471
- };
1472
- ResizeAwareComponent.ctorParameters = function () { return [
1473
- { type: core.ElementRef },
1474
- { type: core.NgZone }
1475
- ]; };
1476
- ResizeAwareComponent = __decorate([
1477
- core.Directive(),
1478
- __metadata("design:paramtypes", [core.ElementRef, core.NgZone])
1479
- ], ResizeAwareComponent);
1480
- return ResizeAwareComponent;
1481
- }(DisposableComponent));
1482
-
1483
- /**
1484
- * @file Automatically generated by barrelsby.
1485
- */
2053
+ __decorate([
2054
+ core.Input(),
2055
+ __metadata("design:type", String)
2056
+ ], AbstractInputComponent.prototype, "label", void 0);
2057
+ __decorate([
2058
+ core.Input(),
2059
+ __metadata("design:type", String)
2060
+ ], AbstractInputComponent.prototype, "floatLabel", void 0);
2061
+ __decorate([
2062
+ core.Input(),
2063
+ __metadata("design:type", String)
2064
+ ], AbstractInputComponent.prototype, "hint", void 0);
2065
+ __decorate([
2066
+ core.Input(),
2067
+ __metadata("design:type", String)
2068
+ ], AbstractInputComponent.prototype, "placeholder", void 0);
2069
+ __decorate([
2070
+ core.Input('command.focus'),
2071
+ __metadata("design:type", pectin.Command)
2072
+ ], AbstractInputComponent.prototype, "focusCommand", void 0);
2073
+ __decorate([
2074
+ core.Input('command.blur'),
2075
+ __metadata("design:type", pectin.Command)
2076
+ ], AbstractInputComponent.prototype, "blurCommand", void 0);
2077
+ __decorate([
2078
+ core.Input('command.enter'),
2079
+ __metadata("design:type", pectin.Command)
2080
+ ], AbstractInputComponent.prototype, "enterCommand", void 0);
2081
+ __decorate([
2082
+ core.Input('command.escape'),
2083
+ __metadata("design:type", pectin.Command)
2084
+ ], AbstractInputComponent.prototype, "escapeCommand", void 0);
2085
+ __decorate([
2086
+ core.Input('command.click'),
2087
+ __metadata("design:type", pectin.Command)
2088
+ ], AbstractInputComponent.prototype, "clickCommand", void 0);
2089
+ __decorate([
2090
+ core.Output(),
2091
+ __metadata("design:type", Object)
2092
+ ], AbstractInputComponent.prototype, "focus", void 0);
2093
+ __decorate([
2094
+ core.Output(),
2095
+ __metadata("design:type", Object)
2096
+ ], AbstractInputComponent.prototype, "blur", void 0);
2097
+ __decorate([
2098
+ core.Output(),
2099
+ __metadata("design:type", Object)
2100
+ ], AbstractInputComponent.prototype, "enterKey", void 0);
2101
+ __decorate([
2102
+ core.Output(),
2103
+ __metadata("design:type", Object)
2104
+ ], AbstractInputComponent.prototype, "escapeKey", void 0);
2105
+ __decorate([
2106
+ core.HostBinding('class'),
2107
+ __metadata("design:type", Object)
2108
+ ], AbstractInputComponent.prototype, "baseClassName", void 0);
2109
+ __decorate([
2110
+ core.HostListener('click'),
2111
+ __metadata("design:type", Function),
2112
+ __metadata("design:paramtypes", []),
2113
+ __metadata("design:returntype", void 0)
2114
+ ], AbstractInputComponent.prototype, "notifyClick", null);
2115
+ __decorate([
2116
+ core.HostListener('focusin'),
2117
+ __metadata("design:type", Function),
2118
+ __metadata("design:paramtypes", []),
2119
+ __metadata("design:returntype", void 0)
2120
+ ], AbstractInputComponent.prototype, "notifyFocusIn", null);
2121
+ __decorate([
2122
+ core.HostListener('focusout'),
2123
+ __metadata("design:type", Function),
2124
+ __metadata("design:paramtypes", []),
2125
+ __metadata("design:returntype", void 0)
2126
+ ], AbstractInputComponent.prototype, "notifyFocusOut", null);
2127
+ AbstractInputComponent = __decorate([
2128
+ core.Component({ template: '' }),
2129
+ __metadata("design:paramtypes", [])
2130
+ ], AbstractInputComponent);
2131
+ return AbstractInputComponent;
2132
+ }(DisposableComponent));
1486
2133
 
1487
- var ActivityActionsComponent = /** @class */ (function (_super) {
1488
- __extends(ActivityActionsComponent, _super);
1489
- function ActivityActionsComponent() {
1490
- var _this = _super !== null && _super.apply(this, arguments) || this;
1491
- _this.align = 'start';
2134
+ var CheckboxInputComponent = /** @class */ (function (_super) {
2135
+ __extends(CheckboxInputComponent, _super);
2136
+ function CheckboxInputComponent() {
2137
+ var _this = _super.call(this) || this;
2138
+ _this.color = 'accent';
2139
+ _this.labelPosition = 'after';
1492
2140
  return _this;
1493
2141
  }
1494
- Object.defineProperty(ActivityActionsComponent.prototype, "alignEnd", {
1495
- get: function () {
1496
- return this.align === 'end';
1497
- },
1498
- enumerable: true,
1499
- configurable: true
1500
- });
1501
- ActivityActionsComponent.prototype.ngOnInit = function () {
1502
- };
1503
- ActivityActionsComponent.prototype.hasConfirmText = function () {
1504
- return !___default__default.isEmpty(this.confirmText);
2142
+ CheckboxInputComponent.prototype.ngOnInit = function () {
1505
2143
  };
1506
2144
  __decorate([
1507
- core.Input(),
1508
- pectin.TrackExternal(),
1509
- __metadata("design:type", pectin.Command)
1510
- ], ActivityActionsComponent.prototype, "confirmCommand", void 0);
2145
+ core.Input(), pectin.TrackExternal({ delegateTo: 'delegatingFormValueModel' }),
2146
+ __metadata("design:type", Object)
2147
+ ], CheckboxInputComponent.prototype, "valueModel", void 0);
1511
2148
  __decorate([
1512
2149
  core.Input(),
1513
2150
  __metadata("design:type", String)
1514
- ], ActivityActionsComponent.prototype, "confirmText", void 0);
1515
- __decorate([
1516
- core.Input(),
1517
- pectin.TrackExternal(),
1518
- __metadata("design:type", pectin.Command)
1519
- ], ActivityActionsComponent.prototype, "cancelCommand", void 0);
2151
+ ], CheckboxInputComponent.prototype, "color", void 0);
1520
2152
  __decorate([
1521
2153
  core.Input(),
1522
2154
  __metadata("design:type", String)
1523
- ], ActivityActionsComponent.prototype, "align", void 0);
1524
- __decorate([
1525
- core.HostBinding('class.align-end'),
1526
- __metadata("design:type", Boolean),
1527
- __metadata("design:paramtypes", [])
1528
- ], ActivityActionsComponent.prototype, "alignEnd", null);
1529
- ActivityActionsComponent = __decorate([
2155
+ ], CheckboxInputComponent.prototype, "labelPosition", void 0);
2156
+ CheckboxInputComponent = __decorate([
1530
2157
  core.Component({
1531
- selector: 'aup-activity-actions',
1532
- template: "<button class=\"cancel\" mat-icon-button [pectinCommand]=\"cancelCommand\">\n <mat-icon>clear</mat-icon>\n</button>\n<button class=\"confirm\" *ngIf=\"!hasConfirmText()\" mat-icon-button [pectinCommand]=\"confirmCommand\">\n <mat-icon>done</mat-icon>\n</button>\n<button class=\"confirm\" *ngIf=\"hasConfirmText()\" mat-button [pectinCommand]=\"confirmCommand\">{{confirmText}}</button>\n<div class=\"content\">\n <ng-content></ng-content>\n</div>\n",
1533
- styles: [":host{display:-ms-grid;display:grid;grid-template-areas:\"cancel confirm content\";-ms-grid-columns:auto auto 1fr;grid-template-columns:auto auto 1fr;-ms-grid-rows:auto;grid-template-rows:auto;align-items:center;justify-content:end}:host.align-end{grid-template-areas:\"content cancel confirm\";-ms-grid-columns:1fr auto auto;grid-template-columns:1fr auto auto}.cancel{-ms-grid-row:1;-ms-grid-column:1;grid-area:cancel}:host.align-end>.cancel{-ms-grid-row:1;-ms-grid-column:2}.confirm{-ms-grid-row:1;-ms-grid-column:2;grid-area:confirm}:host.align-end>.confirm{-ms-grid-row:1;-ms-grid-column:3}.content{-ms-grid-row:1;-ms-grid-column:3;grid-area:content;text-align:left}:host.align-end>.content{-ms-grid-row:1;-ms-grid-column:1}"]
1534
- })
1535
- ], ActivityActionsComponent);
1536
- return ActivityActionsComponent;
1537
- }(DisposableComponent));
1538
-
1539
- var ACTIVITY_DATA = new core.InjectionToken('InteractionActivityData');
1540
- var Activity = /** @class */ (function (_super) {
1541
- __extends(Activity, _super);
1542
- function Activity() {
1543
- var _this = _super !== null && _super.apply(this, arguments) || this;
1544
- _this._busyModel = new pectin.DelegatingValueModel().withDefault(false);
1545
- return _this;
1546
- }
1547
- Activity.prototype.initialise = function (nestedInteractionContext, activityContext) {
1548
- typescriptUtilities.assert.isNil(this._activityContext);
1549
- this._activityContext = activityContext;
1550
- this._interactionContext = nestedInteractionContext;
1551
- };
1552
- Object.defineProperty(Activity.prototype, "interactionContext", {
1553
- get: function () {
1554
- typescriptUtilities.assert.isTruthy(this.isInitialised());
1555
- return this._interactionContext;
1556
- },
1557
- enumerable: true,
1558
- configurable: true
1559
- });
1560
- Activity.prototype.done = function (result) {
1561
- return this._activityContext.onDone(result);
1562
- };
1563
- Activity.prototype.cancel = function (error) {
1564
- this._activityContext.onCancel(error);
1565
- };
1566
- // @Trace()
1567
- Activity.prototype.onActivityReady = function () {
1568
- };
1569
- Object.defineProperty(Activity.prototype, "busy", {
1570
- get: function () {
1571
- return this._busyModel.readonly;
1572
- },
1573
- enumerable: true,
1574
- configurable: true
1575
- });
1576
- Activity.prototype.busyWhile = function (busyModel) {
1577
- this._busyModel.setDelegate(busyModel);
1578
- };
1579
- Activity.prototype.isBusy = function () {
1580
- return this._busyModel.value;
1581
- };
1582
- Activity.prototype.isInitialised = function () {
1583
- return !!this._activityContext;
1584
- };
1585
- return Activity;
1586
- }(DisposableComponent));
2158
+ selector: 'aup-checkbox-input',
2159
+ template: "<!-- TODO: add focus binding -->\n<mat-checkbox\n [(ngModel)]=\"valueModel.value\"\n [color]=\"color\"\n [labelPosition]=\"labelPosition\"\n [disabled]=\"!isEnabled()\"\n>{{label}}</mat-checkbox>\n<mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n<mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n",
2160
+ styles: [":host{display:inline-flex;flex-direction:column;margin-top:24px;margin-bottom:16px}mat-error,mat-hint{margin-top:4px;margin-left:24px;font-size:12px;font-weight:400;line-height:13.5px}"]
2161
+ }),
2162
+ __metadata("design:paramtypes", [])
2163
+ ], CheckboxInputComponent);
2164
+ return CheckboxInputComponent;
2165
+ }(AbstractInputComponent));
1587
2166
 
1588
- var AlertDialogComponent = /** @class */ (function (_super) {
1589
- __extends(AlertDialogComponent, _super);
1590
- function AlertDialogComponent(alert) {
2167
+ var NumberInputComponent = /** @class */ (function (_super) {
2168
+ __extends(NumberInputComponent, _super);
2169
+ function NumberInputComponent() {
1591
2170
  var _this = _super.call(this) || this;
1592
- _this.alert = alert;
2171
+ _this.min = Number.MIN_SAFE_INTEGER;
2172
+ _this.max = Number.MAX_SAFE_INTEGER;
1593
2173
  return _this;
1594
2174
  }
1595
- AlertDialogComponent.prototype.ngOnInit = function () {
2175
+ NumberInputComponent.prototype.ngOnInit = function () {
1596
2176
  };
1597
- AlertDialogComponent.ctorParameters = function () { return [
1598
- { type: undefined, decorators: [{ type: core.Inject, args: [ACTIVITY_DATA,] }] }
1599
- ]; };
1600
- AlertDialogComponent = __decorate([
2177
+ __decorate([
2178
+ core.Input(), pectin.TrackExternal({ delegateTo: 'delegatingFormValueModel' }),
2179
+ __metadata("design:type", Object)
2180
+ ], NumberInputComponent.prototype, "valueModel", void 0);
2181
+ __decorate([
2182
+ core.Input(),
2183
+ __metadata("design:type", Object)
2184
+ ], NumberInputComponent.prototype, "min", void 0);
2185
+ __decorate([
2186
+ core.Input(),
2187
+ __metadata("design:type", Object)
2188
+ ], NumberInputComponent.prototype, "max", void 0);
2189
+ NumberInputComponent = __decorate([
1601
2190
  core.Component({
1602
- selector: 'aup-alert-dialog',
1603
- template: "<h3 matDialogTitle *ngIf=\"alert.title\">{{alert.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of alert.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</div>\n",
1604
- styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
2191
+ selector: 'aup-number-input',
2192
+ template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"number\"\n matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"delegatingFormValueModel?.focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n [min]=\"min\"\n [max]=\"max\"\n >\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
2193
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}:host-context(aup-table-cell-renderer) mat-form-field div.mat-form-field-infix{width:auto}"]
1605
2194
  }),
1606
- __param(0, core.Inject(ACTIVITY_DATA)),
1607
- __metadata("design:paramtypes", [Object])
1608
- ], AlertDialogComponent);
1609
- return AlertDialogComponent;
1610
- }(Activity));
2195
+ __metadata("design:paramtypes", [])
2196
+ ], NumberInputComponent);
2197
+ return NumberInputComponent;
2198
+ }(AbstractInputComponent));
1611
2199
 
1612
- var ConfirmThenDialogComponent = /** @class */ (function (_super) {
1613
- __extends(ConfirmThenDialogComponent, _super);
1614
- function ConfirmThenDialogComponent(config) {
1615
- var _this = _super.call(this) || this;
1616
- _this.config = config;
1617
- pectin.assert.notNil(config);
1618
- return _this;
2200
+ var PasswordInputComponent = /** @class */ (function (_super) {
2201
+ __extends(PasswordInputComponent, _super);
2202
+ function PasswordInputComponent() {
2203
+ return _super.call(this) || this;
1619
2204
  }
1620
- ConfirmThenDialogComponent.prototype.ngOnInit = function () {
1621
- };
1622
- Object.defineProperty(ConfirmThenDialogComponent.prototype, "confirm", {
1623
- get: function () {
1624
- return this.config.confirm;
1625
- },
1626
- enumerable: true,
1627
- configurable: true
1628
- });
1629
- ConfirmThenDialogComponent.prototype.isDestructive = function () {
1630
- return this.confirm.destructive && this.confirm.destructive();
1631
- };
1632
- ConfirmThenDialogComponent.prototype.onConfirm = function () {
1633
- var _this = this;
1634
- this.interactionContext.startActivity(this.config.activityType, this.config.data)
1635
- .then(function (result) { return _this.done(result); })
1636
- .catch(function (error) { return _this.cancel(error); });
2205
+ PasswordInputComponent.prototype.ngOnInit = function () {
1637
2206
  };
1638
- ConfirmThenDialogComponent.ctorParameters = function () { return [
1639
- { type: undefined, decorators: [{ type: core.Inject, args: [ACTIVITY_DATA,] }] }
1640
- ]; };
1641
- ConfirmThenDialogComponent = __decorate([
2207
+ __decorate([
2208
+ core.Input(), pectin.TrackExternal({ delegateTo: "delegatingFormValueModel" }),
2209
+ __metadata("design:type", Object)
2210
+ ], PasswordInputComponent.prototype, "valueModel", void 0);
2211
+ PasswordInputComponent = __decorate([
1642
2212
  core.Component({
1643
- selector: 'aup-confirmation-dialog',
1644
- template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n",
1645
- styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
2213
+ selector: 'aup-password-input',
2214
+ template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"password\"\n matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"delegatingFormValueModel.focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n\n",
2215
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}:host-context(aup-table-cell-renderer) mat-form-field div.mat-form-field-infix{width:auto}"]
1646
2216
  }),
1647
- __param(0, core.Inject(ACTIVITY_DATA)),
1648
- __metadata("design:paramtypes", [Object])
1649
- ], ConfirmThenDialogComponent);
1650
- return ConfirmThenDialogComponent;
1651
- }(Activity));
2217
+ __metadata("design:paramtypes", [])
2218
+ ], PasswordInputComponent);
2219
+ return PasswordInputComponent;
2220
+ }(AbstractInputComponent));
1652
2221
 
1653
- var ConfirmationDialogComponent = /** @class */ (function (_super) {
1654
- __extends(ConfirmationDialogComponent, _super);
1655
- function ConfirmationDialogComponent(confirm) {
2222
+ var SelectInputComponent = /** @class */ (function (_super) {
2223
+ __extends(SelectInputComponent, _super);
2224
+ function SelectInputComponent() {
1656
2225
  var _this = _super.call(this) || this;
1657
- _this.confirm = confirm;
1658
- pectin.assert.notNil(confirm);
2226
+ _this.optionLabelFormat = function (option) { return (option && _this.optionLabel) ? option[_this.optionLabel] : option; };
1659
2227
  return _this;
1660
2228
  }
1661
- ConfirmationDialogComponent.prototype.ngOnInit = function () {
1662
- };
1663
- ConfirmationDialogComponent.prototype.isDestructive = function () {
1664
- return this.confirm.destructive && this.confirm.destructive();
2229
+ SelectInputComponent.prototype.ngOnInit = function () {
1665
2230
  };
1666
- ConfirmationDialogComponent.ctorParameters = function () { return [
1667
- { type: undefined, decorators: [{ type: core.Inject, args: [ACTIVITY_DATA,] }] }
1668
- ]; };
1669
- ConfirmationDialogComponent = __decorate([
2231
+ __decorate([
2232
+ core.Input(), pectin.TrackExternal({ delegateTo: "delegatingFormValueModel" }),
2233
+ __metadata("design:type", Object)
2234
+ ], SelectInputComponent.prototype, "valueModel", void 0);
2235
+ __decorate([
2236
+ core.Input(), pectin.TrackExternal(),
2237
+ __metadata("design:type", pectin.ListModel)
2238
+ ], SelectInputComponent.prototype, "optionsModel", void 0);
2239
+ __decorate([
2240
+ core.Input(), pectin.StoreInListModel('optionsModel'),
2241
+ __metadata("design:type", Array)
2242
+ ], SelectInputComponent.prototype, "options", void 0);
2243
+ __decorate([
2244
+ core.Input(),
2245
+ __metadata("design:type", Object)
2246
+ ], SelectInputComponent.prototype, "optionLabel", void 0);
2247
+ __decorate([
2248
+ core.Input(),
2249
+ __metadata("design:type", Boolean)
2250
+ ], SelectInputComponent.prototype, "allowNil", void 0);
2251
+ __decorate([
2252
+ core.ContentChild("optionTemplate"),
2253
+ __metadata("design:type", core.TemplateRef)
2254
+ ], SelectInputComponent.prototype, "optionTemplateRef", void 0);
2255
+ __decorate([
2256
+ core.ContentChild("nilOptionTemplate"),
2257
+ __metadata("design:type", core.TemplateRef)
2258
+ ], SelectInputComponent.prototype, "nilOptionTemplateRef", void 0);
2259
+ __decorate([
2260
+ core.Input(),
2261
+ __metadata("design:type", Function)
2262
+ ], SelectInputComponent.prototype, "optionLabelFormat", void 0);
2263
+ SelectInputComponent = __decorate([
1670
2264
  core.Component({
1671
- selector: 'aup-confirmation-dialog',
1672
- template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n",
1673
- styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
2265
+ selector: 'aup-select-input',
2266
+ template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"delegatingFormValueModel.focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-option *ngIf=\"allowNil\">{{placeholder}}</mat-option>\n <mat-option *ngFor=\"let option of optionsModel.value; let i = index\" [value]=\"option\">\n <ng-container *ngIf=\"!optionTemplateRef\">{{optionLabelFormat(option)}}</ng-container>\n <ng-container *ngIf=\"optionTemplateRef\"\n [ngTemplateOutlet]=\"optionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: i }\"\n >\n </ng-container>\n </mat-option>\n </mat-select>\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
2267
+ styles: [":host{display:inline-block}mat-form-field{width:100%}"]
1674
2268
  }),
1675
- __param(0, core.Inject(ACTIVITY_DATA)),
1676
- __metadata("design:paramtypes", [Object])
1677
- ], ConfirmationDialogComponent);
1678
- return ConfirmationDialogComponent;
1679
- }(Activity));
2269
+ __metadata("design:paramtypes", [])
2270
+ ], SelectInputComponent);
2271
+ return SelectInputComponent;
2272
+ }(AbstractInputComponent));
1680
2273
 
1681
- var AbstractInteractionContext = /** @class */ (function () {
1682
- function AbstractInteractionContext() {
2274
+ var StringInputActivity = /** @class */ (function (_super) {
2275
+ __extends(StringInputActivity, _super);
2276
+ function StringInputActivity() {
2277
+ return _super !== null && _super.apply(this, arguments) || this;
1683
2278
  }
1684
- AbstractInteractionContext.prototype.startActivity = function (activityType, data) {
1685
- return this.createAndLaunchActivity(activityType, data, false);
1686
- };
1687
- AbstractInteractionContext.prototype.confirm = function (confirm) {
1688
- // Important: we have to implement confirmOrReject as the main entry point
1689
- // as the canDeactivation guards need to be able to cancel an interaction
1690
- // without caring about returning a value.
1691
- return this.confirmOrReject(confirm).then(function () { return true; }).catch(function () { return false; });
1692
- };
1693
- AbstractInteractionContext.prototype.alert = function (alert) {
1694
- // TODO: Test disableClose === false
1695
- return this.createAndLaunchActivity(AlertDialogComponent, alert, false);
1696
- };
1697
- AbstractInteractionContext.prototype.confirmOrReject = function (confirm) {
1698
- return this.createAndLaunchActivity(ConfirmationDialogComponent, confirm, true);
1699
- };
1700
- /**
1701
- * Presents the confirmation to the user and runs the activity only if the user confirms.
1702
- * @param confirm:Confirm the confirmation to display.
1703
- * @param activityType the activity to run if confirmed.
1704
- * @param data the activity data.
1705
- */
1706
- AbstractInteractionContext.prototype.confirmThen = function (confirm, activityType, data) {
1707
- return this.createAndLaunchActivity(ConfirmThenDialogComponent, {
1708
- confirm: confirm,
1709
- activityType: activityType,
1710
- data: data
1711
- }, true);
1712
- };
1713
- return AbstractInteractionContext;
1714
- }());
2279
+ StringInputActivity = __decorate([
2280
+ core.Component({
2281
+ selector: 'aup-string-input-activity',
2282
+ template: "\n <aup-string-input [valueModel]=\"valueModel\"\n [label]=\"data.label\"\n [placeholder]=\"data.placeholder\"\n [command.enter]=\"confirmCommand\"\n [command.escape]=\"cancelCommand\"></aup-string-input>\n <aup-activity-actions align=\"end\"\n [confirmCommand]=\"confirmCommand\"\n [cancelCommand]=\"cancelCommand\"></aup-activity-actions>\n "
2283
+ })
2284
+ ], StringInputActivity);
2285
+ return StringInputActivity;
2286
+ }(AbstractInputActivity));
1715
2287
 
1716
- var ActivityRef = /** @class */ (function () {
1717
- function ActivityRef(activityClass, activityData, onComplete) {
1718
- this.activityClass = activityClass;
1719
- this.activityData = activityData;
1720
- this.onComplete = onComplete;
1721
- this._complete = false;
1722
- this.deferredResult = pectin.Deferred.defer();
1723
- }
1724
- ActivityRef.prototype.isActivityRealised = function () {
1725
- return !!this._activity;
1726
- };
1727
- ActivityRef.prototype.isComplete = function () {
1728
- return this._complete;
1729
- };
1730
- Object.defineProperty(ActivityRef.prototype, "activity", {
1731
- get: function () {
1732
- pectin.assert.isTruthy(this.isActivityRealised());
1733
- return this._activity;
1734
- },
1735
- enumerable: true,
1736
- configurable: true
1737
- });
1738
- ActivityRef.prototype.notifyActivityCreated = function (activity, nestedInteractionContext) {
1739
- pectin.assert.isNil(this._activity);
1740
- this._activity = activity;
1741
- var self = this;
1742
- this._activity.initialise(nestedInteractionContext, {
1743
- onDone: function (result) {
1744
- self.finishActivity(function (deferred) { return deferred.resolve(result); });
1745
- },
1746
- onCancel: function (error) {
1747
- self.finishActivity(function (deferred) { return deferred.reject(error); });
1748
- }
2288
+ var StringInputComponent = /** @class */ (function (_super) {
2289
+ __extends(StringInputComponent, _super);
2290
+ function StringInputComponent() {
2291
+ var _this = _super.call(this) || this;
2292
+ var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2293
+ _this.clearCommand = pectin.Command.create(function () {
2294
+ _this.valueModel.value = null;
1749
2295
  });
2296
+ _this.clearCommand.disableWhile(chain.stringValue(_this.valueModel).isBlank());
2297
+ return _this;
2298
+ }
2299
+ StringInputComponent.prototype.ngOnInit = function () {
1750
2300
  };
1751
- ActivityRef.prototype.finishActivity = function (resolveOrReject) {
1752
- pectin.assert.isFalsey(this.isComplete());
1753
- resolveOrReject(this.deferredResult);
1754
- this._complete = true;
1755
- this.onComplete(this);
1756
- };
1757
- ActivityRef.prototype.cancel = function () {
1758
- this.activity.cancel();
1759
- };
1760
- Object.defineProperty(ActivityRef.prototype, "activityResult", {
1761
- get: function () {
1762
- return this.deferredResult.promise;
1763
- },
1764
- enumerable: true,
1765
- configurable: true
1766
- });
1767
- return ActivityRef;
1768
- }());
2301
+ __decorate([
2302
+ core.Input(), pectin.TrackExternal({ delegateTo: 'delegatingFormValueModel' }),
2303
+ __metadata("design:type", Object)
2304
+ ], StringInputComponent.prototype, "valueModel", void 0);
2305
+ __decorate([
2306
+ core.Input(), pectin.TrackExternal({ defaultValue: false }),
2307
+ __metadata("design:type", pectin.ValueModel)
2308
+ ], StringInputComponent.prototype, "enableClearModel", void 0);
2309
+ __decorate([
2310
+ core.Input(), pectin.StoreInValueModel('enableClearModel'),
2311
+ __metadata("design:type", Boolean)
2312
+ ], StringInputComponent.prototype, "enableClear", void 0);
2313
+ StringInputComponent = __decorate([
2314
+ core.Component({
2315
+ selector: 'aup-string-input',
2316
+ template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"delegatingFormValueModel.focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n <button mat-button mat-icon-button matSuffix *ngIf=\"enableClear\" [pectinCommand]=\"clearCommand\">\n <mat-icon>close</mat-icon>\n </button>\n</mat-form-field>\n\n",
2317
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}:host-context(aup-table-cell-renderer) mat-form-field div.mat-form-field-infix{width:auto}button[disabled]{visibility:hidden}"]
2318
+ }),
2319
+ __metadata("design:paramtypes", [])
2320
+ ], StringInputComponent);
2321
+ return StringInputComponent;
2322
+ }(AbstractInputComponent));
1769
2323
 
1770
- /**
1771
- * ActivityOutletComponent creates and displays an activity and delegates the interaction context functionality to an
1772
- * external service.
1773
- */
1774
- var ActivityOutletComponent = /** @class */ (function () {
1775
- function ActivityOutletComponent(componentFactoryResolver, viewContainerRef, injector) {
1776
- this.componentFactoryResolver = componentFactoryResolver;
1777
- this.viewContainerRef = viewContainerRef;
1778
- this.injector = injector;
2324
+ var TextInputComponent = /** @class */ (function (_super) {
2325
+ __extends(TextInputComponent, _super);
2326
+ function TextInputComponent() {
2327
+ var _this = _super.call(this) || this;
2328
+ _this.rows = 2;
2329
+ return _this;
2330
+ // const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
1779
2331
  }
1780
- Object.defineProperty(ActivityOutletComponent.prototype, "activityRef", {
1781
- get: function () {
1782
- return this._activityRef;
1783
- },
1784
- set: function (activityRef) {
1785
- if (this.activityRef && !this.activityRef.isComplete()) {
1786
- typescriptUtilities.lang.illegalState("changing activity before previous one has completed");
1787
- }
1788
- this._activityRef = activityRef;
1789
- this.loadActivity(activityRef);
1790
- },
1791
- enumerable: true,
1792
- configurable: true
1793
- });
1794
- ;
1795
- ActivityOutletComponent.prototype.ngOnInit = function () {
1796
- };
1797
- ActivityOutletComponent.prototype.loadActivity = function (activityRef) {
1798
- var injector = core.Injector.create({
1799
- providers: [
1800
- { provide: ACTIVITY_DATA, useValue: activityRef.activityData }
1801
- ],
1802
- parent: this.injector
1803
- });
1804
- var componentFactory = this.componentFactoryResolver.resolveComponentFactory(activityRef.activityClass);
1805
- this.viewContainerRef.clear();
1806
- // console.log(`creating component -> ${activityRef.activityClass.name}`);
1807
- this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
1808
- this.activityRef.notifyActivityCreated(this.activityComponentRef.instance, this.nestedInteractionContext);
2332
+ TextInputComponent.prototype.ngOnInit = function () {
1809
2333
  };
1810
- Object.defineProperty(ActivityOutletComponent.prototype, "component", {
1811
- get: function () {
1812
- return this.activityComponentRef.instance;
1813
- },
1814
- enumerable: true,
1815
- configurable: true
1816
- });
1817
- ActivityOutletComponent.ctorParameters = function () { return [
1818
- { type: core.ComponentFactoryResolver },
1819
- { type: core.ViewContainerRef },
1820
- { type: core.Injector }
1821
- ]; };
2334
+ __decorate([
2335
+ core.Input(), pectin.TrackExternal({ delegateTo: 'delegatingFormValueModel' }),
2336
+ __metadata("design:type", Object)
2337
+ ], TextInputComponent.prototype, "valueModel", void 0);
1822
2338
  __decorate([
1823
2339
  core.Input(),
1824
2340
  __metadata("design:type", Object)
1825
- ], ActivityOutletComponent.prototype, "nestedInteractionContext", void 0);
2341
+ ], TextInputComponent.prototype, "rows", void 0);
1826
2342
  __decorate([
1827
2343
  core.Input(),
1828
- __metadata("design:type", ActivityRef),
1829
- __metadata("design:paramtypes", [ActivityRef])
1830
- ], ActivityOutletComponent.prototype, "activityRef", null);
1831
- ActivityOutletComponent = __decorate([
2344
+ __metadata("design:type", Number)
2345
+ ], TextInputComponent.prototype, "cols", void 0);
2346
+ TextInputComponent = __decorate([
1832
2347
  core.Component({
1833
- selector: 'aup-activity-outlet',
1834
- template: '',
2348
+ selector: 'aup-text-input',
2349
+ template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <textarea matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"delegatingFormValueModel.focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n [rows]=\"rows\"\n [cols]=\"cols\"\n >\n </textarea>\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n\n",
2350
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}:host-context(aup-table-cell-renderer) mat-form-field div.mat-form-field-infix{width:auto}button[disabled]{visibility:hidden}textarea{overflow:auto}"]
2351
+ }),
2352
+ __metadata("design:paramtypes", [])
2353
+ ], TextInputComponent);
2354
+ return TextInputComponent;
2355
+ }(AbstractInputComponent));
2356
+
2357
+ var NoopComponent = /** @class */ (function () {
2358
+ function NoopComponent() {
2359
+ }
2360
+ NoopComponent = __decorate([
2361
+ core.Component({
2362
+ selector: 'aup-noop',
2363
+ template: "",
1835
2364
  styles: [":host{display:block}"]
1836
2365
  }),
1837
- __metadata("design:paramtypes", [core.ComponentFactoryResolver,
1838
- core.ViewContainerRef,
1839
- core.Injector])
1840
- ], ActivityOutletComponent);
1841
- return ActivityOutletComponent;
2366
+ __metadata("design:paramtypes", [])
2367
+ ], NoopComponent);
2368
+ return NoopComponent;
1842
2369
  }());
1843
2370
 
1844
- var ActivityContainerComponent = /** @class */ (function (_super) {
1845
- __extends(ActivityContainerComponent, _super);
1846
- function ActivityContainerComponent() {
1847
- var _this = _super.call(this) || this;
1848
- _this.dynamicHeight = false;
1849
- _this.activityTabs = [];
1850
- _this.garbage = new pectin.GarbageCollector();
1851
- return _this;
1852
- }
1853
- ActivityContainerComponent.prototype.ngOnInit = function () {
1854
- };
1855
- ActivityContainerComponent.prototype.ngAfterViewInit = function () {
1856
- var _this = this;
1857
- var _a = pectin.Dsl.disposeWith(this), chain = _a.chain, observe = _a.observe;
1858
- // using the component directly rather than (animationDone)=.. allows us
1859
- // to keep our callback private.
1860
- observe.valuesFrom(this.tabs.animationDone).subscribe(function () { return _this.onAnimationFinished(); });
1861
- };
1862
- ActivityContainerComponent.prototype.initialise = function (identifier, api) {
1863
- pectin.assert.isFalsey(this.isInitialised());
1864
- pectin.assert.notNil(identifier);
1865
- pectin.assert.notNil(api);
1866
- this._identifier = identifier;
1867
- this.interactionServiceApi = api;
2371
+ var ScrollContainerComponent = /** @class */ (function () {
2372
+ function ScrollContainerComponent() {
2373
+ }
2374
+ ScrollContainerComponent.prototype.ngOnInit = function () {
1868
2375
  };
1869
- Object.defineProperty(ActivityContainerComponent.prototype, "identifier", {
2376
+ ScrollContainerComponent = __decorate([
2377
+ core.Component({
2378
+ selector: 'aup-scroll-container',
2379
+ template: "<div class=\"container\">\n <ng-content></ng-content>\n</div>\n",
2380
+ styles: [":host{display:flex;flex-direction:column;min-height:0;align-items:stretch}.container{display:flex;flex-direction:column;flex:1;flex-basis:0;overflow-y:scroll;align-items:stretch}"]
2381
+ }),
2382
+ __metadata("design:paramtypes", [])
2383
+ ], ScrollContainerComponent);
2384
+ return ScrollContainerComponent;
2385
+ }());
2386
+
2387
+ var SwitchCaseOption = /** @class */ (function () {
2388
+ function SwitchCaseOption(templateRef) {
2389
+ this.templateRef = templateRef;
2390
+ }
2391
+ Object.defineProperty(SwitchCaseOption.prototype, "name", {
1870
2392
  get: function () {
1871
- return this._identifier;
2393
+ return this.constructor.name;
1872
2394
  },
1873
2395
  enumerable: true,
1874
2396
  configurable: true
1875
2397
  });
1876
- ActivityContainerComponent.prototype.isInitialised = function () {
1877
- return !!this.identifier;
1878
- };
1879
- /**
1880
- * Returns true if an activity is currently running.
1881
- */
1882
- ActivityContainerComponent.prototype.isActive = function () {
1883
- return this.getActiveActivityCount() > 0;
1884
- };
1885
- ActivityContainerComponent.prototype.registerDisposable = function (disposable) {
1886
- return this.garbage.registerDisposable(disposable);
2398
+ return SwitchCaseOption;
2399
+ }());
2400
+ var SwitchCaseWhenDirective = /** @class */ (function (_super) {
2401
+ __extends(SwitchCaseWhenDirective, _super);
2402
+ function SwitchCaseWhenDirective(templateRef) {
2403
+ var _this = _super.call(this, templateRef) || this;
2404
+ _this.isDefault = false;
2405
+ return _this;
2406
+ }
2407
+ SwitchCaseWhenDirective_1 = SwitchCaseWhenDirective;
2408
+ SwitchCaseWhenDirective.prototype.matches = function (value) {
2409
+ return this.aupSwitchCaseWhen === value;
1887
2410
  };
1888
- ActivityContainerComponent.prototype.dispose = function () {
1889
- // TODO: think about auto cancelling any outstanding activity on dispose.
1890
- // See NavigationState.Navigating for a use-case.
1891
- pectin.assert.isFalsey(this.isActive());
1892
- this.garbage.dispose();
2411
+ var SwitchCaseWhenDirective_1;
2412
+ SwitchCaseWhenDirective.ctorParameters = function () { return [
2413
+ { type: core.TemplateRef }
2414
+ ]; };
2415
+ __decorate([
2416
+ core.Input(),
2417
+ __metadata("design:type", Object)
2418
+ ], SwitchCaseWhenDirective.prototype, "aupSwitchCaseWhen", void 0);
2419
+ SwitchCaseWhenDirective = SwitchCaseWhenDirective_1 = __decorate([
2420
+ core.Directive({
2421
+ selector: '[aupSwitchCaseWhen]',
2422
+ providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseWhenDirective_1 }]
2423
+ }),
2424
+ __metadata("design:paramtypes", [core.TemplateRef])
2425
+ ], SwitchCaseWhenDirective);
2426
+ return SwitchCaseWhenDirective;
2427
+ }(SwitchCaseOption));
2428
+ var SwitchCaseDefaultDirective = /** @class */ (function (_super) {
2429
+ __extends(SwitchCaseDefaultDirective, _super);
2430
+ function SwitchCaseDefaultDirective(templateRef) {
2431
+ var _this = _super.call(this, templateRef) || this;
2432
+ _this.isDefault = true;
2433
+ return _this;
2434
+ }
2435
+ SwitchCaseDefaultDirective_1 = SwitchCaseDefaultDirective;
2436
+ SwitchCaseDefaultDirective.prototype.matches = function (value) {
2437
+ return false;
1893
2438
  };
1894
- ActivityContainerComponent.prototype.getActiveActivityRef = function () {
1895
- if (!this.isActive()) {
1896
- typescriptUtilities.lang.illegalState('no activity in progress');
1897
- }
1898
- return ___default__default.findLast(this.activityTabs, function (tab) { return !tab.isComplete(); });
2439
+ var SwitchCaseDefaultDirective_1;
2440
+ SwitchCaseDefaultDirective.ctorParameters = function () { return [
2441
+ { type: core.TemplateRef }
2442
+ ]; };
2443
+ SwitchCaseDefaultDirective = SwitchCaseDefaultDirective_1 = __decorate([
2444
+ core.Directive({
2445
+ selector: '[aupSwitchCaseDefault]',
2446
+ providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseDefaultDirective_1 }]
2447
+ }),
2448
+ __metadata("design:paramtypes", [core.TemplateRef])
2449
+ ], SwitchCaseDefaultDirective);
2450
+ return SwitchCaseDefaultDirective;
2451
+ }(SwitchCaseOption));
2452
+ var SwitchCaseComponent = /** @class */ (function (_super) {
2453
+ __extends(SwitchCaseComponent, _super);
2454
+ function SwitchCaseComponent(cdr) {
2455
+ var _this = _super.call(this) || this;
2456
+ _this.cdr = cdr;
2457
+ _this.selectedIndex = 0;
2458
+ return _this;
2459
+ }
2460
+ SwitchCaseComponent.prototype.ngOnInit = function () {
1899
2461
  };
1900
- /**
1901
- * Cancels the current activity and returns true the context is no longer active, false if
1902
- * there is still another activity running.
1903
- */
1904
- // @Trace()
1905
- ActivityContainerComponent.prototype.cancelActiveActivity = function () {
1906
- return __awaiter(this, void 0, void 0, function () {
1907
- var activity;
1908
- return __generator(this, function (_a) {
1909
- activity = this.getActiveActivityRef();
1910
- activity.cancel();
1911
- if (this.isCleaningUp()) {
1912
- return [2 /*return*/, this.waitForInteractionContextCleanupToFinish()];
1913
- }
1914
- else {
1915
- return [2 /*return*/, !this.isActive()];
1916
- }
1917
- return [2 /*return*/];
1918
- });
1919
- });
2462
+ SwitchCaseComponent.prototype.ngAfterContentInit = function () {
2463
+ var _this = this;
2464
+ var subscription = this.switchCaseOptions.changes.subscribe(function (change) { return _this.updateSelection(); });
2465
+ this.onDispose(function () { return subscription.unsubscribe(); });
2466
+ var _a = pectin.Dsl.disposeWith(this), chain = _a.chain, when = _a.when;
2467
+ when.valueOf(this.switchModel).changes(function () { return _this.updateSelection(); }, { initialValue: 'triggerChange' });
2468
+ this.cdr.detectChanges();
1920
2469
  };
1921
- // TODO: this handling of multiple nested activities is only used by the activity component and is not a general case.
1922
- // @Trace()
1923
- ActivityContainerComponent.prototype.createAndLaunchActivity = function (activityType, data, disableClose) {
2470
+ SwitchCaseComponent.prototype.updateSelection = function () {
1924
2471
  var _this = this;
1925
- pectin.assert.isTruthy(this.isInitialised()); // make sure we've been initialised
1926
- var activityRef = new ActivityRef(activityType, data, function () {
1927
- var activeActivityCount = _this.getActiveActivityCount() > 0;
1928
- if (activeActivityCount) {
1929
- _this.triggerTabSynchronisation();
1930
- }
1931
- else {
1932
- _this.finishAndStartCleanup();
2472
+ var matchingIndicies = [];
2473
+ this.switchCaseOptions.forEach(function (option, index) {
2474
+ if (option.matches(_this.switchModel.value)) {
2475
+ matchingIndicies.push(index);
1933
2476
  }
1934
2477
  });
1935
- this.launchActivity(activityRef);
1936
- // if this is the first activity let the interaction service know.
1937
- if (this.activityTabs.length === 1) {
1938
- // console.log('Now active!!!');
1939
- this.interactionServiceApi.notifyActive(this);
2478
+ if (matchingIndicies.length > 1) {
2479
+ console.warn("found " + matchingIndicies.length + " matching case values, displaying the first.");
1940
2480
  }
1941
- return activityRef.activityResult;
1942
- };
1943
- ActivityContainerComponent.prototype.getActiveActivityCount = function () {
1944
- return this.activityTabs.filter(function (ref) { return !ref.isComplete(); }).length;
1945
- };
1946
- /**
1947
- * Checks if this interaction context has finished an is in the process of waiting
1948
- * for all the infrastructure (including route updates) to be completed.
1949
- */
1950
- ActivityContainerComponent.prototype.isCleaningUp = function () {
1951
- return !!this._deferredCleanUp;
1952
- };
1953
- ActivityContainerComponent.prototype.waitForInteractionContextCleanupToFinish = function () {
1954
- return __awaiter(this, void 0, void 0, function () {
1955
- return __generator(this, function (_a) {
1956
- return [2 /*return*/, this._deferredCleanUp ?
1957
- this._deferredCleanUp :
1958
- true];
1959
- });
1960
- });
1961
- };
1962
- // @Trace()
1963
- ActivityContainerComponent.prototype.finishAndStartCleanup = function () {
1964
- var _this = this;
1965
- if (!this._deferredCleanUp) {
1966
- // Important:
1967
- // Clear our tabs so the next activity triggers a tab change.
1968
- // Without this our animation done wasn't called when a single
1969
- // new activity followed a single tab activity (since we're tracking
1970
- // by activity index)
1971
- this.activityTabs = [];
1972
- var promise = this.interactionServiceApi.notifyFinished(this);
1973
- this._deferredCleanUp = promise
1974
- .finally(function () {
1975
- _this._deferredCleanUp = null;
2481
+ if (matchingIndicies.length === 0) {
2482
+ this.switchCaseOptions.forEach(function (option, index) {
2483
+ matchingIndicies.push(index);
1976
2484
  });
2485
+ if (matchingIndicies.length > 1) {
2486
+ console.warn("found " + matchingIndicies.length + " default case values, displaying the first.");
2487
+ }
1977
2488
  }
1978
- };
1979
- // @Trace()
1980
- ActivityContainerComponent.prototype.launchActivity = function (activityRef) {
1981
- var cleanedTabs = this.activityTabs.filter(function (tab) { return !tab.isComplete(); });
1982
- this.activityTabs = cleanedTabs.concat(activityRef);
1983
- this.synchroniseSelectedTabIndex();
1984
- };
1985
- ActivityContainerComponent.prototype.activityIndex = function (index, activityRef) {
1986
- return index;
1987
- };
1988
- ;
1989
- ActivityContainerComponent.prototype.onAnimationFinished = function () {
1990
- if (this.onAnimationFinishedJob) {
1991
- this.onAnimationFinishedJob();
1992
- this.onAnimationFinishedJob = undefined;
1993
- }
1994
- };
1995
- /**
1996
- * Synchronises the selected tab index.
1997
- */
1998
- ActivityContainerComponent.prototype.synchroniseSelectedTabIndex = function () {
1999
- var _this = this;
2000
- var previousIndex = this.tabs.selectedIndex;
2001
- var newIndex = this.getActiveActivityCount() - 1;
2002
- if (previousIndex !== newIndex) {
2003
- this.tabs.selectedIndex = newIndex;
2004
- this.onAnimationFinishedJob = function () {
2005
- _this.getSelectedOutlet().component.onActivityReady();
2006
- _this.activityTabs = _this.activityTabs.filter(function (tab) { return !tab.isComplete(); });
2007
- };
2489
+ if (matchingIndicies.length > 0) {
2490
+ this.selectedIndex = matchingIndicies[0];
2008
2491
  }
2009
- };
2010
- ActivityContainerComponent.prototype.getSelectedOutlet = function () {
2011
- return this.activityOutlets.toArray()[this.tabs.selectedIndex];
2012
- };
2013
- // @Trace()
2014
- ActivityContainerComponent.prototype.triggerTabSynchronisation = function () {
2015
- var _this = this;
2016
- if (this.syncSelectedTabTimeout) {
2017
- clearTimeout(this.syncSelectedTabTimeout);
2492
+ else {
2493
+ console.warn("found no matching or default case values.");
2494
+ this.selectedIndex = -1;
2018
2495
  }
2019
- this.syncSelectedTabTimeout = setTimeout(function () {
2020
- _this.syncSelectedTabTimeout = null;
2021
- _this.synchroniseSelectedTabIndex();
2022
- }, 75);
2023
2496
  };
2497
+ SwitchCaseComponent.ctorParameters = function () { return [
2498
+ { type: core.ChangeDetectorRef }
2499
+ ]; };
2024
2500
  __decorate([
2025
- core.Input(),
2026
- __metadata("design:type", Object)
2027
- ], ActivityContainerComponent.prototype, "dynamicHeight", void 0);
2501
+ core.Input(), pectin.TrackExternal(),
2502
+ __metadata("design:type", pectin.ValueModel)
2503
+ ], SwitchCaseComponent.prototype, "switchModel", void 0);
2028
2504
  __decorate([
2029
- core.ViewChild('tabs', { static: true }),
2030
- __metadata("design:type", tabs.MatTabGroup)
2031
- ], ActivityContainerComponent.prototype, "tabs", void 0);
2505
+ core.Input(), pectin.StoreInValueModel('switchModel'),
2506
+ __metadata("design:type", Object)
2507
+ ], SwitchCaseComponent.prototype, "switch", void 0);
2032
2508
  __decorate([
2033
- core.ViewChildren(ActivityOutletComponent),
2509
+ core.ContentChildren(SwitchCaseOption),
2034
2510
  __metadata("design:type", core.QueryList)
2035
- ], ActivityContainerComponent.prototype, "activityOutlets", void 0);
2511
+ ], SwitchCaseComponent.prototype, "switchCaseOptions", void 0);
2512
+ SwitchCaseComponent = __decorate([
2513
+ core.Component({
2514
+ selector: 'aup-switch-case',
2515
+ template: "<mat-tab-group class=\"content-wrapper\" no-tab-header full-height-tabs [selectedIndex]=\"selectedIndex\">\n <mat-tab *ngFor=\"let option of switchCaseOptions\">\n <ng-template [ngTemplateOutlet]=\"option.templateRef\"></ng-template>\n </mat-tab>\n</mat-tab-group>\n\n\n",
2516
+ styles: [":host{display:flex;flex-direction:column;align-items:stretch}mat-tab-group{flex:1}"]
2517
+ }),
2518
+ __metadata("design:paramtypes", [core.ChangeDetectorRef])
2519
+ ], SwitchCaseComponent);
2520
+ return SwitchCaseComponent;
2521
+ }(DisposableComponent));
2522
+
2523
+ var DefaultCellRendererComponent = /** @class */ (function () {
2524
+ function DefaultCellRendererComponent() {
2525
+ }
2526
+ Object.defineProperty(DefaultCellRendererComponent.prototype, "value", {
2527
+ get: function () {
2528
+ return this._value;
2529
+ },
2530
+ set: function (value) {
2531
+ this._value = value;
2532
+ },
2533
+ enumerable: true,
2534
+ configurable: true
2535
+ });
2036
2536
  __decorate([
2037
- pectin.Trace(),
2038
- __metadata("design:type", Function),
2039
- __metadata("design:paramtypes", []),
2040
- __metadata("design:returntype", void 0)
2041
- ], ActivityContainerComponent.prototype, "dispose", null);
2042
- ActivityContainerComponent = __decorate([
2537
+ core.Input(),
2538
+ __metadata("design:type", Object),
2539
+ __metadata("design:paramtypes", [Object])
2540
+ ], DefaultCellRendererComponent.prototype, "value", null);
2541
+ DefaultCellRendererComponent = __decorate([
2043
2542
  core.Component({
2044
- selector: 'aup-activity-container',
2045
- template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\">\n <mat-tab *ngFor=\"let tab of activityTabs; trackBy: activityIndex\" >\n <aup-activity-outlet [nestedInteractionContext]=\"this\" [activityRef]=\"tab\"></aup-activity-outlet>\n </mat-tab>\n</mat-tab-group>\n",
2046
- styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
2543
+ selector: 'aup-default-cell-renderer',
2544
+ template: "{{value}}\n",
2545
+ styles: [""]
2047
2546
  }),
2048
2547
  __metadata("design:paramtypes", [])
2049
- ], ActivityContainerComponent);
2050
- return ActivityContainerComponent;
2051
- }(AbstractInteractionContext));
2548
+ ], DefaultCellRendererComponent);
2549
+ return DefaultCellRendererComponent;
2550
+ }());
2052
2551
 
2053
- var InteractionServiceRoutingAdapter = /** @class */ (function () {
2054
- function InteractionServiceRoutingAdapter(activeInteractionContextIds, activeModalContext, createExclusiveInteractionContext) {
2055
- this.activeInteractionContextIds = activeInteractionContextIds;
2056
- this.activeModalContext = activeModalContext;
2057
- this.createExclusiveInteractionContext = createExclusiveInteractionContext;
2552
+ var DefaultHeaderCellRendererComponent = /** @class */ (function () {
2553
+ function DefaultHeaderCellRendererComponent() {
2058
2554
  }
2059
- InteractionServiceRoutingAdapter.prototype.isActive = function () {
2060
- return this.getActiveInteractionContextIds().length > 0;
2061
- };
2062
- InteractionServiceRoutingAdapter.prototype.isModalActive = function () {
2063
- return !!this.activeModalContext.value;
2555
+ __decorate([
2556
+ core.Input(),
2557
+ __metadata("design:type", ColumnModel)
2558
+ ], DefaultHeaderCellRendererComponent.prototype, "columnModel", void 0);
2559
+ DefaultHeaderCellRendererComponent = __decorate([
2560
+ core.Component({
2561
+ selector: 'aup-default-header-renderer',
2562
+ template: "{{columnModel.getHeaderText()}}\n",
2563
+ styles: [""]
2564
+ }),
2565
+ __metadata("design:paramtypes", [])
2566
+ ], DefaultHeaderCellRendererComponent);
2567
+ return DefaultHeaderCellRendererComponent;
2568
+ }());
2569
+
2570
+ // export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];
2571
+ // export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];
2572
+ /**
2573
+ * Example:
2574
+ * @example
2575
+ * const model = TableModel.fromList(heroList, table => {
2576
+ * table.pluck("firstName");
2577
+ * table.pluck("lastName");
2578
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2579
+ * });
2580
+ *
2581
+ * Editable tables
2582
+ * @example
2583
+ * const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
2584
+ * if (form.validate()) {
2585
+ * // normal form save stuff
2586
+ * return true; // finish editing
2587
+ * }
2588
+ * return false; // continue editiing
2589
+ * }
2590
+ * const colorsNames: ListModel<string> = ...;
2591
+ * const model = TableModel.fromList(heroList, table => {
2592
+ * table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
2593
+ * table.pluck("lastName").cellEditor(StringInputComponent, {
2594
+ * validators: [Validator.present("We need a last name")]
2595
+ * });
2596
+ * table.pluck("age").cellEditor(NumberInputComponent);
2597
+ * table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
2598
+ * initialiseComponent(component: SelectInputComponent) {
2599
+ * selectInput.optionsModel = colorsNames; // <- initialise our component
2600
+ * }
2601
+ * });
2602
+ * table.addEditControls(saveCommand); // <- required to enable editing
2603
+ * });
2604
+ *
2605
+ * Selection models
2606
+ * @example
2607
+ * const model = TableModel.fromList(heroList, table => {
2608
+ * table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
2609
+ * table.pluck("firstName");
2610
+ * table.pluck("lastName");
2611
+ * });
2612
+ *
2613
+ * Custom cell renderers and editors
2614
+ * @example
2615
+ * const model = TableModel.fromList(heroList, table => {
2616
+ * table.pluck("favoriteColor")
2617
+ * .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
2618
+ * // configure your component with what ever you need.
2619
+ * });
2620
+ * .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
2621
+ * .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
2622
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2623
+ * });
2624
+ *
2625
+ * I18n
2626
+ * @example
2627
+ * [table.yml]
2628
+ * table:
2629
+ * columns(ColumnTextProperties[]):
2630
+ * firstName:
2631
+ * headerText: "First Name"
2632
+ * fullName:
2633
+ * headerText: "Full Name"
2634
+ *
2635
+ * const model = TableModel.fromList(heroList, table => {
2636
+ * table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
2637
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2638
+ *
2639
+ * table.columnTextProperties(I18n.table.columns); // <- configures all columns
2640
+ * });
2641
+ */
2642
+ exports.TableModel = /** @class */ (function () {
2643
+ function TableModel(sourceOfTruth) {
2644
+ this.sourceOfTruth = sourceOfTruth;
2645
+ this._garbage = new pectin.GarbageCollector();
2646
+ this._columns = new pectin.MutableListModel();
2647
+ this._editorSessions = new pectin.MutableListModel();
2648
+ this.identityOf = sourceOfTruth.identityOf;
2649
+ var _a = pectin.Dsl.disposeWith(this._garbage), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2650
+ this._columnsById = chain(this._columns).indexBy('columnId');
2651
+ this._rowsBeingEdited = new pectin.MutableListModel([], {
2652
+ identifiedWith: this.identityOf
2653
+ });
2654
+ this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
2655
+ this.editing = chain(this._editorSessions).count().isGreaterThan(0);
2656
+ this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
2657
+ }
2658
+ TableModel_1 = TableModel;
2659
+ TableModel.fromList = function (sourceOfTruth, builder) {
2660
+ var model = new TableModel_1(sourceOfTruth);
2661
+ builder(model);
2662
+ return model;
2064
2663
  };
2065
- // @Trace()
2066
- InteractionServiceRoutingAdapter.prototype.isComponentInteracting = function (component) {
2067
- return component.interactionContext && component.interactionContext.isActive();
2664
+ Object.defineProperty(TableModel.prototype, "rowsBeingEdited", {
2665
+ get: function () {
2666
+ return this._rowsBeingEdited.readonly;
2667
+ },
2668
+ enumerable: true,
2669
+ configurable: true
2670
+ });
2671
+ TableModel.prototype.getTrackByFunction = function () {
2672
+ var _this = this;
2673
+ return function (index, item) {
2674
+ return _this.identityOf ? _this.identityOf(item) : index;
2675
+ };
2068
2676
  };
2069
- InteractionServiceRoutingAdapter.prototype.getActiveInteractionContextIds = function () {
2070
- return this.activeInteractionContextIds.value;
2677
+ Object.defineProperty(TableModel.prototype, "columns", {
2678
+ get: function () {
2679
+ return this._columns.readonly;
2680
+ },
2681
+ enumerable: true,
2682
+ configurable: true
2683
+ });
2684
+ TableModel.prototype.pluck = function (property) {
2685
+ return this.addColumn(new PropertyColumnModel(property, this));
2071
2686
  };
2072
- // @Trace()
2073
- InteractionServiceRoutingAdapter.prototype.cancelCurrentModalInteraction = function () {
2074
- return this.activeModalContext.value.cancelActiveActivity();
2687
+ TableModel.prototype.addSelectionColumn = function (selectionModel) {
2688
+ return this.addColumn(new SelectionColumnModel('selection', this, selectionModel));
2075
2689
  };
2076
- // @Trace()
2077
- InteractionServiceRoutingAdapter.prototype.cancelComponentInteraction = function (component) {
2078
- return component.interactionContext.cancelActiveActivity();
2690
+ TableModel.prototype.addEditControls = function (saveCommand) {
2691
+ this.saveCommand = saveCommand;
2692
+ return this.addColumn(new EditorControlColumnModel('editControls', saveCommand, this));
2079
2693
  };
2080
- return InteractionServiceRoutingAdapter;
2081
- }());
2082
-
2083
- var ModalInteractionContextFactory = /** @class */ (function () {
2084
- function ModalInteractionContextFactory() {
2085
- }
2086
- return ModalInteractionContextFactory;
2087
- }());
2088
-
2089
- var inplaceMonitorCount = 0;
2090
- exports.ɵbg = /** @class */ (function () {
2091
- function InteractionService(modelInteractionContextFactory) {
2092
- this.modelInteractionContextFactory = modelInteractionContextFactory;
2093
- this.garbage = new pectin.GarbageCollector();
2094
- // private readonly _activeModalContext = new MutableValueModel<InteractionContext>();
2095
- // private readonly _activeInlineContext = new MutableValueModel<InteractionContext>();
2096
- // private readonly _activeContext: ValueModelChain<InteractionContext>;
2097
- this._navigationInProgress = new pectin.DelegatingValueModel().withDefault(false);
2098
- var _a = pectin.Dsl.disposeWith(this.garbage), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2099
- this.exclusiveInteractionRegistry = new InteractionService_1.ContextRegistry();
2100
- this.modalInteractionRegistry = new InteractionService_1.ContextRegistry();
2101
- this.inPlaceInteractionRegistry = new InteractionService_1.ContextRegistry();
2102
- this.modalInteractionRegistry.disableWhen(valueOf.any(this.exclusiveInteractionRegistry.active, this.modalInteractionRegistry.active).areTruthy());
2103
- this.inPlaceInteractionRegistry.disableWhen(valueOf.any(this.exclusiveInteractionRegistry.active, this.modalInteractionRegistry.active, this.inPlaceInteractionRegistry.active).areTruthy());
2104
- this.active = valueOf.any(this.inPlaceInteractionRegistry.active, this.modalInteractionRegistry.active).areTruthy();
2105
- // TODO: chain.concat(listOrValueModels) would be nice.
2106
- this.activeInteractionContextIds = chain(this.inPlaceInteractionRegistry.interactionContextIds)
2107
- .concat(this.modalInteractionRegistry.interactionContextIds);
2108
- this.activeModalContext = chain(this.modalInteractionRegistry.interactionContexts).first();
2109
- this.inModalInteraction = chain(this.activeModalContext).isNotNil();
2110
- }
2111
- InteractionService_1 = InteractionService;
2112
- InteractionService.prototype.isActive = function () {
2113
- return this.active.value;
2694
+ TableModel.prototype.addCustomColumn = function (columnId, dataAccessor) {
2695
+ return this.addColumn(new CustomValueColumnModel(columnId, this, dataAccessor));
2114
2696
  };
2115
- /**
2116
- * @deprecated use #createModalInteractionContextDisposedWith instead.
2117
- * @param disposable
2118
- */
2119
- InteractionService.prototype.createModalInteractionContextFor = function (disposable) {
2120
- return this.createModalInteractionContextDisposedWith(disposable);
2697
+ TableModel.prototype.addColumn = function (column) {
2698
+ if (this._columnsById.get(column.columnId)) {
2699
+ pectin.lang.illegalState("Column with id=" + column.columnId + " already exists");
2700
+ }
2701
+ else {
2702
+ this._columns.push(column);
2703
+ }
2704
+ return column;
2121
2705
  };
2122
- /**
2123
- * Creates a new model interaction context that will be disposed along with the component.
2124
- * @param disposable
2125
- */
2126
- InteractionService.prototype.createModalInteractionContextDisposedWith = function (disposable) {
2127
- // TODO: look at making the registry the factory..
2128
- return this.modelInteractionContextFactory.createInteractionContext('modal', new InteractionService_1.ApiAdapter(this.placeRouter, this.modalInteractionRegistry));
2706
+ TableModel.prototype.columnTextProperties = function (columnTextProperties) {
2707
+ this._columnTextPropertiesLookup = columnTextProperties;
2129
2708
  };
2130
- InteractionService.prototype.registerInplaceInteractionContext = function (interactionContext) {
2131
- // TODO: look at making the registry the factory..
2132
- // Todo: check for double registration.
2133
- // Todo: allow multiple inplace interactions..
2134
- interactionContext.initialise("ip" + ++inplaceMonitorCount, new InteractionService_1.ApiAdapter(this.placeRouter, this.inPlaceInteractionRegistry));
2709
+ TableModel.prototype.getColumnTextProperties = function (column) {
2710
+ var factory = this._columnTextPropertiesLookup[column.columnId];
2711
+ return factory ? factory() : undefined;
2135
2712
  };
2136
- /**
2137
- * Creates an interaction context that will prevent any other contexts from starting an
2138
- * activity until it is disposed. This is intended for use by the router for passing
2139
- * to PlaceComponent.canDeactivate(interactionContext). This ensures components don't
2140
- * try and interact in a way that we can't track and synchronise with the browser back
2141
- * button.
2142
- */
2143
- InteractionService.prototype.registerPlaceRouter = function (router) {
2713
+ TableModel.prototype.startEditSession = function (row) {
2144
2714
  var _this = this;
2145
- typescriptUtilities.assert.isFalsey(this.placeRouter);
2146
- this.placeRouter = router;
2147
- this._navigationInProgress.setDelegate(this.placeRouter.navigationInProgress);
2148
- var self = this;
2149
- return new InteractionServiceRoutingAdapter(this.activeInteractionContextIds, this.activeModalContext, function () {
2150
- return self.modelInteractionContextFactory.createInteractionContext('exclusive', new InteractionService_1.ApiAdapter(_this.placeRouter, _this.exclusiveInteractionRegistry));
2151
- });
2152
- };
2153
- var InteractionService_1;
2154
- InteractionService.ctorParameters = function () { return [
2155
- { type: ModalInteractionContextFactory }
2156
- ]; };
2157
- InteractionService.ɵprov = core.ɵɵdefineInjectable({ factory: function InteractionService_Factory() { return new InteractionService(core.ɵɵinject(ModalInteractionContextFactory)); }, token: InteractionService, providedIn: "root" });
2158
- InteractionService = InteractionService_1 = __decorate([
2159
- core.Injectable({
2160
- providedIn: 'root'
2161
- }),
2162
- __metadata("design:paramtypes", [ModalInteractionContextFactory])
2163
- ], InteractionService);
2164
- return InteractionService;
2165
- }());
2166
- (function (InteractionService) {
2167
- /**
2168
- * Provides a mechanism for the service to keep track of what the API adapters are doing to
2169
- * ensure the rules are followed, i.e. modal or in-place interaction aren't started while
2170
- * an exclusive routing interaction is active.
2171
- */
2172
- var ContextRegistry = /** @class */ (function (_super) {
2173
- __extends(ContextRegistry, _super);
2174
- function ContextRegistry() {
2175
- var _this = _super.call(this) || this;
2176
- _this._interactions = new pectin.MutableListModel();
2177
- _this._disabledDelegate = new pectin.DelegatingValueModel().withDefault(false);
2178
- var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2179
- _this.active = chain(_this._interactions).isNotEmpty();
2180
- _this.interactionContextIds = chain(_this._interactions).pluck("identifier");
2181
- return _this;
2715
+ var rowId = this.identityOf(row);
2716
+ if (this._rowsBeingEdited.query().indexOf(row) > -1) {
2717
+ return pectin.lang.illegalState("Row with id=" + rowId + " already being edited");
2182
2718
  }
2183
- Object.defineProperty(ContextRegistry.prototype, "interactionContexts", {
2184
- get: function () {
2185
- return this._interactions.readonly;
2186
- },
2187
- enumerable: true,
2188
- configurable: true
2189
- });
2190
- ContextRegistry.prototype.start = function (context) {
2191
- this._interactions.push(context);
2192
- };
2193
- ContextRegistry.prototype.finish = function (context) {
2194
- this._interactions.remove(context);
2195
- };
2196
- ContextRegistry.prototype.isActive = function () {
2197
- return this.active.value;
2198
- };
2199
- ContextRegistry.prototype.disableWhen = function (disabled) {
2200
- this._disabledDelegate.setDelegate(disabled);
2201
- };
2202
- return ContextRegistry;
2203
- }(pectin.GarbageCollector));
2204
- InteractionService.ContextRegistry = ContextRegistry;
2205
- var ApiAdapter = /** @class */ (function () {
2206
- function ApiAdapter(placeRouter, contextRegistry) {
2207
- this.placeRouter = placeRouter;
2208
- this.contextRegistry = contextRegistry;
2719
+ else {
2720
+ var editSession_1 = new TableModel_1.EditSession(rowId, row, this.saveCommand);
2721
+ var when = pectin.Dsl.disposeWith(editSession_1).when;
2722
+ when.valueOf(editSession_1.rowValueModel).changes(function (editedValue) {
2723
+ _this._rowsBeingEdited.replaceOrPush(editedValue);
2724
+ }, { initialValue: 'triggerChangeUnlessNil' });
2725
+ this._editorSessions.push(editSession_1);
2726
+ editSession_1.onDispose(function () {
2727
+ _this._rowsBeingEdited.remove(editSession_1.rowValueModel.value);
2728
+ _this._editorSessions.remove(editSession_1);
2729
+ });
2730
+ return editSession_1;
2209
2731
  }
2210
- // @Trace()
2211
- ApiAdapter.prototype.notifyActive = function (context) {
2212
- typescriptUtilities.assert.isTruthy(context.identifier);
2213
- this.contextRegistry.start(context);
2214
- return this.isNavigationInProgress() ? Promise.resolve() : this.placeRouter.syncInteractionContextIdsWithRouter();
2215
- };
2216
- // @Trace()
2217
- ApiAdapter.prototype.isNavigationInProgress = function () {
2218
- return this.placeRouter.navigationInProgress.value;
2219
- };
2220
- // @Trace()
2221
- ApiAdapter.prototype.notifyFinished = function (context) {
2222
- this.contextRegistry.finish(context);
2223
- // :: Important ::
2224
- // This method will be traversed by both the place router (during can canDeactivate guards) and user land code
2225
- // (both when routing is idle and while it is active in PlaceComponent.canDeactivate()).
2226
- // The result of pushInteractionIdsToRoute will not start until after the current route finishes, and the
2227
- // current route won't finish until after this promise returns... Deadlock.
2228
- // So in order to keep this logic out of the activities we perform the check here and ensure that
2229
- // any interactions with the context while routing is active returns immediately.
2230
- return this.isNavigationInProgress() ? Promise.resolve() : this.placeRouter.syncInteractionContextIdsWithRouter();
2231
- };
2232
- return ApiAdapter;
2233
- }());
2234
- InteractionService.ApiAdapter = ApiAdapter;
2235
- })(exports.ɵbg || (exports.ɵbg = {}));
2732
+ };
2733
+ TableModel.prototype.getEditSessionFor = function (row) {
2734
+ return this._editorSessionByRowId.get(this.identityOf(row));
2735
+ };
2736
+ TableModel.prototype.cancelAllEditorSessions = function () {
2737
+ var _this = this;
2738
+ this._editorSessions.runInTransaction(function (draft) {
2739
+ _this._rowsBeingEdited.runInTransaction(function () {
2740
+ draft.value.forEach(function (session) { return session.dispose(); });
2741
+ });
2742
+ });
2743
+ };
2744
+ var TableModel_1;
2745
+ TableModel.ctorParameters = function () { return [
2746
+ { type: pectin.ListModel }
2747
+ ]; };
2748
+ TableModel = TableModel_1 = __decorate([
2749
+ pectin.TrackExternal.Strategy(new pectin.TrackExternal.OneTimeBinding()),
2750
+ __metadata("design:paramtypes", [pectin.ListModel])
2751
+ ], TableModel);
2752
+ return TableModel;
2753
+ }());
2754
+ (function (TableModel) {
2755
+ var EditSession = /** @class */ (function (_super) {
2756
+ __extends(EditSession, _super);
2757
+ function EditSession(rowId, row, saveCommand) {
2758
+ var _this = _super.call(this) || this;
2759
+ _this.rowId = rowId;
2760
+ _this.saveCommand = saveCommand;
2761
+ _this._editorValue = new pectin.MutableValueModel();
2762
+ _this.rowValueModel = _this._editorValue.readonly;
2763
+ _this.form = new pectin.Form();
2764
+ _this.form.load(row);
2765
+ _this._editorValue.value = row;
2766
+ _this.form.onEdit(function () {
2767
+ _this._editorValue.value = produce(_this._editorValue.value, function (draft) {
2768
+ _this.form.writeDirtyStateTo(draft);
2769
+ });
2770
+ });
2771
+ return _this;
2772
+ }
2773
+ return EditSession;
2774
+ }(pectin.GarbageCollector));
2775
+ TableModel.EditSession = EditSession;
2776
+ })(exports.TableModel || (exports.TableModel = {}));
2236
2777
 
2237
- var InPlaceInteractionContextComponent = /** @class */ (function (_super) {
2238
- __extends(InPlaceInteractionContextComponent, _super);
2239
- function InPlaceInteractionContextComponent(interactionService, tabConfig) {
2778
+ var EditRowControls = /** @class */ (function (_super) {
2779
+ __extends(EditRowControls, _super);
2780
+ function EditRowControls() {
2240
2781
  var _this = _super.call(this) || this;
2241
- _this.interactionService = interactionService;
2242
- _this.tabConfig = tabConfig;
2243
- /**
2244
- * If true then the first startActivity call will slide the activity into view. If false
2245
- * the activity will replace the existing content immediately.
2246
- */
2247
- _this.animateFirstActivity = true;
2782
+ _this.saveCommand = pectin.Command.create(function () {
2783
+ _this.editSession.saveCommand.execute(_this.editSession.form)
2784
+ .then(function (finished) {
2785
+ if (finished) {
2786
+ _this.editSession.dispose();
2787
+ }
2788
+ });
2789
+ });
2790
+ _this.cancelCommand = pectin.Command.create(function () {
2791
+ _this.editSession.dispose();
2792
+ });
2248
2793
  return _this;
2249
2794
  }
2250
- Object.defineProperty(InPlaceInteractionContextComponent.prototype, "animationDuration", {
2795
+ EditRowControls.prototype.ngOnInit = function () {
2796
+ };
2797
+ Object.defineProperty(EditRowControls.prototype, "form", {
2251
2798
  get: function () {
2252
2799
  var _a;
2253
- return this.animateFirstActivity ? (((_a = this.tabConfig) === null || _a === void 0 ? void 0 : _a.animationDuration) || '500ms') : "0ms";
2800
+ return (_a = this.editSession) === null || _a === void 0 ? void 0 : _a.form;
2254
2801
  },
2255
2802
  enumerable: true,
2256
2803
  configurable: true
2257
2804
  });
2258
- InPlaceInteractionContextComponent.prototype.ngAfterViewInit = function () {
2259
- this.interactionService.registerInplaceInteractionContext(this);
2260
- };
2261
- InPlaceInteractionContextComponent.prototype.initialise = function (id, api) {
2262
- this.activityContainerComponent.initialise(id, api);
2263
- };
2264
- Object.defineProperty(InPlaceInteractionContextComponent.prototype, "identifier", {
2805
+ __decorate([
2806
+ core.Input(),
2807
+ __metadata("design:type", Object)
2808
+ ], EditRowControls.prototype, "row", void 0);
2809
+ __decorate([
2810
+ core.Input(),
2811
+ pectin.TrackExternal(),
2812
+ __metadata("design:type", pectin.Command)
2813
+ ], EditRowControls.prototype, "editRowCommand", void 0);
2814
+ __decorate([
2815
+ core.Input(),
2816
+ __metadata("design:type", exports.TableModel.EditSession)
2817
+ ], EditRowControls.prototype, "editSession", void 0);
2818
+ EditRowControls = __decorate([
2819
+ core.Component({
2820
+ selector: 'aup-row-editor-controls',
2821
+ template: "<button *ngIf=\"!editSession\" mat-icon-button [pectinCommand]=\"editRowCommand\" class=\"edit-button\"><mat-icon>edit</mat-icon></button>\n<button *ngIf=\"editSession\" mat-icon-button [pectinCommand]=\"saveCommand\"><mat-icon>done</mat-icon></button>\n<button *ngIf=\"editSession\" mat-icon-button [pectinCommand]=\"cancelCommand\"><mat-icon>clear</mat-icon></button>\n",
2822
+ styles: [":host{display:block;width:80px}.edit-button{visibility:hidden}:host-context(tr:hover) .edit-button{visibility:visible}"]
2823
+ }),
2824
+ __metadata("design:paramtypes", [])
2825
+ ], EditRowControls);
2826
+ return EditRowControls;
2827
+ }(DisposableComponent));
2828
+
2829
+ var SelectCellRendererComponent = /** @class */ (function (_super) {
2830
+ __extends(SelectCellRendererComponent, _super);
2831
+ function SelectCellRendererComponent() {
2832
+ var _this = _super.call(this) || this;
2833
+ _this.selectCommand = pectin.Command.create(function () {
2834
+ _this.selectionModel.selectCommand.execute(_this.row);
2835
+ });
2836
+ return _this;
2837
+ }
2838
+ Object.defineProperty(SelectCellRendererComponent.prototype, "row", {
2265
2839
  get: function () {
2266
- return this.activityContainerComponent.identifier;
2840
+ return this._row;
2841
+ },
2842
+ set: function (value) {
2843
+ this._row = value;
2267
2844
  },
2268
2845
  enumerable: true,
2269
2846
  configurable: true
2270
2847
  });
2271
- InPlaceInteractionContextComponent.prototype.alert = function (alert) {
2272
- return this.activityContainerComponent.alert(alert);
2273
- };
2274
- InPlaceInteractionContextComponent.prototype.cancelActiveActivity = function () {
2275
- return this.activityContainerComponent.cancelActiveActivity();
2276
- };
2277
- InPlaceInteractionContextComponent.prototype.confirm = function (confirm) {
2278
- return this.activityContainerComponent.confirm(confirm);
2279
- };
2280
- InPlaceInteractionContextComponent.prototype.confirmOrReject = function (confirm) {
2281
- return this.activityContainerComponent.confirmOrReject(confirm);
2282
- };
2283
- InPlaceInteractionContextComponent.prototype.confirmThen = function (confirm, activityType, data) {
2284
- return this.activityContainerComponent.confirmThen(confirm, activityType);
2285
- };
2286
- InPlaceInteractionContextComponent.prototype.isActive = function () {
2287
- return this.activityContainerComponent.isActive();
2288
- };
2289
- InPlaceInteractionContextComponent.prototype.startActivity = function (activityType, data) {
2290
- return this.activityContainerComponent.startActivity(activityType, data);
2848
+ SelectCellRendererComponent.prototype.isSelected = function () {
2849
+ return this.selectionModel.isSelected(this.row);
2291
2850
  };
2292
- InPlaceInteractionContextComponent.ctorParameters = function () { return [
2293
- { type: exports.ɵbg },
2294
- { type: undefined, decorators: [{ type: core.Inject, args: [tabs.MAT_TABS_CONFIG,] }, { type: core.Optional }] }
2295
- ]; };
2296
2851
  __decorate([
2297
- core.ViewChild('activityContainer', { static: true }),
2298
- __metadata("design:type", ActivityContainerComponent)
2299
- ], InPlaceInteractionContextComponent.prototype, "activityContainerComponent", void 0);
2852
+ core.Input(),
2853
+ __metadata("design:type", Object),
2854
+ __metadata("design:paramtypes", [Object])
2855
+ ], SelectCellRendererComponent.prototype, "row", null);
2300
2856
  __decorate([
2301
2857
  core.Input(),
2302
2858
  __metadata("design:type", Object)
2303
- ], InPlaceInteractionContextComponent.prototype, "animateFirstActivity", void 0);
2304
- InPlaceInteractionContextComponent = __decorate([
2859
+ ], SelectCellRendererComponent.prototype, "selectionModel", void 0);
2860
+ SelectCellRendererComponent = __decorate([
2305
2861
  core.Component({
2306
- selector: 'aup-in-place-interaction-context',
2307
- template: "<mat-tab-group no-tab-header [selectedIndex]=\"isActive() ? 1 : 0\" full-height-tabs [dynamicHeight]=\"false\" [animationDuration]=\"animationDuration\">\n <mat-tab>\n <ng-content></ng-content>\n </mat-tab>\n <mat-tab>\n <aup-activity-container #activityContainer [dynamicHeight]=\"false\"></aup-activity-container>\n </mat-tab>\n</mat-tab-group>\n\n",
2308
- styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
2862
+ selector: 'aup-select-cell-renderer',
2863
+ template: "<mat-checkbox [pectinCommand]=\"selectCommand\" [checked]=\"isSelected()\"></mat-checkbox>\n",
2864
+ styles: [""]
2309
2865
  }),
2310
- __param(1, core.Inject(tabs.MAT_TABS_CONFIG)), __param(1, core.Optional()),
2311
- __metadata("design:paramtypes", [exports.ɵbg, Object])
2312
- ], InPlaceInteractionContextComponent);
2313
- return InPlaceInteractionContextComponent;
2866
+ __metadata("design:paramtypes", [])
2867
+ ], SelectCellRendererComponent);
2868
+ return SelectCellRendererComponent;
2314
2869
  }(DisposableComponent));
2315
2870
 
2316
- var DialogInteractionContext = /** @class */ (function (_super) {
2317
- __extends(DialogInteractionContext, _super);
2318
- function DialogInteractionContext(identifier, api, dialogService, config) {
2871
+ var SelectHeaderCellRendererComponent = /** @class */ (function (_super) {
2872
+ __extends(SelectHeaderCellRendererComponent, _super);
2873
+ function SelectHeaderCellRendererComponent() {
2319
2874
  var _this = _super.call(this) || this;
2320
- _this.identifier = identifier;
2321
- _this.api = api;
2322
- _this.dialogService = dialogService;
2323
- _this.config = config;
2324
- _this.garbage = new pectin.GarbageCollector();
2325
- typescriptUtilities.assert.notNil(dialogService);
2875
+ _this.selectCommand = pectin.Command.create(function () {
2876
+ _this.selectionModel.toggleAllCommand.execute();
2877
+ });
2326
2878
  return _this;
2327
2879
  }
2328
- DialogInteractionContext.prototype.cancelActiveActivity = function () {
2329
- return this.activityContainer.cancelActiveActivity();
2880
+ SelectHeaderCellRendererComponent.prototype.isSelected = function () {
2881
+ return this.selectionModel.allSelected.value;
2330
2882
  };
2331
- DialogInteractionContext.prototype.dispose = function () {
2332
- if (this.isActive()) {
2333
- pectin.lang.illegalState('Dispose called while active.');
2334
- }
2335
- this.garbage.dispose();
2883
+ SelectHeaderCellRendererComponent.prototype.isIntermediate = function () {
2884
+ return this.selectionModel.someSelected.value;
2336
2885
  };
2337
- DialogInteractionContext.prototype.registerDisposable = function (disposable) {
2338
- return this.garbage.registerDisposable(disposable);
2886
+ __decorate([
2887
+ core.Input(),
2888
+ __metadata("design:type", pectin.MultipleSelectionModel)
2889
+ ], SelectHeaderCellRendererComponent.prototype, "selectionModel", void 0);
2890
+ SelectHeaderCellRendererComponent = __decorate([
2891
+ core.Component({
2892
+ selector: 'aup-select-header-cell-renderer',
2893
+ template: "<mat-checkbox [pectinCommand]=\"selectCommand\" [checked]=\"isSelected()\" [indeterminate]=\"this.isIntermediate()\"></mat-checkbox>\n",
2894
+ styles: [""]
2895
+ }),
2896
+ __metadata("design:paramtypes", [])
2897
+ ], SelectHeaderCellRendererComponent);
2898
+ return SelectHeaderCellRendererComponent;
2899
+ }(DisposableComponent));
2900
+
2901
+ var ColumnModel = /** @class */ (function () {
2902
+ function ColumnModel(columnId, defaults) {
2903
+ this.columnId = columnId;
2904
+ this.defaults = defaults;
2905
+ this.cellHeaderRenderer(DefaultHeaderCellRendererComponent, function (component, column) {
2906
+ component.columnModel = column;
2907
+ });
2908
+ }
2909
+ ColumnModel.prototype.getHeaderText = function () {
2910
+ var _a;
2911
+ return ((_a = this.getColumnTextProperties()) === null || _a === void 0 ? void 0 : _a.headerText()) || this.getDefaultHeaderText();
2339
2912
  };
2340
- DialogInteractionContext.prototype.isActive = function () {
2341
- return !!this.activityContainer && this.activityContainer.isActive();
2913
+ ColumnModel.prototype.getDefaultHeaderText = function () {
2914
+ return this.columnId;
2342
2915
  };
2343
- DialogInteractionContext.prototype.createAndLaunchActivity = function (activityType, data, disableClose) {
2916
+ ColumnModel.prototype.getColumnTextProperties = function () {
2917
+ return this._columnTextProperties || this.defaults.getColumnTextProperties(this);
2918
+ };
2919
+ ColumnModel.prototype.textProperties = function (columnTextProperties) {
2920
+ this._columnTextProperties = columnTextProperties;
2921
+ return this;
2922
+ };
2923
+ ColumnModel.prototype.setCellRenderer = function (cellRenderer, initialiser) {
2924
+ this._cellRendererConfig = {
2925
+ portal: new portal.ComponentPortal(cellRenderer),
2926
+ pushState: initialiser
2927
+ };
2928
+ };
2929
+ ColumnModel.prototype.cellHeaderRenderer = function (cellRenderer, initialiser) {
2930
+ this._columnHeaderConfig = {
2931
+ portal: new portal.ComponentPortal(cellRenderer),
2932
+ initialiseComponent: initialiser
2933
+ };
2934
+ };
2935
+ ColumnModel.prototype.setCellEditor = function (cellEditor) {
2936
+ this._cellEditorConfig = cellEditor;
2937
+ };
2938
+ Object.defineProperty(ColumnModel.prototype, "cellRendererPortal", {
2939
+ get: function () {
2940
+ return this._cellRendererConfig.portal;
2941
+ },
2942
+ enumerable: true,
2943
+ configurable: true
2944
+ });
2945
+ Object.defineProperty(ColumnModel.prototype, "columnHeaderCellRendererPortal", {
2946
+ get: function () {
2947
+ return this._columnHeaderConfig.portal;
2948
+ },
2949
+ enumerable: true,
2950
+ configurable: true
2951
+ });
2952
+ Object.defineProperty(ColumnModel.prototype, "cellEditorPortal", {
2953
+ get: function () {
2954
+ var _a;
2955
+ return (_a = this._cellEditorConfig) === null || _a === void 0 ? void 0 : _a.portal;
2956
+ },
2957
+ enumerable: true,
2958
+ configurable: true
2959
+ });
2960
+ ColumnModel.prototype.hasEditor = function () {
2961
+ return !!this._cellEditorConfig;
2962
+ };
2963
+ ColumnModel.prototype.updateCellRenderer = function (component, row, editRowCommand, editSession) {
2964
+ this._cellRendererConfig.pushState(component, row, editRowCommand, editSession);
2965
+ };
2966
+ ColumnModel.prototype.initialiseHeader = function (component) {
2967
+ this._columnHeaderConfig.initialiseComponent(component, this);
2968
+ };
2969
+ ColumnModel.prototype.initialiseEditor = function (component, editSession) {
2970
+ this._cellEditorConfig.initialiseComponent(component, editSession);
2971
+ };
2972
+ __decorate([
2973
+ src.Memoize(),
2974
+ __metadata("design:type", Function),
2975
+ __metadata("design:paramtypes", []),
2976
+ __metadata("design:returntype", String)
2977
+ ], ColumnModel.prototype, "getHeaderText", null);
2978
+ __decorate([
2979
+ src.Memoize(),
2980
+ __metadata("design:type", Function),
2981
+ __metadata("design:paramtypes", []),
2982
+ __metadata("design:returntype", Object)
2983
+ ], ColumnModel.prototype, "getColumnTextProperties", null);
2984
+ return ColumnModel;
2985
+ }());
2986
+ var PropertyColumnModel = /** @class */ (function (_super) {
2987
+ __extends(PropertyColumnModel, _super);
2988
+ function PropertyColumnModel(property, defaults) {
2989
+ var _this = _super.call(this, property.toString(), defaults) || this;
2990
+ _this.property = property;
2991
+ _this.cellRenderer(DefaultCellRendererComponent);
2992
+ return _this;
2993
+ }
2994
+ PropertyColumnModel.prototype.cellRenderer = function (componentType) {
2344
2995
  var _this = this;
2345
- typescriptUtilities.assert.isNil(this._currentActivityRef);
2346
- var config = __assign(__assign({}, this.config), {
2347
- disableClose: disableClose,
2348
- panelClass: 'dialog-interaction-context'
2996
+ this.setCellRenderer(componentType, function (component, row) {
2997
+ component.value = row[_this.property];
2349
2998
  });
2350
- var self = this;
2351
- var matDialogRef = this.dialogService.open(ActivityContainerComponent, config);
2352
- var activityContainer = this.activityContainer = matDialogRef.componentInstance;
2353
- this.activityContainer.initialise(this.identifier, this.api);
2354
- var activityResult = this.activityContainer.startActivity(activityType, data);
2355
- activityResult.finally(function () { return matDialogRef.close(); });
2356
- // we need to check if our onDone/onCancel methods above we called or if we were
2357
- // closed by the user clicking the backdrop. If the later then we need to cancel our
2358
- // activity.
2359
- matDialogRef.afterClosed().subscribe(function (promiseAlreadyFinished) {
2360
- if (activityContainer.isActive()) {
2361
- activityContainer.cancelActiveActivity();
2999
+ };
3000
+ PropertyColumnModel.prototype.cellEditor = function (editor, options) {
3001
+ var _this = this;
3002
+ this.setCellEditor({
3003
+ portal: new portal.ComponentPortal(editor),
3004
+ initialiseComponent: function (component, editSession) {
3005
+ var formValueModel = editSession.form.pluck(_this.property);
3006
+ if (options === null || options === void 0 ? void 0 : options.validators) {
3007
+ formValueModel.validateUsing(options.validators);
3008
+ }
3009
+ component.valueModel = formValueModel;
3010
+ if (options === null || options === void 0 ? void 0 : options.initialiseComponent) {
3011
+ options.initialiseComponent(component);
3012
+ }
2362
3013
  }
2363
- _this.activityContainer = null;
2364
3014
  });
2365
- matDialogRef.updateSize();
2366
- matDialogRef.afterOpened().subscribe(function (promiseAlreadyFinished) {
2367
- matDialogRef.updateSize();
3015
+ return this;
3016
+ };
3017
+ return PropertyColumnModel;
3018
+ }(ColumnModel));
3019
+ var CustomValueColumnModel = /** @class */ (function (_super) {
3020
+ __extends(CustomValueColumnModel, _super);
3021
+ function CustomValueColumnModel(columnId, defaults, getValue) {
3022
+ var _this = _super.call(this, columnId, defaults) || this;
3023
+ _this.getValue = getValue;
3024
+ _this.cellRenderer(DefaultCellRendererComponent);
3025
+ return _this;
3026
+ }
3027
+ CustomValueColumnModel.prototype.cellRenderer = function (componentType) {
3028
+ var _this = this;
3029
+ this.setCellRenderer(componentType, function (component, row) {
3030
+ component.value = _this.getValue(row);
2368
3031
  });
2369
- return activityResult;
2370
3032
  };
2371
- return DialogInteractionContext;
2372
- }(AbstractInteractionContext));
3033
+ return CustomValueColumnModel;
3034
+ }(ColumnModel));
3035
+ var EditorControlColumnModel = /** @class */ (function (_super) {
3036
+ __extends(EditorControlColumnModel, _super);
3037
+ function EditorControlColumnModel(columnId, saveCommand, defaults) {
3038
+ var _this = _super.call(this, columnId, defaults) || this;
3039
+ _this.cellRenderer(EditRowControls);
3040
+ return _this;
3041
+ }
3042
+ EditorControlColumnModel.prototype.cellRenderer = function (componentType) {
3043
+ this.setCellRenderer(componentType, function (component, row, editRowCommand, editSession) {
3044
+ component.row = row;
3045
+ component.editSession = editSession;
3046
+ component.editRowCommand = editRowCommand;
3047
+ });
3048
+ };
3049
+ EditorControlColumnModel.prototype.getDefaultHeaderText = function () {
3050
+ return '';
3051
+ };
3052
+ return EditorControlColumnModel;
3053
+ }(ColumnModel));
3054
+ var CustomTemplateColumnModel = /** @class */ (function (_super) {
3055
+ __extends(CustomTemplateColumnModel, _super);
3056
+ function CustomTemplateColumnModel(columnId, defaults, component) {
3057
+ return _super.call(this, columnId, defaults) || this;
3058
+ }
3059
+ return CustomTemplateColumnModel;
3060
+ }(ColumnModel));
3061
+ var SelectionColumnModel = /** @class */ (function (_super) {
3062
+ __extends(SelectionColumnModel, _super);
3063
+ function SelectionColumnModel(columnId, defaults, selectionModel) {
3064
+ var _this = _super.call(this, columnId, defaults) || this;
3065
+ if (selectionModel instanceof pectin.MultipleSelectionModel) {
3066
+ _this.cellHeaderRenderer(SelectHeaderCellRendererComponent, function (component) {
3067
+ component.selectionModel = selectionModel;
3068
+ });
3069
+ }
3070
+ _this.setCellRenderer(SelectCellRendererComponent, function (component, row, editRowCommand, editSession) {
3071
+ component.row = row;
3072
+ component.selectionModel = selectionModel;
3073
+ });
3074
+ return _this;
3075
+ }
3076
+ SelectionColumnModel.prototype.getDefaultHeaderText = function () {
3077
+ return '';
3078
+ };
3079
+ return SelectionColumnModel;
3080
+ }(ColumnModel));
3081
+
3082
+ /**
3083
+ * Create your model:
3084
+ * @example
3085
+ * this.heroTableModel = TableModel.fromList(heroList, table => {
3086
+ * table.pluck("firstName");
3087
+ * table.pluck("lastName");
3088
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
3089
+ * });
3090
+ *
3091
+ * Create your table
3092
+ * @example
3093
+ * <aup-table [tableModel]="heroTableModel"></aup-table>
3094
+ *
3095
+ * Styling
3096
+ * @example
3097
+ * aup-table {
3098
+ * --column-gap: 10px; // defaults to 24px
3099
+ * aup-table-cell-renderer {
3100
+ * &:first-column {
3101
+ * // do stuff
3102
+ * }
3103
+ * &:last-column {
3104
+ * // do stuff
3105
+ * }
3106
+ * }
3107
+ * }
3108
+ */
3109
+ var TableComponent = /** @class */ (function (_super) {
3110
+ __extends(TableComponent, _super);
3111
+ function TableComponent() {
3112
+ return _super.call(this) || this;
3113
+ }
3114
+ TableComponent.prototype.ngOnInit = function () {
3115
+ var _a = pectin.Dsl.disposeWith(this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
3116
+ this.columns = chain(this.tableModel.columns);
3117
+ this.columnIds = chain(this.columns).pluck('columnId');
3118
+ };
3119
+ TableComponent.prototype.isEditing = function (row) {
3120
+ return !!this.tableModel.getEditSessionFor(row);
3121
+ };
3122
+ __decorate([
3123
+ core.Input(),
3124
+ pectin.TrackExternal(),
3125
+ __metadata("design:type", exports.TableModel)
3126
+ ], TableComponent.prototype, "tableModel", void 0);
3127
+ TableComponent = __decorate([
3128
+ core.Component({
3129
+ selector: 'aup-table',
3130
+ template: "<table mat-table [dataSource]=\"tableModel.dataSource.value\" [trackBy]=\"tableModel.getTrackByFunction()\">\n\n <ng-container *ngFor=\"let column of columns.value; index as index; first as first; last as last\" matColumnDef=\"{{column.columnId}}\">\n <th mat-header-cell *matHeaderCellDef>\n <aup-table-header-cell-renderer [column]=\"column\"\n [attr.column-index]=\"index\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-header-cell-renderer>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <aup-table-cell-renderer [column]=\"column\"\n [row]=\"row\"\n [tableModel]=\"tableModel\"\n [editSession]=\"tableModel.getEditSessionFor(row)\"\n [attr.column-index]=\"index\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-cell-renderer>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"columnIds.value\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columnIds.value;\"></tr>\n\n</table>\n",
3131
+ styles: [":host{display:flex;flex-direction:column;align-items:stretch}:host table{flex:1}"]
3132
+ }),
3133
+ __metadata("design:paramtypes", [])
3134
+ ], TableComponent);
3135
+ return TableComponent;
3136
+ }(DisposableComponent));
3137
+
3138
+ var ColumnTemplateDirective = /** @class */ (function () {
3139
+ function ColumnTemplateDirective(host, templateRef, viewContainer) {
3140
+ this.templateRef = templateRef;
3141
+ this.viewContainer = viewContainer;
3142
+ }
3143
+ ColumnTemplateDirective.ctorParameters = function () { return [
3144
+ { type: TableComponent },
3145
+ { type: core.TemplateRef },
3146
+ { type: core.ViewContainerRef }
3147
+ ]; };
3148
+ ColumnTemplateDirective = __decorate([
3149
+ core.Directive({
3150
+ selector: '[aupColumnTemplate]'
3151
+ }),
3152
+ __metadata("design:paramtypes", [TableComponent,
3153
+ core.TemplateRef,
3154
+ core.ViewContainerRef])
3155
+ ], ColumnTemplateDirective);
3156
+ return ColumnTemplateDirective;
3157
+ }());
3158
+
3159
+ var TableCellRendererComponent = /** @class */ (function () {
3160
+ function TableCellRendererComponent() {
3161
+ var _this = this;
3162
+ this.defaultClassNames = "aup-header-cell-renderer";
3163
+ this.editRowCommand = pectin.Command.create(function () {
3164
+ _this.tableModel.startEditSession(_this.row);
3165
+ });
3166
+ }
3167
+ TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
3168
+ if (this.renderer !== instance) {
3169
+ this.renderer = instance;
3170
+ this.column.updateCellRenderer(this.renderer, this.row, this.editRowCommand, this.editSession);
3171
+ }
3172
+ };
3173
+ TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
3174
+ if (this.editor !== instance) {
3175
+ this.editor = instance;
3176
+ this.column.initialiseEditor(this.editor, this.editSession);
3177
+ }
3178
+ };
3179
+ TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
3180
+ if (this.renderer) {
3181
+ this.column.updateCellRenderer(this.renderer, this.row, this.editRowCommand, this.editSession);
3182
+ this.renderer.editSession = this.editSession;
3183
+ }
3184
+ };
3185
+ TableCellRendererComponent.prototype.hasActiveEditor = function () {
3186
+ return this.editSession && this.column.hasEditor();
3187
+ };
3188
+ __decorate([
3189
+ core.Input(),
3190
+ __metadata("design:type", Object)
3191
+ ], TableCellRendererComponent.prototype, "row", void 0);
3192
+ __decorate([
3193
+ core.Input(),
3194
+ __metadata("design:type", ColumnModel)
3195
+ ], TableCellRendererComponent.prototype, "column", void 0);
3196
+ __decorate([
3197
+ core.Input(),
3198
+ __metadata("design:type", exports.TableModel.EditSession)
3199
+ ], TableCellRendererComponent.prototype, "editSession", void 0);
3200
+ __decorate([
3201
+ core.Input(),
3202
+ __metadata("design:type", exports.TableModel)
3203
+ ], TableCellRendererComponent.prototype, "tableModel", void 0);
3204
+ __decorate([
3205
+ core.HostBinding('class'),
3206
+ __metadata("design:type", Object)
3207
+ ], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
3208
+ TableCellRendererComponent = __decorate([
3209
+ core.Component({
3210
+ selector: 'aup-table-cell-renderer',
3211
+ template: "<ng-container *ngIf=\"!hasActiveEditor()\" [cdkPortalOutlet]=\"column.cellRendererPortal\" (attached)=\"initialiseRenderer($event.instance)\"></ng-container>\n<ng-container *ngIf=\"hasActiveEditor()\" [cdkPortalOutlet]=\"column.cellEditorPortal\" (attached)=\"initialiseEditor($event.instance)\"></ng-container>\n",
3212
+ styles: [":host{display:flex;flex-direction:column;align-items:stretch}"]
3213
+ }),
3214
+ __metadata("design:paramtypes", [])
3215
+ ], TableCellRendererComponent);
3216
+ return TableCellRendererComponent;
3217
+ }());
3218
+
3219
+ var TableHeaderCellRendererComponent = /** @class */ (function () {
3220
+ function TableHeaderCellRendererComponent() {
3221
+ this.defaultClassNames = "aup-header-cell-renderer";
3222
+ }
3223
+ TableHeaderCellRendererComponent.prototype.initialiseHeader = function (instance) {
3224
+ if (this.renderer !== instance) {
3225
+ this.renderer = instance;
3226
+ this.column.initialiseHeader(this.renderer);
3227
+ }
3228
+ };
3229
+ __decorate([
3230
+ core.Input(),
3231
+ __metadata("design:type", ColumnModel)
3232
+ ], TableHeaderCellRendererComponent.prototype, "column", void 0);
3233
+ __decorate([
3234
+ core.HostBinding('class'),
3235
+ __metadata("design:type", Object)
3236
+ ], TableHeaderCellRendererComponent.prototype, "defaultClassNames", void 0);
3237
+ TableHeaderCellRendererComponent = __decorate([
3238
+ core.Component({
3239
+ selector: 'aup-table-header-cell-renderer',
3240
+ template: "<ng-container [cdkPortalOutlet]=\"column.columnHeaderCellRendererPortal\" (attached)=\"initialiseHeader($event.instance)\"></ng-container>\n",
3241
+ styles: [":host{display:flex;flex-direction:column;align-items:stretch}"]
3242
+ }),
3243
+ __metadata("design:paramtypes", [])
3244
+ ], TableHeaderCellRendererComponent);
3245
+ return TableHeaderCellRendererComponent;
3246
+ }());
2373
3247
 
2374
- var DIALOG_INTERACTION_SERVICE_DEFAULTS = new core.InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
2375
- var DialogInteractionContextFactory = /** @class */ (function (_super) {
2376
- __extends(DialogInteractionContextFactory, _super);
2377
- function DialogInteractionContextFactory(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
2378
- var _this = _super.call(this) || this;
2379
- _this.dialogService = dialogService;
2380
- _this.dialogServiceDefaults = dialogServiceDefaults;
2381
- _this.matDialogDefaultConfig = matDialogDefaultConfig;
2382
- typescriptUtilities.assert.notNil(dialogService);
3248
+ var VerticalFocusContainerComponent = /** @class */ (function (_super) {
3249
+ __extends(VerticalFocusContainerComponent, _super);
3250
+ function VerticalFocusContainerComponent(focusManager) {
3251
+ var _this = _super.call(this, focusManager) || this;
3252
+ _this.focusManager = focusManager;
2383
3253
  return _this;
2384
3254
  }
2385
- DialogInteractionContextFactory.prototype.createInteractionContext = function (identifier, api) {
2386
- var config = __assign(__assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig), this.dialogServiceDefaults);
2387
- return new DialogInteractionContext(identifier, api, this.dialogService, config);
3255
+ VerticalFocusContainerComponent.prototype.arrowLeft = function (event) {
3256
+ if (this.leftArrowCommand.enabled.value) {
3257
+ event.preventDefault();
3258
+ event.stopPropagation();
3259
+ this.leftArrowCommand.execute();
3260
+ }
2388
3261
  };
2389
- DialogInteractionContextFactory.ctorParameters = function () { return [
2390
- { type: dialog.MatDialog },
2391
- { type: dialog.MatDialogConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
2392
- { type: dialog.MatDialogConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [dialog.MAT_DIALOG_DEFAULT_OPTIONS,] }] }
3262
+ VerticalFocusContainerComponent.prototype.arrowRight = function (event) {
3263
+ if (this.rightArrowCommand.enabled.value) {
3264
+ event.preventDefault();
3265
+ event.stopPropagation();
3266
+ this.rightArrowCommand.execute();
3267
+ }
3268
+ };
3269
+ VerticalFocusContainerComponent.prototype.arrowDown = function (event) {
3270
+ event.preventDefault();
3271
+ event.stopPropagation();
3272
+ this.focusManager.focusNext();
3273
+ };
3274
+ VerticalFocusContainerComponent.prototype.arrowUp = function (event) {
3275
+ event.preventDefault();
3276
+ event.stopPropagation();
3277
+ this.focusManager.focusPrevious();
3278
+ };
3279
+ VerticalFocusContainerComponent.prototype.ngOnInit = function () {
3280
+ };
3281
+ VerticalFocusContainerComponent.ctorParameters = function () { return [
3282
+ { type: pectin.FocusManager, decorators: [{ type: core.Self }] }
2393
3283
  ]; };
2394
- DialogInteractionContextFactory.ɵprov = core.ɵɵdefineInjectable({ factory: function DialogInteractionContextFactory_Factory() { return new DialogInteractionContextFactory(core.ɵɵinject(dialog.MatDialog), core.ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), core.ɵɵinject(dialog.MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionContextFactory, providedIn: "root" });
2395
- DialogInteractionContextFactory = __decorate([
2396
- core.Injectable({
2397
- providedIn: 'root'
3284
+ __decorate([
3285
+ core.Input('command.arrowRight'),
3286
+ pectin.TrackExternal(),
3287
+ __metadata("design:type", pectin.Command)
3288
+ ], VerticalFocusContainerComponent.prototype, "rightArrowCommand", void 0);
3289
+ __decorate([
3290
+ core.Input('command.arrowLeft'),
3291
+ pectin.TrackExternal(),
3292
+ __metadata("design:type", pectin.Command)
3293
+ ], VerticalFocusContainerComponent.prototype, "leftArrowCommand", void 0);
3294
+ __decorate([
3295
+ core.HostListener('keyup.arrowLeft', ['$event']),
3296
+ __metadata("design:type", Function),
3297
+ __metadata("design:paramtypes", [KeyboardEvent]),
3298
+ __metadata("design:returntype", void 0)
3299
+ ], VerticalFocusContainerComponent.prototype, "arrowLeft", null);
3300
+ __decorate([
3301
+ core.HostListener('keyup.arrowRight', ['$event']),
3302
+ __metadata("design:type", Function),
3303
+ __metadata("design:paramtypes", [KeyboardEvent]),
3304
+ __metadata("design:returntype", void 0)
3305
+ ], VerticalFocusContainerComponent.prototype, "arrowRight", null);
3306
+ __decorate([
3307
+ core.HostListener('keyup.arrowDown', ['$event']),
3308
+ __metadata("design:type", Function),
3309
+ __metadata("design:paramtypes", [KeyboardEvent]),
3310
+ __metadata("design:returntype", void 0)
3311
+ ], VerticalFocusContainerComponent.prototype, "arrowDown", null);
3312
+ __decorate([
3313
+ core.HostListener('keyup.arrowUp', ['$event']),
3314
+ __metadata("design:type", Function),
3315
+ __metadata("design:paramtypes", [KeyboardEvent]),
3316
+ __metadata("design:returntype", void 0)
3317
+ ], VerticalFocusContainerComponent.prototype, "arrowUp", null);
3318
+ VerticalFocusContainerComponent = __decorate([
3319
+ core.Component({
3320
+ selector: 'aup-vertical-focus-container',
3321
+ template: "<ng-content></ng-content>\n",
3322
+ providers: [
3323
+ { provide: pectin.FocusManager }
3324
+ ],
3325
+ styles: [":host{display:block}"]
2398
3326
  }),
2399
- __param(1, core.Optional()), __param(1, core.Inject(DIALOG_INTERACTION_SERVICE_DEFAULTS)),
2400
- __param(2, core.Optional()), __param(2, core.Inject(dialog.MAT_DIALOG_DEFAULT_OPTIONS)),
2401
- __metadata("design:paramtypes", [dialog.MatDialog,
2402
- dialog.MatDialogConfig,
2403
- dialog.MatDialogConfig])
2404
- ], DialogInteractionContextFactory);
2405
- return DialogInteractionContextFactory;
2406
- }(ModalInteractionContextFactory));
3327
+ __param(0, core.Self()),
3328
+ __metadata("design:paramtypes", [pectin.FocusManager])
3329
+ ], VerticalFocusContainerComponent);
3330
+ return VerticalFocusContainerComponent;
3331
+ }(FocusContainerComponent));
2407
3332
 
2408
3333
  /**
2409
3334
  * @file Automatically generated by barrelsby.
2410
3335
  */
2411
3336
 
2412
- var AddItemInteractionContextComponent = /** @class */ (function (_super) {
2413
- __extends(AddItemInteractionContextComponent, _super);
2414
- function AddItemInteractionContextComponent() {
2415
- var _this = _super.call(this) || this;
2416
- _this.tabindex = 0;
2417
- _this.clickCommand = pectin.Command.create(function (context) {
2418
- if (_this.activityClass) {
2419
- _this.startActivity(_this.activityClass, _this.activityData).catch(function (e) {
2420
- // don't care.
2421
- });
2422
- }
2423
- else {
2424
- _this.addCommand.withContext(context).execute();
2425
- }
2426
- });
3337
+ var ActivityActionsComponent = /** @class */ (function (_super) {
3338
+ __extends(ActivityActionsComponent, _super);
3339
+ function ActivityActionsComponent() {
3340
+ var _this = _super !== null && _super.apply(this, arguments) || this;
3341
+ _this.align = 'start';
2427
3342
  return _this;
2428
3343
  }
2429
- Object.defineProperty(AddItemInteractionContextComponent.prototype, "active", {
3344
+ Object.defineProperty(ActivityActionsComponent.prototype, "alignEnd", {
2430
3345
  get: function () {
2431
- return this.interactionContext ? this.interactionContext.isActive() : false;
3346
+ return this.align === 'end';
2432
3347
  },
2433
3348
  enumerable: true,
2434
3349
  configurable: true
2435
3350
  });
2436
- AddItemInteractionContextComponent.prototype.startActivity = function (activityType, data) {
2437
- return this.interactionContext.startActivity(activityType, data);
3351
+ ActivityActionsComponent.prototype.ngOnInit = function () {
2438
3352
  };
2439
- AddItemInteractionContextComponent.prototype.ngOnInit = function () {
3353
+ ActivityActionsComponent.prototype.hasConfirmText = function () {
3354
+ return !___default__default.isEmpty(this.confirmText);
2440
3355
  };
2441
3356
  __decorate([
2442
3357
  core.Input(),
2443
- __metadata("design:type", String)
2444
- ], AddItemInteractionContextComponent.prototype, "label", void 0);
2445
- __decorate([
2446
- core.Input(),
2447
- __metadata("design:type", Object)
2448
- ], AddItemInteractionContextComponent.prototype, "activityClass", void 0);
3358
+ pectin.TrackExternal(),
3359
+ __metadata("design:type", pectin.Command)
3360
+ ], ActivityActionsComponent.prototype, "confirmCommand", void 0);
2449
3361
  __decorate([
2450
3362
  core.Input(),
2451
- __metadata("design:type", Object)
2452
- ], AddItemInteractionContextComponent.prototype, "activityData", void 0);
3363
+ __metadata("design:type", String)
3364
+ ], ActivityActionsComponent.prototype, "confirmText", void 0);
2453
3365
  __decorate([
2454
3366
  core.Input(),
2455
3367
  pectin.TrackExternal(),
2456
3368
  __metadata("design:type", pectin.Command)
2457
- ], AddItemInteractionContextComponent.prototype, "addCommand", void 0);
3369
+ ], ActivityActionsComponent.prototype, "cancelCommand", void 0);
2458
3370
  __decorate([
2459
- core.ViewChild(InPlaceInteractionContextComponent),
2460
- __metadata("design:type", InPlaceInteractionContextComponent)
2461
- ], AddItemInteractionContextComponent.prototype, "interactionContext", void 0);
3371
+ core.Input(),
3372
+ __metadata("design:type", String)
3373
+ ], ActivityActionsComponent.prototype, "align", void 0);
2462
3374
  __decorate([
2463
- core.HostBinding('class.interaction-active'),
3375
+ core.HostBinding('class.align-end'),
2464
3376
  __metadata("design:type", Boolean),
2465
3377
  __metadata("design:paramtypes", [])
2466
- ], AddItemInteractionContextComponent.prototype, "active", null);
2467
- __decorate([
2468
- core.HostBinding('tabindex'),
2469
- __metadata("design:type", Object)
2470
- ], AddItemInteractionContextComponent.prototype, "tabindex", void 0);
2471
- AddItemInteractionContextComponent = __decorate([
3378
+ ], ActivityActionsComponent.prototype, "alignEnd", null);
3379
+ ActivityActionsComponent = __decorate([
2472
3380
  core.Component({
2473
- selector: 'aup-add-item-interaction-context',
2474
- template: "<aup-in-place-interaction-context #interactionContext [animateFirstActivity]=\"false\">\n <a part=\"link\" class=\"link\" [pectinCommand]=\"clickCommand\"><mat-icon>add</mat-icon> {{label}}</a>\n</aup-in-place-interaction-context>\n",
2475
- styles: [":host{--def-link-color:var(--link-color, currentColor);--def-link-backgound:var(--link-background, rgba(0, 0, 0, 0.05));--def-link-border-radius:var(--link-border-radius, 4px);--def-link-padding:var(--link-padding, calc(var(--aup-default-padding) / 2));display:flex;flex-direction:column;border-radius:var(--def-link-border-radius);box-sizing:border-box;outline:0}:host:hover{--link-background:rgba(0,0,0,0.1)}aup-in-place-interaction-context{border-radius:var(--def-link-border-radius)}a.link{display:flex;flex-direction:row;align-items:center;border-radius:var(--def-link-border-radius);color:var(--def-link-color);background:var(--def-link-backgound);padding:var(--def-link-padding);cursor:pointer;text-decoration:none}a.link mat-icon{margin-right:8px}"]
2476
- }),
2477
- __metadata("design:paramtypes", [])
2478
- ], AddItemInteractionContextComponent);
2479
- return AddItemInteractionContextComponent;
3381
+ selector: 'aup-activity-actions',
3382
+ template: "<button class=\"cancel\" mat-icon-button [pectinCommand]=\"cancelCommand\">\n <mat-icon>clear</mat-icon>\n</button>\n<button class=\"confirm\" *ngIf=\"!hasConfirmText()\" mat-icon-button [pectinCommand]=\"confirmCommand\">\n <mat-icon>done</mat-icon>\n</button>\n<button class=\"confirm\" *ngIf=\"hasConfirmText()\" mat-button [pectinCommand]=\"confirmCommand\">{{confirmText}}</button>\n<div class=\"content\">\n <ng-content></ng-content>\n</div>\n",
3383
+ styles: [":host{display:-ms-grid;display:grid;grid-template-areas:\"cancel confirm content\";-ms-grid-columns:auto auto 1fr;grid-template-columns:auto auto 1fr;-ms-grid-rows:auto;grid-template-rows:auto;align-items:center;justify-content:end}:host.align-end{grid-template-areas:\"content cancel confirm\";-ms-grid-columns:1fr auto auto;grid-template-columns:1fr auto auto}.cancel{-ms-grid-row:1;-ms-grid-column:1;grid-area:cancel}:host.align-end>.cancel{-ms-grid-row:1;-ms-grid-column:2}.confirm{-ms-grid-row:1;-ms-grid-column:2;grid-area:confirm}:host.align-end>.confirm{-ms-grid-row:1;-ms-grid-column:3}.content{-ms-grid-row:1;-ms-grid-column:3;grid-area:content;text-align:left}:host.align-end>.content{-ms-grid-row:1;-ms-grid-column:1}"]
3384
+ })
3385
+ ], ActivityActionsComponent);
3386
+ return ActivityActionsComponent;
2480
3387
  }(DisposableComponent));
2481
3388
 
2482
3389
  var InteractionModule = /** @class */ (function () {
@@ -2504,14 +3411,18 @@
2504
3411
  ActivityOutletComponent,
2505
3412
  InPlaceInteractionContextComponent,
2506
3413
  AddItemInteractionContextComponent,
2507
- ActivityActionsComponent
3414
+ ActivityActionsComponent,
3415
+ PopupInteractionContextComponent,
3416
+ InteractionContextTriggerFor
2508
3417
  ],
2509
3418
  exports: [
2510
3419
  ActivityContainerComponent,
2511
3420
  ActivityOutletComponent,
2512
3421
  InPlaceInteractionContextComponent,
2513
3422
  AddItemInteractionContextComponent,
2514
- ActivityActionsComponent
3423
+ ActivityActionsComponent,
3424
+ PopupInteractionContextComponent,
3425
+ InteractionContextTriggerFor
2515
3426
  ],
2516
3427
  entryComponents: [
2517
3428
  ActivityContainerComponent,
@@ -2520,13 +3431,94 @@
2520
3431
  AlertDialogComponent
2521
3432
  ],
2522
3433
  providers: [
2523
- exports.ɵbg,
3434
+ exports.ɵbw
3435
+ // {
3436
+ // provide: MAT_TABS_CONFIG, useValue: { animationDuration: "2s" }
3437
+ // }
2524
3438
  ]
2525
3439
  })
2526
3440
  ], InteractionModule);
2527
3441
  return InteractionModule;
2528
3442
  }());
2529
3443
 
3444
+ var ComponentsModule = /** @class */ (function () {
3445
+ function ComponentsModule() {
3446
+ }
3447
+ ComponentsModule = __decorate([
3448
+ core.NgModule({
3449
+ declarations: [
3450
+ AbstractInputComponent,
3451
+ AbstractInputActivity,
3452
+ NumberInputComponent,
3453
+ StringInputComponent,
3454
+ StringInputActivity,
3455
+ TextInputComponent,
3456
+ PasswordInputComponent,
3457
+ SelectInputComponent,
3458
+ CheckboxInputComponent,
3459
+ ScrollContainerComponent,
3460
+ NoopComponent,
3461
+ SwitchCaseComponent,
3462
+ SwitchCaseWhenDirective,
3463
+ SwitchCaseDefaultDirective,
3464
+ FocusContainerComponent,
3465
+ VerticalFocusContainerComponent,
3466
+ FocusableComponent,
3467
+ CardContainerComponent,
3468
+ TableComponent,
3469
+ EditRowControls,
3470
+ ColumnTemplateDirective,
3471
+ DefaultCellRendererComponent,
3472
+ TableCellRendererComponent,
3473
+ SelectCellRendererComponent,
3474
+ SelectHeaderCellRendererComponent,
3475
+ DefaultHeaderCellRendererComponent,
3476
+ TableHeaderCellRendererComponent
3477
+ ],
3478
+ imports: [
3479
+ common.CommonModule,
3480
+ animations.BrowserAnimationsModule,
3481
+ forms.FormsModule,
3482
+ input.MatInputModule,
3483
+ formField.MatFormFieldModule,
3484
+ select.MatSelectModule,
3485
+ tabs.MatTabsModule,
3486
+ DirectivesModule,
3487
+ icon.MatIconModule,
3488
+ button.MatButtonModule,
3489
+ checkbox.MatCheckboxModule,
3490
+ InteractionModule,
3491
+ table.MatTableModule,
3492
+ portal.PortalModule
3493
+ ],
3494
+ exports: [
3495
+ NumberInputComponent,
3496
+ StringInputComponent,
3497
+ TextInputComponent,
3498
+ PasswordInputComponent,
3499
+ CheckboxInputComponent,
3500
+ SelectInputComponent,
3501
+ ScrollContainerComponent,
3502
+ NoopComponent,
3503
+ SwitchCaseComponent,
3504
+ SwitchCaseWhenDirective,
3505
+ SwitchCaseDefaultDirective,
3506
+ FocusContainerComponent,
3507
+ VerticalFocusContainerComponent,
3508
+ FocusableComponent,
3509
+ CardContainerComponent,
3510
+ TableComponent,
3511
+ EditRowControls,
3512
+ ColumnTemplateDirective
3513
+ ],
3514
+ providers: [
3515
+ FocusBindingFactory,
3516
+ ]
3517
+ })
3518
+ ], ComponentsModule);
3519
+ return ComponentsModule;
3520
+ }());
3521
+
2530
3522
  exports.ParameterDefinition = /** @class */ (function () {
2531
3523
  function ParameterDefinition(propertyName, options, urlFormat) {
2532
3524
  this.propertyName = propertyName;
@@ -3639,7 +4631,7 @@
3639
4631
  return PopStateNavigation;
3640
4632
  }(AbstractPopStateNavigation));
3641
4633
 
3642
- exports.ɵbj = /** @class */ (function () {
4634
+ exports.ɵco = /** @class */ (function () {
3643
4635
  function PlaceHistory() {
3644
4636
  this._archive = new Map();
3645
4637
  this.placeHistoryDepth = 4;
@@ -3776,7 +4768,7 @@
3776
4768
  // }
3777
4769
  //
3778
4770
  // }
3779
- })(exports.ɵbj || (exports.ɵbj = {}));
4771
+ })(exports.ɵco || (exports.ɵco = {}));
3780
4772
 
3781
4773
  exports.UrlSnapshot = /** @class */ (function () {
3782
4774
  // TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
@@ -4299,11 +5291,11 @@
4299
5291
  PlaceRouter.ctorParameters = function () { return [
4300
5292
  { type: router.Router },
4301
5293
  { type: common.Location },
4302
- { type: exports.ɵbg },
5294
+ { type: exports.ɵbw },
4303
5295
  { type: UrlService },
4304
- { type: exports.ɵbj }
5296
+ { type: exports.ɵco }
4305
5297
  ]; };
4306
- PlaceRouter.ɵprov = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(common.Location), core.ɵɵinject(exports.ɵbg), core.ɵɵinject(UrlService), core.ɵɵinject(exports.ɵbj)); }, token: PlaceRouter, providedIn: "root" });
5298
+ PlaceRouter.ɵprov = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(common.Location), core.ɵɵinject(exports.ɵbw), core.ɵɵinject(UrlService), core.ɵɵinject(exports.ɵco)); }, token: PlaceRouter, providedIn: "root" });
4307
5299
  __decorate([
4308
5300
  pectin.Trace(),
4309
5301
  __metadata("design:type", Function),
@@ -4316,9 +5308,9 @@
4316
5308
  }),
4317
5309
  __metadata("design:paramtypes", [router.Router,
4318
5310
  common.Location,
4319
- exports.ɵbg,
5311
+ exports.ɵbw,
4320
5312
  UrlService,
4321
- exports.ɵbj])
5313
+ exports.ɵco])
4322
5314
  ], PlaceRouter);
4323
5315
  return PlaceRouter;
4324
5316
  }(pectin.GarbageCollector));
@@ -5297,6 +6289,7 @@
5297
6289
 
5298
6290
  exports.ACTIVITY_DATA = ACTIVITY_DATA;
5299
6291
  exports.AUP_PLACE_CONFIG = AUP_PLACE_CONFIG;
6292
+ exports.AbstractInputActivity = AbstractInputActivity;
5300
6293
  exports.AbstractInputComponent = AbstractInputComponent;
5301
6294
  exports.AbstractInteractionContext = AbstractInteractionContext;
5302
6295
  exports.AbstractPlaceNavigationComponent = AbstractPlaceNavigationComponent;
@@ -5312,18 +6305,26 @@
5312
6305
  exports.BusyOverlayComponent = BusyOverlayComponent;
5313
6306
  exports.CardContainerComponent = CardContainerComponent;
5314
6307
  exports.CheckboxInputComponent = CheckboxInputComponent;
6308
+ exports.ColumnModel = ColumnModel;
6309
+ exports.ColumnTemplateDirective = ColumnTemplateDirective;
5315
6310
  exports.CommandDirective = CommandDirective;
5316
6311
  exports.ComponentsModule = ComponentsModule;
5317
6312
  exports.ConfirmThenDialogComponent = ConfirmThenDialogComponent;
5318
6313
  exports.ConfirmationDialogComponent = ConfirmationDialogComponent;
5319
6314
  exports.ConsolidatedParameterMap = ConsolidatedParameterMap;
6315
+ exports.CustomTemplateColumnModel = CustomTemplateColumnModel;
6316
+ exports.CustomValueColumnModel = CustomValueColumnModel;
5320
6317
  exports.DEFINITION_META_DATA_KEY = DEFINITION_META_DATA_KEY;
5321
6318
  exports.DIALOG_INTERACTION_SERVICE_DEFAULTS = DIALOG_INTERACTION_SERVICE_DEFAULTS;
6319
+ exports.DefaultCellRendererComponent = DefaultCellRendererComponent;
6320
+ exports.DefaultHeaderCellRendererComponent = DefaultHeaderCellRendererComponent;
5322
6321
  exports.DialogInteractionContext = DialogInteractionContext;
5323
6322
  exports.DialogInteractionContextFactory = DialogInteractionContextFactory;
5324
6323
  exports.Dimension = Dimension;
5325
6324
  exports.DirectivesModule = DirectivesModule;
5326
6325
  exports.DisposableComponent = DisposableComponent;
6326
+ exports.EditRowControls = EditRowControls;
6327
+ exports.EditorControlColumnModel = EditorControlColumnModel;
5327
6328
  exports.EmptyStateComponent = EmptyStateComponent;
5328
6329
  exports.EventCleanUpSession = EventCleanUpSession;
5329
6330
  exports.FocusBinding = FocusBinding;
@@ -5332,8 +6333,9 @@
5332
6333
  exports.FocusContainerComponent = FocusContainerComponent;
5333
6334
  exports.FocusableComponent = FocusableComponent;
5334
6335
  exports.InPlaceInteractionContextComponent = InPlaceInteractionContextComponent;
6336
+ exports.InteractionContextTriggerFor = InteractionContextTriggerFor;
5335
6337
  exports.InteractionModule = InteractionModule;
5336
- exports.InteractionService = exports.ɵbg;
6338
+ exports.InteractionService = exports.ɵbw;
5337
6339
  exports.InteractionServiceRoutingAdapter = InteractionServiceRoutingAdapter;
5338
6340
  exports.LEFT_RIGHT_PLACE_ANIMATION = LEFT_RIGHT_PLACE_ANIMATION;
5339
6341
  exports.ListPlaceNavComponent = ListPlaceNavComponent;
@@ -5349,20 +6351,26 @@
5349
6351
  exports.PlaceComponentDeactivationHandler = PlaceComponentDeactivationHandler;
5350
6352
  exports.PlaceDefinition = PlaceDefinition;
5351
6353
  exports.PlaceGuard = PlaceGuard;
5352
- exports.PlaceHistory = exports.ɵbj;
6354
+ exports.PlaceHistory = exports.ɵco;
5353
6355
  exports.PlaceModule = PlaceModule;
5354
6356
  exports.PlaceOutletComponent = PlaceOutletComponent;
5355
6357
  exports.PlaceRouter = PlaceRouter;
5356
6358
  exports.Point = Point;
5357
6359
  exports.PopStateDuringInteractionNavigation = PopStateDuringInteractionNavigation;
5358
6360
  exports.PopStateNavigation = PopStateNavigation;
6361
+ exports.PopupInteractionContextComponent = PopupInteractionContextComponent;
6362
+ exports.PropertyColumnModel = PropertyColumnModel;
5359
6363
  exports.ROUTE_PARAMETER_LIST_KEY = ROUTE_PARAMETER_LIST_KEY;
5360
6364
  exports.RemoveLastInteractionFromUrlNavigationSession = RemoveLastInteractionFromUrlNavigationSession;
5361
6365
  exports.ResizeAwareComponent = ResizeAwareComponent;
5362
6366
  exports.RouteId = RouteId;
5363
6367
  exports.ScrollContainerComponent = ScrollContainerComponent;
6368
+ exports.SelectCellRendererComponent = SelectCellRendererComponent;
6369
+ exports.SelectHeaderCellRendererComponent = SelectHeaderCellRendererComponent;
5364
6370
  exports.SelectInputComponent = SelectInputComponent;
6371
+ exports.SelectionColumnModel = SelectionColumnModel;
5365
6372
  exports.SidePlaceNavigationComponent = SidePlaceNavigationComponent;
6373
+ exports.StringInputActivity = StringInputActivity;
5366
6374
  exports.StringInputComponent = StringInputComponent;
5367
6375
  exports.SwitchCaseComponent = SwitchCaseComponent;
5368
6376
  exports.SwitchCaseDefaultDirective = SwitchCaseDefaultDirective;
@@ -5370,6 +6378,9 @@
5370
6378
  exports.SwitchCaseWhenDirective = SwitchCaseWhenDirective;
5371
6379
  exports.SynchroniseInteractionContextIdsWithRoute = SynchroniseInteractionContextIdsWithRoute;
5372
6380
  exports.TabbedPlaceNavigationComponent = TabbedPlaceNavigationComponent;
6381
+ exports.TableCellRendererComponent = TableCellRendererComponent;
6382
+ exports.TableComponent = TableComponent;
6383
+ exports.TableHeaderCellRendererComponent = TableHeaderCellRendererComponent;
5373
6384
  exports.TextInputComponent = TextInputComponent;
5374
6385
  exports.UrlService = UrlService;
5375
6386
  exports.VerticalFocusContainerComponent = VerticalFocusContainerComponent;
@@ -5385,55 +6396,70 @@
5385
6396
  exports.slideRightOnEnterAnimation = slideRightOnEnterAnimation;
5386
6397
  exports.ɵa = DirectivesModule;
5387
6398
  exports.ɵb = CommandDirective;
5388
- exports.ɵba = PlaceOutletComponent;
5389
- exports.ɵbb = leftRightPlaceAnimation;
5390
- exports.ɵbc = LEFT_RIGHT_PLACE_ANIMATION;
5391
- exports.ɵbd = AUP_PLACE_CONFIG;
5392
- exports.ɵbf = PlaceRouter;
5393
- exports.ɵbh = ModalInteractionContextFactory;
5394
- exports.ɵbi = UrlService;
5395
- exports.ɵbk = TabbedPlaceNavigationComponent;
5396
- exports.ɵbl = AbstractPlaceNavigationComponent;
5397
- exports.ɵbm = ListPlaceNavComponent;
5398
- exports.ɵbn = SidePlaceNavigationComponent;
5399
- exports.ɵbo = InteractionModule;
5400
- exports.ɵbp = ActivityContainerComponent;
5401
- exports.ɵbq = AbstractInteractionContext;
5402
- exports.ɵbr = ActivityOutletComponent;
5403
- exports.ɵbs = ConfirmationDialogComponent;
5404
- exports.ɵbt = ACTIVITY_DATA;
5405
- exports.ɵbu = Activity;
5406
- exports.ɵbw = ConfirmThenDialogComponent;
5407
- exports.ɵbx = AlertDialogComponent;
5408
- exports.ɵbz = InPlaceInteractionContextComponent;
6399
+ exports.ɵba = CardContainerComponent;
6400
+ exports.ɵbb = TableComponent;
6401
+ exports.ɵbc = EditRowControls;
6402
+ exports.ɵbd = ColumnTemplateDirective;
6403
+ exports.ɵbe = DefaultCellRendererComponent;
6404
+ exports.ɵbf = TableCellRendererComponent;
6405
+ exports.ɵbg = SelectCellRendererComponent;
6406
+ exports.ɵbh = SelectHeaderCellRendererComponent;
6407
+ exports.ɵbi = DefaultHeaderCellRendererComponent;
6408
+ exports.ɵbj = TableHeaderCellRendererComponent;
6409
+ exports.ɵbk = InteractionModule;
6410
+ exports.ɵbl = ActivityContainerComponent;
6411
+ exports.ɵbm = AbstractInteractionContext;
6412
+ exports.ɵbn = ActivityOutletComponent;
6413
+ exports.ɵbo = ConfirmationDialogComponent;
6414
+ exports.ɵbp = ACTIVITY_DATA;
6415
+ exports.ɵbq = Activity;
6416
+ exports.ɵbs = ConfirmThenDialogComponent;
6417
+ exports.ɵbt = AlertDialogComponent;
6418
+ exports.ɵbv = InPlaceInteractionContextComponent;
6419
+ exports.ɵbx = ModalInteractionContextFactory;
6420
+ exports.ɵby = AddItemInteractionContextComponent;
6421
+ exports.ɵbz = DisposableComponent;
5409
6422
  exports.ɵc = FocusBindingDirective;
5410
- exports.ɵca = AddItemInteractionContextComponent;
5411
- exports.ɵcb = DisposableComponent;
5412
- exports.ɵcc = InPlaceInteractionContextComponent;
5413
- exports.ɵcd = ActivityActionsComponent;
6423
+ exports.ɵca = InPlaceInteractionContextComponent;
6424
+ exports.ɵcb = ActivityActionsComponent;
6425
+ exports.ɵcc = PopupInteractionContextComponent;
6426
+ exports.ɵcd = InteractionContextTriggerFor;
6427
+ exports.ɵce = PlaceModule;
6428
+ exports.ɵcf = EmptyStateComponent;
6429
+ exports.ɵcg = BusyOverlayComponent;
6430
+ exports.ɵch = PlaceOutletComponent;
6431
+ exports.ɵci = leftRightPlaceAnimation;
6432
+ exports.ɵcj = LEFT_RIGHT_PLACE_ANIMATION;
6433
+ exports.ɵck = AUP_PLACE_CONFIG;
6434
+ exports.ɵcm = PlaceRouter;
6435
+ exports.ɵcn = UrlService;
6436
+ exports.ɵcp = TabbedPlaceNavigationComponent;
6437
+ exports.ɵcq = AbstractPlaceNavigationComponent;
6438
+ exports.ɵcr = ListPlaceNavComponent;
6439
+ exports.ɵcs = SidePlaceNavigationComponent;
5414
6440
  exports.ɵd = DisposableComponent;
5415
6441
  exports.ɵe = FocusBindingFactory;
5416
6442
  exports.ɵf = ComponentsModule;
5417
- exports.ɵg = NumberInputComponent;
5418
- exports.ɵh = AbstractInputComponent;
5419
- exports.ɵi = StringInputComponent;
5420
- exports.ɵj = TextInputComponent;
5421
- exports.ɵk = PasswordInputComponent;
5422
- exports.ɵl = SelectInputComponent;
5423
- exports.ɵm = CheckboxInputComponent;
5424
- exports.ɵn = ScrollContainerComponent;
5425
- exports.ɵo = NoopComponent;
5426
- exports.ɵp = SwitchCaseOption;
5427
- exports.ɵq = SwitchCaseWhenDirective;
5428
- exports.ɵr = SwitchCaseDefaultDirective;
5429
- exports.ɵs = SwitchCaseComponent;
5430
- exports.ɵt = FocusContainerComponent;
5431
- exports.ɵu = VerticalFocusContainerComponent;
5432
- exports.ɵv = FocusableComponent;
5433
- exports.ɵw = CardContainerComponent;
5434
- exports.ɵx = PlaceModule;
5435
- exports.ɵy = EmptyStateComponent;
5436
- exports.ɵz = BusyOverlayComponent;
6443
+ exports.ɵg = AbstractInputComponent;
6444
+ exports.ɵh = AbstractInputActivity;
6445
+ exports.ɵi = Activity;
6446
+ exports.ɵj = ACTIVITY_DATA;
6447
+ exports.ɵk = NumberInputComponent;
6448
+ exports.ɵl = StringInputComponent;
6449
+ exports.ɵm = StringInputActivity;
6450
+ exports.ɵn = TextInputComponent;
6451
+ exports.ɵo = PasswordInputComponent;
6452
+ exports.ɵp = SelectInputComponent;
6453
+ exports.ɵq = CheckboxInputComponent;
6454
+ exports.ɵr = ScrollContainerComponent;
6455
+ exports.ɵs = NoopComponent;
6456
+ exports.ɵt = SwitchCaseOption;
6457
+ exports.ɵu = SwitchCaseWhenDirective;
6458
+ exports.ɵv = SwitchCaseDefaultDirective;
6459
+ exports.ɵw = SwitchCaseComponent;
6460
+ exports.ɵx = FocusContainerComponent;
6461
+ exports.ɵy = VerticalFocusContainerComponent;
6462
+ exports.ɵz = FocusableComponent;
5437
6463
 
5438
6464
  Object.defineProperty(exports, '__esModule', { value: true });
5439
6465