Skip to content

Commit

Permalink
build: angular8 (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored May 31, 2019
1 parent 2f90998 commit 72c753c
Show file tree
Hide file tree
Showing 59 changed files with 328 additions and 425 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.9.0
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/*.md
**/*.json
**/*.svg
**/test.ts
_nginx/
Expand Down
14 changes: 7 additions & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"singleQuote": true,
"semi": true,
"trailingComma": "all",
"tabWidth": 2,
"useTabs": false,
"overrides": [{
"files": ".prettierrc",
"options": {
"parser": "json"
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
}]
]
}
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: required
language: node_js
node_js:
- "8.11.0"
- '10.9.0'

env:
- TASK=test
Expand All @@ -21,6 +21,7 @@ git:
depth: 1

before_install:
- export NG_CLI_ANALYTICS=ci
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
Expand Down
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"tsConfig": "src/tsconfig.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
Expand Down
2 changes: 1 addition & 1 deletion components/actionsheet/actionsheet.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class ActionSheetComponent implements OnDestroy {
this._shownAnt = true;
this.detectChanges();
}, 10);
return Observable.create((observer: Observer<any>) => {
return new Observable((observer: Observer<any>) => {
this.observer = observer;
});
}
Expand Down
4 changes: 2 additions & 2 deletions components/actionsheet/actionsheet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ describe('Component: ActionSheet', () => {
class TestActionSheetServiceComponent {}

@Component({
selector: 'test-actionsheet',
selector: 'app-actionsheet',
template: '',
})
class TestActionSheetComponent {
@ViewChild(ActionSheetComponent) actioinSheet: ActionSheetComponent;
@ViewChild(ActionSheetComponent, { static: true }) actioinSheet: ActionSheetComponent;

menus: any[] = [...MENUS];

Expand Down
2 changes: 1 addition & 1 deletion components/button/button.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('Component: Button', () => {
});

@Component({
selector: 'test-button',
selector: 'app-button',
template: ``,
})
class TestButtonComponent extends ButtonComponent {
Expand Down
2 changes: 1 addition & 1 deletion components/cell/swipe.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('Directive: Swipe(not body)', () => {
});

@Component({
selector: 'test-swipe',
selector: 'app-swipe',
template: '',
})
class TestSwipeComponent {
Expand Down
2 changes: 1 addition & 1 deletion components/chart-g2/chart-g2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ describe('Component: ChartG2', () => {
class TestChartG2Component {
margin = 0;

@ViewChild('c1') c1: ChartG2Directive;
@ViewChild('c1', { static: true }) c1: ChartG2Directive;
}
2 changes: 1 addition & 1 deletion components/chart-g2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ npm install g2-mobile --save-dev
```

```typescript
@ViewChild('c1') c1: ChartG2Directive;
@ViewChild('c1', { static: true }) c1: ChartG2Directive;
renderC1() {
const chart = this.c1.chart;
chart.source([
Expand Down
2 changes: 1 addition & 1 deletion components/core/addon/public-api.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { AddOnModule } from './addon.module';
export { StringTemplateOutletDirective } from './string_template_outlet';
export { AddOnModule } from './addon.module';
4 changes: 2 additions & 2 deletions components/core/addon/string_template_outlet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('string_template_outlet', () => {
`,
})
class TestComponent {
@ViewChild('tpl1') tpl1: TemplateRef<void>;
@ViewChild('tpl2') tpl2: TemplateRef<void>;
@ViewChild('tpl1', { static: true }) tpl1: TemplateRef<void>;
@ViewChild('tpl2', { static: true }) tpl2: TemplateRef<void>;
value: string | TemplateRef<void> | null | undefined;
}
5 changes: 3 additions & 2 deletions components/core/addon/string_template_outlet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef } from '@angular/core';

@Directive({
// tslint:disable-next-line: directive-selector
selector: '[stringTemplateOutlet]',
exportAs: 'stringTemplateOutlet',
})
Expand All @@ -25,7 +26,7 @@ export class StringTemplateOutletDirective {

updateView(): void {
if (!this.isTemplate) {
/** use default template when input is string **/
// use default template when input is string
if (!this.defaultViewRef) {
this.viewContainer.clear();
this.inputViewRef = null;
Expand All @@ -36,7 +37,7 @@ export class StringTemplateOutletDirective {
if (this.inputViewRef) {
this.inputViewRef = null;
}
/** use input template when input is templateRef **/
// use input template when input is templateRef
this.viewContainer.clear();
this.defaultViewRef = null;
this.inputViewRef = this.viewContainer.createEmbeddedView(this.inputTemplate!);
Expand Down
4 changes: 2 additions & 2 deletions components/dialog/dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class DialogComponent implements OnDestroy {

constructor(private DEF: DialogConfig, private cdr: ChangeDetectorRef) {}

@ViewChild('container') container: any;
@ViewChild('container', { static: true }) container: any;
_prompError: boolean = false;
_promptData: any;

Expand Down Expand Up @@ -187,7 +187,7 @@ export class DialogComponent implements OnDestroy {
setTimeout(() => {
this.open.emit(this);
}, 300);
return Observable.create((observer: Observer<any>) => {
return new Observable((observer: Observer<any>) => {
this.observer = observer;
});
}
Expand Down
4 changes: 2 additions & 2 deletions components/dialog/dialog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ describe('Component: Dialog', () => {
class TestDialogServiceComponent {}

@Component({
selector: 'test-dialog',
selector: 'app-dialog',
template: '',
})
class TestDialogComponent {
@ViewChild(DialogComponent) dialog: DialogComponent;
@ViewChild(DialogComponent, { static: true }) dialog: DialogComponent;

config: DialogConfig = { ...CONFIG };
}
2 changes: 1 addition & 1 deletion components/infiniteloader/infiniteloader.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export class InfiniteLoaderConfig {
finished?: string =
'<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">已加载完毕</span></div>';

/**滚动节流时长(单位:ms),默认:`100` */
/** 滚动节流时长(单位:ms),默认:`100` */
throttle?: number = 100;
}
2 changes: 1 addition & 1 deletion components/mask/mask.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class MaskComponent implements OnDestroy {
this._shown = true;
this.cdr.detectChanges();
});
return Observable.create((observer: Observer<void>) => {
return new Observable((observer: Observer<void>) => {
this.observer = observer;
});
}
Expand Down
2 changes: 1 addition & 1 deletion components/mask/mask.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('Component: Button', () => {

@Component({ template: `` })
class TestMaskComponent {
@ViewChild(MaskComponent) mask: MaskComponent;
@ViewChild(MaskComponent, { static: true }) mask: MaskComponent;

backdrop = true;
close() {}
Expand Down
23 changes: 11 additions & 12 deletions components/picker/picker-city.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,27 @@ import { PickerComponent } from './picker.component';
encapsulation: ViewEncapsulation.None,
})
export class CityPickerComponent implements ControlValueAccessor, OnDestroy {
@ViewChild(PickerComponent) _pickerInstance: PickerComponent;

private _tmpData: any;
private onChange: any = Function.prototype;
private onTouched: any = Function.prototype;
_value: string;
_groups: any[] | null = [];
_selected: number[] = [];
private _tmpData: any;

@Input()
dataMap: { label: string; value: string; items: string } = {
label: 'name',
value: 'code',
items: 'sub',
};
/** 城市数据,可以参考示例中的数据格式 */
@Input()
set data(d: any) {
this._tmpData = d;
this.parseData(this._tmpData, this.dataMap.items, this._selected);
}
@ViewChild(PickerComponent, { static: true }) _pickerInstance: PickerComponent;

@Input()
dataMap: { label: string; value: string; items: string } = {
label: 'name',
value: 'code',
items: 'sub',
};
/** 配置项 */
@Input() options: PickerOptions;
/** 当options.type=='form'时,占位符文本 */
Expand Down Expand Up @@ -190,9 +192,6 @@ export class CityPickerComponent implements ControlValueAccessor, OnDestroy {
}
}

private onChange: any = Function.prototype;
private onTouched: any = Function.prototype;

registerOnChange(fn: (_: any) => {}): void {
this.onChange = fn;
}
Expand Down
9 changes: 4 additions & 5 deletions components/picker/picker-date.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ export type FORMAT_TYPE =
encapsulation: ViewEncapsulation.None,
})
export class DatePickerComponent implements OnInit, ControlValueAccessor, OnDestroy, OnChanges {
@ViewChild(PickerComponent) _pickerInstance: PickerComponent;
private initFlag = false;
private onChange: any = Function.prototype;
private onTouched: any = Function.prototype;
@ViewChild(PickerComponent, { static: true }) _pickerInstance: PickerComponent;

_value: Date;
_groups: any[] = [];
Expand Down Expand Up @@ -313,7 +316,6 @@ export class DatePickerComponent implements OnInit, ControlValueAccessor, OnDest
this.cancel.emit();
}

private initFlag = false;
ngOnInit(): void {
this.initFlag = true;
this.genGroups();
Expand Down Expand Up @@ -342,9 +344,6 @@ export class DatePickerComponent implements OnInit, ControlValueAccessor, OnDest
this._pickerInstance._text = value instanceof Date ? this.getFormatDate(value)! : '';
}

private onChange: any = Function.prototype;
private onTouched: any = Function.prototype;

registerOnChange(fn: (_: any) => {}): void {
this.onChange = fn;
}
Expand Down
10 changes: 5 additions & 5 deletions components/picker/picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ import { PickerConfig } from './picker.config';
encapsulation: ViewEncapsulation.None,
})
export class PickerComponent implements ControlValueAccessor, OnInit, OnChanges {
private onChange: any = Function.prototype;
private onTouched: any = Function.prototype;
_showP: boolean = false;
_shown: boolean = false;

/** 配置项 */
@Input() options: PickerOptions;

Expand Down Expand Up @@ -94,8 +99,6 @@ export class PickerComponent implements ControlValueAccessor, OnInit, OnChanges
if (!this.options) this.parseOptions();
}

_showP: boolean = false;
_shown: boolean = false;
_onHide(fh: boolean) {
if (!fh && !this.options.backdrop) return false;
this._shown = false;
Expand Down Expand Up @@ -195,9 +198,6 @@ export class PickerComponent implements ControlValueAccessor, OnInit, OnChanges
}
}

private onChange: any = Function.prototype;
private onTouched: any = Function.prototype;

registerOnChange(fn: (_: any) => {}): void {
this.onChange = fn;
}
Expand Down
1 change: 0 additions & 1 deletion components/picker/picker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export class PickerService extends BaseService {
*
* @param data 城市数据,可以参考示例中的数据格式
* @param [value] 默认值,即城市编号
* @param [dataMap]
* @param options 配置项
* @returns 务必订阅结果才会显示。
*/
Expand Down
Loading

0 comments on commit 72c753c

Please sign in to comment.