Skip to content

Commit

Permalink
feat(moulde:*): add global config
Browse files Browse the repository at this point in the history
  • Loading branch information
ng-nest-moon committed Jul 12, 2020
1 parent 0d3ebc2 commit 7c4555d
Show file tree
Hide file tree
Showing 43 changed files with 382 additions and 172 deletions.
3 changes: 2 additions & 1 deletion lib/ng-nest/ui/container/aside.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, ViewEncapsulation, ChangeDetectionStrategy, Renderer2, ElementRef, HostBinding } from '@angular/core';
import { XAsidePrefix, XAsideProperty } from './container.property';
import { XConfigService } from '@ng-nest/ui/core';

@Component({
selector: `${XAsidePrefix}`,
Expand All @@ -13,7 +14,7 @@ export class XAsideComponent extends XAsideProperty {
return this.width;
}

constructor(private renderer: Renderer2, private elementRef: ElementRef) {
constructor(private renderer: Renderer2, private elementRef: ElementRef, public configService: XConfigService) {
super();
this.renderer.addClass(this.elementRef.nativeElement, XAsidePrefix);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ng-nest/ui/container/container.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, ViewEncapsulation, ChangeDetectionStrategy, Renderer2, ElementRef, Input, SimpleChanges } from '@angular/core';
import { XContainerPrefix, XContainerProperty } from './container.property';
import { XDirection } from '@ng-nest/ui/core';
import { XDirection, XConfigService } from '@ng-nest/ui/core';

@Component({
selector: `${XContainerPrefix}`,
Expand All @@ -21,7 +21,7 @@ export class XContainerComponent extends XContainerProperty implements OnInit {
}
}

constructor(private renderer: Renderer2, private elementRef: ElementRef) {
constructor(private renderer: Renderer2, private elementRef: ElementRef, public configService: XConfigService) {
super();
this.renderer.addClass(this.elementRef.nativeElement, XContainerPrefix);
}
Expand Down
10 changes: 5 additions & 5 deletions lib/ng-nest/ui/container/container.property.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { XDirection, XProperty, XNumber } from '@ng-nest/ui/core';
import { XDirection, XProperty, XNumber, XWithConfig } from '@ng-nest/ui/core';
import { Input, Component } from '@angular/core';

/**
Expand All @@ -17,7 +17,7 @@ export class XContainerProperty extends XProperty {
* flex 布局下的子元素排列方向
* @description 子元素中有 x-header 或 x-footer 时为 column
*/
@Input() direction: XDirection;
@Input() @XWithConfig<XDirection>() direction: XDirection;
}

/**
Expand All @@ -35,7 +35,7 @@ export class XHeaderProperty extends XProperty {
/**
* 高度,rem
*/
@Input() height: XNumber = 3;
@Input() @XWithConfig<number>(3) height: number;
}

/**
Expand All @@ -53,7 +53,7 @@ export class XAsideProperty extends XProperty {
/**
* 宽度,rem
*/
@Input() width: XNumber = 12;
@Input() @XWithConfig<number>(12) width: number;
}

/**
Expand All @@ -78,5 +78,5 @@ export class XFooterProperty extends XProperty {
/**
* 高度,rem
*/
@Input() height: XNumber = 3;
@Input() @XWithConfig<number>(3) height: XNumber = 3;
}
8 changes: 7 additions & 1 deletion lib/ng-nest/ui/container/footer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '@angular/core';
import { XFooterPrefix, XFooterProperty } from './container.property';
import { XContainerComponent } from './container.component';
import { XConfigService } from '@ng-nest/ui/core';

@Component({
selector: `${XFooterPrefix}`,
Expand All @@ -23,7 +24,12 @@ export class XFooterComponent extends XFooterProperty implements OnInit {
@HostBinding(`style.height.rem`) get getHeight() {
return this.height;
}
constructor(@Optional() @Host() public container: XContainerComponent, private renderer: Renderer2, private elementRef: ElementRef) {
constructor(
@Optional() @Host() public container: XContainerComponent,
private renderer: Renderer2,
private elementRef: ElementRef,
public configService: XConfigService
) {
super();
this.renderer.addClass(this.elementRef.nativeElement, XFooterPrefix);
}
Expand Down
8 changes: 7 additions & 1 deletion lib/ng-nest/ui/container/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '@angular/core';
import { XHeaderPrefix, XHeaderProperty } from './container.property';
import { XContainerComponent } from './container.component';
import { XConfigService } from '@ng-nest/ui/core';

@Component({
selector: `${XHeaderPrefix}`,
Expand All @@ -24,7 +25,12 @@ export class XHeaderComponent extends XHeaderProperty implements OnInit {
return this.height;
}

constructor(@Optional() @Host() public container: XContainerComponent, private renderer: Renderer2, private elementRef: ElementRef) {
constructor(
@Optional() @Host() public container: XContainerComponent,
private renderer: Renderer2,
private elementRef: ElementRef,
public configService: XConfigService
) {
super();
this.renderer.addClass(this.elementRef.nativeElement, XHeaderPrefix);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/ng-nest/ui/container/main.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, ViewEncapsulation, ChangeDetectionStrategy, Renderer2, ElementRef } from '@angular/core';
import { XMainPrefix } from './container.property';
import { XConfigService } from '@ng-nest/ui/core';

@Component({
selector: `${XMainPrefix}`,
Expand All @@ -9,7 +10,7 @@ import { XMainPrefix } from './container.property';
changeDetection: ChangeDetectionStrategy.OnPush
})
export class XMainComponent {
constructor(private renderer: Renderer2, private elementRef: ElementRef) {
constructor(private renderer: Renderer2, private elementRef: ElementRef, public configService: XConfigService) {
this.renderer.addClass(this.elementRef.nativeElement, XMainPrefix);
}
}

0 comments on commit 7c4555d

Please sign in to comment.