Skip to content

Commit 850f5df

Browse files
committed
feat(demo-app): added a drag handle in the real-life-example table
1 parent 7f6426e commit 850f5df

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

projects/demo-app/src/app/real-life-example/real-life-example.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
</div>
113113
</ktd-grid-item>
114114
<ktd-grid-item class="ktd-grid-item-table" id="4">
115+
<div ktdGridDragHandle class="table-drag-handle">Drag here</div>
115116
<ktd-table-sorting></ktd-table-sorting>
116117
<ng-template ktdGridItemPlaceholder>
117118
<div class="custom-placeholder-container ktd-grid-item-table">

projects/demo-app/src/app/real-life-example/real-life-example.component.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,29 @@
3636
}
3737
}
3838

39+
ktd-grid-item {
40+
.table-drag-handle {
41+
position: absolute;
42+
padding: 2px;
43+
top: 0;
44+
left: 16px;
45+
right: 16px;
46+
border: 1px solid #484747;
47+
border-radius: 2px;
48+
color: #eaeaea;
49+
background-color: #888888;
50+
cursor: grab;
51+
}
52+
53+
&.ktd-grid-item-dragging {
54+
.table-drag-handle {
55+
cursor: grabbing;
56+
}
57+
}
58+
}
59+
60+
61+
3962
.ktd-grid-img-container {
4063
width: 100%;
4164
height: 100%;

projects/demo-app/src/app/real-life-example/real-life-example.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { ChangeDetectorRef, Component, Inject, OnDestroy, OnInit, ViewChild } from '@angular/core';
2-
import { KtdGridComponent, KtdGridItemResizeEvent, KtdGridLayout, ktdTrackById, KtdGridItemComponent, KtdGridItemPlaceholder } from '@katoid/angular-grid-layout';
2+
import {
3+
KtdGridComponent, KtdGridItemResizeEvent, KtdGridLayout, ktdTrackById, KtdGridItemComponent, KtdGridItemPlaceholder, KtdGridDragHandle
4+
} from '@katoid/angular-grid-layout';
35
import { fromEvent, merge, Subscription } from 'rxjs';
46
import { debounceTime } from 'rxjs/operators';
57
import { countriesPopulation, countriesPopulationByYear } from './data/countries-population.data';
@@ -13,7 +15,7 @@ import { KtdTableSortingComponent } from './table-sorting/table-sorting.componen
1315
selector: 'ktd-real-life-example',
1416
templateUrl: './real-life-example.component.html',
1517
styleUrls: ['./real-life-example.component.scss'],
16-
imports: [KtdGridComponent, KtdGridItemComponent, BarChartModule, KtdGridItemPlaceholder, TreeMapModule, KtdTableSortingComponent, PieChartModule, KtdFooterComponent]
18+
imports: [KtdGridComponent, KtdGridItemComponent, BarChartModule, KtdGridItemPlaceholder, KtdGridDragHandle, TreeMapModule, KtdTableSortingComponent, PieChartModule, KtdFooterComponent]
1719
})
1820
export class KtdRealLifeExampleComponent implements OnInit, OnDestroy {
1921
@ViewChild(KtdGridComponent, {static: true}) grid: KtdGridComponent;

projects/demo-app/src/app/real-life-example/table-sorting/table-sorting.component.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
width: 100%;
44
height: 100%;
55
overflow-y: auto;
6-
touch-action: none; // This is needed to make drag and drop on touch devices possible without interfering with the inner scroll.
76
}
87

98
table {

0 commit comments

Comments
 (0)