@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.
- package/esm2022/lib/interaction/interaction.module.mjs +1 -8
- package/esm2022/lib/place/components/list-place-nav/list-place-nav.component.mjs +3 -4
- package/esm2022/lib/place/place.module.mjs +1 -5
- package/fesm2022/coolon-angular-ui-powerups.mjs +1 -12
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/interaction/interaction.module.d.ts +6 -7
- package/lib/place/place.module.d.ts +3 -4
- package/package.json +2 -2
- package/schematics/activity/index.d.ts +3 -0
- package/schematics/activity/index.js +32 -0
- package/schematics/activity/index.js.map +1 -0
- package/schematics/activity/index.spec.d.ts +1 -0
- package/schematics/activity/index.spec.js +364 -0
- package/schematics/activity/index.spec.js.map +1 -0
- package/schematics/activity/schema.d.ts +4 -0
- package/schematics/activity/schema.js +3 -0
- package/schematics/activity/schema.js.map +1 -0
- package/schematics/activity/schema.json +27 -0
- package/schematics/activity/templates/component/__name@dasherize__.component.html.template +5 -0
- package/schematics/activity/templates/component/__name@dasherize__.component.scss.template +4 -0
- package/schematics/activity/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
- package/schematics/activity/templates/component/__name@dasherize__.component.ts.template +40 -0
- package/schematics/activity/templates/component/__name@dasherize__.i18n.yml.template +9 -0
- package/schematics/aup-i18n/index.d.ts +4 -0
- package/schematics/aup-i18n/index.js +86 -0
- package/schematics/aup-i18n/index.js.map +1 -0
- package/schematics/aup-i18n/schema.d.ts +3 -0
- package/schematics/aup-i18n/schema.js +3 -0
- package/schematics/aup-i18n/schema.js.map +1 -0
- package/schematics/aup-i18n/schema.json +18 -0
- package/schematics/aup-i18n/templates/app/aup.i18n.yml.template +80 -0
- package/schematics/bootstrap-app/index.d.ts +4 -0
- package/schematics/bootstrap-app/index.js +109 -0
- package/schematics/bootstrap-app/index.js.map +1 -0
- package/schematics/bootstrap-app/schema.d.ts +3 -0
- package/schematics/bootstrap-app/schema.js +3 -0
- package/schematics/bootstrap-app/schema.js.map +1 -0
- package/schematics/bootstrap-app/schema.json +18 -0
- package/schematics/bootstrap-app/templates/i18n.config.json.template +11 -0
- package/schematics/bootstrap-app/templates/src/app/app-routing.module.ts.template +23 -0
- package/schematics/bootstrap-app/templates/src/app/app.component.html.template +7 -0
- package/schematics/bootstrap-app/templates/src/app/app.component.scss.template +12 -0
- package/schematics/bootstrap-app/templates/src/app/app.component.ts.template +19 -0
- package/schematics/bootstrap-app/templates/src/app/app.module.ts.template +74 -0
- package/schematics/bootstrap-app/templates/src/app/components/components.module.ts.template +16 -0
- package/schematics/bootstrap-app/templates/src/app/i18n.ts.template +9 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.eot +0 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.ijmap +1 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.svg +2373 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.ttf +0 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.woff +0 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.woff2 +0 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/README.md +9 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/codepoints +932 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/material-icons.css +36 -0
- package/schematics/bootstrap-app/templates/src/index.html.template +13 -0
- package/schematics/bootstrap-app/templates/src/styles/global-variables.scss.template +13 -0
- package/schematics/bootstrap-app/templates/src/styles.scss.template +85 -0
- package/schematics/collection.json +48 -0
- package/schematics/component/index.d.ts +3 -0
- package/schematics/component/index.js +36 -0
- package/schematics/component/index.js.map +1 -0
- package/schematics/component/index.spec.d.ts +1 -0
- package/schematics/component/index.spec.js +364 -0
- package/schematics/component/index.spec.js.map +1 -0
- package/schematics/component/schema.d.ts +5 -0
- package/schematics/component/schema.js +3 -0
- package/schematics/component/schema.js.map +1 -0
- package/schematics/component/schema.json +39 -0
- package/schematics/component/templates/component/__name@dasherize__.component.html.template +1 -0
- package/schematics/component/templates/component/__name@dasherize__.component.scss.template +4 -0
- package/schematics/component/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
- package/schematics/component/templates/component/__name@dasherize__.component.ts.template +24 -0
- package/schematics/component/templates/component/__name@dasherize__.i18n.yml.template +1 -0
- package/schematics/ng-add/index.d.ts +3 -0
- package/schematics/ng-add/index.js +37 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/package-util.d.ts +13 -0
- package/schematics/package-util.js +61 -0
- package/schematics/package-util.js.map +1 -0
- package/schematics/place-add/index.d.ts +3 -0
- package/schematics/place-add/index.js +45 -0
- package/schematics/place-add/index.js.map +1 -0
- package/schematics/place-add/index.spec.d.ts +1 -0
- package/schematics/place-add/index.spec.js +364 -0
- package/schematics/place-add/index.spec.js.map +1 -0
- package/schematics/place-add/schema.d.ts +4 -0
- package/schematics/place-add/schema.js +3 -0
- package/schematics/place-add/schema.js.map +1 -0
- package/schematics/place-add/schema.json +27 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.html.template +1 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.scss.template +4 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.ts.template +35 -0
- package/schematics/place-add/templates/component/__name@dasherize__.i18n.yml.template +5 -0
- package/schematics/place-bootstrap/index.d.ts +3 -0
- package/schematics/place-bootstrap/index.js +21 -0
- package/schematics/place-bootstrap/index.js.map +1 -0
- package/schematics/place-bootstrap/schema.d.ts +4 -0
- package/schematics/place-bootstrap/schema.js +3 -0
- package/schematics/place-bootstrap/schema.js.map +1 -0
- package/schematics/place-bootstrap/schema.json +28 -0
- package/schematics/place-bootstrap/templates/__name@dasherize__/place-routes.ts.template +3 -0
- package/schematics/place-bootstrap/templates/__name@dasherize__/places.module.ts.template +16 -0
- package/schematics/place-routes/index.d.ts +3 -0
- package/schematics/place-routes/index.js +24 -0
- package/schematics/place-routes/index.js.map +1 -0
- package/schematics/place-routes/place-builder.d.ts +18 -0
- package/schematics/place-routes/place-builder.js +123 -0
- package/schematics/place-routes/place-builder.js.map +1 -0
- package/schematics/place-routes/place-class-scanner.d.ts +47 -0
- package/schematics/place-routes/place-class-scanner.js +223 -0
- package/schematics/place-routes/place-class-scanner.js.map +1 -0
- package/schematics/place-routes/place-def.d.ts +62 -0
- package/schematics/place-routes/place-def.js +195 -0
- package/schematics/place-routes/place-def.js.map +1 -0
- package/schematics/place-routes/schema.d.ts +4 -0
- package/schematics/place-routes/schema.js +3 -0
- package/schematics/place-routes/schema.js.map +1 -0
- package/schematics/place-routes/schema.json +26 -0
- package/schematics/place-routes/templates/place-routes.ts.template +15 -0
- package/schematics/utils/build-context.d.ts +74 -0
- package/schematics/utils/build-context.js +189 -0
- package/schematics/utils/build-context.js.map +1 -0
- package/schematics/utils/decorators/decorated-class.d.ts +13 -0
- package/schematics/utils/decorators/decorated-class.js +28 -0
- package/schematics/utils/decorators/decorated-class.js.map +1 -0
- package/schematics/utils/decorators/decorated-source-file.d.ts +15 -0
- package/schematics/utils/decorators/decorated-source-file.js +27 -0
- package/schematics/utils/decorators/decorated-source-file.js.map +1 -0
- package/schematics/utils/import-def.d.ts +30 -0
- package/schematics/utils/import-def.js +97 -0
- package/schematics/utils/import-def.js.map +1 -0
- package/schematics/utils/method-scanner.d.ts +16 -0
- package/schematics/utils/method-scanner.js +70 -0
- package/schematics/utils/method-scanner.js.map +1 -0
- package/schematics/utils/mixin.d.ts +11 -0
- package/schematics/utils/mixin.js +27 -0
- package/schematics/utils/mixin.js.map +1 -0
- package/schematics/utils/parameter-def.d.ts +5 -0
- package/schematics/utils/parameter-def.js +3 -0
- package/schematics/utils/parameter-def.js.map +1 -0
- package/schematics/utils/path-helper.d.ts +14 -0
- package/schematics/utils/path-helper.js +30 -0
- package/schematics/utils/path-helper.js.map +1 -0
- package/schematics/utils/schematic-tree-file-system.d.ts +30 -0
- package/schematics/utils/schematic-tree-file-system.js +113 -0
- package/schematics/utils/schematic-tree-file-system.js.map +1 -0
- package/schematics/utils/source-file-scanner.d.ts +14 -0
- package/schematics/utils/source-file-scanner.js +89 -0
- package/schematics/utils/source-file-scanner.js.map +1 -0
- package/schematics/utils/source-file-utilities.d.ts +6 -0
- package/schematics/utils/source-file-utilities.js +36 -0
- package/schematics/utils/source-file-utilities.js.map +1 -0
- package/schematics/utils/stringy.d.ts +15 -0
- package/schematics/utils/stringy.js +50 -0
- package/schematics/utils/stringy.js.map +1 -0
- package/schematics/utils/template-utilities.d.ts +2 -0
- package/schematics/utils/template-utilities.js +24 -0
- package/schematics/utils/template-utilities.js.map +1 -0
- package/schematics/utils/workspace.d.ts +15 -0
- package/schematics/utils/workspace.js +59 -0
- package/schematics/utils/workspace.js.map +1 -0
|
@@ -32,14 +32,13 @@ import * as i30 from "@angular/cdk/portal";
|
|
|
32
32
|
import * as i31 from "@angular/router";
|
|
33
33
|
import * as i32 from "@angular/material/icon";
|
|
34
34
|
import * as i33 from "../directives/directives.module";
|
|
35
|
-
import * as i34 from "
|
|
36
|
-
import * as i35 from "
|
|
37
|
-
import * as i36 from "@angular/
|
|
38
|
-
import * as i37 from "@angular/material/legacy-
|
|
39
|
-
import * as i38 from "@angular/
|
|
40
|
-
import * as i39 from "@angular/cdk/a11y";
|
|
35
|
+
import * as i34 from "../components/components.module";
|
|
36
|
+
import * as i35 from "@angular/forms";
|
|
37
|
+
import * as i36 from "@angular/material/legacy-input";
|
|
38
|
+
import * as i37 from "@angular/material/legacy-form-field";
|
|
39
|
+
import * as i38 from "@angular/cdk/a11y";
|
|
41
40
|
export declare class InteractionModule {
|
|
42
41
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractionModule, never>;
|
|
43
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<InteractionModule, [typeof i1.ActivityContainerComponent, typeof i2.ConfirmationDialogComponent, typeof i3.ConfirmThenDialogComponent, typeof i4.ConfirmThenExecuteDialogComponent, typeof i5.AlertDialogComponent, typeof i6.ActivityOutletComponent, typeof i7.InPlaceInteractionContextComponent, typeof i8.AddItemInteractionContextComponent, typeof i9.ActivityActionsComponent, typeof i10.PopupInteractionContextComponent, typeof i11.StringInputActivity, typeof i12.SelectInputActivity, typeof i13.InputActivity, typeof i14.InteractionContextTriggerFor, typeof i15.Activity, typeof i16.ActivityTitleComponent, typeof i17.ActivityBodyComponent, typeof i9.ActivityActionsComponent, typeof i18.AbstractActivityTriggerComponent, typeof i19.PopupActivityTriggerComponent, typeof i20.InlineActivityTriggerComponent, typeof i21.ModalActivityTriggerComponent, typeof i22.AddCardActivityComponent, typeof i23.InlineStringEditorComponent, typeof i24.AbstractDialogComponent, typeof i25.AbstractConfirmDialogComponent], [typeof i26.CommonModule, typeof i27.MatLegacyButtonModule, typeof i28.MatLegacyDialogModule, typeof i29.MatLegacyTabsModule, typeof i30.PortalModule, typeof i31.RouterModule, typeof i32.MatIconModule, typeof i33.DirectivesModule, typeof i34.
|
|
42
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<InteractionModule, [typeof i1.ActivityContainerComponent, typeof i2.ConfirmationDialogComponent, typeof i3.ConfirmThenDialogComponent, typeof i4.ConfirmThenExecuteDialogComponent, typeof i5.AlertDialogComponent, typeof i6.ActivityOutletComponent, typeof i7.InPlaceInteractionContextComponent, typeof i8.AddItemInteractionContextComponent, typeof i9.ActivityActionsComponent, typeof i10.PopupInteractionContextComponent, typeof i11.StringInputActivity, typeof i12.SelectInputActivity, typeof i13.InputActivity, typeof i14.InteractionContextTriggerFor, typeof i15.Activity, typeof i16.ActivityTitleComponent, typeof i17.ActivityBodyComponent, typeof i9.ActivityActionsComponent, typeof i18.AbstractActivityTriggerComponent, typeof i19.PopupActivityTriggerComponent, typeof i20.InlineActivityTriggerComponent, typeof i21.ModalActivityTriggerComponent, typeof i22.AddCardActivityComponent, typeof i23.InlineStringEditorComponent, typeof i24.AbstractDialogComponent, typeof i25.AbstractConfirmDialogComponent], [typeof i26.CommonModule, typeof i27.MatLegacyButtonModule, typeof i28.MatLegacyDialogModule, typeof i29.MatLegacyTabsModule, typeof i30.PortalModule, typeof i31.RouterModule, typeof i32.MatIconModule, typeof i33.DirectivesModule, typeof i34.ComponentsModule, typeof i35.FormsModule, typeof i36.MatLegacyInputModule, typeof i37.MatLegacyFormFieldModule, typeof i38.A11yModule], [typeof i1.ActivityContainerComponent, typeof i6.ActivityOutletComponent, typeof i16.ActivityTitleComponent, typeof i7.InPlaceInteractionContextComponent, typeof i8.AddItemInteractionContextComponent, typeof i9.ActivityActionsComponent, typeof i10.PopupInteractionContextComponent, typeof i14.InteractionContextTriggerFor, typeof i11.StringInputActivity, typeof i12.SelectInputActivity, typeof i17.ActivityBodyComponent, typeof i19.PopupActivityTriggerComponent, typeof i20.InlineActivityTriggerComponent, typeof i21.ModalActivityTriggerComponent, typeof i22.AddCardActivityComponent, typeof i23.InlineStringEditorComponent]>;
|
|
44
43
|
static ɵinj: i0.ɵɵInjectorDeclaration<InteractionModule>;
|
|
45
44
|
}
|
|
@@ -14,11 +14,10 @@ import * as i12 from "@angular/material/legacy-list";
|
|
|
14
14
|
import * as i13 from "@angular/material/legacy-tooltip";
|
|
15
15
|
import * as i14 from "@angular/material/icon";
|
|
16
16
|
import * as i15 from "../directives/directives.module";
|
|
17
|
-
import * as i16 from "
|
|
18
|
-
import * as i17 from "
|
|
19
|
-
import * as i18 from "@angular/cdk/portal";
|
|
17
|
+
import * as i16 from "../components/components.module";
|
|
18
|
+
import * as i17 from "@angular/cdk/portal";
|
|
20
19
|
export declare class PlaceModule {
|
|
21
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<PlaceModule, never>;
|
|
22
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<PlaceModule, [typeof i1.PlaceOutletComponent, typeof i2.TabbedPlaceNavigationComponent, typeof i3.ListPlaceNavComponent, typeof i4.SidePlaceNavigationComponent, typeof i5.AbstractPlaceNavigationComponent, typeof i6.NotAuthorisedNoticeComponent], [typeof i7.CommonModule, typeof i8.BrowserAnimationsModule, typeof i9.MatLegacyProgressSpinnerModule, typeof i10.RouterModule, typeof i11.MatLegacyTabsModule, typeof i12.MatLegacyListModule, typeof i13.MatLegacyTooltipModule, typeof i14.MatIconModule, typeof i15.DirectivesModule, typeof i16.
|
|
21
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<PlaceModule, [typeof i1.PlaceOutletComponent, typeof i2.TabbedPlaceNavigationComponent, typeof i3.ListPlaceNavComponent, typeof i4.SidePlaceNavigationComponent, typeof i5.AbstractPlaceNavigationComponent, typeof i6.NotAuthorisedNoticeComponent], [typeof i7.CommonModule, typeof i8.BrowserAnimationsModule, typeof i9.MatLegacyProgressSpinnerModule, typeof i10.RouterModule, typeof i11.MatLegacyTabsModule, typeof i12.MatLegacyListModule, typeof i13.MatLegacyTooltipModule, typeof i14.MatIconModule, typeof i15.DirectivesModule, typeof i16.ComponentsModule, typeof i17.PortalModule], [typeof i1.PlaceOutletComponent, typeof i2.TabbedPlaceNavigationComponent, typeof i3.ListPlaceNavComponent, typeof i4.SidePlaceNavigationComponent, typeof i5.AbstractPlaceNavigationComponent]>;
|
|
23
22
|
static ɵinj: i0.ɵɵInjectorDeclaration<PlaceModule>;
|
|
24
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coolon/angular-ui-powerups",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.2",
|
|
4
4
|
"schematics": "./schematics/collection.json",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/animations": "^16.0.0",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"immer": ">=7.0.15",
|
|
23
23
|
"escape-string-regexp": "^5.0.0",
|
|
24
24
|
"ts-morph": "9.1.0",
|
|
25
|
-
"
|
|
25
|
+
"zone.js": "0.13.1"
|
|
26
26
|
},
|
|
27
27
|
"optionalDependencies": {
|
|
28
28
|
"@fortawesome/fontawesome-free": "^6.0.0"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addActivity = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const stringy_1 = require("../utils/stringy");
|
|
6
|
+
const template_utilities_1 = require("../utils/template-utilities");
|
|
7
|
+
const workspace_1 = require("../utils/workspace");
|
|
8
|
+
function addActivity(_options) {
|
|
9
|
+
return (tree, context) => {
|
|
10
|
+
const workspace = workspace_1.Workspace.load(tree, context);
|
|
11
|
+
const buildContext = workspace.getProject(_options.project);
|
|
12
|
+
const nameParts = _options.name.split('/');
|
|
13
|
+
const componentName = nameParts[nameParts.length - 1];
|
|
14
|
+
const componentPathParts = nameParts.slice(0, nameParts.length - 1);
|
|
15
|
+
const pathToSourceRoot = [buildContext.sourceCodeRoot].concat(componentPathParts);
|
|
16
|
+
// we'll let angular do it by just create a default component then we'll clobber it with our real templates later.
|
|
17
|
+
const updateModule = (0, schematics_1.externalSchematic)('@schematics/angular', 'component', {
|
|
18
|
+
project: _options.project,
|
|
19
|
+
name: _options.name
|
|
20
|
+
});
|
|
21
|
+
const i18nNamespace = `I18n.${componentPathParts.concat(componentName).map(p => stringy_1.Stringy.from(p).camelizeLower().toString()).join('.')}`;
|
|
22
|
+
const componentFiles = (0, template_utilities_1.applyTemplatesWithOverwrite)(tree, 'templates/component', {
|
|
23
|
+
name: componentName,
|
|
24
|
+
selectorPrefix: buildContext.selectorPrefix,
|
|
25
|
+
pathToRoot: pathToSourceRoot.map(p => '..').join('/'),
|
|
26
|
+
i18nNamespace
|
|
27
|
+
}, `${(pathToSourceRoot.join('/'))}/${componentName}`);
|
|
28
|
+
return (0, schematics_1.chain)([updateModule, componentFiles])(tree, context);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.addActivity = addActivity;
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/activity/index.ts"],"names":[],"mappings":";;;AAAA,2DAAoG;AACpG,8CAA2C;AAC3C,oEAA0E;AAC1E,kDAA+C;AAI/C,SAAgB,WAAW,CAAC,QAAgB;IAE1C,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAE/C,MAAM,SAAS,GAAG,qBAAS,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhD,MAAM,YAAY,GAAG,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAE5D,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,aAAa,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACtD,MAAM,kBAAkB,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACpE,MAAM,gBAAgB,GAAG,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAElF,kHAAkH;QAClH,MAAM,YAAY,GAAG,IAAA,8BAAiB,EAAC,qBAAqB,EAAE,WAAW,EAAE;YACzE,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,QAAQ,kBAAkB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAExI,MAAM,cAAc,GAAG,IAAA,gDAA2B,EAChD,IAAI,EACJ,qBAAqB,EACrB;YACE,IAAI,EAAE,aAAa;YACnB,cAAc,EAAE,YAAY,CAAC,cAAc;YAC3C,UAAU,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACrD,aAAa;SACd,EACD,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,aAAa,EAAE,CACnD,CAAC;QAGF,OAAO,IAAA,kBAAK,EAAC,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE9D,CAAC,CAAC;AAEJ,CAAC;AAtCD,kCAsCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
/**
|
|
13
|
+
* @license
|
|
14
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
15
|
+
*
|
|
16
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
17
|
+
* found in the LICENSE file at https://angular.io/license
|
|
18
|
+
*/
|
|
19
|
+
// tslint:disable:no-big-function
|
|
20
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
21
|
+
// import { Schema as ApplicationOptions } from '../application/schema';
|
|
22
|
+
// import { createAppModule } from '../utility/test';
|
|
23
|
+
// import { Schema as WorkspaceOptions } from '../workspace/schema';
|
|
24
|
+
// import { ChangeDetection, Schema as ComponentOptions, Style } from './schema';
|
|
25
|
+
describe('Add Place Schematic', () => {
|
|
26
|
+
const schematicRunner = new testing_1.SchematicTestRunner('@coolon/angular-ui-powerups', require.resolve('../collection.json'));
|
|
27
|
+
const workspaceOptions = {
|
|
28
|
+
name: 'testWorkspace',
|
|
29
|
+
newProjectRoot: 'apps',
|
|
30
|
+
version: '10.1.1'
|
|
31
|
+
};
|
|
32
|
+
// const appOptions: ApplicationOptions = {
|
|
33
|
+
const appOptions = {
|
|
34
|
+
name: 'bar',
|
|
35
|
+
routing: true,
|
|
36
|
+
prefix: 'the-prefix',
|
|
37
|
+
};
|
|
38
|
+
const defaultOptions = {
|
|
39
|
+
project: appOptions.name,
|
|
40
|
+
name: 'places/new-place'
|
|
41
|
+
};
|
|
42
|
+
let appTree;
|
|
43
|
+
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
|
+
appTree = yield schematicRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
|
|
45
|
+
appTree = yield schematicRunner.runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree).toPromise();
|
|
46
|
+
appTree = yield schematicRunner
|
|
47
|
+
.runSchematicAsync('bootstrap-app', {
|
|
48
|
+
project: appOptions.name,
|
|
49
|
+
initialPlaceName: undefined // need to disable this for the test as bootstrap will invoke us if specified
|
|
50
|
+
}, appTree)
|
|
51
|
+
.toPromise();
|
|
52
|
+
}));
|
|
53
|
+
it('should create a component', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
const options = Object.assign({}, defaultOptions);
|
|
55
|
+
const tree = yield schematicRunner.runSchematicAsync('place-add', options, appTree).toPromise();
|
|
56
|
+
const files = tree.files;
|
|
57
|
+
expect(files).toEqual(jasmine.arrayContaining([
|
|
58
|
+
'/apps/bar/src/app/places/new-place/new-place.component.scss',
|
|
59
|
+
'/apps/bar/src/app/places/new-place/new-place.component.html',
|
|
60
|
+
'/apps/bar/src/app/places/new-place/new-place.component.spec.ts',
|
|
61
|
+
'/apps/bar/src/app/places/new-place/new-place.component.ts'
|
|
62
|
+
]));
|
|
63
|
+
const moduleContent = tree.readContent('/apps/bar/src/app/places/new-place/new-place.component.ts');
|
|
64
|
+
expect(moduleContent).toMatch(/export class NewPlaceComponent extends PlaceComponent/);
|
|
65
|
+
expect(moduleContent).toMatch(/path: 'new-place'/);
|
|
66
|
+
expect(moduleContent).toMatch(/nav: I18n.places.newPlace.nav/);
|
|
67
|
+
expect(moduleContent).toMatch(/selector: 'the-prefix-new-place'/);
|
|
68
|
+
expect(moduleContent).toMatch(/import.*I18n.*from '\.\.\/\.\.\/i18n'/);
|
|
69
|
+
}));
|
|
70
|
+
it('should add it to the place module', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
const options = Object.assign({}, defaultOptions);
|
|
72
|
+
const tree = yield schematicRunner.runSchematicAsync('place-add', options, appTree).toPromise();
|
|
73
|
+
// const moduleContent = tree.readContent('/projects/bar/src/app/app.module.ts');
|
|
74
|
+
// expect(moduleContent).toMatch(/import.*Foo.*from '.\/foo\/foo.component'/);
|
|
75
|
+
// expect(moduleContent).toMatch(/declarations:\s*\[[^\]]+?,\r?\n\s+FooComponent\r?\n/m);
|
|
76
|
+
}));
|
|
77
|
+
it('should create an i18n file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
const options = Object.assign({}, defaultOptions);
|
|
79
|
+
const tree = yield schematicRunner.runSchematicAsync('place-add', options, appTree).toPromise();
|
|
80
|
+
const files = tree.files;
|
|
81
|
+
expect(files).toEqual(jasmine.arrayContaining([
|
|
82
|
+
'/apps/bar/src/i18n/places/new-place.yml',
|
|
83
|
+
]));
|
|
84
|
+
}));
|
|
85
|
+
// it('should set change detection to OnPush', async () => {
|
|
86
|
+
// const options = { ...defaultOptions, changeDetection: 'OnPush' };
|
|
87
|
+
//
|
|
88
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
89
|
+
// const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
90
|
+
// expect(tsContent).toMatch(/changeDetection: ChangeDetectionStrategy.OnPush/);
|
|
91
|
+
// });
|
|
92
|
+
// it('should not set view encapsulation', async () => {
|
|
93
|
+
// const options = { ...defaultOptions };
|
|
94
|
+
//
|
|
95
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
96
|
+
// const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
97
|
+
// expect(tsContent).not.toMatch(/encapsulation: ViewEncapsulation/);
|
|
98
|
+
// });
|
|
99
|
+
//
|
|
100
|
+
// it('should set view encapsulation to Emulated', async () => {
|
|
101
|
+
// const options = { ...defaultOptions, viewEncapsulation: 'Emulated' };
|
|
102
|
+
//
|
|
103
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
104
|
+
// const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
105
|
+
// expect(tsContent).toMatch(/encapsulation: ViewEncapsulation.Emulated/);
|
|
106
|
+
// });
|
|
107
|
+
//
|
|
108
|
+
// it('should set view encapsulation to None', async () => {
|
|
109
|
+
// const options = { ...defaultOptions, viewEncapsulation: 'None' };
|
|
110
|
+
//
|
|
111
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
112
|
+
// const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
113
|
+
// expect(tsContent).toMatch(/encapsulation: ViewEncapsulation.None/);
|
|
114
|
+
// });
|
|
115
|
+
// it('should create a flat component', async () => {
|
|
116
|
+
// const options = { ...defaultOptions, flat: true };
|
|
117
|
+
//
|
|
118
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
119
|
+
// const files = tree.files;
|
|
120
|
+
// expect(files).toEqual(
|
|
121
|
+
// jasmine.arrayContaining([
|
|
122
|
+
// '/projects/bar/src/app/foo.component.css',
|
|
123
|
+
// '/projects/bar/src/app/foo.component.html',
|
|
124
|
+
// '/projects/bar/src/app/foo.component.spec.ts',
|
|
125
|
+
// '/projects/bar/src/app/foo.component.ts',
|
|
126
|
+
// ]),
|
|
127
|
+
// );
|
|
128
|
+
// });
|
|
129
|
+
// it('should find the closest module', async () => {
|
|
130
|
+
// const options = { ...defaultOptions };
|
|
131
|
+
// const fooModule = '/projects/bar/src/app/foo/foo.module.ts';
|
|
132
|
+
// appTree.create(
|
|
133
|
+
// fooModule,
|
|
134
|
+
// `
|
|
135
|
+
// import { NgModule } from '@angular/core';
|
|
136
|
+
// @NgModule({
|
|
137
|
+
// imports: [],
|
|
138
|
+
// declarations: []
|
|
139
|
+
// })
|
|
140
|
+
// export class FooModule { }
|
|
141
|
+
// `
|
|
142
|
+
// );
|
|
143
|
+
//
|
|
144
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
145
|
+
// const fooModuleContent = tree.readContent(fooModule);
|
|
146
|
+
// expect(fooModuleContent).toMatch(/import { FooComponent } from '.\/foo.component'/);
|
|
147
|
+
// });
|
|
148
|
+
// it('should export the component', async () => {
|
|
149
|
+
// const options = { ...defaultOptions, export: true };
|
|
150
|
+
//
|
|
151
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
152
|
+
// const appModuleContent = tree.readContent('/projects/bar/src/app/app.module.ts');
|
|
153
|
+
// expect(appModuleContent).toMatch(/exports: \[FooComponent\]/);
|
|
154
|
+
// });
|
|
155
|
+
// it('should set the entry component', async () => {
|
|
156
|
+
// const options = { ...defaultOptions, entryComponent: true };
|
|
157
|
+
//
|
|
158
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
159
|
+
// const appModuleContent = tree.readContent('/projects/bar/src/app/app.module.ts');
|
|
160
|
+
// expect(appModuleContent).toMatch(/entryComponents: \[FooComponent\]/);
|
|
161
|
+
// });
|
|
162
|
+
// it('should import into a specified module', async () => {
|
|
163
|
+
// const options = { ...defaultOptions, module: 'app.module.ts' };
|
|
164
|
+
//
|
|
165
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
166
|
+
// const appModule = tree.readContent('/projects/bar/src/app/app.module.ts');
|
|
167
|
+
//
|
|
168
|
+
// expect(appModule).toMatch(/import { FooComponent } from '.\/foo\/foo.component'/);
|
|
169
|
+
// });
|
|
170
|
+
// it('should fail if specified module does not exist', async () => {
|
|
171
|
+
// const options = { ...defaultOptions, module: '/projects/bar/src/app.moduleXXX.ts' };
|
|
172
|
+
// let thrownError: Error | null = null;
|
|
173
|
+
// try {
|
|
174
|
+
// await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
175
|
+
// } catch (err) {
|
|
176
|
+
// thrownError = err;
|
|
177
|
+
// }
|
|
178
|
+
// expect(thrownError).toBeDefined();
|
|
179
|
+
// });
|
|
180
|
+
// it('should handle upper case paths', async () => {
|
|
181
|
+
// const pathOption = 'projects/bar/src/app/SOME/UPPER/DIR';
|
|
182
|
+
// const options = { ...defaultOptions, path: pathOption };
|
|
183
|
+
//
|
|
184
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
185
|
+
// let files = tree.files;
|
|
186
|
+
// let root = `/${pathOption}/foo/foo.component`;
|
|
187
|
+
// expect(files).toEqual(
|
|
188
|
+
// jasmine.arrayContaining([`${root}.css`, `${root}.html`, `${root}.spec.ts`, `${root}.ts`])
|
|
189
|
+
// );
|
|
190
|
+
//
|
|
191
|
+
// const options2 = { ...options, name: 'BAR' };
|
|
192
|
+
// const tree2 = await schematicRunner.runSchematicAsync('component', options2, tree).toPromise();
|
|
193
|
+
// files = tree2.files;
|
|
194
|
+
// root = `/${pathOption}/bar/bar.component`;
|
|
195
|
+
// expect(files).toEqual(
|
|
196
|
+
// jasmine.arrayContaining([`${root}.css`, `${root}.html`, `${root}.spec.ts`, `${root}.ts`])
|
|
197
|
+
// );
|
|
198
|
+
// });
|
|
199
|
+
// it('should create a component in a sub-directory', async () => {
|
|
200
|
+
// const options = { ...defaultOptions, path: 'projects/bar/src/app/a/b/c' };
|
|
201
|
+
//
|
|
202
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
203
|
+
// const files = tree.files;
|
|
204
|
+
// const root = `/${options.path}/foo/foo.component`;
|
|
205
|
+
// expect(files).toEqual(
|
|
206
|
+
// jasmine.arrayContaining([`${root}.css`, `${root}.html`, `${root}.spec.ts`, `${root}.ts`])
|
|
207
|
+
// );
|
|
208
|
+
// });
|
|
209
|
+
// it('should use the prefix', async () => {
|
|
210
|
+
// const options = { ...defaultOptions, prefix: 'pre' };
|
|
211
|
+
//
|
|
212
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
213
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
214
|
+
// expect(content).toMatch(/selector: 'pre-foo'/);
|
|
215
|
+
// });
|
|
216
|
+
// it('should use the default project prefix if none is passed', async () => {
|
|
217
|
+
// const options = { ...defaultOptions, prefix: undefined };
|
|
218
|
+
//
|
|
219
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
220
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
221
|
+
// expect(content).toMatch(/selector: 'app-foo'/);
|
|
222
|
+
// });
|
|
223
|
+
// it('should use the supplied prefix if it is ""', async () => {
|
|
224
|
+
// const options = { ...defaultOptions, prefix: '' };
|
|
225
|
+
//
|
|
226
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
227
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
228
|
+
// expect(content).toMatch(/selector: 'foo'/);
|
|
229
|
+
// });
|
|
230
|
+
// it('should respect the inlineTemplate option', async () => {
|
|
231
|
+
// const options = { ...defaultOptions, inlineTemplate: true };
|
|
232
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
233
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
234
|
+
// expect(content).toMatch(/template: /);
|
|
235
|
+
// expect(content).not.toMatch(/templateUrl: /);
|
|
236
|
+
// expect(tree.files).not.toContain('/projects/bar/src/app/foo/foo.component.html');
|
|
237
|
+
// });
|
|
238
|
+
//
|
|
239
|
+
// it('should respect the inlineStyle option', async () => {
|
|
240
|
+
// const options = { ...defaultOptions, inlineStyle: true };
|
|
241
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
242
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
243
|
+
// expect(content).toMatch(/styles: \[/);
|
|
244
|
+
// expect(content).not.toMatch(/styleUrls: /);
|
|
245
|
+
// expect(tree.files).not.toContain('/projects/bar/src/app/foo/foo.component.css');
|
|
246
|
+
// });
|
|
247
|
+
//
|
|
248
|
+
// it('should respect the displayBlock option when inlineStyle is `false`', async () => {
|
|
249
|
+
// const options = { ...defaultOptions, displayBlock: true };
|
|
250
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
251
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.component.css');
|
|
252
|
+
// expect(content).toMatch(/:host {\r?\n display: block;\r?\n}/);
|
|
253
|
+
// });
|
|
254
|
+
//
|
|
255
|
+
// it('should respect the displayBlock option when inlineStyle is `false` and use correct syntax for `scss`', async () => {
|
|
256
|
+
// const options = { ...defaultOptions, displayBlock: true, style: 'scss' };
|
|
257
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
258
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.component.scss');
|
|
259
|
+
// expect(content).toMatch(/:host {\r?\n display: block;\r?\n}/);
|
|
260
|
+
// });
|
|
261
|
+
//
|
|
262
|
+
// it('should respect the displayBlock option when inlineStyle is `false` and use correct syntax for `sass', async () => {
|
|
263
|
+
// const options = { ...defaultOptions, displayBlock: true, style: 'sass' };
|
|
264
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
265
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.component.sass');
|
|
266
|
+
// expect(content).toMatch(/\\:host\r?\n display: block;\r?\n/);
|
|
267
|
+
// });
|
|
268
|
+
//
|
|
269
|
+
// it('should respect the displayBlock option when inlineStyle is `true`', async () => {
|
|
270
|
+
// const options = { ...defaultOptions, displayBlock: true, inlineStyle: true };
|
|
271
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
272
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
273
|
+
// expect(content).toMatch(/:host {\r?\n(\s*)display: block;(\s*)}\r?\n/);
|
|
274
|
+
// });
|
|
275
|
+
// it('should respect the style option', async () => {
|
|
276
|
+
// const options = { ...defaultOptions, style: Style.Sass };
|
|
277
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
278
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
|
|
279
|
+
// expect(content).toMatch(/styleUrls: \['.\/foo.component.sass/);
|
|
280
|
+
// expect(tree.files).toContain('/projects/bar/src/app/foo/foo.component.sass');
|
|
281
|
+
// expect(tree.files).not.toContain('/projects/bar/src/app/foo/foo.component.css');
|
|
282
|
+
// });
|
|
283
|
+
// it('should respect the type option', async () => {
|
|
284
|
+
// const options = { ...defaultOptions, type: 'Route' };
|
|
285
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
286
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.route.ts');
|
|
287
|
+
// const testContent = tree.readContent('/projects/bar/src/app/foo/foo.route.spec.ts');
|
|
288
|
+
// expect(content).toContain('export class FooRoute implements OnInit');
|
|
289
|
+
// expect(testContent).toContain("describe('FooRoute'");
|
|
290
|
+
// expect(tree.files).toContain('/projects/bar/src/app/foo/foo.route.css');
|
|
291
|
+
// expect(tree.files).toContain('/projects/bar/src/app/foo/foo.route.html');
|
|
292
|
+
// });
|
|
293
|
+
// it('should allow empty string in the type option', async () => {
|
|
294
|
+
// const options = { ...defaultOptions, type: '' };
|
|
295
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
296
|
+
// const content = tree.readContent('/projects/bar/src/app/foo/foo.ts');
|
|
297
|
+
// const testContent = tree.readContent('/projects/bar/src/app/foo/foo.spec.ts');
|
|
298
|
+
// expect(content).toContain('export class Foo implements OnInit');
|
|
299
|
+
// expect(testContent).toContain("describe('Foo'");
|
|
300
|
+
// expect(tree.files).toContain('/projects/bar/src/app/foo/foo.css');
|
|
301
|
+
// expect(tree.files).toContain('/projects/bar/src/app/foo/foo.html');
|
|
302
|
+
// });
|
|
303
|
+
// it('should use the module flag even if the module is a routing module', async () => {
|
|
304
|
+
// const routingFileName = 'app-routing.module.ts';
|
|
305
|
+
// const routingModulePath = `/projects/bar/src/app/${routingFileName}`;
|
|
306
|
+
// const newTree = createAppModule(appTree, routingModulePath);
|
|
307
|
+
// const options = { ...defaultOptions, module: routingFileName };
|
|
308
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, newTree).toPromise();
|
|
309
|
+
// const content = tree.readContent(routingModulePath);
|
|
310
|
+
// expect(content).toMatch(/import { FooComponent } from '.\/foo\/foo.component/);
|
|
311
|
+
// });
|
|
312
|
+
// it('should handle a path in the name option', async () => {
|
|
313
|
+
// const options = { ...defaultOptions, name: 'dir/test-component' };
|
|
314
|
+
//
|
|
315
|
+
// const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
316
|
+
// const content = tree.readContent('/projects/bar/src/app/app.module.ts');
|
|
317
|
+
// expect(content).toMatch(
|
|
318
|
+
// /import { TestComponentComponent } from '\.\/dir\/test-component\/test-component.component'/
|
|
319
|
+
// );
|
|
320
|
+
// });
|
|
321
|
+
// it('should handle a path in the name and module options', async () => {
|
|
322
|
+
// appTree = await schematicRunner
|
|
323
|
+
// .runSchematicAsync('module', { name: 'admin/module', project: 'bar' }, appTree)
|
|
324
|
+
// .toPromise();
|
|
325
|
+
//
|
|
326
|
+
// const options = { ...defaultOptions, name: 'other/test-component', module: 'admin/module' };
|
|
327
|
+
// appTree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
328
|
+
//
|
|
329
|
+
// const content = appTree.readContent('/projects/bar/src/app/admin/module/module.module.ts');
|
|
330
|
+
// expect(content).toMatch(
|
|
331
|
+
// /import { TestComponentComponent } from '..\/..\/other\/test-component\/test-component.component'/
|
|
332
|
+
// );
|
|
333
|
+
// });
|
|
334
|
+
// it('should create the right selector with a path in the name', async () => {
|
|
335
|
+
// const options = { ...defaultOptions, name: 'sub/test' };
|
|
336
|
+
// appTree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
337
|
+
// const content = appTree.readContent('/projects/bar/src/app/sub/test/test.component.ts');
|
|
338
|
+
// expect(content).toMatch(/selector: 'app-test'/);
|
|
339
|
+
// });
|
|
340
|
+
// it('should respect the skipSelector option', async () => {
|
|
341
|
+
// const options = { ...defaultOptions, name: 'sub/test', skipSelector: true };
|
|
342
|
+
// appTree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise();
|
|
343
|
+
// const content = appTree.readContent('/projects/bar/src/app/sub/test/test.component.ts');
|
|
344
|
+
// expect(content).not.toMatch(/selector: 'app-test'/);
|
|
345
|
+
// });
|
|
346
|
+
// it('should respect the sourceRoot value', async () => {
|
|
347
|
+
// const config = JSON.parse(appTree.readContent('/angular.json'));
|
|
348
|
+
// config.projects.bar.sourceRoot = 'projects/bar/custom';
|
|
349
|
+
// appTree.overwrite('/angular.json', JSON.stringify(config, null, 2));
|
|
350
|
+
//
|
|
351
|
+
// // should fail without a module in that dir
|
|
352
|
+
// await expectAsync(
|
|
353
|
+
// schematicRunner.runSchematicAsync('component', defaultOptions, appTree).toPromise(),
|
|
354
|
+
// ).toBeRejected();
|
|
355
|
+
//
|
|
356
|
+
// // move the module
|
|
357
|
+
// appTree.rename('/projects/bar/src/app/app.module.ts', '/projects/bar/custom/app/app.module.ts');
|
|
358
|
+
// appTree = await schematicRunner
|
|
359
|
+
// .runSchematicAsync('component', defaultOptions, appTree)
|
|
360
|
+
// .toPromise();
|
|
361
|
+
// expect(appTree.files).toContain('/projects/bar/custom/app/foo/foo.component.ts');
|
|
362
|
+
// });
|
|
363
|
+
});
|
|
364
|
+
//# sourceMappingURL=index.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/activity/index.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;GAMG;AACH,iCAAiC;AACjC,gEAAuF;AACvF,wEAAwE;AACxE,qDAAqD;AACrD,oEAAoE;AACpE,iFAAiF;AAEjF,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,eAAe,GAAG,IAAI,6BAAmB,CAC7C,6BAA6B,EAC7B,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CACtC,CAAC;IAEF,MAAM,gBAAgB,GAAG;QACvB,IAAI,EAAE,eAAe;QACrB,cAAc,EAAE,MAAM;QACtB,OAAO,EAAE,QAAQ;KAClB,CAAC;IAEF,2CAA2C;IAC3C,MAAM,UAAU,GAAG;QACjB,IAAI,EAAE,KAAK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../../libs/angular-ui-powerups/schematics/activity/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "AddActivitySchematic",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "Add a new activity component",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the project.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "projectName"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"name": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "The name of the activity component.",
|
|
17
|
+
"$default": {
|
|
18
|
+
"$source": "argv",
|
|
19
|
+
"index": 0
|
|
20
|
+
},
|
|
21
|
+
"x-prompt": "What name would you like to use for the activity?"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"name"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { <%=capitalize(camelize(name))%>Component } from './<%=dasherize(name)%>.component';
|
|
4
|
+
|
|
5
|
+
describe('<%=capitalize(camelize(name))%>Component', () => {
|
|
6
|
+
let component: <%=capitalize(camelize(name))%>Component;
|
|
7
|
+
let fixture: ComponentFixture<<%=capitalize(camelize(name))%>Component>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ <%=capitalize(camelize(name))%>Component ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(<%=capitalize(camelize(name))%>Component);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {Component, Inject, OnInit} from '@angular/core';
|
|
2
|
+
import { Dsl, Command } from '@coolon/pectin';
|
|
3
|
+
import {Activity} from "@coolon/angular-ui-powerups";
|
|
4
|
+
import { I18n } from '<%=pathToRoot%>/i18n';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: '<%=selectorPrefix%>-<%=dasherize(name)%>',
|
|
8
|
+
templateUrl: './<%=dasherize(name)%>.component.html',
|
|
9
|
+
styleUrls: ['./<%=dasherize(name)%>.component.scss'],
|
|
10
|
+
})
|
|
11
|
+
export class <%=capitalize(camelize(name))%>Component extends Activity<<%=capitalize(camelize(name))%>Component.Data, void> implements OnInit {
|
|
12
|
+
|
|
13
|
+
readonly i18n = <%=i18nNamespace%>;
|
|
14
|
+
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
const {chain} = Dsl.disposeWith(this);
|
|
18
|
+
|
|
19
|
+
// Actity data is pre injected into...
|
|
20
|
+
// this.activityData
|
|
21
|
+
|
|
22
|
+
this.confirmCommand = Command.create(() => {
|
|
23
|
+
this.done();
|
|
24
|
+
});
|
|
25
|
+
this.cancelCommand = Command.create(() => {
|
|
26
|
+
this.cancel();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
this.busyWhile(this.confirmCommand.busy);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
ngOnInit() {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export namespace <%=capitalize(camelize(name))%>Component {
|
|
38
|
+
export interface Data {
|
|
39
|
+
}
|
|
40
|
+
}
|