@coolon/angular-ui-powerups 0.0.26 → 0.0.28

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 (287) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +3930 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -0
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +2 -0
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -0
  5. package/coolon-angular-ui-powerups.d.ts +30 -0
  6. package/coolon-angular-ui-powerups.metadata.json +1 -0
  7. package/esm2015/coolon-angular-ui-powerups.js +33 -0
  8. package/esm2015/index.js +6 -0
  9. package/esm2015/lib/angular-ui-powerups.module.js +54 -0
  10. package/esm2015/lib/animations/index.js +9 -0
  11. package/esm2015/lib/animations/slideDownAndUpAnimation.js +30 -0
  12. package/esm2015/lib/components/disposable-component.js +14 -0
  13. package/esm2015/lib/components/forms/abstract-input.component.js +183 -0
  14. package/esm2015/lib/components/forms/number-input/number-input.component.js +26 -0
  15. package/esm2015/lib/components/forms/password-input/password-input.component.js +26 -0
  16. package/esm2015/lib/components/forms/select-input/select-input.component.js +60 -0
  17. package/esm2015/lib/components/forms/string-input/string-input.component.js +26 -0
  18. package/esm2015/lib/components/index.js +18 -0
  19. package/esm2015/lib/components/resize-aware.component.js +96 -0
  20. package/esm2015/lib/components/types/bounds.class.js +56 -0
  21. package/esm2015/lib/components/types/dimension.class.js +21 -0
  22. package/esm2015/lib/components/types/point.class.js +36 -0
  23. package/esm2015/lib/directives/command.directive.js +135 -0
  24. package/esm2015/lib/directives/focus-binding.directive.js +179 -0
  25. package/esm2015/lib/directives/index.js +10 -0
  26. package/esm2015/lib/interaction/abstract-activity.js +129 -0
  27. package/esm2015/lib/interaction/activity.js +27 -0
  28. package/esm2015/lib/interaction/alert.js +23 -0
  29. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +144 -0
  30. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.js +22 -0
  31. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +169 -0
  32. package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +37 -0
  33. package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +46 -0
  34. package/esm2015/lib/interaction/confirm.js +17 -0
  35. package/esm2015/lib/interaction/index.js +21 -0
  36. package/esm2015/lib/interaction/interaction-context.js +35 -0
  37. package/esm2015/lib/interaction/interaction.module.js +41 -0
  38. package/esm2015/lib/interaction/result.js +24 -0
  39. package/esm2015/lib/interaction/services/dialog-interaction.service.js +114 -0
  40. package/esm2015/lib/place/abstract-place-component.js +59 -0
  41. package/esm2015/lib/place/components/busy-overlay/busy-overlay.component.js +44 -0
  42. package/esm2015/lib/place/components/empty-state/empty-state.component.js +28 -0
  43. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +67 -0
  44. package/esm2015/lib/place/components/place-outlet/route-animations.js +35 -0
  45. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +50 -0
  46. package/esm2015/lib/place/guards/leave-place.guard.js +52 -0
  47. package/esm2015/lib/place/guards/place-route.guard.js +74 -0
  48. package/esm2015/lib/place/index.js +27 -0
  49. package/esm2015/lib/place/place-component.js +17 -0
  50. package/esm2015/lib/place/place.decorator.js +72 -0
  51. package/esm2015/lib/place/place.module.js +49 -0
  52. package/esm2015/lib/place/place.service.js +61 -0
  53. package/esm2015/lib/place/route/json-types.js +13 -0
  54. package/esm2015/lib/place/route/parameter-decorators.js +182 -0
  55. package/esm2015/lib/place/route/parameter-definition.class.js +24 -0
  56. package/esm2015/lib/place/route/parameter-sanitiser.js +17 -0
  57. package/esm2015/lib/place/route/parameter-type.js +43 -0
  58. package/esm2015/lib/place/route/route-parameter-bindings.js +294 -0
  59. package/esm2015/lib/place/route/route-parameter-sanitiser.js +280 -0
  60. package/esm2015/public_api.js +11 -0
  61. package/esm5/coolon-angular-ui-powerups.js +33 -0
  62. package/esm5/index.js +6 -0
  63. package/esm5/lib/angular-ui-powerups.module.js +58 -0
  64. package/esm5/lib/animations/index.js +9 -0
  65. package/esm5/lib/animations/slideDownAndUpAnimation.js +30 -0
  66. package/esm5/lib/components/disposable-component.js +24 -0
  67. package/esm5/lib/components/forms/abstract-input.component.js +232 -0
  68. package/esm5/lib/components/forms/number-input/number-input.component.js +33 -0
  69. package/esm5/lib/components/forms/password-input/password-input.component.js +33 -0
  70. package/esm5/lib/components/forms/select-input/select-input.component.js +67 -0
  71. package/esm5/lib/components/forms/string-input/string-input.component.js +33 -0
  72. package/esm5/lib/components/index.js +18 -0
  73. package/esm5/lib/components/resize-aware.component.js +124 -0
  74. package/esm5/lib/components/types/bounds.class.js +59 -0
  75. package/esm5/lib/components/types/dimension.class.js +19 -0
  76. package/esm5/lib/components/types/point.class.js +43 -0
  77. package/esm5/lib/directives/command.directive.js +155 -0
  78. package/esm5/lib/directives/focus-binding.directive.js +231 -0
  79. package/esm5/lib/directives/index.js +10 -0
  80. package/esm5/lib/interaction/abstract-activity.js +173 -0
  81. package/esm5/lib/interaction/activity.js +27 -0
  82. package/esm5/lib/interaction/alert.js +23 -0
  83. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +181 -0
  84. package/esm5/lib/interaction/components/activity-outlet/activity-outlet-context.js +22 -0
  85. package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +206 -0
  86. package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +42 -0
  87. package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +54 -0
  88. package/esm5/lib/interaction/confirm.js +17 -0
  89. package/esm5/lib/interaction/index.js +21 -0
  90. package/esm5/lib/interaction/interaction-context.js +45 -0
  91. package/esm5/lib/interaction/interaction.module.js +45 -0
  92. package/esm5/lib/interaction/result.js +24 -0
  93. package/esm5/lib/interaction/services/dialog-interaction.service.js +140 -0
  94. package/esm5/lib/place/abstract-place-component.js +66 -0
  95. package/esm5/lib/place/components/busy-overlay/busy-overlay.component.js +49 -0
  96. package/esm5/lib/place/components/empty-state/empty-state.component.js +29 -0
  97. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +81 -0
  98. package/esm5/lib/place/components/place-outlet/route-animations.js +35 -0
  99. package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +57 -0
  100. package/esm5/lib/place/guards/leave-place.guard.js +57 -0
  101. package/esm5/lib/place/guards/place-route.guard.js +78 -0
  102. package/esm5/lib/place/index.js +27 -0
  103. package/esm5/lib/place/place-component.js +17 -0
  104. package/esm5/lib/place/place.decorator.js +69 -0
  105. package/esm5/lib/place/place.module.js +53 -0
  106. package/esm5/lib/place/place.service.js +75 -0
  107. package/esm5/lib/place/route/json-types.js +13 -0
  108. package/esm5/lib/place/route/parameter-decorators.js +182 -0
  109. package/esm5/lib/place/route/parameter-definition.class.js +24 -0
  110. package/esm5/lib/place/route/parameter-sanitiser.js +17 -0
  111. package/esm5/lib/place/route/parameter-type.js +65 -0
  112. package/esm5/lib/place/route/route-parameter-bindings.js +339 -0
  113. package/esm5/lib/place/route/route-parameter-sanitiser.js +395 -0
  114. package/esm5/public_api.js +11 -0
  115. package/fesm2015/coolon-angular-ui-powerups.js +3149 -0
  116. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -0
  117. package/fesm5/coolon-angular-ui-powerups.js +3703 -0
  118. package/fesm5/coolon-angular-ui-powerups.js.map +1 -0
  119. package/lib/angular-ui-powerups.module.d.ts +2 -0
  120. package/{src/lib/animations/index.ts → lib/animations/index.d.ts} +0 -1
  121. package/lib/animations/slideDownAndUpAnimation.d.ts +5 -0
  122. package/lib/components/disposable-component.d.ts +5 -0
  123. package/lib/components/forms/abstract-input.component.d.ts +35 -0
  124. package/lib/components/forms/number-input/number-input.component.d.ts +6 -0
  125. package/lib/components/forms/password-input/password-input.component.d.ts +6 -0
  126. package/lib/components/forms/select-input/select-input.component.d.ts +11 -0
  127. package/lib/components/forms/string-input/string-input.component.d.ts +6 -0
  128. package/{src/lib/components/index.ts → lib/components/index.d.ts} +0 -1
  129. package/lib/components/resize-aware.component.d.ts +22 -0
  130. package/lib/components/types/bounds.class.d.ts +16 -0
  131. package/lib/components/types/dimension.class.d.ts +5 -0
  132. package/lib/components/types/point.class.d.ts +10 -0
  133. package/lib/directives/command.directive.d.ts +14 -0
  134. package/lib/directives/focus-binding.directive.d.ts +22 -0
  135. package/{src/lib/directives/index.ts → lib/directives/index.d.ts} +0 -1
  136. package/lib/interaction/abstract-activity.d.ts +17 -0
  137. package/lib/interaction/activity.d.ts +11 -0
  138. package/lib/interaction/alert.d.ts +5 -0
  139. package/lib/interaction/components/activity-container/activity-container.component.d.ts +32 -0
  140. package/{src/lib/interaction/components/activity-outlet/activity-outlet-context.ts → lib/interaction/components/activity-outlet/activity-outlet-context.d.ts} +5 -7
  141. package/lib/interaction/components/activity-outlet/activity-outlet.component.d.ts +30 -0
  142. package/lib/interaction/components/alert-dialog/alert-dialog.component.d.ts +8 -0
  143. package/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.d.ts +9 -0
  144. package/{src/lib/interaction/confirm.ts → lib/interaction/confirm.d.ts} +2 -3
  145. package/{src/lib/interaction/index.ts → lib/interaction/index.d.ts} +0 -1
  146. package/lib/interaction/interaction-context.d.ts +11 -0
  147. package/lib/interaction/interaction.module.d.ts +2 -0
  148. package/lib/interaction/result.d.ts +8 -0
  149. package/lib/interaction/services/dialog-interaction.service.d.ts +14 -0
  150. package/lib/place/abstract-place-component.d.ts +13 -0
  151. package/lib/place/components/busy-overlay/busy-overlay.component.d.ts +8 -0
  152. package/lib/place/components/empty-state/empty-state.component.d.ts +5 -0
  153. package/lib/place/components/place-outlet/place-outlet.component.d.ts +13 -0
  154. package/lib/place/components/place-outlet/route-animations.d.ts +1 -0
  155. package/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.d.ts +11 -0
  156. package/lib/place/guards/leave-place.guard.d.ts +10 -0
  157. package/lib/place/guards/place-route.guard.d.ts +9 -0
  158. package/{src/lib/place/index.ts → lib/place/index.d.ts} +0 -1
  159. package/lib/place/place-component.d.ts +5 -0
  160. package/lib/place/place.decorator.d.ts +20 -0
  161. package/lib/place/place.module.d.ts +2 -0
  162. package/lib/place/place.service.d.ts +8 -0
  163. package/lib/place/route/json-types.d.ts +7 -0
  164. package/lib/place/route/parameter-decorators.d.ts +28 -0
  165. package/lib/place/route/parameter-definition.class.d.ts +11 -0
  166. package/{src/lib/place/route/parameter-sanitiser.ts → lib/place/route/parameter-sanitiser.d.ts} +1 -1
  167. package/lib/place/route/parameter-type.d.ts +16 -0
  168. package/lib/place/route/route-parameter-bindings.d.ts +18 -0
  169. package/lib/place/route/route-parameter-sanitiser.d.ts +42 -0
  170. package/package.json +14 -12
  171. package/schematics/ng-add/index.d.ts +2 -0
  172. package/schematics/ng-add/index.js +12 -0
  173. package/schematics/ng-add/index.js.map +1 -0
  174. package/schematics/place-routes/index.d.ts +3 -0
  175. package/schematics/place-routes/index.js +114 -0
  176. package/schematics/place-routes/index.js.map +1 -0
  177. package/schematics/place-routes/place-def.d.ts +37 -0
  178. package/schematics/place-routes/place-def.js +108 -0
  179. package/schematics/place-routes/place-def.js.map +1 -0
  180. package/schematics/place-routes/scanner.d.ts +38 -0
  181. package/schematics/place-routes/scanner.js +169 -0
  182. package/schematics/place-routes/scanner.js.map +1 -0
  183. package/schematics/place-routes/schema.d.ts +7 -0
  184. package/schematics/place-routes/schema.js +3 -0
  185. package/schematics/place-routes/schema.js.map +1 -0
  186. package/schematics/place-routes/templates/{services/place-router.service.ts.template → place-router.ts.template} +13 -18
  187. package/CHANGELOG.md +0 -7
  188. package/jest.config.js +0 -9
  189. package/ng-package.json +0 -13
  190. package/schematics/ng-add/index.ts +0 -10
  191. package/schematics/place-routes/index.ts +0 -152
  192. package/schematics/place-routes/place-def.ts +0 -93
  193. package/schematics/place-routes/scanner.ts +0 -145
  194. package/schematics/place-routes/schema.ts +0 -7
  195. package/src/lib/angular-ui-powerups.module.spec.ts +0 -14
  196. package/src/lib/angular-ui-powerups.module.ts +0 -49
  197. package/src/lib/animations/slideDownAndUpAnimation.ts +0 -39
  198. package/src/lib/components/disposable-component.ts +0 -9
  199. package/src/lib/components/forms/abstract-input.component.ts +0 -108
  200. package/src/lib/components/forms/number-input/number-input.component.html +0 -15
  201. package/src/lib/components/forms/number-input/number-input.component.scss +0 -3
  202. package/src/lib/components/forms/number-input/number-input.component.spec.ts +0 -25
  203. package/src/lib/components/forms/number-input/number-input.component.ts +0 -19
  204. package/src/lib/components/forms/password-input/password-input.component.html +0 -16
  205. package/src/lib/components/forms/password-input/password-input.component.scss +0 -3
  206. package/src/lib/components/forms/password-input/password-input.component.spec.ts +0 -25
  207. package/src/lib/components/forms/password-input/password-input.component.ts +0 -18
  208. package/src/lib/components/forms/scss/mixins.scss +0 -16
  209. package/src/lib/components/forms/select-input/select-input.component.html +0 -16
  210. package/src/lib/components/forms/select-input/select-input.component.scss +0 -7
  211. package/src/lib/components/forms/select-input/select-input.component.spec.ts +0 -25
  212. package/src/lib/components/forms/select-input/select-input.component.ts +0 -31
  213. package/src/lib/components/forms/string-input/string-input.component.html +0 -15
  214. package/src/lib/components/forms/string-input/string-input.component.scss +0 -3
  215. package/src/lib/components/forms/string-input/string-input.component.spec.ts +0 -25
  216. package/src/lib/components/forms/string-input/string-input.component.ts +0 -18
  217. package/src/lib/components/resize-aware.component.ts +0 -52
  218. package/src/lib/components/types/bounds.class.ts +0 -25
  219. package/src/lib/components/types/dimension.class.ts +0 -3
  220. package/src/lib/components/types/point.class.ts +0 -13
  221. package/src/lib/directives/command.directive.spec.ts +0 -73
  222. package/src/lib/directives/command.directive.ts +0 -81
  223. package/src/lib/directives/focus-binding.directive.spec.ts +0 -8
  224. package/src/lib/directives/focus-binding.directive.ts +0 -108
  225. package/src/lib/interaction/abstract-activity.ts +0 -57
  226. package/src/lib/interaction/activity.ts +0 -17
  227. package/src/lib/interaction/alert.ts +0 -6
  228. package/src/lib/interaction/components/activity-container/activity-container.component.html +0 -8
  229. package/src/lib/interaction/components/activity-container/activity-container.component.scss +0 -3
  230. package/src/lib/interaction/components/activity-container/activity-container.component.spec.ts +0 -25
  231. package/src/lib/interaction/components/activity-container/activity-container.component.ts +0 -93
  232. package/src/lib/interaction/components/activity-outlet/activity-outlet.component.scss +0 -3
  233. package/src/lib/interaction/components/activity-outlet/activity-outlet.component.spec.ts +0 -25
  234. package/src/lib/interaction/components/activity-outlet/activity-outlet.component.ts +0 -96
  235. package/src/lib/interaction/components/alert-dialog/alert-dialog.component.html +0 -7
  236. package/src/lib/interaction/components/alert-dialog/alert-dialog.component.scss +0 -7
  237. package/src/lib/interaction/components/alert-dialog/alert-dialog.component.spec.ts +0 -25
  238. package/src/lib/interaction/components/alert-dialog/alert-dialog.component.ts +0 -20
  239. package/src/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.html +0 -9
  240. package/src/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.scss +0 -8
  241. package/src/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.spec.ts +0 -25
  242. package/src/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.ts +0 -26
  243. package/src/lib/interaction/interaction-context.ts +0 -16
  244. package/src/lib/interaction/interaction.module.ts +0 -35
  245. package/src/lib/interaction/result.ts +0 -16
  246. package/src/lib/interaction/services/dialog-interaction.service.scss +0 -11
  247. package/src/lib/interaction/services/dialog-interaction.service.spec.ts +0 -12
  248. package/src/lib/interaction/services/dialog-interaction.service.ts +0 -63
  249. package/src/lib/place/abstract-place-component.ts +0 -33
  250. package/src/lib/place/components/busy-overlay/busy-overlay.component.html +0 -4
  251. package/src/lib/place/components/busy-overlay/busy-overlay.component.scss +0 -27
  252. package/src/lib/place/components/busy-overlay/busy-overlay.component.spec.ts +0 -25
  253. package/src/lib/place/components/busy-overlay/busy-overlay.component.ts +0 -23
  254. package/src/lib/place/components/empty-state/empty-state.component.scss +0 -15
  255. package/src/lib/place/components/empty-state/empty-state.component.spec.ts +0 -25
  256. package/src/lib/place/components/empty-state/empty-state.component.ts +0 -19
  257. package/src/lib/place/components/place-outlet/place-outlet.component.html +0 -7
  258. package/src/lib/place/components/place-outlet/place-outlet.component.scss +0 -12
  259. package/src/lib/place/components/place-outlet/place-outlet.component.spec.ts +0 -25
  260. package/src/lib/place/components/place-outlet/place-outlet.component.ts +0 -37
  261. package/src/lib/place/components/place-outlet/route-animations.ts +0 -30
  262. package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.html +0 -7
  263. package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.scss +0 -100
  264. package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.spec.ts +0 -25
  265. package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.ts +0 -30
  266. package/src/lib/place/guards/leave-place.guard.spec.ts +0 -15
  267. package/src/lib/place/guards/leave-place.guard.ts +0 -18
  268. package/src/lib/place/guards/place-route.guard.ts +0 -37
  269. package/src/lib/place/place-component.ts +0 -6
  270. package/src/lib/place/place.decorator.ts +0 -40
  271. package/src/lib/place/place.module.ts +0 -44
  272. package/src/lib/place/place.service.spec.ts +0 -12
  273. package/src/lib/place/place.service.ts +0 -29
  274. package/src/lib/place/route/json-types.ts +0 -5
  275. package/src/lib/place/route/parameter-decorators.ts +0 -99
  276. package/src/lib/place/route/parameter-definition.class.ts +0 -12
  277. package/src/lib/place/route/parameter-type.ts +0 -31
  278. package/src/lib/place/route/route-parameter-bindings.ts +0 -140
  279. package/src/lib/place/route/route-parameter-sanitiser.ts +0 -135
  280. package/src/test-setup.ts +0 -1
  281. package/tsconfig.json +0 -7
  282. package/tsconfig.lib.json +0 -20
  283. package/tsconfig.schematics.json +0 -35
  284. package/tsconfig.spec.json +0 -10
  285. package/tslint.json +0 -7
  286. /package/{src/index.ts → index.d.ts} +0 -0
  287. /package/{src/public_api.ts → public_api.d.ts} +0 -0
@@ -1,93 +0,0 @@
1
- import { SchematicContext } from '@angular-devkit/schematics';
2
- import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
3
- import { ClassDeclaration } from 'ts-morph';
4
- import { Scanner } from './scanner';
5
-
6
- export class PlaceDef {
7
-
8
-
9
- constructor(
10
- readonly importPath: string,
11
- readonly componentClass: string,
12
- readonly properties: PlaceDef.Options,
13
- readonly routeDef: PlaceDef.Parameter,
14
- readonly queryParameters: PlaceDef.Parameter[]
15
- ) {
16
- // console.log({ properties, routeDef });
17
- }
18
-
19
- @Memoize()
20
- get path() {
21
- return this.stripEnclosingQuotes(this.properties.path);
22
- }
23
-
24
- @Memoize()
25
- get routeIdentifier() {
26
- return this.routeDef ? this.stripEnclosingQuotes(this.routeDef.parameterName) : null;
27
- }
28
-
29
- get fullPath() {
30
- return !!this.routeIdentifier ?
31
- `${this.path}/:${this.routeIdentifier}` :
32
- this.path;
33
- }
34
-
35
- @Memoize()
36
- get placeName() {
37
- return this.componentClass.replace(/Component$/, "")
38
- }
39
-
40
- get order() {
41
- return this.properties.order
42
- }
43
-
44
- @Memoize()
45
- get activateGuardNames() {
46
- const activateGuards = [];
47
- if (this.authenticate) {
48
- activateGuards.push('AuthGuard');
49
- }
50
- if (this.requiresRouteGuard()) {
51
- activateGuards.push('PlaceRouteGuard');
52
- }
53
- return activateGuards;
54
- }
55
-
56
- private requiresRouteGuard() {
57
- return this.routeIdentifier || this.queryParameters.length > 0;
58
- }
59
-
60
- @Memoize()
61
- get routeModelName() {
62
- return this.routeDef ? this.stripEnclosingQuotes(this.routeDef.modelName) : null;
63
- }
64
-
65
- get authenticate() {
66
- return this.properties.authenticate === 'true';
67
- }
68
-
69
- stripEnclosingQuotes(value: string): string {
70
- const cooked = value.replace(/(^["'])|(["']$)/g, '');
71
- // console.log({ raw: value, cooked: cooked });
72
- return cooked;
73
- }
74
- }
75
-
76
- export namespace PlaceDef {
77
-
78
- export interface Options {
79
- title: string;
80
- path: string;
81
- order: number;
82
- authenticate: string;
83
- }
84
-
85
- export interface Parameter {
86
- parameterName: string;
87
- modelName: string;
88
- }
89
-
90
- export function scan(classDecl: ClassDeclaration, context: SchematicContext): Scanner {
91
- return new Scanner(classDecl, context);
92
- }
93
- }
@@ -1,145 +0,0 @@
1
- import { SchematicContext } from '@angular-devkit/schematics';
2
- import {
3
- ClassDeclaration,
4
- Decorator,
5
- Node,
6
- ObjectLiteralExpression,
7
- PropertyAssignmentStructure,
8
- PropertyDeclaration,
9
- SyntaxKind
10
- } from 'ts-morph';
11
- import { PlaceDef } from './place-def';
12
-
13
- function isDecoratorNode(node: Node, name: string): node is Decorator {
14
- return node.getKind() === SyntaxKind.Decorator && node.getText().startsWith(`${name}(`); // NOTE: I'm only supporting the @Decorator(...) style of usage (i.e. decorator factories).
15
- }
16
-
17
- export class Scanner {
18
-
19
- private placeAnnotation: Decorator;
20
-
21
- constructor(private readonly classDecl: ClassDeclaration, readonly context: SchematicContext) {
22
- classDecl.forEachChild((node) => {
23
- if (isDecoratorNode(node, '@Place')) {
24
- this.placeAnnotation = node as Decorator;
25
- // stop iterating when the node is a class declaration
26
- return true;
27
- }
28
- });
29
- }
30
-
31
- isPlace() {
32
- return !!this.placeAnnotation;
33
- }
34
-
35
- onMatch(callback: (scan: Scanner) => void) {
36
- if (this.isPlace()) {
37
- callback(this);
38
- }
39
- }
40
-
41
- createDefinition(moduleImportPath: string): PlaceDef {
42
- this.getRouteIdParameter();
43
- return new PlaceDef(moduleImportPath,
44
- this.classDecl.getName(),
45
- this.getPlaceOptions(),
46
- this.getRouteIdParameter(),
47
- this.getQueryParameters()
48
- );
49
- }
50
-
51
- protected getPlaceOptions(): PlaceDef.Options {
52
- // const args = this.placeAnnotation.getArguments();
53
- // if (args.length !== 1) {
54
- // console.error('@Place() accepts a single Options argument. got', args);
55
- // }
56
- return Scanner.getOptionsArg(this.placeAnnotation, {
57
- title: '',
58
- path: '',
59
- order: -1,
60
- authenticate: 'true'
61
- }, {
62
- position: 0,
63
- required: true
64
- });
65
- }
66
-
67
- protected getRouteIdParameter(): PlaceDef.Parameter {
68
- const routeProperties = this.getDecoratedProperties('@RouteId');
69
- if (routeProperties.length === 1) {
70
- const route = routeProperties[0];
71
- const routeOptions = Scanner.getOptionsArg(route.decorator, { as: 'id' }, {
72
- position: 1,
73
- required: false
74
- });
75
- return {
76
- modelName: route.property.getName(),
77
- parameterName: routeOptions.as
78
- };
79
- } else if (routeProperties.length > 1) {
80
- this.context.logger.error(`There an only be one @RouteId(), got ${routeProperties.length}`);
81
- }
82
- return null;
83
- }
84
-
85
- protected getQueryParameters(): PlaceDef.Parameter[] {
86
- return this.getDecoratedProperties('@QueryParameter')
87
- .map(p => {
88
- const options = Scanner.getOptionsArg(p.decorator, { as: p.property.getName() }, {
89
- position: 1,
90
- required: false
91
- });
92
- return {
93
- modelName: p.property.getName(),
94
- parameterName: options.as
95
- };
96
- });
97
- }
98
-
99
- protected getDecoratedProperties(annotation: string): { decorator: Decorator, property: PropertyDeclaration }[] {
100
- return this.classDecl.getProperties().map(p => {
101
- let result: { decorator: Decorator, property: PropertyDeclaration } = null;
102
- p.forEachChild((child) => {
103
- if (isDecoratorNode(child, annotation)) {
104
- result = {
105
- decorator: child,
106
- property: p
107
- };
108
- // stop traversal
109
- return true;
110
- }
111
- });
112
- return result;
113
- }).filter(r => !!r);
114
- }
115
-
116
- }
117
-
118
- export namespace Scanner {
119
-
120
- export function getObjectLiteralArgument(annotation: Decorator, position: number): ObjectLiteralExpression {
121
- const args = annotation.getArguments();
122
- if (args.length > position && args[position] instanceof ObjectLiteralExpression) {
123
- return args[position] as ObjectLiteralExpression;
124
- }
125
- return null;
126
- }
127
-
128
- export function getOptionsArg<T extends {}>(annotation: Decorator, defaults: T, options: { position: number, required: boolean } = {
129
- position: 0,
130
- required: true
131
- }): T {
132
- const objectLiteralArgument = getObjectLiteralArgument(annotation, options.position);
133
- if (!objectLiteralArgument) {
134
- if (options.required) {
135
- console.error(`expected object literal arg at position ${options.position}`, { expectedType: defaults });
136
- }
137
- return defaults;
138
- } else {
139
- return objectLiteralArgument.getProperties().reduce((result, p) => {
140
- const structure = p.getStructure() as PropertyAssignmentStructure;
141
- return { ...result, [structure.name]: structure.initializer as string };
142
- }, { ...defaults });
143
- }
144
- }
145
- }
@@ -1,7 +0,0 @@
1
- export interface Schema {
2
- project: string;
3
- authGuard: {
4
- className: string;
5
- moduleImport: string;
6
- }
7
- }
@@ -1,14 +0,0 @@
1
- import { async, TestBed } from '@angular/core/testing';
2
- import { AngularUiPowerupsModule } from './angular-ui-powerups.module';
3
-
4
- describe('AngularUiPowerupsModule', () => {
5
- beforeEach(async(() => {
6
- TestBed.configureTestingModule({
7
- imports: [AngularUiPowerupsModule]
8
- }).compileComponents();
9
- }));
10
-
11
- it('should create', () => {
12
- expect(AngularUiPowerupsModule).toBeDefined();
13
- });
14
- });
@@ -1,49 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
3
- import { FormsModule } from '@angular/forms';
4
- import { MatFormFieldModule, MatInputModule, MatSelectModule } from '@angular/material';
5
- import { BrowserModule } from '@angular/platform-browser';
6
- import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
- import { NumberInputComponent} from './components/forms/number-input/number-input.component';
8
- import { CommandDirective } from './directives/command.directive';
9
- import { FocusBindingDirective } from './directives/focus-binding.directive';
10
- import { StringInputComponent } from './components/forms/string-input/string-input.component';
11
- import { PasswordInputComponent } from './components/forms/password-input/password-input.component';
12
- import { SelectInputComponent } from './components/forms/select-input/select-input.component';
13
- import { InteractionModule } from './interaction/interaction.module';
14
- import { PlaceModule } from './place/place.module';
15
-
16
- @NgModule({
17
- declarations: [
18
- CommandDirective,
19
- FocusBindingDirective,
20
- NumberInputComponent,
21
- StringInputComponent,
22
- PasswordInputComponent,
23
- SelectInputComponent,
24
- ],
25
- imports: [
26
- CommonModule,
27
- BrowserModule,
28
- BrowserAnimationsModule,
29
- FormsModule,
30
- MatInputModule,
31
- MatFormFieldModule,
32
- MatSelectModule,
33
- PlaceModule,
34
- InteractionModule
35
- ],
36
- exports: [
37
- CommandDirective,
38
- FocusBindingDirective,
39
- NumberInputComponent,
40
- StringInputComponent,
41
- PasswordInputComponent,
42
- SelectInputComponent,
43
- InteractionModule,
44
- PlaceModule,
45
- ]
46
-
47
- })
48
- export class AngularUiPowerupsModule {
49
- }
@@ -1,39 +0,0 @@
1
- import { animate, AnimationStyleMetadata, style, transition, trigger } from '@angular/animations';
2
- import { OptionsHelper } from '@coolon/pectin';
3
-
4
- const defaultHiddenStyleDef = style({
5
- opacity: 0,
6
- 'height': '0',
7
- paddingTop: '0',
8
- paddingBottom: '0'
9
- });
10
-
11
- export function slideDownAndUpAnimation(triggerName: string, options?: {
12
- duration?: string;
13
- hiddenStyleDef?: AnimationStyleMetadata;
14
- }) {
15
- // SEE to fix this: https://github.com/angular/angular/issues/15587#issuecomment-351510501
16
- const duration = OptionsHelper.get(options).getOptional('duration', '100ms');
17
- const hiddenStyleDef = OptionsHelper.get(options).getOptional('hiddenStyleDef', defaultHiddenStyleDef);
18
- return trigger(triggerName, [
19
- transition(':enter', [hiddenStyleDef, animate('100ms')]),
20
- transition(':leave', [animate('100ms', hiddenStyleDef)])
21
- ]);
22
- }
23
-
24
- // export function slideOutLeftAnimation(triggerName: string, duration:string = "100ms") {
25
- // return trigger(triggerName, [
26
- // state('true', style(
27
- // {
28
- // 'width': '*',
29
- // 'overflow': 'hidden',
30
- // 'opacity': '1'
31
- // })),
32
- // state('false', style({
33
- // 'width': '0px',
34
- // 'overflow': 'hidden',
35
- // 'opacity': '0'
36
- // })),
37
- // transition('* => *', [animate(duration)])
38
- // ]);
39
- // }
@@ -1,9 +0,0 @@
1
- import {OnDestroy} from '@angular/core';
2
- import {GarbageCollector} from '@coolon/pectin';
3
-
4
- export class DisposableComponent extends GarbageCollector implements OnDestroy {
5
-
6
- ngOnDestroy(): void {
7
- this.dispose();
8
- }
9
- }
@@ -1,108 +0,0 @@
1
- /* tslint:disable:no-input-rename */
2
- import { EventEmitter, HostListener, Input, OnInit, Output } from '@angular/core';
3
- import { FormControl, FormGroupDirective, NgForm } from '@angular/forms';
4
- import { ErrorStateMatcher } from '@angular/material';
5
- import { Command, DelegatingFormValueModel, ListModel, UseDelegate, ValueModel } from '@coolon/pectin';
6
- import { DisposableComponent } from '../disposable-component';
7
-
8
- export abstract class AbstractInputComponent<T> extends DisposableComponent implements OnInit {
9
-
10
- readonly valueModel = new DelegatingFormValueModel<T>();
11
-
12
- @Input('valueModel') @UseDelegate()
13
- set userValueModel(model: ValueModel<T>) {
14
- this.valueModel.setDelegate(model);
15
- }
16
-
17
- @Input() label: string;
18
- @Input() floatLabel: 'auto' | 'always' | 'never';
19
- @Input() hint: string;
20
- @Input() placeholder: string;
21
-
22
- @Input('command.focus') focusCommand: Command<any>;
23
- @Input('command.blur') blurCommand: Command<any>;
24
- @Input('command.enter') enterCommand: Command<any>;
25
- @Input('command.escape') escapeCommand: Command<any>;
26
- @Input('command.click') clickCommand: Command<any>;
27
-
28
- // TODO: fix this.
29
- // tslint:disable-next-line:no-output-native
30
- @Output() focus = new EventEmitter();
31
- // tslint:disable-next-line:no-output-native
32
- @Output() blur = new EventEmitter();
33
- // tslint:disable-next-line:no-output-native
34
- @Output() enterKey = new EventEmitter();
35
- // tslint:disable-next-line:no-output-native
36
- @Output() escapeKey = new EventEmitter();
37
-
38
- readonly errorStateMatcher: ErrorStateMatcher;
39
-
40
- @HostListener('click')
41
- notifyClick() {
42
- this.safelyInvoke(this.clickCommand);
43
- }
44
-
45
- @HostListener('focusin')
46
- notifyFocusIn() {
47
- this.safelyInvoke(this.focusCommand);
48
- this.focus.emit();
49
- }
50
-
51
- @HostListener('focusout')
52
- notifyFocusOut() {
53
- this.safelyInvoke(this.blurCommand);
54
- this.blur.emit();
55
- }
56
-
57
-
58
- notifyEnterKey() {
59
- this.safelyInvoke(this.enterCommand);
60
- this.enterKey.emit();
61
- }
62
-
63
- notifyEscapeKey() {
64
- this.safelyInvoke(this.escapeCommand);
65
- this.escapeKey.emit();
66
- }
67
-
68
- protected safelyInvoke(command: Command<any>) {
69
- if (command && command.enabled.value) {
70
- command.execute();
71
- }
72
- }
73
-
74
- constructor() {
75
- super();
76
- const self = this;
77
- this.errorStateMatcher = {
78
- isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
79
- return self.hasErrors();
80
- }
81
- };
82
- }
83
-
84
- ngOnInit(): void {
85
- }
86
-
87
- isEnabled(): boolean {
88
- return this.enabled.value;
89
- }
90
-
91
- get enabled(): ValueModel<boolean> {
92
- return this.valueModel.enabled;
93
- }
94
-
95
- hasErrors(): boolean {
96
- return !this.errorList.query().isEmpty();
97
- }
98
-
99
- get errorList(): ListModel<string> {
100
- return this.valueModel.errorList;
101
- }
102
-
103
- get firstError() {
104
- return this.hasErrors() ? this.errorList.value[0] : null;
105
- }
106
-
107
-
108
- }
@@ -1,15 +0,0 @@
1
- <mat-form-field appearance="standard" [floatLabel]="floatLabel">
2
- <mat-label *ngIf="label">{{label}}</mat-label>
3
- <input type="number"
4
- matInput
5
- placeholder="{{placeholder}}"
6
- [(ngModel)]="valueModel.value"
7
- [disabled]="!enabled.value"
8
- (keydown.enter)="notifyEnterKey()"
9
- (keydown.escape)="notifyEscapeKey()"
10
- [pectinFocusBinding]="valueModel"
11
- [errorStateMatcher]="errorStateMatcher"
12
- >
13
- <mat-hint *ngIf="hint">{{hint}}</mat-hint>
14
- <mat-error *ngIf="hasErrors">{{firstError}}</mat-error>
15
- </mat-form-field>
@@ -1,3 +0,0 @@
1
- @import "../scss/mixins";
2
-
3
- @include mat-form-field-defaults;
@@ -1,25 +0,0 @@
1
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { NumberInputComponent } from './number-input.component';
4
-
5
- describe('NumberInputComponent', () => {
6
- let component: NumberInputComponent;
7
- let fixture: ComponentFixture<NumberInputComponent>;
8
-
9
- beforeEach(async(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ NumberInputComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(NumberInputComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,19 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
- import {AbstractInputComponent} from '../abstract-input.component';
3
-
4
-
5
- @Component({
6
- selector: 'angular-ui-powerups-number-input',
7
- templateUrl: './number-input.component.html',
8
- styleUrls: ['./number-input.component.scss']
9
- })
10
- export class NumberInputComponent extends AbstractInputComponent<string> implements OnInit {
11
-
12
- constructor() {
13
- super();
14
- }
15
-
16
- ngOnInit() {
17
- }
18
-
19
- }
@@ -1,16 +0,0 @@
1
- <mat-form-field appearance="standard" [floatLabel]="floatLabel">
2
- <mat-label *ngIf="label">{{label}}</mat-label>
3
- <input type="password"
4
- matInput
5
- placeholder="{{placeholder}}"
6
- [(ngModel)]="valueModel.value"
7
- [disabled]="!enabled.value"
8
- (keydown.enter)="notifyEnterKey()"
9
- (keydown.escape)="notifyEscapeKey()"
10
- [pectinFocusBinding]="valueModel"
11
- [errorStateMatcher]="errorStateMatcher"
12
- >
13
- <mat-hint *ngIf="hint">{{hint}}</mat-hint>
14
- <mat-error *ngIf="hasErrors">{{firstError}}</mat-error>
15
- </mat-form-field>
16
-
@@ -1,3 +0,0 @@
1
- @import "../scss/mixins";
2
-
3
- @include mat-form-field-defaults;
@@ -1,25 +0,0 @@
1
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { PasswordInputComponent } from './password-input.component';
4
-
5
- describe('PasswordInputComponent', () => {
6
- let component: PasswordInputComponent;
7
- let fixture: ComponentFixture<PasswordInputComponent>;
8
-
9
- beforeEach(async(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ PasswordInputComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(PasswordInputComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,18 +0,0 @@
1
- import {Component, OnInit} from '@angular/core';
2
- import {AbstractInputComponent} from '../abstract-input.component';
3
-
4
- @Component({
5
- selector: 'angular-ui-powerups-password-input',
6
- templateUrl: './password-input.component.html',
7
- styleUrls: ['./password-input.component.scss']
8
- })
9
- export class PasswordInputComponent extends AbstractInputComponent<string> implements OnInit {
10
-
11
- constructor() {
12
- super();
13
- }
14
-
15
- ngOnInit() {
16
- }
17
-
18
- }
@@ -1,16 +0,0 @@
1
- @import '../../../../../../../node_modules/@angular/material/theming';
2
-
3
- @mixin mat-form-field-defaults {
4
-
5
- :host {
6
- display: block;
7
- }
8
-
9
- mat-form-field, input {
10
- width: 100%;
11
-
12
- mat-hint.faux-error {
13
- color: mat-color(mat-palette($mat-red));
14
- }
15
- }
16
- }
@@ -1,16 +0,0 @@
1
- <mat-form-field appearance="standard" [floatLabel]="floatLabel">
2
- <mat-label *ngIf="label">{{label}}</mat-label>
3
- <mat-select placeholder="{{placeholder}}"
4
- [(ngModel)]="valueModel.value"
5
- [disabled]="!enabled.value"
6
- (keydown.enter)="notifyEnterKey()"
7
- (keydown.escape)="notifyEscapeKey()"
8
- [pectinFocusBinding]="valueModel"
9
- [errorStateMatcher]="errorStateMatcher"
10
- >
11
- <mat-option *ngFor="let option of optionsModel.value" [value]="option">{{optionLabelFormat(option)}}
12
- </mat-option>
13
- </mat-select>
14
- <mat-hint *ngIf="hint">{{hint}}</mat-hint>
15
- <mat-error *ngIf="hasErrors">{{firstError}}</mat-error>
16
- </mat-form-field>
@@ -1,7 +0,0 @@
1
- :host {
2
- display: inline-block;
3
- }
4
-
5
- mat-form-field {
6
- width: 100%;
7
- }
@@ -1,25 +0,0 @@
1
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { SelectInputComponent } from './select-input.component';
4
-
5
- describe('SelectInputComponent', () => {
6
- let component: SelectInputComponent;
7
- let fixture: ComponentFixture<SelectInputComponent>;
8
-
9
- beforeEach(async(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ SelectInputComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(SelectInputComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });