Skip to content

Commit

Permalink
feat: support set item line height
Browse files Browse the repository at this point in the history
  • Loading branch information
walkerkay authored and HandsomeButterball committed Jun 11, 2020
1 parent 8dcf412 commit 571d7df
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion example/src/app/flat/flat.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<input type="checkbox" [(ngModel)]="options.draggable" />
</span>
</div>

<div class="header-section">
<span class="header-section-title">合并间隔天数:</span>
<span class="header-section-content">
Expand All @@ -31,6 +30,7 @@
[viewType]="options.viewType"
[draggable]="options.draggable"
[mergeIntervalDays]="options.mergeIntervalDays"
[styles]="options.styles"
>
<ng-template #group let-group="group">
{{ group.title }}
Expand Down
5 changes: 4 additions & 1 deletion example/src/app/flat/flat.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export class AppFlatExampleComponent implements OnInit {
options = {
viewType: GanttViewType.month,
draggable: true,
mergeIntervalDays: 3
mergeIntervalDays: 3,
styles: {
lineHeight: 50
}
};

@HostBinding('class.gantt-demo') class = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<ng-template #ganttItems let-items="items">
<ng-container *ngFor="let item of items; trackBy: trackBy">
<div class="gantt-item">
<div class="gantt-item" [style.height.px]="ganttRef.styles.lineHeight">
<gantt-bar [item]="item" [template]="barTemplate" (barClick)="barClick.emit($event)"></gantt-bar>
</div>
<ng-container *ngFor="let item of item.children; trackBy: trackBy">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<ng-template #ganttItems let-items="items">
<ng-container *ngFor="let item of items">
<div class="gantt-table-item gantt-table-row">
<div class="gantt-table-item gantt-table-row" [style.height.px]="ganttRef.styles.lineHeight" [style.lineHeight.px]="ganttRef.styles.lineHeight">
<div class="item-column gantt-table-column" *ngFor="let column of columnList" [style.width.px]="column.width">
<ng-template
[ngTemplateOutlet]="column.templateRef"
Expand Down
10 changes: 5 additions & 5 deletions packages/gantt/src/components/table/gantt-table.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

.gantt-table-row {
display: flex;
box-sizing: border-box;
border-bottom: 1px solid $gantt-border-color;

.gantt-table-column {
height: $gantt-item-height;
line-height: $gantt-item-height;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
border-bottom: 1px solid $gantt-border-color;
border-right: 1px solid $gantt-border-color;
box-sizing: border-box;

&:last-child {
border-right: none;
Expand All @@ -27,6 +25,8 @@
top: 0;
background: #fff;
z-index: 1;
height: $gantt-header-height;
line-height: $gantt-header-height;

.header-column {
font-weight: 400;
Expand All @@ -36,7 +36,7 @@
.gantt-table-body {
.gantt-table-group {
display: flex;
height: $gantt-item-height;
height: $gantt-group-height;
background: $gantt-group-background-color;
padding: 0 10px;
align-items: center;
Expand Down
2 changes: 1 addition & 1 deletion packages/gantt/src/flat/gantt-flat.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<ng-container *ngFor="let group of groups; trackBy: trackBy">
<div class="gantt-flat-group">
<ng-container *ngFor="let items of group.mergedItems">
<div class="gantt-flat-items">
<div class="gantt-flat-items" [style.height.px]="styles.lineHeight">
<ng-container *ngFor="let item of items; trackBy: trackBy">
<gantt-bar [item]="item" [template]="barTemplate" (barClick)="barClick.emit($event)"></gantt-bar>
</ng-container>
Expand Down
1 change: 0 additions & 1 deletion packages/gantt/src/flat/gantt-flat.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@

.gantt-flat-items {
position: relative;
height: $gantt-item-height;
}
}
1 change: 0 additions & 1 deletion packages/gantt/src/gantt.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
}

.gantt-item {
height: $gantt-item-height;
border-bottom: 1px solid $gantt-border-color;
box-sizing: border-box;
position: relative;
Expand Down
4 changes: 2 additions & 2 deletions packages/gantt/src/gantt.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ export const defaultStyles = {
barHeight: 22
};

export type GanttStyles = typeof defaultStyles;

export const headerHeight = 44;

export type GanttStyles = typeof defaultStyles;

export const sideWidth = 400;

export const sideMiddleWidth = 500;
Expand Down

0 comments on commit 571d7df

Please sign in to comment.