mirror of https://github.com/abpframework/abp.git
8 changed files with 122 additions and 33 deletions
@ -1,9 +1,16 @@ |
|||
import { Component } from '@angular/core'; |
|||
import { Component, Input } from '@angular/core'; |
|||
|
|||
@Component({ |
|||
selector: 'abp-card-body', |
|||
template: `<div class="card-body">
|
|||
<ng-content></ng-content> |
|||
</div>`,
|
|||
template: ` |
|||
<div [ngClass]="cardBodyClass" [ngStyle]="cardBodyStyle" > |
|||
<ng-content></ng-content> |
|||
</div>`,
|
|||
host: { |
|||
class: 'card-body', |
|||
} |
|||
}) |
|||
export class CardBodyComponent {} |
|||
export class CardBodyComponent { |
|||
@Input() cardBodyClass: string; |
|||
@Input() cardBodyStyle: string; |
|||
} |
|||
|
|||
@ -0,0 +1,19 @@ |
|||
import { Component, Input } from '@angular/core'; |
|||
|
|||
@Component({ |
|||
selector: 'abp-card-footer', |
|||
template: ` |
|||
<div [ngStyle]="cardFooterStyle" [ngClass]="cardFooterClass" > |
|||
<ng-content ></ng-content> |
|||
</div> |
|||
`,
|
|||
styles: [], |
|||
host: { |
|||
class: 'card-footer', |
|||
} |
|||
}) |
|||
export class CardFooterComponent { |
|||
@Input() cardFooterStyle: string; |
|||
@Input() cardFooterClass: string; |
|||
|
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
import { Component, Input } from '@angular/core'; |
|||
|
|||
@Component({ |
|||
selector: 'abp-card-header', |
|||
template: ` |
|||
<div [ngClass]="cardHeaderClass" [ngStyle]="cardHeaderStyle"> |
|||
<ng-content ></ng-content> |
|||
</div> |
|||
`,
|
|||
styles: [], |
|||
host: { |
|||
class: 'card-header', |
|||
} |
|||
}) |
|||
export class CardHeaderComponent { |
|||
@Input() cardHeaderClass: string; |
|||
@Input() cardHeaderStyle: string; |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
import { Component } from '@angular/core'; |
|||
|
|||
@Component({ |
|||
selector: 'abp-card-title', |
|||
template: `<div class="card-title">
|
|||
<ng-content></ng-content> |
|||
</div>`,
|
|||
}) |
|||
export class CardTitleComponent {} |
|||
@ -1,22 +1,55 @@ |
|||
import { Component, ContentChild, Input } from '@angular/core'; |
|||
import { CardBodyComponent } from './card-body.component'; |
|||
import { CardTitleComponent } from './card-title.component'; |
|||
import { Component, Directive, Input } from '@angular/core'; |
|||
|
|||
@Directive({ |
|||
selector: `abp-card-title, [abp-card-title], [abpCardTitle]`, |
|||
host: { |
|||
class: 'card-title', |
|||
}, |
|||
}) |
|||
export class CardTitle{} |
|||
|
|||
@Directive({ |
|||
selector: `abp-card-subtitle, [abp-card-subtitle], [abpCardSubtitle]`, |
|||
host: { |
|||
class: 'card-subtitle', |
|||
}, |
|||
}) |
|||
export class CardSubtitle{} |
|||
|
|||
@Directive({ |
|||
selector: `abp-card-text, [abp-card-text], [abpCardText]`, |
|||
host: { |
|||
class: 'card-text', |
|||
}, |
|||
}) |
|||
export class CardText{} |
|||
|
|||
@Directive({ |
|||
selector: `abp-card-img-top, [abp-card-img-top], [abpCardImgTop]`, |
|||
host: { |
|||
class: 'card-img-top', |
|||
}, |
|||
}) |
|||
export class CardImgTop{} |
|||
|
|||
@Directive({ |
|||
selector: `abp-card-link, [abp-card-link], [abpCardLink]`, |
|||
host: { |
|||
class: 'card-link', |
|||
}, |
|||
}) |
|||
export class CardLink{} |
|||
|
|||
|
|||
@Component({ |
|||
selector: 'abp-card', |
|||
template: ` <div class="card" [ngClass]="cardClass" [ngStyle]="cardStyle">
|
|||
<ng-content *ngIf="cardTitleTemplate" select="abp-card-title"></ng-content> |
|||
<ng-content *ngIf="cardBodyTemplate" select="abp-card-body"></ng-content> |
|||
template: `
|
|||
<div class="card" [ngClass]="cardClass" [ngStyle]="cardStyle"> |
|||
<ng-content ></ng-content> |
|||
</div>`,
|
|||
}) |
|||
export class CardComponent { |
|||
@Input() cardClass: string; |
|||
|
|||
@Input() cardStyle: string; |
|||
|
|||
@ContentChild(CardBodyComponent) |
|||
cardBodyTemplate?: CardBodyComponent; |
|||
|
|||
@ContentChild(CardTitleComponent) |
|||
cardTitleTemplate?: CardTitleComponent; |
|||
} |
|||
|
|||
@ -1,14 +1,34 @@ |
|||
import { CommonModule } from '@angular/common'; |
|||
import { NgModule } from '@angular/core'; |
|||
import { CardBodyComponent } from './card-body.component'; |
|||
import { CardTitleComponent } from './card-title.component'; |
|||
import { CardComponent } from './card.component'; |
|||
import { |
|||
CardComponent, |
|||
CardImgTop, |
|||
CardLink, |
|||
CardSubtitle, |
|||
CardText, |
|||
CardTitle |
|||
} from './card.component'; |
|||
import { CardHeaderComponent } from './card-header.component'; |
|||
import { CardFooterComponent } from './card-footer.component'; |
|||
|
|||
const declarationsWithExports = [CardComponent, CardBodyComponent, CardTitleComponent]; |
|||
const declarationsWithExports = [ |
|||
CardComponent, |
|||
CardBodyComponent, |
|||
CardHeaderComponent, |
|||
CardFooterComponent, |
|||
CardTitle, |
|||
CardSubtitle, |
|||
CardText, |
|||
CardImgTop, |
|||
CardLink, |
|||
]; |
|||
|
|||
@NgModule({ |
|||
declarations: [...declarationsWithExports], |
|||
declarations: [ |
|||
...declarationsWithExports, |
|||
], |
|||
imports: [CommonModule], |
|||
exports: [...declarationsWithExports], |
|||
}) |
|||
export class CardModule {} |
|||
export class CardModule { } |
|||
|
|||
@ -1,4 +1,5 @@ |
|||
export * from './card.module'; |
|||
export * from './card.component'; |
|||
export * from './card-body.component'; |
|||
export * from './card-title.component'; |
|||
export * from './card-footer.component'; |
|||
export * from './card-header.component'; |
|||
Loading…
Reference in new issue