Skip to content

Commit

Permalink
feat: bump deps, support typescript 4.0+ (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin authored Sep 25, 2020
1 parent a4980e9 commit 7291f95
Show file tree
Hide file tree
Showing 35 changed files with 3,630 additions and 4,593 deletions.
4 changes: 2 additions & 2 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');

module.exports = {
stories: [
'../stories/**/index.(js|ts)',
'../stories/**/*.stories.(js|ts|mdx)',
'../stories/**/index.@(js|ts)',
'../stories/**/*.stories.@(js|ts|mdx)',
],
addons: [
'@storybook/addon-docs',
Expand Down
56 changes: 28 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,45 +48,45 @@
"@1stg/app-config": "^0.5.5",
"@1stg/lib-config": "^0.5.5",
"@1stg/tslint-config": "^0.8.5",
"@angular-devkit/build-angular": "^0.1000.5",
"@angular-devkit/core": "^10.0.1",
"@angular/animations": "^10.0.8",
"@angular-devkit/build-angular": "^0.1001.2",
"@angular-devkit/core": "^10.1.2",
"@angular/animations": "^10.1.2",
"@angular/cdk": "^10.2.2",
"@angular/cli": "^10.0.5",
"@angular/common": "^10.0.8",
"@angular/compiler": "^10.0.8",
"@angular/compiler-cli": "^10.0.8",
"@angular/core": "^10.0.8",
"@angular/forms": "^10.0.8",
"@angular/platform-browser": "^10.0.8",
"@angular/platform-browser-dynamic": "^10.0.8",
"@storybook/addon-actions": "^5.3.18",
"@storybook/addon-docs": "^5.3.18",
"@storybook/addon-knobs": "^5.3.18",
"@storybook/addon-storysource": "^5.3.18",
"@storybook/addons": "^5.3.18",
"@storybook/angular": "^5.3.18",
"@storybook/cli": "^5.3.18",
"@storybook/source-loader": "^5.3.18",
"@types/jest": "^26.0.9",
"@types/node": "^14.0.27",
"@angular/cli": "^10.1.2",
"@angular/common": "^10.1.2",
"@angular/compiler": "^10.1.2",
"@angular/compiler-cli": "^10.1.2",
"@angular/core": "^10.1.2",
"@angular/forms": "^10.1.2",
"@angular/platform-browser": "^10.1.2",
"@angular/platform-browser-dynamic": "^10.1.2",
"@storybook/addon-actions": "^6.0.21",
"@storybook/addon-docs": "^6.0.21",
"@storybook/addon-knobs": "^6.0.21",
"@storybook/addon-storysource": "^6.0.21",
"@storybook/addons": "^6.0.21",
"@storybook/angular": "^6.0.21",
"@storybook/cli": "^6.0.21",
"@storybook/source-loader": "^6.0.21",
"@types/jest": "^26.0.14",
"@types/node": "^14.11.2",
"babel-loader": "^8.1.0",
"clipboard-polyfill": "^3.0.1",
"gulp": "^4.0.2",
"gulp-dart-sass": "^1.0.2",
"jest": "^26.2.2",
"jest": "^26.4.2",
"jest-junit": "^11.1.0",
"jest-preset-angular": "^8.2.1",
"ng-packagr": "^10.0.3",
"jest-preset-angular": "^8.3.1",
"ng-packagr": "^10.1.0",
"ng-tslint": "^1.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.4",
"prettier": "^2.1.2",
"rxjs": "^6.6.2",
"standard-version": "^8.0.2",
"standard-version": "^9.0.0",
"tsconfig-paths-webpack-plugin": "^3.3.0",
"tslib": "^2.0.1",
"tslint": "^6.1.3",
"typescript": "^3.9.7",
"yarn-deduplicate": "^2.1.1"
"typescript": "^4.0.3",
"yarn-deduplicate": "^3.0.0"
}
}
3 changes: 2 additions & 1 deletion src/accordion/accordion-item/accordion-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export class AccordionItemContentDirective {}
preserveWhitespaces: false,
viewProviders: [AccordionItemComponent],
})
export class AccordionItemComponent extends CdkAccordionItem
export class AccordionItemComponent
extends CdkAccordionItem
implements AfterContentInit {
@Input()
hideToggle: false;
Expand Down
17 changes: 7 additions & 10 deletions src/autocomplete/autocomplete.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ import { SuggestionComponent } from './suggestion/suggestion.component';
@Directive({
selector: 'input[auiAutocomplete],textarea[auiAutocomplete]',
exportAs: 'auiAutocomplete',
inputs: ['class:auiAutocompleteClass'],
host: {
autocomplete: 'off',
},
})
export class AutoCompleteDirective extends BaseTooltip
export class AutoCompleteDirective
extends BaseTooltip<AutoCompleteContext>
implements OnInit, OnDestroy {
@Input('auiAutocomplete')
get autocomplete() {
Expand All @@ -54,9 +56,6 @@ export class AutoCompleteDirective extends BaseTooltip
this.content = val.template;
}

@Input('auiAutocompleteClass')
class: string;

@Input('auiAutocompleteFilterFn')
@Input()
get filterFn() {
Expand All @@ -82,12 +81,6 @@ export class AutoCompleteDirective extends BaseTooltip
@Output('auiAutocompleteHide')
hide: EventEmitter<void>;

readonly type: TooltipType = TooltipType.Plain;
readonly trigger: TooltipTrigger = TooltipTrigger.Focus;
readonly position = 'bottom start';
readonly hideOnClick = true;
context: AutoCompleteContext;

private _autocomplete: AutocompleteComponent;
private focusedSuggestion: SuggestionComponent;

Expand All @@ -113,6 +106,10 @@ export class AutoCompleteDirective extends BaseTooltip
private readonly ngControl: NgControl,
) {
super(overlay, viewContainerRef, elRef, renderer, cdr, ngZone);
this.type = TooltipType.Plain;
this.trigger = TooltipTrigger.Focus;
this.position = 'bottom start';
this.hideOnClick = true;
}

ngOnInit() {
Expand Down
3 changes: 2 additions & 1 deletion src/checkbox/checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ let uniqueId = 0;
},
],
})
export class CheckboxComponent extends CommonFormControl<boolean>
export class CheckboxComponent
extends CommonFormControl<boolean>
implements AfterViewInit, OnDestroy {
id = `aui-checkbox-${uniqueId++}`;

Expand Down
20 changes: 14 additions & 6 deletions src/dialog/dialog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
import {
ComponentPortal,
ComponentType,
PortalInjector,
TemplatePortal,
} from '@angular/cdk/portal';
import {
Expand Down Expand Up @@ -173,12 +172,21 @@ export class DialogService {
config: DialogConfig,
dialogRef: DialogRef<T>,
dialogIns: DialogComponent,
): PortalInjector {
): Injector {
const userInjector = config?.viewContainerRef?.injector;
const injectionTokens = new WeakMap();
injectionTokens.set(DialogRef, dialogRef);
injectionTokens.set(DIALOG_DATA, config.data || dialogIns);
return new PortalInjector(userInjector || this.injector, injectionTokens);
return Injector.create({
providers: [
{
provide: DialogRef,
useValue: dialogRef,
},
{
provide: DIALOG_DATA,
useValue: config.data || dialogIns,
},
],
parent: userInjector || this.injector,
});
}

private removeDialog(dialogRef: DialogRef<any>) {
Expand Down
24 changes: 10 additions & 14 deletions src/dropdown/dropdown.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@ import { MenuComponent } from './menu/menu.component';

@Directive({
selector: '[auiDropdown]',
exportAs: 'auiDropdown',
inputs: [
'class:auiDropdownClass',
'disabled:auiDropdownDisabled',
'position:auiDropdownPosition',
'trigger:auiDropdownTrigger',
],
providers: [
{
provide: BaseTooltip,
useExisting: DropdownDirective,
},
],
exportAs: 'auiDropdown',
})
export class DropdownDirective extends BaseTooltip implements OnInit {
@Input('auiDropdown')
Expand All @@ -50,18 +56,6 @@ export class DropdownDirective extends BaseTooltip implements OnInit {
@Input('auiDropdownContext')
lazyContentContext: any;

@Input('auiDropdownPosition')
position = 'bottom end';

@Input('auiDropdownClass')
class: string;

@Input('auiDropdownTrigger')
trigger = TooltipTrigger.Click;

@Input('auiDropdownDisabled')
disabled: boolean;

@Input('auiDropdownHideOnClick')
hideOnClick = true;

Expand All @@ -71,7 +65,6 @@ export class DropdownDirective extends BaseTooltip implements OnInit {
@Output('auiDropdownHide')
hide: EventEmitter<void>;

readonly type: TooltipType = TooltipType.Plain;
private _menu: MenuComponent;

constructor(
Expand All @@ -84,6 +77,9 @@ export class DropdownDirective extends BaseTooltip implements OnInit {
) {
super(overlay, viewContainerRef, elRef, renderer, cdr, ngZone);
new DropdownActiveDirective(this, elRef, renderer).customClass = 'isActive';
this.type = TooltipType.Plain;
this.position = 'bottom end';
this.trigger = TooltipTrigger.Click;
}

ngOnInit() {
Expand Down
10 changes: 9 additions & 1 deletion src/dropdown/menu-item/menu-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ import { MenuItemType } from '../dropdown.types';
export class MenuItemComponent {
bem: Bem = buildBem('aui-menu-item');

protected _disabled = false;

@Input()
disabled = false;
get disabled() {
return this._disabled;
}

set disabled(value) {
this._disabled = value;
}

@Input()
divide = false;
Expand Down
6 changes: 0 additions & 6 deletions src/dropdown/submenu/submenu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,10 @@ export class SubmenuComponent extends MenuItemComponent {
return this._disabled || !this.hasEnabledItem;
}

set disabled(val) {
this._disabled = val;
}

@ContentChildren(MenuItemComponent, { descendants: true })
menuItems: QueryList<MenuItemComponent>;

get hasEnabledItem() {
return this.menuItems?.length > 0;
}

private _disabled = false;
}
4 changes: 2 additions & 2 deletions src/form/__snapshots__/form.component.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports[`FormComponent should match snapshot 1`] = `
auiformitemaddon=""
class="aui-form-item__addon"
>
addon
addon
</div>
</div>
</div>
Expand Down Expand Up @@ -119,7 +119,7 @@ exports[`FormComponent should match snapshot 2`] = `
auiformitemaddon=""
class="aui-form-item__addon"
>
addon
addon
</div>
</div>
</div>
Expand Down
4 changes: 1 addition & 3 deletions src/form/form.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ describe('FormComponent', () => {
<div auiFormItemError *ngIf="name.errors?.required">required</div>
<div auiFormItemError *ngIf="name.errors?.minlength">minlength: 3</div>
<div auiFormItemHint>input your name</div>
<div auiFormItemAddon>
addon
</div>
<div auiFormItemAddon>addon</div>
</aui-form-item>
</form>
`,
Expand Down
8 changes: 4 additions & 4 deletions src/icon/icon.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
x2="150"
y2="180"
>
<stop offset="0" style="stop-color:#000000" />
<stop offset="1" style="stop-color:#808080" />
<stop offset="0" style="stop-color: #000000" />
<stop offset="1" style="stop-color: #808080" />
</linearGradient>
<linearGradient
[attr.id]="'left-' + id"
Expand All @@ -26,8 +26,8 @@
x2="50"
y2="180"
>
<stop offset="0" style="stop-color:#FFFFFF" />
<stop offset="1" style="stop-color:#808080" />
<stop offset="0" style="stop-color: #ffffff" />
<stop offset="1" style="stop-color: #808080" />
</linearGradient>
<mask [attr.id]="'mask-' + id">
<g>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ exports[`InputGroupComponent should match snapshot 1`] = `
>
<stop
offset="0"
style="stop-color:#000000"
style="stop-color: #000000"
/>
<stop
offset="1"
style="stop-color:#808080"
style="stop-color: #808080"
/>
</lineargradient>
<lineargradient
Expand All @@ -87,11 +87,11 @@ exports[`InputGroupComponent should match snapshot 1`] = `
>
<stop
offset="0"
style="stop-color:#FFFFFF"
style="stop-color: #ffffff"
/>
<stop
offset="1"
style="stop-color:#808080"
style="stop-color: #808080"
/>
</lineargradient>
<mask
Expand Down
4 changes: 1 addition & 3 deletions src/input/number-input/number-input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { Bem, buildBem } from '../../utils/bem';
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
inputs: ['disabled'],
providers: [
{
provide: NG_VALUE_ACCESSOR,
Expand All @@ -45,9 +46,6 @@ export class NumberInputComponent extends CommonFormControl<number> {
@Input()
precision: number;

@Input()
disabled = false;

@Input()
controls = true;

Expand Down
3 changes: 2 additions & 1 deletion src/notification/notification.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ let uniqueId = 0;
changeDetection: ChangeDetectionStrategy.OnPush,
preserveWhitespaces: false,
})
export class NotificationComponent extends MessageComponent
export class NotificationComponent
extends MessageComponent
implements AfterViewInit {
protected readonly animateStartState = 'flyLeft';
protected readonly animateStartEnd = 'flyUp';
Expand Down
3 changes: 2 additions & 1 deletion src/select/base-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import { scrollIntoView } from '../utils/scroll-into-view';
import { OptionComponent } from './option/option.component';
import { OptionFilterFn, TrackFn } from './select.types';

export abstract class BaseSelect<T> extends CommonFormControl<T>
export abstract class BaseSelect<T>
extends CommonFormControl<T>
implements AfterContentInit, AfterViewInit, OnDestroy {
@Input()
get size() {
Expand Down
Loading

0 comments on commit 7291f95

Please sign in to comment.