This commit is contained in:
CHEVALLIER Abel
2025-11-13 16:23:22 +01:00
parent de9c515a47
commit cb235644dc
34924 changed files with 3811102 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const schematics_1 = require("@angular/cdk/schematics");
const schematics_2 = require("@angular-devkit/schematics");
const utility_1 = require("@schematics/angular/utility");
const fs_1 = require("fs");
const bootPageHTML = `<!-- NG-ZORRO -->
<a href="https://github.com/NG-ZORRO/ng-zorro-antd" target="_blank" style="display: flex;align-items: center;justify-content: center;height: 100%;width: 100%;">
<img height="300" alt="logo" src="https://img.alicdn.com/tfs/TB1X.qJJgHqK1RjSZFgXXa7JXXa-89-131.svg">
</a>`;
function default_1(options) {
return (host, context) => __awaiter(this, void 0, void 0, function* () {
const workspace = yield (0, utility_1.readWorkspace)(host);
const project = (0, schematics_1.getProjectFromWorkspace)(workspace, options.project);
const appHTMLFile = `${project.sourceRoot}/app/app.html`;
const buffer = host.read(appHTMLFile);
if (!buffer) {
context.logger.error(`Could not find the project ${appHTMLFile} file inside of the ` + `workspace config`);
return (0, schematics_2.noop)();
}
if ((0, fs_1.existsSync)(appHTMLFile)) {
const stat = (0, fs_1.statSync)(appHTMLFile);
if (stat.mtimeMs === stat.ctimeMs) {
host.overwrite(appHTMLFile, bootPageHTML);
}
}
else {
host.overwrite(appHTMLFile, bootPageHTML);
}
return (0, schematics_2.noop)();
});
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/blank/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;AAiBH,4BAwBC;AAvCD,wDAAkE;AAGlE,2DAA8D;AAC9D,yDAA4D;AAE5D,2BAA0C;AAI1C,MAAM,YAAY,GAAG;;;KAGhB,CAAC;AAEN,mBAAwB,OAAe;IACrC,OAAO,CAAO,IAAU,EAAE,OAAO,EAAE,EAAE;QACnC,MAAM,SAAS,GAAG,MAAM,IAAA,uBAAa,EAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,IAAA,oCAAuB,EAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACpE,MAAM,WAAW,GAAG,GAAG,OAAO,CAAC,UAAU,eAAe,CAAC;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEtC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,8BAA8B,WAAW,sBAAsB,GAAG,kBAAkB,CACrF,CAAC;YACF,OAAO,IAAA,iBAAI,GAAE,CAAC;QAChB,CAAC;QACD,IAAI,IAAA,eAAU,EAAC,WAAW,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,IAAA,aAAQ,EAAC,WAAW,CAAC,CAAC;YACnC,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,IAAA,iBAAI,GAAE,CAAC;IAChB,CAAC,CAAA,CAAC;AACJ,CAAC"}

View File

@@ -0,0 +1,38 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const testing_1 = require("@angular-devkit/schematics/testing");
const test_app_1 = require("../../testing/test-app");
describe('[schematic] ng-generate', () => {
const defaultOptions = {
project: 'ng-zorro',
};
let runner;
let appTree;
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../../collection.json'));
appTree = yield (0, test_app_1.createTestApp)(runner);
}));
it('should update app.html', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const appComponentHTMLPath = '/projects/ng-zorro/src/app/app.html';
const tree = yield runner.runSchematic('blank', options, appTree);
const appComponentHTML = tree.readContent(appComponentHTMLPath);
const files = tree.files;
expect(files).toEqual(jasmine.arrayContaining([appComponentHTMLPath]));
expect(appComponentHTML).toContain('href="https://github.com/NG-ZORRO/ng-zorro-antd"');
}));
});
//# sourceMappingURL=index.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/blank/index.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;AAGH,gEAAyE;AAGzE,qDAAuD;AAEvD,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,MAAM,cAAc,GAAc;QAChC,OAAO,EAAE,UAAU;KACpB,CAAC;IACF,IAAI,MAA2B,CAAC;IAChC,IAAI,OAAa,CAAC;IAElB,UAAU,CAAC,GAAS,EAAE;QACpB,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACzF,OAAO,GAAG,MAAM,IAAA,wBAAa,EAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,wBAAwB,EAAE,GAAS,EAAE;QACtC,MAAM,OAAO,qBAAO,cAAc,CAAC,CAAC;QACpC,MAAM,oBAAoB,GAAG,qCAAqC,CAAC;QACnE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAClE,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;QAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAE,oBAAoB,CAAE,CAAC,CAAC,CAAC;QACzE,MAAM,CAAC,gBAAgB,CAAC,CAAC,SAAS,CAAC,kDAAkD,CAAC,CAAC;IACzF,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,7 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=schema.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/blank/schema.ts"],"names":[],"mappings":";AAAA;;;GAGG"}

View File

@@ -0,0 +1,16 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "nz-ng-generate-boot",
"title": "Ant Design of Angular(NG-ZORRO) boot page schematic",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "Name of the project.",
"$default": {
"$source": "projectName"
}
}
},
"required": []
}

View File

@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: '/welcome' },
{ path: 'welcome', loadChildren: () => import('./pages/welcome/welcome-module').then(m => m.WelcomeModule) }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {}

View File

@@ -0,0 +1,80 @@
:host {
display: flex;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.app-layout {
height: 100vh;
}
.menu-sidebar {
position: relative;
z-index: 10;
min-height: 100vh;
box-shadow: 2px 0 6px rgba(0,21,41,.35);
}
.header-trigger {
height: 64px;
padding: 20px 24px;
font-size: 20px;
cursor: pointer;
transition: all .3s,padding 0s;
}
.trigger:hover {
color: #1890ff;
}
.sidebar-logo {
position: relative;
height: 64px;
padding-left: 24px;
overflow: hidden;
line-height: 64px;
background: #001529;
transition: all .3s;
}
.sidebar-logo img {
display: inline-block;
height: 32px;
width: 32px;
vertical-align: middle;
}
.sidebar-logo h1 {
display: inline-block;
margin: 0 0 0 20px;
color: #fff;
font-weight: 600;
font-size: 14px;
font-family: Avenir,Helvetica Neue,Arial,Helvetica,sans-serif;
vertical-align: middle;
}
nz-header {
padding: 0;
width: 100%;
z-index: 2;
}
.app-header {
position: relative;
height: 64px;
padding: 0;
background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08);
}
nz-content {
margin: 24px;
}
.inner-content {
padding: 24px;
background: #fff;
height: 100%;
}

View File

@@ -0,0 +1,51 @@
<nz-layout class="app-layout">
<nz-sider class="menu-sidebar"
nzCollapsible
nzWidth="256px"
nzBreakpoint="md"
[(nzCollapsed)]="isCollapsed"
[nzTrigger]="null">
<div class="sidebar-logo">
<a href="https://ng.ant.design/" target="_blank">
<img src="https://ng.ant.design/assets/img/logo.svg" alt="logo">
<h1>Ant Design Of Angular</h1>
</a>
</div>
<ul nz-menu nzTheme="dark" nzMode="inline" [nzInlineCollapsed]="isCollapsed">
<li nz-submenu nzOpen nzTitle="Dashboard" nzIcon="dashboard">
<ul>
<li nz-menu-item nzMatchRouter>
<a routerLink="/welcome">Welcome</a>
</li>
<li nz-menu-item nzMatchRouter>
<a>Monitor</a>
</li>
<li nz-menu-item nzMatchRouter>
<a>Workplace</a>
</li>
</ul>
</li>
<li nz-submenu nzOpen nzTitle="Form" nzIcon="form">
<ul>
<li nz-menu-item nzMatchRouter>
<a>Basic Form</a>
</li>
</ul>
</li>
</ul>
</nz-sider>
<nz-layout>
<nz-header>
<div class="app-header">
<span class="header-trigger" (click)="isCollapsed = !isCollapsed">
<nz-icon class="trigger" [nzType]="isCollapsed ? 'menu-unfold' : 'menu-fold'" />
</span>
</div>
</nz-header>
<nz-content>
<div class="inner-content">
<router-outlet></router-outlet>
</div>
</nz-content>
</nz-layout>
</nz-layout>

View File

@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: '<%= prefix %>-root',
standalone: false,
templateUrl: './app.html',
styleUrl: './app.<%= style %>'
})
export class App {
isCollapsed = false;
}

View File

@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { NzIconModule, provideNzIcons } from 'ng-zorro-antd/icon';
import {
MenuFoldOutline,
MenuUnfoldOutline,
FormOutline,
DashboardOutline
} from '@ant-design/icons-angular/icons';
const icons = [MenuFoldOutline, MenuUnfoldOutline, DashboardOutline, FormOutline];
@NgModule({
imports: [NzIconModule],
exports: [NzIconModule],
providers: [
provideNzIcons(icons)
]
})
export class IconsProviderModule {}

View File

@@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { WelcomeRoutingModule } from './welcome-routing-module';
import <% if(!exportDefault) { %>{ <% }%>Welcome<%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './welcome<%= type ? '.' + dasherize(type): '' %>';
@NgModule({
imports: [WelcomeRoutingModule],
declarations: [Welcome<%= type ? classify(type): '' %>],
exports: [Welcome<%= type ? classify(type): '' %>]
})
export class WelcomeModule {}

View File

@@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import <% if(!exportDefault) { %>{ <% }%>Welcome<%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './welcome<%= type ? '.' + dasherize(type): '' %>';
const routes: Routes = [
{ path: '', component: Welcome<%= type ? classify(type): '' %> },
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class WelcomeRoutingModule {}

View File

@@ -0,0 +1,83 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const schematics_1 = require("@angular/cdk/schematics");
const schematics_2 = require("@angular-devkit/schematics");
const utility_1 = require("@schematics/angular/utility");
const app_config_1 = require("@schematics/angular/utility/standalone/app_config");
const util_1 = require("@schematics/angular/utility/standalone/util");
const apply_changes_1 = require("../../utils/apply-changes");
const config_1 = require("../../utils/config");
const root_module_1 = require("../../utils/root-module");
function default_1(options) {
return (host) => __awaiter(this, void 0, void 0, function* () {
var _a;
const workspace = yield (0, utility_1.readWorkspace)(host);
const project = (0, schematics_1.getProjectFromWorkspace)(workspace, options.project);
const mainFile = (0, schematics_1.getProjectMainFile)(project);
const { componentOptions, sourceDir } = yield (0, config_1.getAppOptions)(options.project, project.root);
const prefix = options.prefix || project.prefix;
const style = options.style || componentOptions.style;
const exportDefault = (_a = componentOptions.exportDefault) !== null && _a !== void 0 ? _a : false;
const isStandalone = (0, schematics_1.isStandaloneApp)(host, mainFile);
const templateSourcePath = isStandalone ? './standalone' : './files';
return (0, schematics_2.chain)([
(0, schematics_2.mergeWith)((0, schematics_2.apply)((0, schematics_2.url)(`${templateSourcePath}/src`), [
(0, schematics_2.applyTemplates)(Object.assign(Object.assign(Object.assign({}, schematics_2.strings), componentOptions), { exportDefault,
prefix,
style })),
(0, schematics_2.move)(project.sourceRoot),
(0, schematics_2.forEach)((fileEntry) => {
if (host.exists(fileEntry.path)) {
host.overwrite(fileEntry.path, fileEntry.content);
}
return fileEntry;
})
]), schematics_2.MergeStrategy.Overwrite),
(0, schematics_2.schematic)('component', Object.assign(Object.assign({ name: 'welcome', project: options.project, standalone: isStandalone }, componentOptions), { path: `${sourceDir}/pages`, skipImport: true, skipTests: true, prefix,
style })),
isStandalone ? addIconsProvider(options.project, mainFile) : addModules(options.project)
]);
});
}
function addModules(project) {
return (0, schematics_2.chain)([
(0, root_module_1.addModule)('AppRoutingModule', './app-routing-module', project),
(0, root_module_1.addModule)('IconsProviderModule', './icons-provider.module', project),
(0, root_module_1.addModule)('NzLayoutModule', 'ng-zorro-antd/layout', project),
(0, root_module_1.addModule)('NzMenuModule', 'ng-zorro-antd/menu', project)
]);
}
function addIconsProvider(project, mainFile) {
return (0, schematics_2.chain)([
importIconDefinitions(mainFile),
(0, utility_1.addRootProvider)(project, ({ code, external }) => {
return code `${external('provideNzIcons', 'ng-zorro-antd/icon')}(icons)`;
})
]);
}
function importIconDefinitions(mainFile) {
return (host) => __awaiter(this, void 0, void 0, function* () {
const bootstrapCall = (0, util_1.findBootstrapApplicationCall)(host, mainFile);
const appConfig = (0, app_config_1.findAppConfig)(bootstrapCall, host, mainFile);
const appConfigFile = appConfig.filePath;
const appConfigSource = (0, schematics_1.parseSourceFile)(host, appConfig.filePath);
(0, apply_changes_1.applyChangesToFile)(host, appConfigFile, [
(0, schematics_1.insertImport)(appConfigSource, appConfigFile, 'icons', './icons-provider')
]);
});
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/side-menu/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;AAkCH,4BA+CC;AA/ED,wDAMiC;AAEjC,2DAcoC;AACpC,yDAA6E;AAC7E,kFAAkF;AAClF,sEAA2F;AAG3F,6DAA+D;AAC/D,+CAAmD;AACnD,yDAAoD;AAEpD,mBAAwB,OAAe;IACrC,OAAO,CAAO,IAAU,EAAE,EAAE;;QAC1B,MAAM,SAAS,GAAG,MAAM,IAAA,uBAAa,EAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,IAAA,oCAAuB,EAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACpE,MAAM,QAAQ,GAAG,IAAA,+BAAkB,EAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,sBAAa,EAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3F,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;QAChD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,gBAAgB,CAAC,KAAK,CAAC;QACtD,MAAM,aAAa,GAAG,MAAA,gBAAgB,CAAC,aAAa,mCAAI,KAAK,CAAC;QAE9D,MAAM,YAAY,GAAG,IAAA,4BAAe,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACrD,MAAM,kBAAkB,GAAG,YAAY,CAAC,CAAC,CAAC,cAAc,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IAAA,uBAAS,EAAC,gBAAgB,EAAE,sBAAsB,EAAE,OAAO,CAAC;QAC5D,IAAA,uBAAS,EAAC,cAAc,EAAE,oBAAoB,EAAE,OAAO,CAAC;KACzD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAe,EAAE,QAAgB;IACzD,OAAO,IAAA,kBAAK,EAAC;QACX,qBAAqB,CAAC,QAAQ,CAAC;QAC/B,IAAA,yBAAe,EAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC9C,OAAO,IAAI,CAAA,GAAG,QAAQ,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,SAAS,CAAC;QAC1E,CAAC,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,QAAgB;IAC7C,OAAO,CAAO,IAAU,EAAE,EAAE;QAC1B,MAAM,aAAa,GAAG,IAAA,mCAA4B,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACnE,MAAM,SAAS,GAAG,IAAA,0BAAa,EAAC,aAAa,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC/D,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC;QACzC,MAAM,eAAe,GAAG,IAAA,4BAAe,EAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;QAElE,IAAA,kCAAkB,EAAC,IAAI,EAAE,aAAa,EAAE;YACtC,IAAA,yBAAY,EAAC,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,kBAAkB,CAAC;SAC1E,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC"}

View File

@@ -0,0 +1,87 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const testing_1 = require("@angular-devkit/schematics/testing");
const schema_1 = require("@schematics/angular/ng-new/schema");
const test_app_1 = require("../../testing/test-app");
const get_file_content_1 = require("../../utils/get-file-content");
describe('[schematic] side-menu', () => {
const defaultOptions = {
project: 'ng-zorro'
};
let runner;
let appTree;
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../../collection.json'));
appTree = yield (0, test_app_1.createTestApp)(runner, { standalone: false });
}));
it('should create side-menu files', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const tree = yield runner.runSchematic('sidemenu', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain('standalone: false');
expect(welcomeContent).toContain('standalone: false');
expect(tree.files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.html',
'/projects/ng-zorro/src/app/app.css',
'/projects/ng-zorro/src/app/app.ts',
'/projects/ng-zorro/src/app/app-routing-module.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome-module.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome-routing-module.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.css',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.html'
]));
}));
describe('style option', () => {
it('should set the style preprocessor correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { style: schema_1.Style.Less });
const tree = yield runner.runSchematic('sidemenu', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain('app.less');
expect(welcomeContent).toContain('welcome.component.less');
expect(tree.files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.less',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.less'
]));
}));
it('should fall back to the @schematics/angular:component option value', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { template: 'sidemenu' });
appTree = yield (0, test_app_1.createTestApp)(runner, { style: schema_1.Style.Less, standalone: false });
const tree = yield runner.runSchematic('ng-add', options, appTree);
expect(tree.files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.less',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.less'
]));
}));
});
it('should set the prefix correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { prefix: 'nz' });
const tree = yield runner.runSchematic('sidemenu', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain(`selector: 'nz-root'`);
expect(welcomeContent).toContain(`selector: 'nz-welcome'`);
}));
it('should set standalone to be false', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const tree = yield runner.runSchematic('ng-add-setup-project', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
expect(appContent).toContain('standalone: false');
}));
});
//# sourceMappingURL=index.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"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C,eAAe,CAAC;gBACtB,qCAAqC;gBACrC,iEAAiE;aAClE,CAAC,CACH,CAAC;QACJ,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,GAAS,EAAE;QAC/C,MAAM,OAAO,mCAAQ,cAAc,KAAE,MAAM,EAAE,IAAI,GAAE,CAAC;QACpD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACrE,MAAM,UAAU,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QAC7E,MAAM,cAAc,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,+DAA+D,CAAC,CAAC;QAE7G,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACpD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAC7D,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAS,EAAE;QACjD,MAAM,OAAO,qBAAQ,cAAc,CAAE,CAAC;QACtC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,sBAAsB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACjF,MAAM,UAAU,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QAC7E,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IACpD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,7 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=schema.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/side-menu/schema.ts"],"names":[],"mappings":";AAAA;;;GAGG"}

View File

@@ -0,0 +1,33 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "sidebar-nav",
"title": "Sidebar Navigation Layout",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "The name of the project.",
"$default": {
"$source": "projectName"
}
},
"style": {
"description": "The file extension or preprocessor to use for style files.",
"type": "string",
"default": "css",
"enum": [
"css",
"scss",
"sass",
"less"
]
},
"prefix": {
"type": "string",
"format": "html-selector",
"description": "A prefix to apply to generated selectors.",
"default": "app",
"alias": "p"
}
}
}

View File

@@ -0,0 +1,88 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const testing_1 = require("@angular-devkit/schematics/testing");
const schema_1 = require("@schematics/angular/ng-new/schema");
const test_app_1 = require("../../testing/test-app");
const get_file_content_1 = require("../../utils/get-file-content");
describe('[schematic][standalone] side-menu', () => {
const defaultOptions = {
project: 'ng-zorro'
};
let runner;
let appTree;
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../../collection.json'));
appTree = yield (0, test_app_1.createTestApp)(runner);
}));
it('should create side-menu files', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const tree = yield runner.runSchematic('sidemenu', options, appTree);
const files = tree.files;
expect(files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.html',
'/projects/ng-zorro/src/app/app.css',
'/projects/ng-zorro/src/app/app.ts',
'/projects/ng-zorro/src/app/app.routes.ts',
'/projects/ng-zorro/src/app/icons-provider.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.css',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.html',
'/projects/ng-zorro/src/app/pages/welcome/welcome.routes.ts'
]));
}));
it('should infer the standalone option from the project structure', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const tree = yield runner.runSchematic('sidemenu', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
expect(tree.exists('/projects/material/src/app/app-module.ts')).toBe(false);
// since v19, the standalone option is removed
expect(appContent).not.toContain('standalone: true');
expect(appContent).toContain('imports: [');
}));
describe('style option', () => {
it('should set the style preprocessor correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { style: schema_1.Style.Less });
const tree = yield runner.runSchematic('sidemenu', options, appTree);
const files = tree.files;
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain('app.less');
expect(welcomeContent).toContain('welcome.component.less');
expect(files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.less',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.less'
]));
}));
it('should fall back to the @schematics/angular:component option value', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { template: 'sidemenu' });
appTree = yield (0, test_app_1.createTestApp)(runner, { style: schema_1.Style.Less });
const tree = yield runner.runSchematic('ng-add', options, appTree);
expect(tree.files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.less',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.less'
]));
}));
});
it('should set the prefix correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { prefix: 'nz' });
const tree = yield runner.runSchematic('sidemenu', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain(`selector: 'nz-root'`);
expect(welcomeContent).toContain(`selector: 'nz-welcome'`);
}));
});
//# sourceMappingURL=standalone.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"standalone.spec.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/side-menu/standalone.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;AAGH,gEAAyE;AACzE,8DAA0D;AAG1D,qDAAuD;AACvD,mEAA8D;AAE9D,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,MAAM,cAAc,GAAc;QAChC,OAAO,EAAE,UAAU;KACpB,CAAC;IAEF,IAAI,MAA2B,CAAC;IAChC,IAAI,OAAa,CAAC;IAElB,UAAU,CAAC,GAAS,EAAE;QACpB,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACzF,OAAO,GAAG,MAAM,IAAA,wBAAa,EAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,GAAS,EAAE;QAC7C,MAAM,OAAO,qBAAQ,cAAc,CAAE,CAAC;QACtC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;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AAc,EAAC,IAAI,EAAE,+DAA+D,CAAC,CAAC;QAE7G,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACpD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAC7D,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,80 @@
:host {
display: flex;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.app-layout {
height: 100vh;
}
.menu-sidebar {
position: relative;
z-index: 10;
min-height: 100vh;
box-shadow: 2px 0 6px rgba(0,21,41,.35);
}
.header-trigger {
height: 64px;
padding: 20px 24px;
font-size: 20px;
cursor: pointer;
transition: all .3s,padding 0s;
}
.trigger:hover {
color: #1890ff;
}
.sidebar-logo {
position: relative;
height: 64px;
padding-left: 24px;
overflow: hidden;
line-height: 64px;
background: #001529;
transition: all .3s;
}
.sidebar-logo img {
display: inline-block;
height: 32px;
width: 32px;
vertical-align: middle;
}
.sidebar-logo h1 {
display: inline-block;
margin: 0 0 0 20px;
color: #fff;
font-weight: 600;
font-size: 14px;
font-family: Avenir,Helvetica Neue,Arial,Helvetica,sans-serif;
vertical-align: middle;
}
nz-header {
padding: 0;
width: 100%;
z-index: 2;
}
.app-header {
position: relative;
height: 64px;
padding: 0;
background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08);
}
nz-content {
margin: 24px;
}
.inner-content {
padding: 24px;
background: #fff;
height: 100%;
}

View File

@@ -0,0 +1,52 @@
<nz-layout class="app-layout">
<nz-sider class="menu-sidebar"
nzCollapsible
nzWidth="256px"
nzBreakpoint="md"
[(nzCollapsed)]="isCollapsed"
[nzTrigger]="null"
>
<div class="sidebar-logo">
<a href="https://ng.ant.design/" target="_blank">
<img src="https://ng.ant.design/assets/img/logo.svg" alt="logo">
<h1>Ant Design of Angular</h1>
</a>
</div>
<ul nz-menu nzTheme="dark" nzMode="inline" [nzInlineCollapsed]="isCollapsed">
<li nz-submenu nzOpen nzTitle="Dashboard" nzIcon="dashboard">
<ul>
<li nz-menu-item nzMatchRouter>
<a routerLink="/welcome">Welcome</a>
</li>
<li nz-menu-item nzMatchRouter>
<a>Monitor</a>
</li>
<li nz-menu-item nzMatchRouter>
<a>Workplace</a>
</li>
</ul>
</li>
<li nz-submenu nzOpen nzTitle="Form" nzIcon="form">
<ul>
<li nz-menu-item nzMatchRouter>
<a>Basic Form</a>
</li>
</ul>
</li>
</ul>
</nz-sider>
<nz-layout>
<nz-header>
<div class="app-header">
<span class="header-trigger" (click)="isCollapsed = !isCollapsed">
<nz-icon class="trigger" [nzType]="isCollapsed ? 'menu-unfold' : 'menu-fold'" />
</span>
</div>
</nz-header>
<nz-content>
<div class="inner-content">
<router-outlet></router-outlet>
</div>
</nz-content>
</nz-layout>
</nz-layout>

View File

@@ -0,0 +1,6 @@
import { Routes } from '@angular/router';
export const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: '/welcome' },
{ path: 'welcome', loadChildren: () => import('./pages/welcome/welcome.routes').then(m => m.WELCOME_ROUTES) }
];

View File

@@ -0,0 +1,15 @@
import { Component } from '@angular/core';
import { RouterLink, RouterOutlet } from '@angular/router';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzLayoutModule } from 'ng-zorro-antd/layout';
import { NzMenuModule } from 'ng-zorro-antd/menu';
@Component({
selector: '<%= prefix %>-root',
imports: [RouterLink, RouterOutlet, NzIconModule, NzLayoutModule, NzMenuModule],
templateUrl: './app.html',
styleUrl: './app.<%= style %>'
})
export class App {
isCollapsed = false;
}

View File

@@ -0,0 +1,8 @@
import {
MenuFoldOutline,
MenuUnfoldOutline,
FormOutline,
DashboardOutline
} from '@ant-design/icons-angular/icons';
export const icons = [MenuFoldOutline, MenuUnfoldOutline, DashboardOutline, FormOutline];

View File

@@ -0,0 +1,6 @@
import { Routes } from '@angular/router';
import <% if(!exportDefault) { %>{ <% }%>Welcome<%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './welcome<%= type ? '.' + dasherize(type): '' %>';
export const WELCOME_ROUTES: Routes = [
{ path: '', component: Welcome<%= type ? classify(type): '' %> },
];

View File

@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: '/welcome' },
{ path: 'welcome', loadChildren: () => import('./pages/welcome/welcome-module').then(m => m.WelcomeModule) }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {}

View File

@@ -0,0 +1,46 @@
:host {
display: flex;
}
.app-layout {
height: 100vh;
}
.top-nav {
line-height: 64px;
}
.logo {
float: left;
height: 64px;
padding-right: 24px;
line-height: 64px;
background: #001529;
}
.logo img {
display: inline-block;
height: 32px;
width: 32px;
vertical-align: middle;
}
.logo h1 {
display: inline-block;
margin: 0 0 0 15px;
color: #fff;
font-weight: 600;
font-size: 20px;
font-family: Avenir,Helvetica Neue,Arial,Helvetica,sans-serif;
vertical-align: middle;
}
nz-content {
padding: 24px 50px;
}
.inner-content {
padding: 24px;
background: #fff;
height: 100%;
}

View File

@@ -0,0 +1,20 @@
<nz-layout class="app-layout">
<nz-header>
<div class="logo">
<a>
<img src="https://ng.ant.design/assets/img/logo.svg" alt="logo">
<h1>NG-ZORRO</h1>
</a>
</div>
<ul nz-menu class="top-nav" nzTheme="dark" nzMode="horizontal">
<li nz-menu-item routerLinkActive="ant-menu-item-selected" routerLink="/welcome">Home</li>
<li nz-menu-item>Account</li>
<li nz-menu-item>Profile</li>
</ul>
</nz-header>
<nz-content>
<div class="inner-content">
<router-outlet></router-outlet>
</div>
</nz-content>
</nz-layout>

View File

@@ -0,0 +1,9 @@
import { Component } from '@angular/core';
@Component({
selector: '<%= prefix %>-root',
standalone: false,
templateUrl: './app.html',
styleUrl: './app.<%= style %>'
})
export class App {}

View File

@@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { WelcomeRoutingModule } from './welcome-routing-module';
import <% if(!exportDefault) { %>{ <% }%>Welcome<%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './welcome<%= type ? '.' + dasherize(type): '' %>';
@NgModule({
imports: [WelcomeRoutingModule],
declarations: [Welcome<%= type ? classify(type): '' %>],
exports: [Welcome<%= type ? classify(type): '' %>]
})
export class WelcomeModule {}

View File

@@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import <% if(!exportDefault) { %>{ <% }%>Welcome<%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './welcome<%= type ? '.' + dasherize(type): '' %>';
const routes: Routes = [
{ path: '', component: Welcome<%= type ? classify(type): '' %> },
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class WelcomeRoutingModule {}

View File

@@ -0,0 +1,60 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const schematics_1 = require("@angular/cdk/schematics");
const schematics_2 = require("@angular-devkit/schematics");
const utility_1 = require("@schematics/angular/utility");
const config_1 = require("../../utils/config");
const root_module_1 = require("../../utils/root-module");
function default_1(options) {
return (host) => __awaiter(this, void 0, void 0, function* () {
var _a;
const workspace = yield (0, utility_1.readWorkspace)(host);
const project = (0, schematics_1.getProjectFromWorkspace)(workspace, options.project);
const mainFile = (0, schematics_1.getProjectMainFile)(project);
const { componentOptions, sourceDir } = yield (0, config_1.getAppOptions)(options.project, project.root);
const prefix = options.prefix || project.prefix;
const style = options.style || componentOptions.style;
const exportDefault = (_a = componentOptions.exportDefault) !== null && _a !== void 0 ? _a : false;
const isStandalone = (0, schematics_1.isStandaloneApp)(host, mainFile);
const templateSourcePath = isStandalone ? './standalone' : './files';
return (0, schematics_2.chain)([
(0, schematics_2.mergeWith)((0, schematics_2.apply)((0, schematics_2.url)(`${templateSourcePath}/src`), [
(0, schematics_2.applyTemplates)(Object.assign(Object.assign(Object.assign({}, schematics_2.strings), componentOptions), { exportDefault,
prefix,
style })),
(0, schematics_2.move)(project.sourceRoot),
(0, schematics_2.forEach)((fileEntry) => {
if (host.exists(fileEntry.path)) {
host.overwrite(fileEntry.path, fileEntry.content);
}
return fileEntry;
})
]), schematics_2.MergeStrategy.Overwrite),
(0, schematics_2.schematic)('component', Object.assign(Object.assign({ name: 'welcome', project: options.project, standalone: isStandalone }, componentOptions), { path: `${sourceDir}/pages`, skipImport: true, skipTests: true, prefix,
style })),
isStandalone ? (0, schematics_2.noop)() : addModules(options.project)
]);
});
}
function addModules(project) {
return (0, schematics_2.chain)([
(0, root_module_1.addModule)('AppRoutingModule', './app-routing-module', project),
(0, root_module_1.addModule)('NzLayoutModule', 'ng-zorro-antd/layout', project),
(0, root_module_1.addModule)('NzMenuModule', 'ng-zorro-antd/menu', project)
]);
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/topnav/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;AA0BH,4BAiDC;AAzED,wDAAuG;AAEvG,2DAeoC;AACpC,yDAA4D;AAG5D,+CAAmD;AACnD,yDAAoD;AAEpD,mBAAwB,OAAe;IACrC,OAAO,CAAO,IAAU,EAAE,EAAE;;QAC1B,MAAM,SAAS,GAAG,MAAM,IA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CACF,EACD,0BAAa,CAAC,SAAS,CACxB;YACD,IAAA,sBAAS,EAAC,WAAW,gCACnB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,UAAU,EAAE,YAAY,IACrB,gBAAgB,KACnB,IAAI,EAAE,GAAG,SAAS,QAAQ,EAC1B,UAAU,EAAE,IAAI,EAChB,SAAS,EAAE,IAAI,EACf,MAAM;gBACN,KAAK,IACL;YACF,YAAY,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;SACpD,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AAGD,SAAS,UAAU,CAAC,OAAe;IACjC,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,uBAAS,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,OAAO,CAAC;QAC9D,IAAA,uBAAS,EAAC,gBAAgB,EAAE,sBAAsB,EAAE,OAAO,CAAC;QAC5D,IAAA,uBAAS,EAAC,cAAc,EAAE,oBAAoB,EAAE,OAAO,CAAC;KACzD,CAAC,CAAC;AACL,CAAC"}

View File

@@ -0,0 +1,75 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const testing_1 = require("@angular-devkit/schematics/testing");
const schema_1 = require("@schematics/angular/ng-new/schema");
const test_app_1 = require("../../testing/test-app");
const get_file_content_1 = require("../../utils/get-file-content");
describe('[schematic] top-nav', () => {
const defaultOptions = {
project: 'ng-zorro'
};
let runner;
let appTree;
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../../collection.json'));
appTree = yield (0, test_app_1.createTestApp)(runner, { name: 'ng-zorro', standalone: false });
}));
it('should create top-nav files', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const tree = yield runner.runSchematic('topnav', options, appTree);
const files = tree.files;
expect(files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.html',
'/projects/ng-zorro/src/app/app.css',
'/projects/ng-zorro/src/app/app.ts',
'/projects/ng-zorro/src/app/app-routing-module.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome-module.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome-routing-module.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.css',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.html'
]));
}));
it('should set the style preprocessor correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { style: schema_1.Style.Less });
const tree = yield runner.runSchematic('topnav', options, appTree);
const files = tree.files;
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain('app.less');
expect(welcomeContent).toContain('welcome.component.less');
expect(files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.less',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.less'
]));
}));
it('should set the prefix correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { prefix: 'nz' });
const tree = yield runner.runSchematic('topnav', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain(`selector: 'nz-root'`);
expect(welcomeContent).toContain(`selector: 'nz-welcome'`);
}));
it('should set standalone to be false', () => __awaiter(void 0, void 0, void 0, function* () {
const tree = yield runner.runSchematic('topnav', defaultOptions, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain('standalone: false');
expect(welcomeContent).toContain('standalone: false');
}));
});
//# sourceMappingURL=index.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/topnav/index.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;AAGH,gEAAyE;AACzE,8DAA0D;AAI1D,qDAAuD;AACvD,mEAA8D;AAE9D,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,cAAc,GAAc;QAChC,OAAO,EAAE,UAAU;KACpB,CAAC;IACF,IAAI,MAA2B,CAAC;IAChC,IAAI,OAAa,CAAC;IAElB,UAAU,CAAC,GAAS,EAAE;QACpB,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACzF,OAAO,GAAG,MAAM,IAAA,wBAAa,EAAC,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IACjF,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAS,EAAE;QAC3C,MAAM,OAAO,qBAAO,cAAc,CAAC,CAAC;QAEpC,MAAM,IAA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,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,MAAM,UAAU,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QAC7E,MAAM,cAAc,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,+DAA+D,CAAC,CAAC;QAE7G,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACpD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAC7D,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAS,EAAE;QACjD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QAC1E,MAAM,UAAU,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QAC7E,MAAM,cAAc,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,+DAA+D,CAAC,CAAC;QAE7G,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAClD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IACxD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,7 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=schema.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/topnav/schema.ts"],"names":[],"mappings":";AAAA;;;GAGG"}

View File

@@ -0,0 +1,34 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "top-nav",
"title": "Top Navigation Layout",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "The name of the project.",
"$default": {
"$source": "projectName"
}
},
"style": {
"description": "The file extension or preprocessor to use for style files.",
"type": "string",
"default": "css",
"enum": [
"css",
"scss",
"sass",
"less",
"styl"
]
},
"prefix": {
"type": "string",
"format": "html-selector",
"description": "A prefix to apply to generated selectors.",
"default": "app",
"alias": "p"
}
}
}

View File

@@ -0,0 +1,76 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const testing_1 = require("@angular-devkit/schematics/testing");
const schema_1 = require("@schematics/angular/ng-new/schema");
const test_app_1 = require("../../testing/test-app");
const get_file_content_1 = require("../../utils/get-file-content");
describe('[schematic][standalone] top-nav', () => {
const defaultOptions = {
project: 'ng-zorro'
};
let runner;
let appTree;
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../../collection.json'));
appTree = yield (0, test_app_1.createTestApp)(runner, { name: 'ng-zorro' });
}));
it('should create top-nav files', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const tree = yield runner.runSchematic('topnav', options, appTree);
const files = tree.files;
expect(files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.html',
'/projects/ng-zorro/src/app/app.css',
'/projects/ng-zorro/src/app/app.ts',
'/projects/ng-zorro/src/app/app.routes.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.css',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.html',
'/projects/ng-zorro/src/app/pages/welcome/welcome.routes.ts'
]));
}));
it('should fall back to the @schematics/angular:component option value', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const tree = yield runner.runSchematic('topnav', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
expect(tree.exists('/projects/ng-zorro/src/app/app-module.ts')).toBe(false);
// since v19, the standalone option is removed
expect(appContent).not.toContain('standalone: true');
expect(appContent).toContain('imports: [');
}));
it('should set the style preprocessor correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { style: schema_1.Style.Less });
const tree = yield runner.runSchematic('topnav', options, appTree);
const files = tree.files;
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain('app.less');
expect(welcomeContent).toContain('welcome.component.less');
expect(files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.less',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.less'
]));
}));
it('should set the prefix correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { prefix: 'nz' });
const tree = yield runner.runSchematic('topnav', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain(`selector: 'nz-root'`);
expect(welcomeContent).toContain(`selector: 'nz-welcome'`);
}));
});
//# sourceMappingURL=standalone.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"standalone.spec.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/topnav/standalone.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;AAGH,gEAAyE;AACzE,8DAA0D;AAI1D,qDAAuD;AACvD,mEAA8D;AAE9D,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC/C,MAAM,cAAc,GAAc;QAChC,OAAO,EAAE,UAAU;KACpB,CAAC;IACF,IAAI,MAA2B,CAAC;IAChC,IAAI,OAAa,CAAC;IAElB,UAAU,CAAC,GAAS,EAAE;QACpB,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACzF,OAAO,GAAG,MAAM,IAAA,wBAAa,EAAC,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IAC9D,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAS,EAAE;QAC3C,MAAM,OAAO,qBAAQ,cAAc,CAAE,CAAC;QAEtC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CACnB,OAAO,CAAC,eAAe,CAAC;YACtB,qCAAqC;YACrC,oCAAoC;YACpC,mCAAmC;YACnC,0CAA0C;YAC1C,+DAA+D;YAC/D,gEAAgE;YAChE,iEAAiE;YACjE,4DAA4D;SAC7D,CAAC,CACH,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,oEAAoE,EAAE,GAAS,EAAE;QAClF,MAAM,OAAO,qBAAQ,cAAc,CAAE,CAAC;QACtC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,Y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EAAE,IAAI,GAAE,CAAC;QACpD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,MAAM,UAAU,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QAC7E,MAAM,cAAc,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,+DAA+D,CAAC,CAAC;QAE7G,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACpD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAC7D,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,46 @@
:host {
display: flex;
}
.app-layout {
height: 100vh;
}
.top-nav {
line-height: 64px;
}
.logo {
float: left;
height: 64px;
padding-right: 24px;
line-height: 64px;
background: #001529;
}
.logo img {
display: inline-block;
height: 32px;
width: 32px;
vertical-align: middle;
}
.logo h1 {
display: inline-block;
margin: 0 0 0 15px;
color: #fff;
font-weight: 600;
font-size: 20px;
font-family: Avenir,Helvetica Neue,Arial,Helvetica,sans-serif;
vertical-align: middle;
}
nz-content {
padding: 24px 50px;
}
.inner-content {
padding: 24px;
background: #fff;
height: 100%;
}

View File

@@ -0,0 +1,20 @@
<nz-layout class="app-layout">
<nz-header>
<div class="logo">
<a>
<img src="https://ng.ant.design/assets/img/logo.svg" alt="logo">
<h1>NG-ZORRO</h1>
</a>
</div>
<ul nz-menu class="top-nav" nzTheme="dark" nzMode="horizontal">
<li nz-menu-item routerLinkActive="ant-menu-item-selected" routerLink="/welcome">Home</li>
<li nz-menu-item>Account</li>
<li nz-menu-item>Profile</li>
</ul>
</nz-header>
<nz-content>
<div class="inner-content">
<router-outlet></router-outlet>
</div>
</nz-content>
</nz-layout>

View File

@@ -0,0 +1,6 @@
import { Routes } from '@angular/router';
export const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: '/welcome' },
{ path: 'welcome', loadChildren: () => import('./pages/welcome/welcome.routes').then(m => m.WELCOME_ROUTES) }
];

View File

@@ -0,0 +1,12 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { NzLayoutModule } from 'ng-zorro-antd/layout';
import { NzMenuModule } from 'ng-zorro-antd/menu';
@Component({
selector: '<%= prefix %>-root',
imports: [RouterOutlet, NzLayoutModule, NzMenuModule],
templateUrl: './app.html',
styleUrl: './app.<%= style %>'
})
export class App {}

View File

@@ -0,0 +1,6 @@
import { Routes } from '@angular/router';
import <% if(!exportDefault) { %>{ <% }%>Welcome<%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './welcome<%= type ? '.' + dasherize(type): '' %>';
export const WELCOME_ROUTES: Routes = [
{ path: '', component: Welcome<%= type ? classify(type): '' %> },
];