@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
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"SelectHeaderCellRendererComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../disposable-component","name":"DisposableComponent","line":10,"character":60},"arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"aup-select-header-cell-renderer","template":"<mat-checkbox [pectinCommand]=\"selectCommand\" [checked]=\"isSelected()\" [indeterminate]=\"this.isIntermediate()\"></mat-checkbox>\n","styles":[""]}]}],"members":{"selectionModel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor"}],"isSelected":[{"__symbolic":"method"}],"isIntermediate":[{"__symbolic":"method"}]}}}}]
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-header-cell-renderer.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-header-cell-renderer.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/select-header-cell-renderer/select-header-cell-renderer.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -0,0 +1,64 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { Component, HostBinding, Input } from '@angular/core';
3
+ import { Command } from '@coolon/pectin';
4
+ import { ColumnModel } from '../column-model';
5
+ import { TableModel } from '../table-model';
6
+ let TableCellRendererComponent = class TableCellRendererComponent {
7
+ constructor() {
8
+ this.defaultClassNames = "aup-header-cell-renderer";
9
+ this.editRowCommand = Command.create(() => {
10
+ this.tableModel.startEditSession(this.row);
11
+ });
12
+ }
13
+ initialiseRenderer(instance) {
14
+ if (this.renderer !== instance) {
15
+ this.renderer = instance;
16
+ this.column.updateCellRenderer(this.renderer, this.row, this.editRowCommand, this.editSession);
17
+ }
18
+ }
19
+ initialiseEditor(instance) {
20
+ if (this.editor !== instance) {
21
+ this.editor = instance;
22
+ this.column.initialiseEditor(this.editor, this.editSession);
23
+ }
24
+ }
25
+ ngOnChanges(changes) {
26
+ if (this.renderer) {
27
+ this.column.updateCellRenderer(this.renderer, this.row, this.editRowCommand, this.editSession);
28
+ this.renderer.editSession = this.editSession;
29
+ }
30
+ }
31
+ hasActiveEditor() {
32
+ return this.editSession && this.column.hasEditor();
33
+ }
34
+ };
35
+ __decorate([
36
+ Input(),
37
+ __metadata("design:type", Object)
38
+ ], TableCellRendererComponent.prototype, "row", void 0);
39
+ __decorate([
40
+ Input(),
41
+ __metadata("design:type", ColumnModel)
42
+ ], TableCellRendererComponent.prototype, "column", void 0);
43
+ __decorate([
44
+ Input(),
45
+ __metadata("design:type", TableModel.EditSession)
46
+ ], TableCellRendererComponent.prototype, "editSession", void 0);
47
+ __decorate([
48
+ Input(),
49
+ __metadata("design:type", TableModel)
50
+ ], TableCellRendererComponent.prototype, "tableModel", void 0);
51
+ __decorate([
52
+ HostBinding('class'),
53
+ __metadata("design:type", Object)
54
+ ], TableCellRendererComponent.prototype, "defaultClassNames", void 0);
55
+ TableCellRendererComponent = __decorate([
56
+ Component({
57
+ selector: 'aup-table-cell-renderer',
58
+ 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",
59
+ styles: [":host{display:flex;flex-direction:column;align-items:stretch}"]
60
+ }),
61
+ __metadata("design:paramtypes", [])
62
+ ], TableCellRendererComponent);
63
+ export { TableCellRendererComponent };
64
+ //# sourceMappingURL=table-cell-renderer.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-cell-renderer.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-cell-renderer/table-cell-renderer.component.ts"],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,CAAC;YAC/F,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;SAC9C;IACH,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IACrD,CAAC;CACF,CAAA;AAjDC;IADC,KAAK,EAAE;;uDACC;AAGT;IADC,KAAK,EAAE;8BACA,WAAW;0DAAM;AAGzB;IADC,KAAK,EAAE;8BACK,UAAU,CAAC,WAAW;+DAAM;AAGzC;IADC,KAAK,EAAE;8BACI,UAAU;8DAAM;AAQ5B;IADC,WAAW,CAAC,OAAO,CAAC;;qEACyB;AApBnC,0BAA0B;IALtC,SAAS,CAAC;QACT,QAAQ,EAAE,yBAAyB;QACnC,qUAAmD;;KAEpD,CAAC;;GACW,0BAA0B,CAoDtC;SApDY,0BAA0B","sourcesContent":["import { Component, HostBinding, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';\nimport { Command } from '@coolon/pectin';\nimport { ColumnModel } from '../column-model';\nimport { TableModel } from '../table-model';\n\n@Component({\n selector: 'aup-table-cell-renderer',\n templateUrl: './table-cell-renderer.component.html',\n styleUrls: ['./table-cell-renderer.component.scss']\n})\nexport class TableCellRendererComponent<Row> implements OnChanges {\n\n @Input()\n row: Row;\n\n @Input()\n column: ColumnModel<Row>;\n\n @Input()\n editSession: TableModel.EditSession<Row>;\n\n @Input()\n tableModel: TableModel<Row>;\n\n private renderer: any;\n private editor: any;\n\n private editRowCommand: Command<void>;\n\n @HostBinding('class')\n defaultClassNames = \"aup-header-cell-renderer\"\n\n constructor() {\n this.editRowCommand = Command.create(() => {\n this.tableModel.startEditSession(this.row);\n });\n }\n\n initialiseRenderer(instance: any) {\n if (this.renderer !== instance) {\n this.renderer = instance;\n this.column.updateCellRenderer(this.renderer, this.row, this.editRowCommand, this.editSession);\n }\n }\n\n initialiseEditor(instance: any) {\n if (this.editor !== instance) {\n this.editor = instance;\n this.column.initialiseEditor(this.editor, this.editSession);\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (this.renderer) {\n this.column.updateCellRenderer(this.renderer, this.row, this.editRowCommand, this.editSession);\n this.renderer.editSession = this.editSession;\n }\n }\n\n hasActiveEditor() {\n return this.editSession && this.column.hasEditor();\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"TableCellRendererComponent":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"aup-table-cell-renderer","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","styles":[":host{display:flex;flex-direction:column;align-items:stretch}"]}]}],"members":{"row":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"column":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"editSession":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":18,"character":3}}]}],"tableModel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":21,"character":3}}]}],"defaultClassNames":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":29,"character":3},"arguments":["class"]}]}],"__ctor__":[{"__symbolic":"constructor"}],"initialiseRenderer":[{"__symbolic":"method"}],"initialiseEditor":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"hasActiveEditor":[{"__symbolic":"method"}]}}}}]
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-cell-renderer.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-cell-renderer/table-cell-renderer.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-cell-renderer.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-cell-renderer/table-cell-renderer.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=table-def.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-def.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-def.ts"],"names":[],"mappings":"","sourcesContent":["import { Form } from '@coolon/pectin';\n\nexport interface TableDef<T> {\n // createRowForm?(item: T): Form<T>; // Optional, if not specified the columns can be used to inject validators\n // save(form: Form<T>)\n}\n\n// RowEditorFactory?\nexport interface EditableTableDef<T> extends TableDef<T> {\n createRowForm?(item: T): Form<T>; // Optional, if not specified the columns can be used to inject validators\n save(form: Form<T>)\n}\n"]}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"TableDef":{"__symbolic":"interface"},"EditableTableDef":{"__symbolic":"interface"}}}]
@@ -0,0 +1,32 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { Component, HostBinding, Input } from '@angular/core';
3
+ import { ColumnModel } from '../column-model';
4
+ let TableHeaderCellRendererComponent = class TableHeaderCellRendererComponent {
5
+ constructor() {
6
+ this.defaultClassNames = "aup-header-cell-renderer";
7
+ }
8
+ initialiseHeader(instance) {
9
+ if (this.renderer !== instance) {
10
+ this.renderer = instance;
11
+ this.column.initialiseHeader(this.renderer);
12
+ }
13
+ }
14
+ };
15
+ __decorate([
16
+ Input(),
17
+ __metadata("design:type", ColumnModel)
18
+ ], TableHeaderCellRendererComponent.prototype, "column", void 0);
19
+ __decorate([
20
+ HostBinding('class'),
21
+ __metadata("design:type", Object)
22
+ ], TableHeaderCellRendererComponent.prototype, "defaultClassNames", void 0);
23
+ TableHeaderCellRendererComponent = __decorate([
24
+ Component({
25
+ selector: 'aup-table-header-cell-renderer',
26
+ template: "<ng-container [cdkPortalOutlet]=\"column.columnHeaderCellRendererPortal\" (attached)=\"initialiseHeader($event.instance)\"></ng-container>\n",
27
+ styles: [":host{display:flex;flex-direction:column;align-items:stretch}"]
28
+ }),
29
+ __metadata("design:paramtypes", [])
30
+ ], TableHeaderCellRendererComponent);
31
+ export { TableHeaderCellRendererComponent };
32
+ //# sourceMappingURL=table-header-cell-renderer.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-header-cell-renderer.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAA+C,MAAM,eAAe,CAAC;AAE3G,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAQ9C,IAAa,gCAAgC,GAA7C,MAAa,gCAAgC;IAU3C;QAFA,sBAAiB,GAAG,0BAA0B,CAAA;IAG9C,CAAC;IAED,gBAAgB,CAAC,QAAa;QAC5B,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE;YAC9B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC7C;IACH,CAAC;CACF,CAAA;AAhBC;IADC,KAAK,EAAE;8BACA,WAAW;gEAAM;AAKzB;IADC,WAAW,CAAC,OAAO,CAAC;;2EACyB;AARnC,gCAAgC;IAL5C,SAAS,CAAC;QACT,QAAQ,EAAE,gCAAgC;QAC1C,wJAA0D;;KAE3D,CAAC;;GACW,gCAAgC,CAmB5C;SAnBY,gCAAgC","sourcesContent":["import { Component, HostBinding, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';\nimport { Command } from '@coolon/pectin';\nimport { ColumnModel } from '../column-model';\nimport { TableModel } from '../table-model';\n\n@Component({\n selector: 'aup-table-header-cell-renderer',\n templateUrl: './table-header-cell-renderer.component.html',\n styleUrls: ['./table-header-cell-renderer.component.scss']\n})\nexport class TableHeaderCellRendererComponent<Row> {\n\n @Input()\n column: ColumnModel<Row>;\n\n private renderer: any;\n\n @HostBinding('class')\n defaultClassNames = \"aup-header-cell-renderer\"\n\n constructor() {\n }\n\n initialiseHeader(instance: any) {\n if (this.renderer !== instance) {\n this.renderer = instance;\n this.column.initialiseHeader(this.renderer);\n }\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"TableHeaderCellRendererComponent":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"aup-table-header-cell-renderer","template":"<ng-container [cdkPortalOutlet]=\"column.columnHeaderCellRendererPortal\" (attached)=\"initialiseHeader($event.instance)\"></ng-container>\n","styles":[":host{display:flex;flex-direction:column;align-items:stretch}"]}]}],"members":{"column":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"defaultClassNames":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":17,"character":3},"arguments":["class"]}]}],"__ctor__":[{"__symbolic":"constructor"}],"initialiseHeader":[{"__symbolic":"method"}]}}}}]
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-header-cell-renderer.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-header-cell-renderer.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table-header-cell-renderer/table-header-cell-renderer.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -0,0 +1,197 @@
1
+ var TableModel_1;
2
+ import { __decorate, __metadata } from "tslib";
3
+ import { BooleanValueModelChain, CanIdentify, Dsl, Form, GarbageCollector, lang, ListModel, ListModelChain, MapModelChain, MutableListModel, MutableValueModel, SelectionModel, TrackExternal, Types, UnaryCommand } from '@coolon/pectin';
4
+ import produce from 'immer';
5
+ import { CustomValueColumnModel, EditorControlColumnModel, PropertyColumnModel, SelectionColumnModel } from './column-model';
6
+ // export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];
7
+ // export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];
8
+ /**
9
+ * Example:
10
+ * @example
11
+ * const model = TableModel.fromList(heroList, table => {
12
+ * table.pluck("firstName");
13
+ * table.pluck("lastName");
14
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
15
+ * });
16
+ *
17
+ * Editable tables
18
+ * @example
19
+ * const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
20
+ * if (form.validate()) {
21
+ * // normal form save stuff
22
+ * return true; // finish editing
23
+ * }
24
+ * return false; // continue editiing
25
+ * }
26
+ * const colorsNames: ListModel<string> = ...;
27
+ * const model = TableModel.fromList(heroList, table => {
28
+ * table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
29
+ * table.pluck("lastName").cellEditor(StringInputComponent, {
30
+ * validators: [Validator.present("We need a last name")]
31
+ * });
32
+ * table.pluck("age").cellEditor(NumberInputComponent);
33
+ * table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
34
+ * initialiseComponent(component: SelectInputComponent) {
35
+ * selectInput.optionsModel = colorsNames; // <- initialise our component
36
+ * }
37
+ * });
38
+ * table.addEditControls(saveCommand); // <- required to enable editing
39
+ * });
40
+ *
41
+ * Selection models
42
+ * @example
43
+ * const model = TableModel.fromList(heroList, table => {
44
+ * table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
45
+ * table.pluck("firstName");
46
+ * table.pluck("lastName");
47
+ * });
48
+ *
49
+ * Custom cell renderers and editors
50
+ * @example
51
+ * const model = TableModel.fromList(heroList, table => {
52
+ * table.pluck("favoriteColor")
53
+ * .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
54
+ * // configure your component with what ever you need.
55
+ * });
56
+ * .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
57
+ * .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }
58
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
59
+ * });
60
+ *
61
+ * I18n
62
+ * @example
63
+ * [table.yml]
64
+ * table:
65
+ * columns(ColumnTextProperties[]):
66
+ * firstName:
67
+ * headerText: "First Name"
68
+ * fullName:
69
+ * headerText: "Full Name"
70
+ *
71
+ * const model = TableModel.fromList(heroList, table => {
72
+ * table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
73
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
74
+ *
75
+ * table.columnTextProperties(I18n.table.columns); // <- configures all columns
76
+ * });
77
+ */
78
+ let TableModel = TableModel_1 = class TableModel {
79
+ constructor(sourceOfTruth) {
80
+ this.sourceOfTruth = sourceOfTruth;
81
+ this._garbage = new GarbageCollector();
82
+ this._columns = new MutableListModel();
83
+ this._editorSessions = new MutableListModel();
84
+ this.identityOf = sourceOfTruth.identityOf;
85
+ const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this._garbage);
86
+ this._columnsById = chain(this._columns).indexBy('columnId');
87
+ this._rowsBeingEdited = new MutableListModel([], {
88
+ identifiedWith: this.identityOf
89
+ });
90
+ this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
91
+ this.editing = chain(this._editorSessions).count().isGreaterThan(0);
92
+ this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
93
+ }
94
+ static fromList(sourceOfTruth, builder) {
95
+ const model = new TableModel_1(sourceOfTruth);
96
+ builder(model);
97
+ return model;
98
+ }
99
+ get rowsBeingEdited() {
100
+ return this._rowsBeingEdited.readonly;
101
+ }
102
+ getTrackByFunction() {
103
+ return (index, item) => {
104
+ return this.identityOf ? this.identityOf(item) : index;
105
+ };
106
+ }
107
+ get columns() {
108
+ return this._columns.readonly;
109
+ }
110
+ pluck(property) {
111
+ return this.addColumn(new PropertyColumnModel(property, this));
112
+ }
113
+ addSelectionColumn(selectionModel) {
114
+ return this.addColumn(new SelectionColumnModel('selection', this, selectionModel));
115
+ }
116
+ addEditControls(saveCommand) {
117
+ this.saveCommand = saveCommand;
118
+ return this.addColumn(new EditorControlColumnModel('editControls', saveCommand, this));
119
+ }
120
+ addCustomColumn(columnId, dataAccessor) {
121
+ return this.addColumn(new CustomValueColumnModel(columnId, this, dataAccessor));
122
+ }
123
+ addColumn(column) {
124
+ if (this._columnsById.get(column.columnId)) {
125
+ lang.illegalState(`Column with id=${column.columnId} already exists`);
126
+ }
127
+ else {
128
+ this._columns.push(column);
129
+ }
130
+ return column;
131
+ }
132
+ columnTextProperties(columnTextProperties) {
133
+ this._columnTextPropertiesLookup = columnTextProperties;
134
+ }
135
+ getColumnTextProperties(column) {
136
+ const factory = this._columnTextPropertiesLookup[column.columnId];
137
+ return factory ? factory() : undefined;
138
+ }
139
+ startEditSession(row) {
140
+ const rowId = this.identityOf(row);
141
+ if (this._rowsBeingEdited.query().indexOf(row) > -1) {
142
+ return lang.illegalState(`Row with id=${rowId} already being edited`);
143
+ }
144
+ else {
145
+ const editSession = new TableModel_1.EditSession(rowId, row, this.saveCommand);
146
+ const { when } = Dsl.disposeWith(editSession);
147
+ when.valueOf(editSession.rowValueModel).changes((editedValue) => {
148
+ this._rowsBeingEdited.replaceOrPush(editedValue);
149
+ }, { initialValue: 'triggerChangeUnlessNil' });
150
+ this._editorSessions.push(editSession);
151
+ editSession.onDispose(() => {
152
+ this._rowsBeingEdited.remove(editSession.rowValueModel.value);
153
+ this._editorSessions.remove(editSession);
154
+ });
155
+ return editSession;
156
+ }
157
+ }
158
+ getEditSessionFor(row) {
159
+ return this._editorSessionByRowId.get(this.identityOf(row));
160
+ }
161
+ cancelAllEditorSessions() {
162
+ this._editorSessions.runInTransaction((draft) => {
163
+ this._rowsBeingEdited.runInTransaction(() => {
164
+ draft.value.forEach(session => session.dispose());
165
+ });
166
+ });
167
+ }
168
+ };
169
+ TableModel.ctorParameters = () => [
170
+ { type: ListModel }
171
+ ];
172
+ TableModel = TableModel_1 = __decorate([
173
+ TrackExternal.Strategy(new TrackExternal.OneTimeBinding()),
174
+ __metadata("design:paramtypes", [ListModel])
175
+ ], TableModel);
176
+ export { TableModel };
177
+ (function (TableModel) {
178
+ class EditSession extends GarbageCollector {
179
+ constructor(rowId, row, saveCommand) {
180
+ super();
181
+ this.rowId = rowId;
182
+ this.saveCommand = saveCommand;
183
+ this._editorValue = new MutableValueModel();
184
+ this.rowValueModel = this._editorValue.readonly;
185
+ this.form = new Form();
186
+ this.form.load(row);
187
+ this._editorValue.value = row;
188
+ this.form.onEdit(() => {
189
+ this._editorValue.value = produce(this._editorValue.value, draft => {
190
+ this.form.writeDirtyStateTo(draft);
191
+ });
192
+ });
193
+ }
194
+ }
195
+ TableModel.EditSession = EditSession;
196
+ })(TableModel || (TableModel = {}));
197
+ //# sourceMappingURL=table-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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C,UAAU,CAoHtB;SApHY,UAAU;AAsHvB,WAAiB,UAAU;IAGzB,MAAa,WAAiB,SAAQ,gBAAgB;QAKpD,YAAqB,KAAU,EAAE,GAAQ,EAAW,WAA6C;YAC/F,KAAK,EAAE,CAAC;YADW,UAAK,GAAL,KAAK,CAAK;YAAqB,gBAAW,GAAX,WAAW,CAAkC;YAHzF,iBAAY,GAAG,IAAI,iBAAiB,EAAO,CAAC;YAC3C,kBAAa,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;YAIlD,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAO,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACpB,IAAI,CAAC,YAAY,CAAC,KAAK,GAAG,GAAG,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;gBACpB,IAAI,CAAC,YAAY,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;oBACjE,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAyB,CAAC,CAAC;gBACzD,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;KACF;IAhBY,sBAAW,cAgBvB,CAAA;AACH,CAAC,EApBgB,UAAU,KAAV,UAAU,QAoB1B","sourcesContent":["import {\n BooleanValueModelChain,\n CanIdentify,\n Dsl,\n Form,\n GarbageCollector,\n lang,\n ListModel,\n ListModelChain,\n MapModelChain,\n MutableListModel,\n MutableValueModel,\n SelectionModel,\n TrackExternal,\n Types,\n UnaryCommand\n} from '@coolon/pectin';\nimport { PickMutable } from '@coolon/typescript-utilities';\nimport produce from 'immer';\nimport {\n ColumnModel,\n CustomValueColumnModel,\n EditorControlColumnModel,\n PropertyColumnModel,\n SelectionColumnModel\n} from './column-model';\nimport { ColumnTextProperties } from './column-text-properties';\n\n// export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];\n// export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];\n\n\n/**\n * Example:\n * @example\n * const model = TableModel.fromList(heroList, table => {\n * table.pluck(\"firstName\");\n * table.pluck(\"lastName\");\n * table.addCustomColumn(\"fullName\", hero => `${hero.firstName} ${hero.lastName}`);\n * });\n *\n * Editable tables\n * @example\n * const saveCommand = UnaryCommand.create((form: Form<Hero>) => {\n * if (form.validate()) {\n * // normal form save stuff\n * return true; // finish editing\n * }\n * return false; // continue editiing\n * }\n * const colorsNames: ListModel<string> = ...;\n * const model = TableModel.fromList(heroList, table => {\n * table.pluck(\"firstName\").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }\n * table.pluck(\"lastName\").cellEditor(StringInputComponent, {\n * validators: [Validator.present(\"We need a last name\")]\n * });\n * table.pluck(\"age\").cellEditor(NumberInputComponent);\n * table.pluck(\"favoriteColor\").cellEditor(SelectInputComponent, {\n * initialiseComponent(component: SelectInputComponent) {\n * selectInput.optionsModel = colorsNames; // <- initialise our component\n * }\n * });\n * table.addEditControls(saveCommand); // <- required to enable editing\n * });\n *\n * Selection models\n * @example\n * const model = TableModel.fromList(heroList, table => {\n * table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model\n * table.pluck(\"firstName\");\n * table.pluck(\"lastName\");\n * });\n *\n * Custom cell renderers and editors\n * @example\n * const model = TableModel.fromList(heroList, table => {\n * table.pluck(\"favoriteColor\")\n * .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {\n * // configure your component with what ever you need.\n * });\n * .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }\n * .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: FormValueModel<string> | ValueModel<string>; }\n * table.addCustomColumn(\"fullName\", hero => `${hero.firstName} ${hero.lastName}`);\n * });\n *\n * I18n\n * @example\n * [table.yml]\n * table:\n * columns(ColumnTextProperties[]):\n * firstName:\n * headerText: \"First Name\"\n * fullName:\n * headerText: \"Full Name\"\n *\n * const model = TableModel.fromList(heroList, table => {\n * table.pluck(\"favoriteColor\").cellRenderer(...).cellEditor(...);\n * table.addCustomColumn(\"fullName\", hero => `${hero.firstName} ${hero.lastName}`);\n *\n * table.columnTextProperties(I18n.table.columns); // <- configures all columns\n * });\n */\n@TrackExternal.Strategy(new TrackExternal.OneTimeBinding())\nexport class TableModel<Row> {\n\n private readonly _garbage = new GarbageCollector();\n\n private readonly _columns = new MutableListModel<ColumnModel<Row>>();\n private _columnsById: MapModelChain<string, ColumnModel<Row>>;\n private _editorSessions = new MutableListModel<TableModel.EditSession<Row>>();\n private readonly _rowsBeingEdited: MutableListModel<Row>;\n\n private _columnTextPropertiesLookup: { [columnName: string]: () => ColumnTextProperties };\n\n readonly identityOf: CanIdentify<Row>['identityOf'];\n private saveCommand: UnaryCommand<Form<Row>, boolean>;\n private _editorSessionByRowId: MapModelChain<any, TableModel.EditSession<Row>>;\n\n readonly editing: BooleanValueModelChain;\n readonly dataSource: ListModelChain<Row>;\n\n static fromList<Row>(sourceOfTruth: ListModel<Row>, builder?: (tableModel: TableModel<Row>) => void): TableModel<Row> {\n const model = new TableModel<Row>(sourceOfTruth);\n builder(model);\n return model;\n }\n\n protected constructor(private sourceOfTruth: ListModel<Row>) {\n this.identityOf = sourceOfTruth.identityOf;\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this._garbage);\n this._columnsById = chain(this._columns).indexBy('columnId');\n this._rowsBeingEdited = new MutableListModel<Row>([], {\n identifiedWith: this.identityOf\n });\n this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');\n this.editing = chain(this._editorSessions).count().isGreaterThan(0);\n this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);\n }\n\n get rowsBeingEdited(): ListModel<Row> {\n return this._rowsBeingEdited.readonly;\n }\n\n getTrackByFunction() {\n return (index: number, item: Row) => {\n return this.identityOf ? this.identityOf(item) : index;\n };\n }\n\n get columns(): ListModel<ColumnModel<Row>> {\n return this._columns.readonly;\n }\n\n pluck<P extends Types.ValuePropertiesOf<Row>>(property: P): PropertyColumnModel<Row, P> {\n return this.addColumn(new PropertyColumnModel<Row, P>(property, this));\n }\n\n addSelectionColumn(selectionModel: SelectionModel<Row>): SelectionColumnModel<Row> {\n return this.addColumn(new SelectionColumnModel<Row>('selection', this, selectionModel));\n }\n\n addEditControls(saveCommand: UnaryCommand<Form<Row>, boolean>):EditorControlColumnModel<Row> {\n this.saveCommand = saveCommand;\n return this.addColumn(new EditorControlColumnModel<Row>('editControls', saveCommand, this));\n }\n\n addCustomColumn<V>(columnId: string, dataAccessor: (row: Row) => V): CustomValueColumnModel<Row, V> {\n return this.addColumn(new CustomValueColumnModel<Row, V>(columnId, this, dataAccessor));\n }\n\n protected addColumn<C extends ColumnModel<Row>>(column: C): C {\n if (this._columnsById.get(column.columnId)) {\n lang.illegalState(`Column with id=${column.columnId} already exists`);\n } else {\n this._columns.push(column);\n }\n return column;\n }\n\n columnTextProperties(columnTextProperties: { [columnName: string]: () => ColumnTextProperties }) {\n this._columnTextPropertiesLookup = columnTextProperties;\n }\n\n getColumnTextProperties(column: ColumnModel<Row>): ColumnTextProperties {\n const factory = this._columnTextPropertiesLookup[column.columnId];\n return factory ? factory() : undefined;\n }\n\n startEditSession(row: Row): TableModel.EditSession<Row> {\n const rowId = this.identityOf(row);\n if (this._rowsBeingEdited.query().indexOf(row) > -1) {\n return lang.illegalState(`Row with id=${rowId} already being edited`);\n } else {\n const editSession = new TableModel.EditSession<Row>(rowId, row, this.saveCommand);\n const { when } = Dsl.disposeWith(editSession);\n when.valueOf(editSession.rowValueModel).changes((editedValue) => {\n this._rowsBeingEdited.replaceOrPush(editedValue);\n }, { initialValue: 'triggerChangeUnlessNil' });\n\n this._editorSessions.push(editSession);\n editSession.onDispose(() => {\n this._rowsBeingEdited.remove(editSession.rowValueModel.value);\n this._editorSessions.remove(editSession);\n });\n return editSession;\n }\n }\n\n getEditSessionFor(row: Row): TableModel.EditSession<Row> {\n return this._editorSessionByRowId.get(this.identityOf(row));\n }\n\n cancelAllEditorSessions() {\n this._editorSessions.runInTransaction((draft) => {\n this._rowsBeingEdited.runInTransaction(() => {\n draft.value.forEach(session => session.dispose());\n });\n });\n }\n}\n\nexport namespace TableModel {\n\n\n export class EditSession<Row> extends GarbageCollector {\n readonly form: Form<Row>;\n private _editorValue = new MutableValueModel<Row>();\n readonly rowValueModel = this._editorValue.readonly;\n\n constructor(readonly rowId: any, row: Row, readonly saveCommand: UnaryCommand<Form<Row>, boolean>) {\n super();\n this.form = new Form<Row>();\n this.form.load(row);\n this._editorValue.value = row;\n this.form.onEdit(() => {\n this._editorValue.value = produce(this._editorValue.value, draft => {\n this.form.writeDirtyStateTo(draft as PickMutable<Row>);\n });\n });\n }\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"TableModel":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"TrackExternal","line":102,"character":1},"member":"Strategy"},"arguments":[{"__symbolic":"new","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"TrackExternal","line":102,"character":28},"member":"OneTimeBinding"}}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@coolon/pectin","name":"ListModel","line":127,"character":47,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":127,"character":57,"context":{"typeName":"Row"}}]}]}],"getTrackByFunction":[{"__symbolic":"method"}],"pluck":[{"__symbolic":"method"}],"addSelectionColumn":[{"__symbolic":"method"}],"addEditControls":[{"__symbolic":"method"}],"addCustomColumn":[{"__symbolic":"method"}],"addColumn":[{"__symbolic":"method"}],"columnTextProperties":[{"__symbolic":"method"}],"getColumnTextProperties":[{"__symbolic":"method"}],"startEditSession":[{"__symbolic":"method"}],"getEditSessionFor":[{"__symbolic":"method"}],"cancelAllEditorSessions":[{"__symbolic":"method"}]}}}}]
@@ -0,0 +1,60 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { Component, Input } from '@angular/core';
3
+ import { Dsl, TrackExternal } from '@coolon/pectin';
4
+ import { DisposableComponent } from '../disposable-component';
5
+ import { TableModel } from './table-model';
6
+ /**
7
+ * Create your model:
8
+ * @example
9
+ * this.heroTableModel = TableModel.fromList(heroList, table => {
10
+ * table.pluck("firstName");
11
+ * table.pluck("lastName");
12
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
13
+ * });
14
+ *
15
+ * Create your table
16
+ * @example
17
+ * <aup-table [tableModel]="heroTableModel"></aup-table>
18
+ *
19
+ * Styling
20
+ * @example
21
+ * aup-table {
22
+ * --column-gap: 10px; // defaults to 24px
23
+ * aup-table-cell-renderer {
24
+ * &:first-column {
25
+ * // do stuff
26
+ * }
27
+ * &:last-column {
28
+ * // do stuff
29
+ * }
30
+ * }
31
+ * }
32
+ */
33
+ let TableComponent = class TableComponent extends DisposableComponent {
34
+ constructor() {
35
+ super();
36
+ }
37
+ ngOnInit() {
38
+ const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
39
+ this.columns = chain(this.tableModel.columns);
40
+ this.columnIds = chain(this.columns).pluck('columnId');
41
+ }
42
+ isEditing(row) {
43
+ return !!this.tableModel.getEditSessionFor(row);
44
+ }
45
+ };
46
+ __decorate([
47
+ Input(),
48
+ TrackExternal(),
49
+ __metadata("design:type", TableModel)
50
+ ], TableComponent.prototype, "tableModel", void 0);
51
+ TableComponent = __decorate([
52
+ Component({
53
+ selector: 'aup-table',
54
+ 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",
55
+ styles: [":host{display:flex;flex-direction:column;align-items:stretch}:host table{flex:1}"]
56
+ }),
57
+ __metadata("design:paramtypes", [])
58
+ ], TableComponent);
59
+ export { TableComponent };
60
+ //# sourceMappingURL=table.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,GAAG,EAAkB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAMH,IAAa,cAAc,GAA3B,MAAa,cAAkB,SAAQ,mBAAmB;IASxD;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,QAAQ;QACN,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACzF,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;IAED,SAAS,CAAC,GAAM;QACd,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;CACF,CAAA;AAlBC;IAFC,KAAK,EAAE;IACP,aAAa,EAAE;8BACJ,UAAU;kDAAI;AAJf,cAAc;IAL1B,SAAS,CAAC;QACT,QAAQ,EAAE,WAAW;QACrB,iyCAAqC;;KAEtC,CAAC;;GACW,cAAc,CAsB1B;SAtBY,cAAc","sourcesContent":["import { Component, Input, OnInit } from '@angular/core';\nimport { Dsl, ListModelChain, TrackExternal } from '@coolon/pectin';\nimport { DisposableComponent } from '../disposable-component';\nimport { ColumnModel } from './column-model';\nimport { TableModel } from './table-model';\n\n/**\n * Create your model:\n * @example\n * this.heroTableModel = TableModel.fromList(heroList, table => {\n * table.pluck(\"firstName\");\n * table.pluck(\"lastName\");\n * table.addCustomColumn(\"fullName\", hero => `${hero.firstName} ${hero.lastName}`);\n * });\n *\n * Create your table\n * @example\n * <aup-table [tableModel]=\"heroTableModel\"></aup-table>\n *\n * Styling\n * @example\n * aup-table {\n * --column-gap: 10px; // defaults to 24px\n * aup-table-cell-renderer {\n * &:first-column {\n * // do stuff\n * }\n * &:last-column {\n * // do stuff\n * }\n * }\n * }\n */\n@Component({\n selector: 'aup-table',\n templateUrl: './table.component.html',\n styleUrls: ['./table.component.scss']\n})\nexport class TableComponent<T> extends DisposableComponent implements OnInit {\n\n @Input()\n @TrackExternal()\n tableModel: TableModel<T>;\n\n columns: ListModelChain<ColumnModel<T>>;\n columnIds: ListModelChain<string>;\n\n constructor() {\n super();\n }\n\n ngOnInit(): void {\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.columns = chain(this.tableModel.columns);\n this.columnIds = chain(this.columns).pluck('columnId');\n }\n\n isEditing(row: T): boolean {\n return !!this.tableModel.getEditSessionFor(row);\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"TableComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../disposable-component","name":"DisposableComponent","line":38,"character":39},"arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":33,"character":1},"arguments":[{"selector":"aup-table","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","styles":[":host{display:flex;flex-direction:column;align-items:stretch}:host table{flex:1}"]}]}],"members":{"tableModel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"TrackExternal","line":41,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor"}],"ngOnInit":[{"__symbolic":"method"}],"isEditing":[{"__symbolic":"method"}]}}}}]
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/table/table.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -1,4 +1,5 @@
1
- import { InjectionToken } from '@angular/core';
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { HostBinding, InjectionToken } from '@angular/core';
2
3
  import { DelegatingValueModel } from '@coolon/pectin';
3
4
  import { assert } from '@coolon/typescript-utilities';
4
5
  import { DisposableComponent } from '../components/disposable-component';
@@ -7,6 +8,7 @@ export class Activity extends DisposableComponent {
7
8
  constructor() {
8
9
  super(...arguments);
9
10
  this._busyModel = new DelegatingValueModel().withDefault(false);
11
+ this.class = 'aup-activity';
10
12
  }
11
13
  initialise(nestedInteractionContext, activityContext) {
12
14
  assert.isNil(this._activityContext);
@@ -39,4 +41,8 @@ export class Activity extends DisposableComponent {
39
41
  return !!this._activityContext;
40
42
  }
41
43
  }
44
+ __decorate([
45
+ HostBinding('class'),
46
+ __metadata("design:type", Object)
47
+ ], Activity.prototype, "class", void 0);
42
48
  //# sourceMappingURL=activity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"activity.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/interaction/activity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAuC,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGzE,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,cAAc,CAAM,yBAAyB,CAAC,CAAC;AAEhF,MAAM,OAAgB,QAAwB,SAAQ,mBAAmB;IAAzE;;QAEmB,eAAU,GAAG,IAAI,oBAAoB,EAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IA6CvF,CAAC;IAvCC,UAAU,CAAC,wBAA4C,EAAE,eAAyC;QAChG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QACxC,IAAI,CAAC,mBAAmB,GAAG,wBAAwB,CAAC;IACtD,CAAC;IAED,IAAI,kBAAkB;QACpB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,IAAI,CAAC,MAAU;QACb,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,KAAS;QACd,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,WAAW;IACX,eAAe;IACf,CAAC;IAGD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;IAClC,CAAC;IAED,SAAS,CAAC,SAA8B;QACtC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAC/B,CAAC;IAED,aAAa;QACX,OAAO,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;CACF","sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { DelegatingValueModel, GarbageCollector, Trace, ValueModel } from '@coolon/pectin';\nimport { assert } from '@coolon/typescript-utilities';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from './interaction-context';\n\nexport const ACTIVITY_DATA = new InjectionToken<any>('InteractionActivityData');\n\nexport abstract class Activity<D, R, E = any> extends DisposableComponent {\n\n private readonly _busyModel = new DelegatingValueModel<boolean>().withDefault(false);\n private _activityContext: Activity.Callbacks<R, E>;\n\n // @Trace()\n private _interactionContext: InteractionContext;\n\n initialise(nestedInteractionContext: InteractionContext, activityContext: Activity.Callbacks<R, E>): void {\n assert.isNil(this._activityContext);\n this._activityContext = activityContext;\n this._interactionContext = nestedInteractionContext;\n }\n\n get interactionContext() {\n assert.isTruthy(this.isInitialised());\n return this._interactionContext;\n }\n\n done(result?: R): void {\n return this._activityContext.onDone(result);\n }\n\n cancel(error?: E): void {\n this._activityContext.onCancel(error);\n }\n\n // @Trace()\n onActivityReady() {\n }\n\n\n get busy(): ValueModel<boolean> {\n return this._busyModel.readonly;\n }\n\n busyWhile(busyModel: ValueModel<boolean>) {\n this._busyModel.setDelegate(busyModel);\n }\n\n isBusy() {\n return this._busyModel.value;\n }\n\n isInitialised() {\n return !!this._activityContext;\n }\n}\n\nexport namespace Activity {\n\n export interface Callbacks<R, E> {\n onDone: (result: R) => void,\n onCancel: (error: E) => void,\n }\n}\n"]}
1
+ {"version":3,"file":"activity.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/interaction/activity.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAuC,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGzE,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,cAAc,CAAM,yBAAyB,CAAC,CAAC;AAEhF,MAAM,OAAgB,QAAwB,SAAQ,mBAAmB;IAAzE;;QAEmB,eAAU,GAAG,IAAI,oBAAoB,EAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAM/D,UAAK,GAAG,cAAc,CAAC;IAyC/C,CAAC;IAvCC,UAAU,CAAC,wBAA4C,EAAE,eAAyC;QAChG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QACxC,IAAI,CAAC,mBAAmB,GAAG,wBAAwB,CAAC;IACtD,CAAC;IAED,IAAI,kBAAkB;QACpB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,IAAI,CAAC,MAAU;QACb,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,KAAS;QACd,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,WAAW;IACX,eAAe;IACf,CAAC;IAGD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;IAClC,CAAC;IAED,SAAS,CAAC,SAA8B;QACtC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAC/B,CAAC;IAED,aAAa;QACX,OAAO,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;CACF;AAzCuB;IAArB,WAAW,CAAC,OAAO,CAAC;;uCAAwB","sourcesContent":["import { HostBinding, InjectionToken } from '@angular/core';\nimport { DelegatingValueModel, GarbageCollector, Trace, ValueModel } from '@coolon/pectin';\nimport { assert } from '@coolon/typescript-utilities';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from './interaction-context';\n\nexport const ACTIVITY_DATA = new InjectionToken<any>('InteractionActivityData');\n\nexport abstract class Activity<D, R, E = any> extends DisposableComponent {\n\n private readonly _busyModel = new DelegatingValueModel<boolean>().withDefault(false);\n private _activityContext: Activity.Callbacks<R, E>;\n\n // @Trace()\n private _interactionContext: InteractionContext;\n\n @HostBinding('class') class = 'aup-activity';\n\n initialise(nestedInteractionContext: InteractionContext, activityContext: Activity.Callbacks<R, E>): void {\n assert.isNil(this._activityContext);\n this._activityContext = activityContext;\n this._interactionContext = nestedInteractionContext;\n }\n\n get interactionContext() {\n assert.isTruthy(this.isInitialised());\n return this._interactionContext;\n }\n\n done(result?: R): void {\n return this._activityContext.onDone(result);\n }\n\n cancel(error?: E): void {\n this._activityContext.onCancel(error);\n }\n\n // @Trace()\n onActivityReady() {\n }\n\n\n get busy(): ValueModel<boolean> {\n return this._busyModel.readonly;\n }\n\n busyWhile(busyModel: ValueModel<boolean>) {\n this._busyModel.setDelegate(busyModel);\n }\n\n isBusy() {\n return this._busyModel.value;\n }\n\n isInitialised() {\n return !!this._activityContext;\n }\n}\n\nexport namespace Activity {\n\n export interface Callbacks<R, E> {\n onDone: (result: R) => void,\n onCancel: (error: E) => void,\n }\n}\n"]}
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"ACTIVITY_DATA":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":6,"character":33},"arguments":["InteractionActivityData"]},"Activity":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../components/disposable-component","name":"DisposableComponent","line":8,"character":54},"arity":3,"members":{"initialise":[{"__symbolic":"method"}],"done":[{"__symbolic":"method"}],"cancel":[{"__symbolic":"method"}],"onActivityReady":[{"__symbolic":"method"}],"busyWhile":[{"__symbolic":"method"}],"isBusy":[{"__symbolic":"method"}],"isInitialised":[{"__symbolic":"method"}]}}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"ACTIVITY_DATA":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":6,"character":33},"arguments":["InteractionActivityData"]},"Activity":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../components/disposable-component","name":"DisposableComponent","line":8,"character":54},"arity":3,"members":{"class":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":16,"character":3},"arguments":["class"]}]}],"initialise":[{"__symbolic":"method"}],"done":[{"__symbolic":"method"}],"cancel":[{"__symbolic":"method"}],"onActivityReady":[{"__symbolic":"method"}],"busyWhile":[{"__symbolic":"method"}],"isBusy":[{"__symbolic":"method"}],"isInitialised":[{"__symbolic":"method"}]}}}}]