forked from katoid/angular-grid-layout
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added support for rowHeight = 'fit', also added Input() height
- Loading branch information
1 parent
033bcac
commit 48458fe
Showing
13 changed files
with
268 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
projects/demo-app/src/app/row-height-fit/row-height-fit.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<div class="grid-container" #gridContainer> | ||
<ktd-grid [cols]="cols" | ||
[height]="gridHeight" | ||
[rowHeight]="'fit'" | ||
[layout]="layout" | ||
[compactType]="compactType" | ||
[preventCollision]="preventCollision" | ||
[gap]="gap"> | ||
<ktd-grid-item *ngFor="let item of layout; trackBy:trackById" | ||
[id]="item.id" | ||
[draggable]="!disableDrag" | ||
[resizable]="!disableResize"> | ||
<div class="grid-item-content">{{item.id}}</div> | ||
<div class="grid-item-remove-handle" | ||
*ngIf="!disableRemove" | ||
(mousedown)="stopEventPropagation($event)" | ||
(click)="removeItem(item.id)"> | ||
</div> | ||
</ktd-grid-item> | ||
</ktd-grid> | ||
</div> | ||
|
||
<div class="footer-container"> | ||
<h2 style="margin-top: 16px">Other examples: </h2> | ||
<div style="display: flex; flex-direction: column"> | ||
<a [routerLink]="['/playground']">Playground</a> | ||
<a [routerLink]="['/custom-handles']">Custom handles</a> | ||
<a [routerLink]="['/real-life-example']">Real life example</a> | ||
<a [routerLink]="['/scroll-test']">Scroll test</a> | ||
</div> | ||
</div> |
67 changes: 67 additions & 0 deletions
67
projects/demo-app/src/app/row-height-fit/row-height-fit.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
:host { | ||
width: 100%; | ||
height: calc(100% - 65px); | ||
padding: 12px 12px; | ||
box-sizing: border-box; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
|
||
|
||
.grid-container { | ||
flex: 1; | ||
min-height: 0; // Let it shrink | ||
box-sizing: border-box; | ||
border: 1px solid var(--ktd-border-color); | ||
background-color: var(--ktd-background-color); | ||
border-radius: 2px; | ||
} | ||
|
||
ktd-grid-item { | ||
color: #121212; | ||
} | ||
|
||
ktd-grid { | ||
transition: height 500ms ease; | ||
} | ||
|
||
.grid-item-content { | ||
box-sizing: border-box; | ||
background: #ccc; | ||
border: 1px solid; | ||
width: 100%; | ||
height: 100%; | ||
user-select: none; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.grid-item-remove-handle { | ||
position: absolute; | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: center; | ||
width: 20px; | ||
height: 20px; | ||
top: 0; | ||
right: 0; | ||
|
||
&::after { | ||
content: 'x'; | ||
color: #121212; | ||
font-size: 16px; | ||
font-weight: 300; | ||
font-family: Arial, sans-serif; | ||
} | ||
} | ||
|
||
// Add custom drag mouse styles | ||
ktd-grid-item { | ||
cursor: grab; | ||
|
||
&.ktd-grid-item-dragging { | ||
cursor: grabbing; | ||
} | ||
} | ||
} |
Oops, something went wrong.