Skip to content

Commit

Permalink
Merge pull request #8227 from abpframework/feat/8184
Browse files Browse the repository at this point in the history
feat: improve page component api for ease of use
  • Loading branch information
muhammedaltug committed Mar 29, 2021
2 parents 9fd3053 + 40e50d7 commit 3f584e0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 28 deletions.
46 changes: 23 additions & 23 deletions npm/ng-packs/packages/components/page/src/page.component.html
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<div class="row entry-row">
<ng-container *ngIf="titleVisible">
<ng-container *ngIf="customTitle; else defaultTitleTemplate">
<ng-content select="abp-page-title-container"></ng-content>
</ng-container>
<ng-container *ngIf="customTitle; else defaultTitleTemplate">
<ng-content select="abp-page-title-container"></ng-content>
</ng-container>

<ng-container *ngIf="breadcrumbVisible">
<ng-container *ngIf="customBreadcrumb; else defaultBreadcrumbTemplate">
<ng-content select="abp-page-breadcrumb-container"></ng-content>
</ng-container>
<ng-container *ngIf="customBreadcrumb; else defaultBreadcrumbTemplate">
<ng-content select="abp-page-breadcrumb-container"></ng-content>
</ng-container>

<ng-container *ngIf="toolbarVisible">
<ng-container *ngIf="customToolbar; else defaultPageToolbarTemplate">
<ng-content select="abp-page-toolbar-container"></ng-content>
</ng-container>
<ng-container *ngIf="customToolbar; else defaultPageToolbarTemplate">
<ng-content select="abp-page-toolbar-container"></ng-content>
</ng-container>
</div>

<ng-content></ng-content>

<ng-template #defaultTitleTemplate>
<div class="col-auto" *abpPagePart="pageParts.title">
<h1 class="content-header-title">
{{ title }}
</h1>
</div>
<ng-container *ngIf="title">
<div class="col-auto" *abpPagePart="pageParts.title">
<h1 class="content-header-title">
{{ title }}
</h1>
</div>
</ng-container>
</ng-template>

<ng-template #defaultBreadcrumbTemplate>
<div class="col-lg-auto pl-lg-0" *abpPagePart="pageParts.breadcrumb">
<abp-breadcrumb></abp-breadcrumb>
</div>
<ng-container *ngIf="breadcrumbVisible">
<div class="col-lg-auto pl-lg-0" *abpPagePart="pageParts.breadcrumb">
<abp-breadcrumb></abp-breadcrumb>
</div>
</ng-container>
</ng-template>

<ng-template #defaultPageToolbarTemplate>
<div class="col" *abpPagePart="pageParts.toolbar; context: record">
<abp-page-toolbar [record]="record"></abp-page-toolbar>
</div>
<ng-container *ngIf="toolbarVisible">
<div class="col" *abpPagePart="pageParts.toolbar; context: toolbarData">
<abp-page-toolbar [record]="toolbarData"></abp-page-toolbar>
</div>
</ng-container>
</ng-template>
16 changes: 12 additions & 4 deletions npm/ng-packs/packages/components/page/src/page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ import {
})
export class PageComponent {
@Input() title: string;
@Input() record: any;

@Input() titleVisible = true;
@Input() breadcrumbVisible = true;
@Input() toolbarVisible = true;
toolbarVisible = false;
_toolbarData: any;
@Input('toolbar') set toolbarData(val: any) {
this._toolbarData = val;
this.toolbarVisible = true;
}

get toolbarData() {
return this._toolbarData;
}

@Input('breadcrumb') breadcrumbVisible = true;

pageParts = {
title: PageParts.title,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<abp-page [title]="'AbpSettingManagement::Settings' | abpLocalization" [toolbarVisible]="false">
<abp-page [title]="'AbpSettingManagement::Settings' | abpLocalization">
<div id="SettingManagementWrapper">
<div class="card">
<div class="card-body">
Expand Down

0 comments on commit 3f584e0

Please sign in to comment.