Skip to content

Commit

Permalink
chore(release): release 8.1.0 (#35)
Browse files Browse the repository at this point in the history
Co-authored-by: huaweidevcloud <devcloudmobile@huawei.com>
  • Loading branch information
wangyaju and huaweidevcloud authored Apr 22, 2020
1 parent cf3db10 commit 998b910
Show file tree
Hide file tree
Showing 205 changed files with 1,654 additions and 1,431 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p align="center"><a href="https://devui.design/home" target="_blank" rel="noopener noreferrer"><img alt="DevUI Logo" src="logo.svg" width="180" style="max-width:100%;">
<p align="center"><a href="https://devui.design/home" target="_blank" rel="noopener noreferrer"><img alt="DevUI Logo" src="logo.svg?sanitize=true" width="180" style="max-width:100%;">
</p>
<p align="center">
<a href="https://github.com/DevCloudFE/ng-devui"><img src="https://img.shields.io/github/stars/DevCloudFE/ng-devui.svg?label=github%20stars" alt="Github Star"></a>
Expand All @@ -11,7 +11,6 @@
<a href="https://gitter.im/devui-design/devui-design"><img src="https://img.shields.io/gitter/room/devui-design/devui-design" alt="Chat"></a>
</p>


<h1 align="center">DevUI for Angular</h1>
The DevUI Design Design system contains a combination of DevUI rules, Design languages, and best practices. DevUI Design allows developers to focus more on application logic, while designers focus on user experience, interactions, and processes.

Expand All @@ -23,6 +22,7 @@ The DevUI Design Design system contains a combination of DevUI rules, Design lan
To see more in [devui.design](https://devui.design/home).

## Angular Support

Now supports Angular <font color=red>`^8.0.0`</font>

## Getting Started
Expand All @@ -41,6 +41,7 @@ $ npm i ng-devui
# font icon library
# $ npm i @devui-design/icons
```

3. Usage:

```typescript
Expand Down Expand Up @@ -91,6 +92,7 @@ Please make sure you read the [contributing](./CONTRIBUTING.md) guide before mak
We appreciate all contributors who helped us build DevUI.

## Support

Modern browsers and Internet Explorer 11+.

| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera |
Expand Down
4 changes: 1 addition & 3 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p align="center"><a href="https://devui.design/home" target="_blank" rel="noopener noreferrer"><img alt="DevUI Logo" src="logo.svg" width="180" style="max-width:100%;">
<p align="center"><a href="https://devui.design/home" target="_blank" rel="noopener noreferrer"><img alt="DevUI Logo" src="logo.svg?sanitize=true" width="180" style="max-width:100%;">
</p>
<p align="center">
<a href="https://github.com/DevCloudFE/ng-devui"><img src="https://img.shields.io/github/stars/DevCloudFE/ng-devui.svg?label=github%20stars" alt="Github Star"></a>
Expand All @@ -11,8 +11,6 @@
<a href="https://gitter.im/devui-design/devui-design"><img src="https://img.shields.io/gitter/room/devui-design/devui-design" alt="Chat"></a>
</p>



<h1 align="center">DevUI for Angular</h1>
DevUI Design设计系统包含了DevUI规则、设计语言和最佳实践的资源组合。DevUI Design可以让开发人员更加专注于应用逻辑的思考,而设计人员专注于用户体验、交互和流程

Expand Down
3 changes: 2 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
'type-empty': [2, 'never'],
'type-enum': [2, 'always', types],
'scope-case': [0, 'always'],
'subject-empty': [2, 'never']
'subject-empty': [2, 'never'],
'subject-case': [0, 'never']
}
};
2 changes: 1 addition & 1 deletion devui/alert/alert.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class AlertComponent {
@Input() closeable = true;
@Input() content: HTMLElement | string;
@Input() showIcon = true;
@Output() closeEvent: EventEmitter<any> = new EventEmitter;
@Output() closeEvent: EventEmitter<any> = new EventEmitter<any>();
@Input() set dismissTime(time) {
setTimeout(() => {
this.close();
Expand Down
13 changes: 13 additions & 0 deletions devui/auto-complete/auto-complete-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Injectable } from '@angular/core';

@Injectable({ providedIn: 'root' })
export class AutoCompleteConfig {
autoComplete = {
delay: 300,
minLength: 1,
itemTemplate: null,
noResultItemTemplate: null,
formatter: (item) => item ? (item.label || item.toString()) : '',
valueParser: (item) => item
};
}
25 changes: 13 additions & 12 deletions devui/auto-complete/auto-complete-popup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ViewChild
} from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { AutoCompleteConfig } from './auto-complete-config';
import { fadeInOut } from 'ng-devui/utils';

@Component({
Expand Down Expand Up @@ -39,28 +40,28 @@ export class AutoCompletePopupComponent implements ControlValueAccessor {
private onChange = (_: any) => null;
private onTouched = () => null;

constructor() {
this.formatter = (item: any) => item ? (item.label || item.toString()) : '';
constructor(private autoCompleteConfig: AutoCompleteConfig) {
this.formatter = this.autoCompleteConfig.autoComplete.formatter;
this.maxHeight = 300;
}

writeValue(obj: any): void {
writeValue(obj): void {
this.value = obj;
}

setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled;
}

registerOnChange(fn: any): void {
registerOnChange(fn): void {
this.onChange = fn;
}

registerOnTouched(fn: any): void {
registerOnTouched(fn): void {
this.onTouched = fn;
}

onSelect(event: any, item: any) {
onSelect(event, item) {
if (this.disabledKey && item[this.disabledKey]) {
event.preventDefault();
event.stopPropagation();
Expand All @@ -76,11 +77,11 @@ export class AutoCompletePopupComponent implements ControlValueAccessor {
this.onChange({ type: 'select', value: this.value });
}

selectCurrentItem(event: any) {
selectCurrentItem(event) {
this.onSelect(event, this.source[this.activeIndex]);
}

onActiveIndexChange(index: any) {
onActiveIndexChange(index) {
this.activeIndex = index;
}

Expand Down Expand Up @@ -108,23 +109,23 @@ export class AutoCompletePopupComponent implements ControlValueAccessor {
}
}

trackByFn(index: any, item: any) {
trackByFn(index, item) {
return index;
}

animationEnd($event: any) {
animationEnd($event) {
if (!this.isOpen) {
const targetElement = this.selectMenuElement.nativeElement;
targetElement.style.display = 'none';
}
}

loadMoreEvent($event: any) {
loadMoreEvent($event) {
this.showLoading = true;
this.onChange({ type: 'loadMore', value: this });
}

loadFinish($event: any) {
loadFinish($event) {
this.showLoading = false;
}
}
45 changes: 24 additions & 21 deletions devui/auto-complete/auto-complete.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { fromEvent, Observable, Subscription, of } from 'rxjs';
import { map, filter, debounceTime, switchMap, tap } from 'rxjs/operators';
import { PositionService } from 'ng-devui/position';
import { AutoCompletePopupComponent } from './auto-complete-popup.component';
import { AutoCompleteConfig } from './auto-complete-config';

@Directive({
selector: '[dAutoComplete]',
Expand Down Expand Up @@ -80,20 +81,22 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
private onChange = (_: any) => null;
private onTouched = () => null;

constructor(private elementRef: ElementRef,
constructor(
private autoCompleteConfig: AutoCompleteConfig,
private elementRef: ElementRef,
private viewContainerRef: ViewContainerRef,
private componentFactoryResolver: ComponentFactoryResolver,
private renderer: Renderer2,
private injector: Injector,
private positionService: PositionService,
private changeDetectorRef: ChangeDetectorRef) {
this.delay = 300;
this.delay = this.autoCompleteConfig.autoComplete.delay;
this.valueChanges = this.registerInputEvent(elementRef);
this.minLength = 1;
this.itemTemplate = null;
this.noResultItemTemplate = null;
this.formatter = (item: any) => item ? (item.label || item.toString()) : '';
this.valueParser = (item: any) => item;
this.minLength = this.autoCompleteConfig.autoComplete.minLength;
this.itemTemplate = this.autoCompleteConfig.autoComplete.itemTemplate;
this.noResultItemTemplate = this.autoCompleteConfig.autoComplete.noResultItemTemplate;
this.formatter = this.autoCompleteConfig.autoComplete.formatter;
this.valueParser = this.autoCompleteConfig.autoComplete.valueParser;
}

ngOnInit() {
Expand Down Expand Up @@ -147,7 +150,7 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
}

// 调用时机:input keyup
onSourceChange(source: any) {
onSourceChange(source) {
if (!this.elementRef.nativeElement.value) {
if (this.sceneType !== 'select') { // 下拉场景不展示最近输入
this.showLatestSource();
Expand Down Expand Up @@ -186,7 +189,7 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
}
}

private showSource(source: any, setOpen: any, isReset: any) {
private showSource(source, setOpen, isReset) {
if ((source && source.length) || this.noResultItemTemplate) {
const pop = this.popupRef.instance;
if (isReset) {
Expand All @@ -203,16 +206,16 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
}
}

writeValue(obj: any): void {
writeValue(obj): void {
this.value = this.formatter(obj) || '';
this.writeInputValue(this.value);
}

registerOnChange(fn: any): void {
registerOnChange(fn): void {
this.onChange = fn;
}

registerOnTouched(fn: any): void {
registerOnTouched(fn): void {
this.onTouched = fn;
}

Expand All @@ -229,7 +232,7 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
}

@HostListener('focus', ['$event'])
onFocus($event: any) {
onFocus($event) {
this.focus = true;
this.transInputFocusEmit.emit({
focus: true,
Expand All @@ -252,18 +255,18 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
}

@HostListener('blur', ['$event'])
onBlur($event: any) {
onBlur($event) {
this.focus = false;
this.onTouched();
}

@HostListener('keydown.esc', ['$event'])
onEscKeyup($event: any) {
onEscKeyup($event) {
this.hidePopup();
}

@HostListener('keydown.Enter', ['$event'])
onEnterKeyDown($event: any) {
onEnterKeyDown($event) {
if (!this.popupRef.instance.source || !this.popupRef.instance.isOpen) {
return;
}
Expand All @@ -273,7 +276,7 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
}

@HostListener('keydown.ArrowUp', ['$event'])
onArrowUpKeyDown($event: any) {
onArrowUpKeyDown($event) {
if (this.popupRef) {
$event.preventDefault();
$event.stopPropagation();
Expand All @@ -282,7 +285,7 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
}

@HostListener('keydown.ArrowDown', ['$event'])
onArrowDownKeyDown($event: any) {
onArrowDownKeyDown($event) {
if (this.popupRef) {
$event.preventDefault();
$event.stopPropagation();
Expand Down Expand Up @@ -318,7 +321,7 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
}
}

private fillPopup(source?: any, term?: string) {
private fillPopup(source?, term?: string) {
this.position = this.positionService.position(this.elementRef.nativeElement);
const pop = this.popupRef.instance;
pop.source = source;
Expand All @@ -334,7 +337,7 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
});
}

private writeInputValue(value: any) {
private writeInputValue(value) {
this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);
}

Expand All @@ -349,7 +352,7 @@ export class AutoCompleteDirective implements OnInit, OnDestroy, OnChanges, Cont
}
}

onTermChange(term: any) {
onTermChange(term) {
this.value = term;
if (this.popupRef) {
this.popupRef.instance.term = term;
Expand Down
6 changes: 3 additions & 3 deletions devui/auto-complete/auto-complete.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { AutoCompleteConfig } from './auto-complete-config';
import { AutoCompleteDirective } from './auto-complete.directive';
import { AutoCompletePopupComponent } from './auto-complete-popup.component';
import { HighlightComponent } from './highlight.component';
Expand All @@ -15,8 +16,7 @@ import { LoadingModule } from 'ng-devui/loading';
imports: [CommonModule, FormsModule, LazyLoadModule, LoadingModule],
exports: [AutoCompleteDirective, AutoCompletePopupComponent, HighlightComponent],
declarations: [AutoCompleteDirective, AutoCompletePopupComponent, HighlightComponent],
providers: [DocumentRef, WindowRef, PositionService],
providers: [DocumentRef, WindowRef, PositionService, AutoCompleteConfig],
entryComponents: [AutoCompletePopupComponent]
})
export class AutoCompleteModule {
}
export class AutoCompleteModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export class AutoDemoArrayComponent {
languages = ['C#', 'C', 'C++', 'CPython', 'Java', 'JavaScript', 'Go', 'Python', 'Ruby', 'F#', 'TypeScript', 'SQL',
'LiveScript', 'CoffeeScript'];

onSearchLocal(term: any) {
onSearchLocal(term) {
return of(this.languages.filter(lang => lang.toLowerCase().indexOf(term.toLowerCase()) !== -1));
}

selectValue(value: any) {
selectValue(value) {
// tslint:disable-next-line:no-console
console.info(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export class AutoDemoCustomComponent {
languages = ['C#', 'C', 'C++', 'CPython', 'Java', 'JavaScript', 'Go', 'Python', 'Ruby', 'F#', 'TypeScript', 'SQL',
'LiveScript', 'CoffeeScript'];

onSearchLocal(term: any) {
onSearchLocal(term) {
return of(this.languages.filter(lang => lang.toLowerCase().indexOf(term.toLowerCase()) !== -1));
}

getIcon(index: any) {
getIcon(index) {
return this.icons[index % this.icons.length];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class AutoDemoDisableComponent {
languages = ['C#', 'C', 'C++', 'CPython', 'Java', 'JavaScript', 'Go', 'Python', 'Ruby', 'F#', 'TypeScript', 'SQL',
'LiveScript', 'CoffeeScript'];

onSearchLocal(term: any) {
onSearchLocal(term) {
return of(this.languages.filter(lang => lang.toLowerCase().indexOf(term.toLowerCase()) !== -1));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class AutoDemoObjectComponent {
languages = ['C#', 'C', 'C++', 'CPython', 'Java', 'JavaScript', 'Go', 'Python', 'Ruby', 'F#', 'TypeScript', 'SQL',
'LiveScript', 'CoffeeScript'];

onSearchObject(term: any) {
onSearchObject(term) {
return of(this.languages
.map((lang, index) => ({ label: lang, id: index }))
.filter(lang => lang.label.toLowerCase().indexOf(term.toLowerCase()) !== -1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class BreadCrumbItemComponent implements OnInit {
@Input() customMenuTemplate: TemplateRef<any>;
@Input() menuList: Array<MenuConfig>;
@Input() isSearch = false;
@Output() toggleEvent: EventEmitter<any> = new EventEmitter();
@Output() toggleEvent: EventEmitter<any> = new EventEmitter<any>();

menuListDisplay: Array<MenuConfig>;
isOpen: boolean;
Expand Down
Loading

0 comments on commit 998b910

Please sign in to comment.