@coolon/angular-ui-powerups 16.0.0 → 16.0.2

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 (163) hide show
  1. package/esm2022/lib/interaction/interaction.module.mjs +1 -8
  2. package/esm2022/lib/place/components/list-place-nav/list-place-nav.component.mjs +3 -4
  3. package/esm2022/lib/place/place.module.mjs +1 -5
  4. package/fesm2022/coolon-angular-ui-powerups.mjs +1 -12
  5. package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
  6. package/lib/interaction/interaction.module.d.ts +6 -7
  7. package/lib/place/place.module.d.ts +3 -4
  8. package/package.json +2 -2
  9. package/schematics/activity/index.d.ts +3 -0
  10. package/schematics/activity/index.js +32 -0
  11. package/schematics/activity/index.js.map +1 -0
  12. package/schematics/activity/index.spec.d.ts +1 -0
  13. package/schematics/activity/index.spec.js +364 -0
  14. package/schematics/activity/index.spec.js.map +1 -0
  15. package/schematics/activity/schema.d.ts +4 -0
  16. package/schematics/activity/schema.js +3 -0
  17. package/schematics/activity/schema.js.map +1 -0
  18. package/schematics/activity/schema.json +27 -0
  19. package/schematics/activity/templates/component/__name@dasherize__.component.html.template +5 -0
  20. package/schematics/activity/templates/component/__name@dasherize__.component.scss.template +4 -0
  21. package/schematics/activity/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
  22. package/schematics/activity/templates/component/__name@dasherize__.component.ts.template +40 -0
  23. package/schematics/activity/templates/component/__name@dasherize__.i18n.yml.template +9 -0
  24. package/schematics/aup-i18n/index.d.ts +4 -0
  25. package/schematics/aup-i18n/index.js +86 -0
  26. package/schematics/aup-i18n/index.js.map +1 -0
  27. package/schematics/aup-i18n/schema.d.ts +3 -0
  28. package/schematics/aup-i18n/schema.js +3 -0
  29. package/schematics/aup-i18n/schema.js.map +1 -0
  30. package/schematics/aup-i18n/schema.json +18 -0
  31. package/schematics/aup-i18n/templates/app/aup.i18n.yml.template +80 -0
  32. package/schematics/bootstrap-app/index.d.ts +4 -0
  33. package/schematics/bootstrap-app/index.js +109 -0
  34. package/schematics/bootstrap-app/index.js.map +1 -0
  35. package/schematics/bootstrap-app/schema.d.ts +3 -0
  36. package/schematics/bootstrap-app/schema.js +3 -0
  37. package/schematics/bootstrap-app/schema.js.map +1 -0
  38. package/schematics/bootstrap-app/schema.json +18 -0
  39. package/schematics/bootstrap-app/templates/i18n.config.json.template +11 -0
  40. package/schematics/bootstrap-app/templates/src/app/app-routing.module.ts.template +23 -0
  41. package/schematics/bootstrap-app/templates/src/app/app.component.html.template +7 -0
  42. package/schematics/bootstrap-app/templates/src/app/app.component.scss.template +12 -0
  43. package/schematics/bootstrap-app/templates/src/app/app.component.ts.template +19 -0
  44. package/schematics/bootstrap-app/templates/src/app/app.module.ts.template +74 -0
  45. package/schematics/bootstrap-app/templates/src/app/components/components.module.ts.template +16 -0
  46. package/schematics/bootstrap-app/templates/src/app/i18n.ts.template +9 -0
  47. package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.eot +0 -0
  48. package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.ijmap +1 -0
  49. package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.svg +2373 -0
  50. package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.ttf +0 -0
  51. package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.woff +0 -0
  52. package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.woff2 +0 -0
  53. package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/README.md +9 -0
  54. package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/codepoints +932 -0
  55. package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/material-icons.css +36 -0
  56. package/schematics/bootstrap-app/templates/src/index.html.template +13 -0
  57. package/schematics/bootstrap-app/templates/src/styles/global-variables.scss.template +13 -0
  58. package/schematics/bootstrap-app/templates/src/styles.scss.template +85 -0
  59. package/schematics/collection.json +48 -0
  60. package/schematics/component/index.d.ts +3 -0
  61. package/schematics/component/index.js +36 -0
  62. package/schematics/component/index.js.map +1 -0
  63. package/schematics/component/index.spec.d.ts +1 -0
  64. package/schematics/component/index.spec.js +364 -0
  65. package/schematics/component/index.spec.js.map +1 -0
  66. package/schematics/component/schema.d.ts +5 -0
  67. package/schematics/component/schema.js +3 -0
  68. package/schematics/component/schema.js.map +1 -0
  69. package/schematics/component/schema.json +39 -0
  70. package/schematics/component/templates/component/__name@dasherize__.component.html.template +1 -0
  71. package/schematics/component/templates/component/__name@dasherize__.component.scss.template +4 -0
  72. package/schematics/component/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
  73. package/schematics/component/templates/component/__name@dasherize__.component.ts.template +24 -0
  74. package/schematics/component/templates/component/__name@dasherize__.i18n.yml.template +1 -0
  75. package/schematics/ng-add/index.d.ts +3 -0
  76. package/schematics/ng-add/index.js +37 -0
  77. package/schematics/ng-add/index.js.map +1 -0
  78. package/schematics/package-util.d.ts +13 -0
  79. package/schematics/package-util.js +61 -0
  80. package/schematics/package-util.js.map +1 -0
  81. package/schematics/place-add/index.d.ts +3 -0
  82. package/schematics/place-add/index.js +45 -0
  83. package/schematics/place-add/index.js.map +1 -0
  84. package/schematics/place-add/index.spec.d.ts +1 -0
  85. package/schematics/place-add/index.spec.js +364 -0
  86. package/schematics/place-add/index.spec.js.map +1 -0
  87. package/schematics/place-add/schema.d.ts +4 -0
  88. package/schematics/place-add/schema.js +3 -0
  89. package/schematics/place-add/schema.js.map +1 -0
  90. package/schematics/place-add/schema.json +27 -0
  91. package/schematics/place-add/templates/component/__name@dasherize__.component.html.template +1 -0
  92. package/schematics/place-add/templates/component/__name@dasherize__.component.scss.template +4 -0
  93. package/schematics/place-add/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
  94. package/schematics/place-add/templates/component/__name@dasherize__.component.ts.template +35 -0
  95. package/schematics/place-add/templates/component/__name@dasherize__.i18n.yml.template +5 -0
  96. package/schematics/place-bootstrap/index.d.ts +3 -0
  97. package/schematics/place-bootstrap/index.js +21 -0
  98. package/schematics/place-bootstrap/index.js.map +1 -0
  99. package/schematics/place-bootstrap/schema.d.ts +4 -0
  100. package/schematics/place-bootstrap/schema.js +3 -0
  101. package/schematics/place-bootstrap/schema.js.map +1 -0
  102. package/schematics/place-bootstrap/schema.json +28 -0
  103. package/schematics/place-bootstrap/templates/__name@dasherize__/place-routes.ts.template +3 -0
  104. package/schematics/place-bootstrap/templates/__name@dasherize__/places.module.ts.template +16 -0
  105. package/schematics/place-routes/index.d.ts +3 -0
  106. package/schematics/place-routes/index.js +24 -0
  107. package/schematics/place-routes/index.js.map +1 -0
  108. package/schematics/place-routes/place-builder.d.ts +18 -0
  109. package/schematics/place-routes/place-builder.js +123 -0
  110. package/schematics/place-routes/place-builder.js.map +1 -0
  111. package/schematics/place-routes/place-class-scanner.d.ts +47 -0
  112. package/schematics/place-routes/place-class-scanner.js +223 -0
  113. package/schematics/place-routes/place-class-scanner.js.map +1 -0
  114. package/schematics/place-routes/place-def.d.ts +62 -0
  115. package/schematics/place-routes/place-def.js +195 -0
  116. package/schematics/place-routes/place-def.js.map +1 -0
  117. package/schematics/place-routes/schema.d.ts +4 -0
  118. package/schematics/place-routes/schema.js +3 -0
  119. package/schematics/place-routes/schema.js.map +1 -0
  120. package/schematics/place-routes/schema.json +26 -0
  121. package/schematics/place-routes/templates/place-routes.ts.template +15 -0
  122. package/schematics/utils/build-context.d.ts +74 -0
  123. package/schematics/utils/build-context.js +189 -0
  124. package/schematics/utils/build-context.js.map +1 -0
  125. package/schematics/utils/decorators/decorated-class.d.ts +13 -0
  126. package/schematics/utils/decorators/decorated-class.js +28 -0
  127. package/schematics/utils/decorators/decorated-class.js.map +1 -0
  128. package/schematics/utils/decorators/decorated-source-file.d.ts +15 -0
  129. package/schematics/utils/decorators/decorated-source-file.js +27 -0
  130. package/schematics/utils/decorators/decorated-source-file.js.map +1 -0
  131. package/schematics/utils/import-def.d.ts +30 -0
  132. package/schematics/utils/import-def.js +97 -0
  133. package/schematics/utils/import-def.js.map +1 -0
  134. package/schematics/utils/method-scanner.d.ts +16 -0
  135. package/schematics/utils/method-scanner.js +70 -0
  136. package/schematics/utils/method-scanner.js.map +1 -0
  137. package/schematics/utils/mixin.d.ts +11 -0
  138. package/schematics/utils/mixin.js +27 -0
  139. package/schematics/utils/mixin.js.map +1 -0
  140. package/schematics/utils/parameter-def.d.ts +5 -0
  141. package/schematics/utils/parameter-def.js +3 -0
  142. package/schematics/utils/parameter-def.js.map +1 -0
  143. package/schematics/utils/path-helper.d.ts +14 -0
  144. package/schematics/utils/path-helper.js +30 -0
  145. package/schematics/utils/path-helper.js.map +1 -0
  146. package/schematics/utils/schematic-tree-file-system.d.ts +30 -0
  147. package/schematics/utils/schematic-tree-file-system.js +113 -0
  148. package/schematics/utils/schematic-tree-file-system.js.map +1 -0
  149. package/schematics/utils/source-file-scanner.d.ts +14 -0
  150. package/schematics/utils/source-file-scanner.js +89 -0
  151. package/schematics/utils/source-file-scanner.js.map +1 -0
  152. package/schematics/utils/source-file-utilities.d.ts +6 -0
  153. package/schematics/utils/source-file-utilities.js +36 -0
  154. package/schematics/utils/source-file-utilities.js.map +1 -0
  155. package/schematics/utils/stringy.d.ts +15 -0
  156. package/schematics/utils/stringy.js +50 -0
  157. package/schematics/utils/stringy.js.map +1 -0
  158. package/schematics/utils/template-utilities.d.ts +2 -0
  159. package/schematics/utils/template-utilities.js +24 -0
  160. package/schematics/utils/template-utilities.js.map +1 -0
  161. package/schematics/utils/workspace.d.ts +15 -0
  162. package/schematics/utils/workspace.js +59 -0
  163. package/schematics/utils/workspace.js.map +1 -0
@@ -0,0 +1,18 @@
1
+ import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
2
+ import { BuildContext } from '../utils/build-context';
3
+ import { Schema } from './schema';
4
+ export declare class PlaceBuilder {
5
+ readonly options: Schema;
6
+ readonly buildContext: BuildContext.App;
7
+ readonly context: SchematicContext;
8
+ private projectName;
9
+ private projectType;
10
+ private sourceRoot;
11
+ private typescriptProject;
12
+ private tsConfigPath;
13
+ constructor(options: Schema, buildContext: BuildContext.App, context: SchematicContext);
14
+ process(tree: Tree): Rule;
15
+ private renderTemplates;
16
+ private extractPlaceDefinitions;
17
+ private buildPlaceHierarchy;
18
+ }
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlaceBuilder = void 0;
4
+ const core_1 = require("@angular-devkit/core");
5
+ const schematics_1 = require("@angular-devkit/schematics");
6
+ const _ = require("lodash");
7
+ const place_def_1 = require("./place-def");
8
+ // interface Config {
9
+ // authGuard: ClassImport;
10
+ // }
11
+ // interface PlaceRoot {
12
+ // dir: string,
13
+ // }
14
+ const noopRule = (tree, context) => tree;
15
+ class PlaceBuilder {
16
+ constructor(options, buildContext, context) {
17
+ this.options = options;
18
+ this.buildContext = buildContext;
19
+ this.context = context;
20
+ this.projectName = options.project;
21
+ this.sourceRoot = buildContext.sourceCodeRootDir;
22
+ this.context.logger.info(`sourceRoot=${this.sourceRoot}`);
23
+ this.context.logger.info(`projectName=${this.projectName}`);
24
+ }
25
+ process(tree) {
26
+ const placeRoots = [];
27
+ placeRoots.push(this.options.dir); // todo support multiple place roots on a single run.
28
+ const rules = placeRoots.map(r => this.sourceRoot.relativeDir(r)).map(placeRoot => {
29
+ const placeDefs = this.extractPlaceDefinitions(tree, placeRoot);
30
+ if (placeDefs.length < 1) {
31
+ this.context.logger.info(`No places found in ${placeRoot.treePath}`);
32
+ return noopRule;
33
+ }
34
+ else {
35
+ // TODO: doesn't handle namespaces
36
+ const visitParameterImports = _.uniqBy(_.flatMap(placeDefs, def => def.getVisitParameterImports()), "typeName")
37
+ .map(def => {
38
+ return {
39
+ typeName: def.typeName,
40
+ importPath: def.importPathFor(placeRoot)
41
+ };
42
+ });
43
+ return this.renderTemplates(placeRoot, placeDefs, visitParameterImports, tree);
44
+ }
45
+ });
46
+ return (0, schematics_1.chain)(rules);
47
+ }
48
+ renderTemplates(placeRoot, placeDefs, visitParameterImports, tree) {
49
+ // this.context.logger.info(`${this.workspaceProject.sourceRoot}/${this.projectType}`);
50
+ // this.context.logger.info(placeRoot.dir);
51
+ const files = (0, schematics_1.apply)((0, schematics_1.url)('./templates'), [
52
+ (0, schematics_1.applyTemplates)(Object.assign(Object.assign(Object.assign({}, this.options), { placeDefs,
53
+ visitParameterImports }), core_1.strings)),
54
+ (0, schematics_1.move)(`${placeRoot.treePath}`),
55
+ // @see https://github.com/angular/angular-cli/issues/11337#issuecomment-448259549
56
+ (0, schematics_1.forEach)((fileEntry) => {
57
+ this.context.logger.info(fileEntry.path);
58
+ if (tree.exists(fileEntry.path)) {
59
+ tree.overwrite(fileEntry.path, fileEntry.content);
60
+ }
61
+ return fileEntry;
62
+ })
63
+ ]);
64
+ return (0, schematics_1.mergeWith)(files);
65
+ }
66
+ // private parseConfig(configString: string): Config {
67
+ // const rawConfig = JSON5.parse(configString);
68
+ // const config:Config = {
69
+ // authGuard: {
70
+ // className: 'NoopAuthGuard', importPath: '@coolon/angular-ui-powerups', ...rawConfig.authGuard
71
+ // }
72
+ // };
73
+ // this.context.logger.info(`config: ${JSON5.stringify(config)}`);
74
+ // return config;
75
+ // }
76
+ extractPlaceDefinitions(tree, placeRootPath) {
77
+ const placeDefs = [];
78
+ this.context.logger.info(`Scanning sources in -> ${placeRootPath.treePath}`);
79
+ const placeRootDir = tree.getDir(placeRootPath.treePath);
80
+ placeRootDir.visit(filePath => {
81
+ if (!filePath.endsWith('.ts') || filePath.endsWith('.spec.ts')) {
82
+ return;
83
+ }
84
+ const content = tree.read(filePath);
85
+ if (!content) {
86
+ return;
87
+ }
88
+ const sourceFile = this.buildContext.getSourceFile(`./${filePath}`);
89
+ if (!sourceFile) {
90
+ throw new Error(`${filePath} is not included by ${this.tsConfigPath}. Until I fix this properly you can add an '"include": ["src/app/**/*.ts", "src/app/**/*.d.ts"], "exclude":["**/*.spec.*"]' `);
91
+ }
92
+ else {
93
+ const imports = sourceFile.getImportDeclarations();
94
+ sourceFile.getClasses().forEach((classDecl) => {
95
+ place_def_1.PlaceDef.scan(sourceFile, classDecl, this.context).onMatch(result => {
96
+ const moduleImportPath = `.${filePath.substr(placeRootDir.path.length, filePath.length - placeRootDir.path.length - '.ts'.length)}`;
97
+ const definition = result.createDefinition(moduleImportPath);
98
+ this.context.logger.info(`${classDecl.getName()}(route: /${definition.fullPath}) -> ${moduleImportPath}`);
99
+ placeDefs.push(definition);
100
+ });
101
+ });
102
+ }
103
+ });
104
+ const rootPlaces = this.buildPlaceHierarchy(placeDefs);
105
+ return placeDefs;
106
+ }
107
+ buildPlaceHierarchy(placeDefs) {
108
+ const parentPlaces = placeDefs.filter(d => d.childRefs.length > 0);
109
+ const childPlaces = [];
110
+ parentPlaces.forEach(p => {
111
+ p.childRefs.forEach(c => {
112
+ const childPlaceDef = c.resolve(placeDefs);
113
+ if (!childPlaceDef) {
114
+ throw new Error(`${p.componentClass} references child ${c.componentClass} which isn't a @Place`);
115
+ }
116
+ childPlaces.push(childPlaceDef);
117
+ childPlaceDef.setParent(p);
118
+ });
119
+ });
120
+ }
121
+ }
122
+ exports.PlaceBuilder = PlaceBuilder;
123
+ //# sourceMappingURL=place-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"place-builder.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/place-routes/place-builder.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAC7C,2DAYoC;AACpC,4BAA4B;AAG5B,2CAAqC;AAQrC,qBAAqB;AACrB,4BAA4B;AAC5B,IAAI;AAEJ,wBAAwB;AACxB,iBAAiB;AACjB,IAAI;AAEJ,MAAM,QAAQ,GAAG,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE,CAAC,IAAI,CAAC;AAEjE,MAAa,YAAY;IASvB,YAAqB,OAAe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AAG,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;wBAC7D,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,YAAY,UAAU,CAAC,QAAQ,QAAQ,gBAAgB,EAAE,CAAC,CAAC;wBAC1G,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBAC7B,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;QACH,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACvD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,mBAAmB,CAAC,SAAqB;QAC/C,MAAM,YAAY,GAAe,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/E,MAAM,WAAW,GAAe,EAAE,CAAC;QACnC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACvB,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACtB,MAAM,aAAa,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBAC3C,IAAI,CAAC,aAAa,EAAE;oBAClB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,cAAc,qBAAqB,CAAC,CAAC,cAAc,uBAAuB,CAAC,CAAC;iBAClG;gBACD,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBAChC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAjID,oCAiIC"}
@@ -0,0 +1,47 @@
1
+ import { SchematicContext } from '@angular-devkit/schematics';
2
+ import { ClassDeclaration, Decorator, ObjectLiteralExpression, PropertyDeclaration } from 'ts-morph';
3
+ import { DecoratedSourceFile } from '../utils/decorators/decorated-source-file';
4
+ import { ImportDef } from "../utils/import-def";
5
+ import { PlaceDef } from './place-def';
6
+ export declare class PlaceClassScanner {
7
+ private readonly sourceFile;
8
+ private readonly classDecl;
9
+ readonly context: SchematicContext;
10
+ private placeAnnotation;
11
+ constructor(sourceFile: DecoratedSourceFile, classDecl: ClassDeclaration, context: SchematicContext);
12
+ isPlace(): boolean;
13
+ onMatch(callback: (scan: PlaceClassScanner) => void): void;
14
+ createDefinition(moduleImportPath: string): PlaceDef;
15
+ protected getPlaceOptions(): PlaceDef.Options;
16
+ protected getChildren(): PlaceDef.ChildRef[];
17
+ protected getDefaultChild(): string;
18
+ protected getRedirectToFirstChild(): boolean;
19
+ getChildRefFor(componentClassName: string): PlaceDef.ChildRef;
20
+ private extractChildComponentClassNames;
21
+ protected getRouteIdParameter(): PlaceClassScanner.RouteParameterInfo;
22
+ protected getRouteParameters(): PlaceDef.Parameter[];
23
+ private getVisitValueParameters;
24
+ private getVisitListParameters;
25
+ protected getDecoratedProperties(annotation: string): {
26
+ decorator: Decorator;
27
+ property: PropertyDeclaration;
28
+ }[];
29
+ }
30
+ export declare namespace PlaceClassScanner {
31
+ function getObjectLiteralArgument(annotation: Decorator, position: number): ObjectLiteralExpression;
32
+ function getOptionsArg<T extends {}>(annotation: Decorator, defaults: T, options?: {
33
+ position: number;
34
+ required: boolean;
35
+ }): T;
36
+ class RouteParameterInfo implements PlaceDef.Parameter {
37
+ private readonly as;
38
+ readonly optional: boolean;
39
+ readonly property: PropertyDeclaration;
40
+ readonly array: boolean;
41
+ readonly parameterType: string;
42
+ readonly importDef: ImportDef | undefined;
43
+ constructor(as: string, optional: boolean, property: PropertyDeclaration, sourceFile: DecoratedSourceFile);
44
+ get parameterName(): string;
45
+ get modelName(): string;
46
+ }
47
+ }
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PlaceClassScanner = void 0;
13
+ const fast_memoize_decorator_1 = require("@typescript-plus/fast-memoize-decorator");
14
+ const lodash_1 = require("lodash");
15
+ const ts_morph_1 = require("ts-morph");
16
+ const import_def_1 = require("../utils/import-def");
17
+ const place_def_1 = require("./place-def");
18
+ function isDecoratorNode(node, name) {
19
+ return node.getKind() === ts_morph_1.SyntaxKind.Decorator && node.getText().startsWith(`${name}(`); // NOTE: I'm only supporting the @Decorator(...) style of usage (i.e. decorator factories).
20
+ }
21
+ const ROUTE_PROPERTY_REGEX = /.*(ListModel|ValueModel)<(.*)>/;
22
+ // @See https://astexplorer.net/
23
+ class PlaceClassScanner {
24
+ constructor(sourceFile, classDecl, context) {
25
+ this.sourceFile = sourceFile;
26
+ this.classDecl = classDecl;
27
+ this.context = context;
28
+ // @ts-ignore
29
+ classDecl.forEachChild((node) => {
30
+ if (isDecoratorNode(node, '@Place')) {
31
+ this.placeAnnotation = node;
32
+ // stop iterating when the node is a class declaration
33
+ return true;
34
+ }
35
+ });
36
+ }
37
+ isPlace() {
38
+ return !!this.placeAnnotation;
39
+ }
40
+ onMatch(callback) {
41
+ if (this.isPlace()) {
42
+ callback(this);
43
+ }
44
+ }
45
+ createDefinition(moduleImportPath) {
46
+ return new place_def_1.PlaceDef(this.sourceFile.getFilePath(), moduleImportPath, this.classDecl.getName(), this.getPlaceOptions(), this.getRouteIdParameter(), this.getRouteParameters(), this.getChildren(), this.getDefaultChild(), this.getRedirectToFirstChild());
47
+ }
48
+ getPlaceOptions() {
49
+ // const args = this.placeAnnotation.getArguments();
50
+ // if (args.length !== 1) {
51
+ // console.error('@Place() accepts a single Options argument. got', args);
52
+ // }
53
+ return PlaceClassScanner.getOptionsArg(this.placeAnnotation, {
54
+ title: '',
55
+ path: '',
56
+ data: null,
57
+ authenticate: 'true',
58
+ roles: [],
59
+ redirectToFirstChild: false
60
+ }, {
61
+ position: 0,
62
+ required: true
63
+ });
64
+ }
65
+ getChildren() {
66
+ const literal = PlaceClassScanner.getObjectLiteralArgument(this.placeAnnotation, 0);
67
+ const children = literal.getProperty('children');
68
+ if (children) {
69
+ const initialiser = children.getStructure().initializer;
70
+ const componentClassNames = this.extractChildComponentClassNames(initialiser);
71
+ // FIXME: Check for duplicates
72
+ return componentClassNames.map(componentClassName => this.getChildRefFor(componentClassName));
73
+ }
74
+ else {
75
+ return [];
76
+ }
77
+ }
78
+ getDefaultChild() {
79
+ const literal = PlaceClassScanner.getObjectLiteralArgument(this.placeAnnotation, 0);
80
+ const defaultChild = literal.getProperty('defaultChild');
81
+ return defaultChild ? defaultChild.getStructure().initializer : null;
82
+ }
83
+ getRedirectToFirstChild() {
84
+ const literal = PlaceClassScanner.getObjectLiteralArgument(this.placeAnnotation, 0);
85
+ const redirect = literal.getProperty('redirectToFirstChild');
86
+ return redirect ? redirect.getStructure().initializer === 'true' : false;
87
+ }
88
+ getChildRefFor(componentClassName) {
89
+ const importDecl = this.sourceFile.getImportDeclarations().find(d => {
90
+ return d.getNamedImports().map(i => i.getText()).includes(componentClassName);
91
+ });
92
+ return new place_def_1.PlaceDef.ChildRef(importDecl.getModuleSpecifierSourceFile().getFilePath(), componentClassName);
93
+ }
94
+ extractChildComponentClassNames(initialiser) {
95
+ return initialiser.replace('[', '')
96
+ .replace(']', '')
97
+ .trim()
98
+ .split(',')
99
+ .map(s => s.trim())
100
+ .filter(s => !(0, lodash_1.isEmpty)(s)); // trailing commas on the last place in the list give us an empty string.
101
+ }
102
+ getRouteIdParameter() {
103
+ const routeProperties = this.getDecoratedProperties('@RouteId');
104
+ if (routeProperties.length === 1) {
105
+ const route = routeProperties[0];
106
+ const routeOptions = PlaceClassScanner.getOptionsArg(route.decorator, { as: '', optional: false }, {
107
+ position: 1,
108
+ required: false
109
+ });
110
+ return new PlaceClassScanner.RouteParameterInfo(routeOptions.as, routeOptions.optional, route.property, this.sourceFile);
111
+ }
112
+ else if (routeProperties.length > 1) {
113
+ this.context.logger.error(`There an only be one @RouteId(), got ${routeProperties.length}`);
114
+ }
115
+ return null;
116
+ }
117
+ getRouteParameters() {
118
+ return this.getVisitValueParameters().concat(this.getVisitListParameters());
119
+ }
120
+ getVisitValueParameters() {
121
+ return this.getDecoratedProperties('@VisitParameter')
122
+ .map(p => {
123
+ const routeOptions = PlaceClassScanner.getOptionsArg(p.decorator, { as: p.property.getName() }, {
124
+ position: 0,
125
+ required: false
126
+ });
127
+ return new PlaceClassScanner.RouteParameterInfo(routeOptions.as, true, p.property, this.sourceFile);
128
+ });
129
+ }
130
+ getVisitListParameters() {
131
+ return this.getDecoratedProperties('@VisitParameterList')
132
+ .map(p => {
133
+ const routeOptions = PlaceClassScanner.getOptionsArg(p.decorator, { as: p.property.getName() }, {
134
+ position: 0,
135
+ required: false
136
+ });
137
+ return new PlaceClassScanner.RouteParameterInfo(routeOptions.as, true, p.property, this.sourceFile);
138
+ });
139
+ }
140
+ getDecoratedProperties(annotation) {
141
+ return this.classDecl.getProperties().map(p => {
142
+ let result = null;
143
+ // @ts-ignore
144
+ p.forEachChild((child) => {
145
+ if (isDecoratorNode(child, annotation)) {
146
+ result = {
147
+ decorator: child,
148
+ property: p
149
+ };
150
+ // stop traversal
151
+ return true;
152
+ }
153
+ });
154
+ return result;
155
+ }).filter(r => !!r);
156
+ }
157
+ }
158
+ exports.PlaceClassScanner = PlaceClassScanner;
159
+ (function (PlaceClassScanner) {
160
+ function getObjectLiteralArgument(annotation, position) {
161
+ const args = annotation.getArguments();
162
+ if (args.length > position && args[position] instanceof ts_morph_1.ObjectLiteralExpression) {
163
+ return args[position];
164
+ }
165
+ return null;
166
+ }
167
+ PlaceClassScanner.getObjectLiteralArgument = getObjectLiteralArgument;
168
+ function getOptionsArg(annotation, defaults, options = {
169
+ position: 0,
170
+ required: true
171
+ }) {
172
+ const objectLiteralArgument = getObjectLiteralArgument(annotation, options.position);
173
+ if (!objectLiteralArgument) {
174
+ if (options.required) {
175
+ console.error(`expected object literal arg at position ${options.position}`, { expectedType: defaults });
176
+ }
177
+ return defaults;
178
+ }
179
+ else {
180
+ return objectLiteralArgument.getProperties().reduce((result, p) => {
181
+ const structure = p.getStructure();
182
+ return Object.assign(Object.assign({}, result), { [structure.name]: structure.initializer });
183
+ }, Object.assign({}, defaults));
184
+ }
185
+ }
186
+ PlaceClassScanner.getOptionsArg = getOptionsArg;
187
+ class RouteParameterInfo {
188
+ constructor(as, optional, property, sourceFile) {
189
+ this.as = as;
190
+ this.optional = optional;
191
+ this.property = property;
192
+ const type = property.getStructure().type;
193
+ const match = ROUTE_PROPERTY_REGEX.exec(type);
194
+ if (!match) {
195
+ throw new Error(`expected ${property.getName()} to be a ListModel or ValueModel, got: ${type}`);
196
+ }
197
+ this.array = match[1] === 'ListModel';
198
+ this.parameterType = match[2];
199
+ const importDec = sourceFile.getImportDeclarations().find(d => {
200
+ return d.getNamedImports().map(i => i.getText()).includes(this.parameterType);
201
+ });
202
+ this.importDef = importDec ? import_def_1.ImportDef.create(this.parameterType, importDec) : undefined;
203
+ }
204
+ get parameterName() {
205
+ return this.as.length > 0 ? place_def_1.PlaceDef.stripEnclosingQuotes(this.as) : this.modelName;
206
+ }
207
+ get modelName() {
208
+ return place_def_1.PlaceDef.stripEnclosingQuotes(this.property.getName());
209
+ }
210
+ }
211
+ __decorate([
212
+ (0, fast_memoize_decorator_1.Memoize)(),
213
+ __metadata("design:type", String),
214
+ __metadata("design:paramtypes", [])
215
+ ], RouteParameterInfo.prototype, "parameterName", null);
216
+ __decorate([
217
+ (0, fast_memoize_decorator_1.Memoize)(),
218
+ __metadata("design:type", String),
219
+ __metadata("design:paramtypes", [])
220
+ ], RouteParameterInfo.prototype, "modelName", null);
221
+ PlaceClassScanner.RouteParameterInfo = RouteParameterInfo;
222
+ })(PlaceClassScanner = exports.PlaceClassScanner || (exports.PlaceClassScanner = {}));
223
+ //# sourceMappingURL=place-class-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"place-class-scanner.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/place-routes/place-class-scanner.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oFAAgE;AAChE,mCAA+B;AAC/B,uCAQkB;AAElB,oDAA8C;AAC9C,2CAAqC;AAGrC,SAAS,eAAe,CAAC,IAAU,EAAE,IAAY;IAC/C,OAAO,IAAI,CAAC,OAAO,EAAE,KAAK,qBAAU,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,2FAA2F;AACtL,CAAC;AAED,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAE9D,gCAAgC;AAChC,MAAa,iBAAiB;IAI5B,YAA6B,UAA+B,EAAmB,SAA2B,EAAW,OAAyB;QAAjH,eAAU,GAAV,UAAU,CAAqB;QAAmB,cAAS,GAAT,SAAS,CAAkB;QAAW,YAAO,GAAP,OAAO,CAAkB;QAC5I,aAAa;QACb,SAAS,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE;YAC9B,IAAI,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE;gBACnC,IAAI,CAAC,eAAe,GAAG,IAAiB,CAAC;gBACzC,sDAAsD;gBACtD,OAAO,IAAI,CAAC;aACb;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,OAAO,CAAC,CAAC,IA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AAoB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;QACtF,CAAC;QAED,IACI,SAAS;YACX,OAAO,oBAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QAChE,CAAC;KAEF;IAVC;QAAC,IAAA,gCAAO,GAAE;;;2DAGT;IAED;QAAC,IAAA,gCAAO,GAAE;;;uDAGT;IA5BU,oCAAkB,qBA8B9B,CAAA;AACH,CAAC,EA3DgB,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QA2DjC"}
@@ -0,0 +1,62 @@
1
+ import { SchematicContext } from '@angular-devkit/schematics';
2
+ import { ClassDeclaration } from 'ts-morph';
3
+ import { DecoratedSourceFile } from '../utils/decorators/decorated-source-file';
4
+ import { ImportDef } from "../utils/import-def";
5
+ import { PlaceClassScanner } from './place-class-scanner';
6
+ export declare class PlaceDef {
7
+ readonly sourceFilePath: string;
8
+ readonly importPath: string;
9
+ readonly componentClass: string;
10
+ readonly properties: PlaceDef.Options;
11
+ readonly routeDef: PlaceDef.Parameter;
12
+ readonly routeParameters: PlaceDef.Parameter[];
13
+ readonly childRefs: PlaceDef.ChildRef[];
14
+ readonly defaultChildComponentClass: string;
15
+ readonly redirectToFirstChild: boolean;
16
+ private parent;
17
+ constructor(sourceFilePath: string, importPath: string, componentClass: string, properties: PlaceDef.Options, routeDef: PlaceDef.Parameter, routeParameters: PlaceDef.Parameter[], childRefs: PlaceDef.ChildRef[], defaultChildComponentClass: string, redirectToFirstChild: boolean);
18
+ get path(): string;
19
+ get routeIdentifier(): PlaceDef.Parameter;
20
+ get fullPath(): string;
21
+ getVisitParameterImports(): ImportDef[];
22
+ getPlaceDestinationParameterArg(name: string): string;
23
+ getPlaceDestinationCreateVisitMethod(): string;
24
+ getPlaceDestinationVisitConstructor(): string;
25
+ get placeName(): string;
26
+ setParent(placeDef: PlaceDef): void;
27
+ isChild(): boolean;
28
+ private requiresRouteGuard;
29
+ get routeModelName(): string;
30
+ get authenticate(): boolean;
31
+ get children(): PlaceDef[];
32
+ getRouteTemplate(): string;
33
+ getChildRouteTemplates(): string[];
34
+ get defaultChildRef(): PlaceDef;
35
+ }
36
+ export declare namespace PlaceDef {
37
+ interface Options {
38
+ path: string;
39
+ data: object;
40
+ authenticate: string;
41
+ roles: string[];
42
+ redirectToFirstChild: boolean;
43
+ }
44
+ interface Parameter {
45
+ parameterName: string;
46
+ modelName: string;
47
+ parameterType: string;
48
+ optional: boolean;
49
+ array: boolean;
50
+ importDef: ImportDef | undefined;
51
+ }
52
+ function scan(sourceFile: DecoratedSourceFile, classDecl: ClassDeclaration, context: SchematicContext): PlaceClassScanner;
53
+ function stripEnclosingQuotes(value: string): string;
54
+ class ChildRef {
55
+ readonly filePath: string;
56
+ readonly componentClass: string;
57
+ private _placeDef;
58
+ constructor(filePath: string, componentClass: string);
59
+ get placeDef(): PlaceDef;
60
+ resolve(placeDefs: PlaceDef[]): PlaceDef;
61
+ }
62
+ }