Skip to content

Commit

Permalink
docs: repair mode (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Oct 20, 2018
1 parent f6c50ae commit 6198248
Show file tree
Hide file tree
Showing 50 changed files with 639 additions and 317 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ delon is a production-ready solution for admin business components packages, Bui
[![Dependency Status](https://david-dm.org/ng-alain/delon/status.svg)](https://david-dm.org/ng-alain/delon)
[![DevDependency Status](https://david-dm.org/ng-alain/delon/dev-status.svg)](https://david-dm.org/ng-alain/delon?type=dev)
[![codecov](https://codecov.io/gh/ng-alain/delon/branch/master/graph/badge.svg)](https://codecov.io/gh/ng-alain/delon)
[![GitHub Release Date](https://img.shields.io/github/release-date/ng-alain/ng-alain.svg?style=flat-square)](https://github.com/ng-alain/ng-alain/releases)
[![npm](https://img.shields.io/npm/l/@delon/theme.svg)](https://www.npmjs.com/package/@delon/theme)
[![npm](https://img.shields.io/npm/dm/@delon/theme.svg)](https://www.npmjs.com/package/@delon/theme)
[![Gitter](https://img.shields.io/gitter/room/cipchk/ng-alain.svg?style=flat-square)](https://gitter.im/cipchk/ng-alain)
[![extension-for-VSCode](https://img.shields.io/badge/extension%20for-VSCode-blue.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=cipchk.ng-alain-vscode)

| package name | npm version | npm next version | taobao version |
| ------------ |:-----:|:----------:|:----------:|
Expand Down
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"root": "",
"sourceRoot": "src",
"projectType": "application",
"targets": {
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
Expand Down Expand Up @@ -107,7 +107,7 @@
"root": "",
"sourceRoot": "",
"projectType": "application",
"targets": {
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ export class DelonModule {
### Missing locale data for the locale "zh-cn"

缺少语言导入,参考[app.module.ts](https://github.com/ng-alain/ng-alain/blob/master/src/app/app.module.ts#L20-L22)
缺少语言导入,参考[app.module.ts](https://github.com/ng-alain/ng-alain/blob/master/src/app/app.module.ts#L6-L25)
5 changes: 3 additions & 2 deletions docs/new-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@ export class ImageWrapperComponent {

```ts
// shared.module.ts
// region: your componets & directives

// #region your componets & directives
import { ImageWrapperComponent } from './image-wrapper';
const COMPONENTS = [
ImageWrapperComponent
];
const DIRECTIVES = [];
// endregion
// #endregion
```

## 使用
Expand Down
7 changes: 0 additions & 7 deletions docs/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ title:
type: Advance
---

## Web 图标

默认除了 ng-zorro-antd 自带 Web 图标,额外增加了 [font-awesome](//fontawesome.io/)[simple-line-icons](//simplelineicons.com/)[weather-icons](//erikflowers.github.io/weather-icons/) 三个图标库,如果你明确不需要,可以删除:

+ 移除 `src/styles.less` 引用样式文件
+ 移除相应包体

## IE 优化

ng-alain 默认开启了对 IE 的支持,这给包体及样式增加了一定大小,倘若你很在意并且不需要 `IE10` 及以下的版本支持的话,可以调整两项配置:
Expand Down
6 changes: 3 additions & 3 deletions docs/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Angular CLI 构建的项目就其目录结构而言已经非常棒了,同时

### 区域

将一组相同属性使用 `// region: ` & `// endregion` 自由折叠代码预处理指令(限VSCODE),以 `shared.module.ts` 文件为例:
将一组相同属性使用 `// #region ` & `// #endregion` 自由折叠代码预处理指令(限VSCODE),以 `shared.module.ts` 文件为例:

```ts
// region: third libs
// #region third libs
import { NzSchemaFormModule } from 'nz-schema-form';
const THIRDMODULES = [ NzSchemaFormModule ];
// endregion
// #endregion
```

将所有第三方模块放在 `third libs` 区域当中,并统一将注册模块放进 `THIRDMODULES` 变量中。你无须再关心导入和导出的问题,因为 `THIRDMODULES` 数组默认加入导入和导出行列中。
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"test": "ng test --code-coverage --watch=false && bash scripts/ci/build-schematics.sh -b -t",
"release": "bash scripts/ci/build-lib.sh && bash scripts/ci/build-schematics.sh -b",
"site:gen": "node scripts/site/main init",
"site": "npm run site:gen && ng serve -c=hmr",
"site": "npm run site:gen && ng serve",
"site:build": "npm run site:gen && ng build --prod --build-optimizer --base-href /",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --pkg package.json",
"pre-publish": "node scripts/publish/publish.js && node scripts/publish/publish-scaffold.js",
Expand All @@ -38,6 +38,7 @@
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/elements": "^6.0.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/platform-browser": "^6.1.0",
Expand Down Expand Up @@ -65,7 +66,8 @@
"ngx-ueditor": "^2.1.0",
"qrious": "^4.0.2",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26"
"zone.js": "^0.8.26",
"@webcomponents/custom-elements": "^1.2.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.8.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/abc/abc.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NgModule, ModuleWithProviders } from '@angular/core';

// region: all modules
// #region all modules
import { STModule } from '@delon/abc/table';
import { SVModule } from '@delon/abc/view';
import { SEModule } from '@delon/abc/edit';
Expand Down Expand Up @@ -59,7 +59,7 @@ const MODULES = [
DatePickerModule,
];

// endregion
// #endregion

@NgModule({
imports: [
Expand Down
4 changes: 2 additions & 2 deletions packages/abc/page-header/page-header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class PageHeaderComponent
return this._menus;
}

// region fields
// #region fields

_title: string;
_titleTpl: TemplateRef<any>;
Expand Down Expand Up @@ -136,7 +136,7 @@ export class PageHeaderComponent
@Input()
tab: TemplateRef<any>;

// endregion
// #endregion

constructor(
cog: PageHeaderConfig,
Expand Down
5 changes: 3 additions & 2 deletions packages/abc/qr/qr.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import { QRConfig } from './qr.config';
})
export class QRComponent implements OnChanges {
dataURL: string;
// region: fields

// #region fields

/** 背景 */
@Input()
Expand Down Expand Up @@ -61,7 +62,7 @@ export class QRComponent implements OnChanges {
@Output()
change = new EventEmitter<string>();

// endregion
// #endregion

constructor(
cog: QRConfig,
Expand Down
4 changes: 2 additions & 2 deletions packages/abc/quick-menu/quick-menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { InputNumber } from '@delon/util';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class QuickMenuComponent implements OnInit, OnChanges {
// region: fields
// #region fields

@Input()
icon:
Expand All @@ -43,7 +43,7 @@ export class QuickMenuComponent implements OnInit, OnChanges {

@Input() borderColor = '#ddd';

// endregion
// #endregion

constructor(
private cd: ChangeDetectorRef,
Expand Down
8 changes: 4 additions & 4 deletions packages/abc/reuse-tab/reuse-tab.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class ReuseTabService implements OnDestroy {
private _closableCached: { [url: string]: boolean } = {};
private removeUrlBuffer: string;

// region: public
// #region public

/** 当前路由地址 */
get curUrl() {
Expand Down Expand Up @@ -335,9 +335,9 @@ export class ReuseTabService implements OnDestroy {
refresh(data?: any) {
this._cachedChange.next({ active: 'refresh', data });
}
// endregion
// #endregion

// region: privates
// #region privates

private destroy(_handle: any) {
if (_handle && _handle.componentRef && _handle.componentRef.destroy)
Expand All @@ -350,7 +350,7 @@ export class ReuseTabService implements OnDestroy {
console.warn(...args);
}

// endregion
// #endregion

constructor(private injector: Injector, private menuService: MenuService) {}

Expand Down
4 changes: 2 additions & 2 deletions packages/abc/sidebar-nav/sidebar-nav.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class SidebarNavComponent implements OnInit, OnDestroy {
this.clearFloatingContainer();
}

// region: Under pad
// #region Under pad

private get isPad(): boolean {
return window.innerWidth < 768;
Expand All @@ -242,5 +242,5 @@ export class SidebarNavComponent implements OnInit, OnDestroy {
this.settings.setLayout('collapsed', status);
}

// endregion
// #endregion
}
7 changes: 3 additions & 4 deletions packages/abc/table/table-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ export class STExport {
);
const cc = colData.length,
dc = opt._d.length;
// region: column

// column
for (let i = 0; i < cc; i++) {
sheet[`${String.fromCharCode(65 + i)}1`] = {
t: 's',
v: colData[i].title,
};
}
// endregion

// region: content
// content
for (let i = 0; i < dc; i++) {
for (let j = 0; j < cc; j++) {
sheet[`${String.fromCharCode(65 + j)}${i + 2}`] = this._stGet(
Expand All @@ -61,7 +61,6 @@ export class STExport {
);
}
}
// endregion

if (cc > 0 && dc > 0) {
sheet['!ref'] = `A1:${String.fromCharCode(65 + cc - 1)}${dc + 1}`;
Expand Down
80 changes: 80 additions & 0 deletions packages/cache/docs/demo/simple.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title:
zh-CN: 基础样例
en-US: Basic Usage
order: 0
---

## zh-CN

最简单的用法。

## en-US

Simplest of usage.

```ts
import { Component, OnDestroy } from '@angular/core';
import { CacheService } from '@delon/cache';
import { NzMessageService } from 'ng-zorro-antd';
import { Subscription } from 'rxjs';

@Component({
selector: 'app-demo',
template: `
<p>value: {{ value | json }}</p>
<div class="pt-sm">
Basic:
<button nz-button (click)="srv.set(key, newValue)">Set</button>
<button nz-button (click)="value = srv.getNone(key)">Get</button>
<button nz-button (click)="srv.remove(key)">Remove</button>
<button nz-button (click)="srv.clear()">Clear</button>
</div>
<div class="pt-sm">
Key is valid request:
<button nz-button (click)="getByHttp()">Get</button>
</div>
<div class="pt-sm">
Notify:
<button nz-button (click)="registerNotify()">Register</button>
<button nz-button (click)="unRegisterNotify()">UnRegister</button>
</div>
`,
})
export class DemoComponent implements OnDestroy {
value: any;
key = 'demo';
private notify$: Subscription;

get newValue() {
return +new Date();
}

constructor(public srv: CacheService, private msg: NzMessageService) {}

getByHttp() {
this.srv.get(`https://randomuser.me/api/?results=1`).subscribe(res => {
this.value = res;
});
}

registerNotify() {
if (this.notify$) this.notify$.unsubscribe();
this.notify$ = this.srv.notify(this.key).subscribe(res => {
if (res == null) {
this.msg.success('register success');
return;
}
this.msg.warning(`"${this.key}" new status: ${res.type}`);
});
}

unRegisterNotify() {
this.srv.cancelNotify(this.key);
}

ngOnDestroy() {
if (this.notify$) this.notify$.unsubscribe();
}
}
```
Loading

0 comments on commit 6198248

Please sign in to comment.