Skip to content

Commit 0cd1399

Browse files
committed
chore: added multi item drag and resize info in the README.md
Also renamed path 'multi-item-handler' for 'multi-item-drag-and-resize'
1 parent 7d847d3 commit 0cd1399

File tree

8 files changed

+32
-19
lines changed

8 files changed

+32
-19
lines changed

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ Both cover the same necessities.
1616
- Draggable items
1717
- Resizable items
1818
- REDUX friendly (akita, ngrx, ngxs...)
19-
- Customizable Drag & Resize handles.
19+
- Customizable Drag & Resize handles. [Custom Handles Example](https://katoid.github.io/angular-grid-layout/custom-handles)
2020
- 3 modes of grid compaction: vertical, horizontal and free (exact same algorithm as [React-Grid-Layout](https://github.com/STRML/react-grid-layout))
2121
- Add/Remove items
2222
- High performance
2323
- Supports touch devices
24-
- Auto-scrolling while dragging
24+
- Auto-scrolling while dragging. [Scroll Example](https://katoid.github.io/angular-grid-layout/scroll-test)
25+
- Multi Item mode, drag and resize more than 1 item at a time. [Multi Item Drag & Resize Example](https://katoid.github.io/angular-grid-layout/multi-item-drag-and-resize)
2526

2627
## Compatibility
2728
| Version | Compatibility |
@@ -34,9 +35,15 @@ Both cover the same necessities.
3435
## Demos
3536
[Playground](https://katoid.github.io/angular-grid-layout/playground) - [Stackblitz](https://stackblitz.com/edit/angular-grid-layout-playground?file=src%2Fapp%2Fplayground%2Fplayground.component.ts)
3637

37-
[Custom handles](https://katoid.github.io/angular-grid-layout/custom-handles)
38+
[Custom Handles](https://katoid.github.io/angular-grid-layout/custom-handles)
3839

39-
[Real life example](https://katoid.github.io/angular-grid-layout/real-life-example)
40+
[Real Life Example](https://katoid.github.io/angular-grid-layout/real-life-example)
41+
42+
[Scroll Test](https://katoid.github.io/angular-grid-layout/scroll-test)
43+
44+
[Row Height Fit](https://katoid.github.io/angular-grid-layout/row-height-fit)
45+
46+
[Multi Item Drag & Resize](https://katoid.github.io/angular-grid-layout/multi-item-drag-and-resize)
4047

4148
## Installation
4249

@@ -121,6 +128,13 @@ Here is listed the basic API of both KtdGridComponent and KtdGridItemComponent.
121128
* */
122129
@Input() height: number | null = null;
123130

131+
/**
132+
* Multiple items drag/resize
133+
* A list of selected items to move (drag or resize) together as a group.
134+
* The multi-selection of items is managed externally. By default, the library manages a single item, but if a set of item IDs is provided, the specified group will be handled as a unit."
135+
*/
136+
@Input()
137+
selectedItemsIds(): string[] | null;
124138

125139
/**
126140
* Parent element that contains the scroll. If an string is provided it would search that element by id on the dom.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/angular-grid-layout/src/lib/grid.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ export class KtdGridComponent implements OnChanges, AfterContentInit, AfterConte
496496
this.setGridBackgroundVisible(this._backgroundConfig?.show === 'whenDragging' || this._backgroundConfig?.show === 'always');
497497
// Perform drag sequence
498498
let gridItemsSelected: KtdGridItemComponent[] = [gridItem];
499-
if(multipleSelection && multipleSelection.some((currItem)=>currItem.id===gridItem.id)) {
499+
if (multipleSelection && multipleSelection.some((currItem) => currItem.id === gridItem.id)) {
500500
gridItemsSelected = multipleSelection
501501
}
502502
return this.performDragSequence$(gridItemsSelected, event, type).pipe(
@@ -533,9 +533,9 @@ export class KtdGridComponent implements OnChanges, AfterContentInit, AfterConte
533533
// Retrieve grid (parent) client rect.
534534
const gridElemClientRect: KtdClientRect = getMutableClientRect(this.elementRef.nativeElement as HTMLElement);
535535

536-
const dragElemClientRect: KtdDictionary<KtdClientRect>={};
537-
const newGridItemRenderData: KtdDictionary<KtdGridItemRenderData<number>>={};
538-
let draggedItemsPos: KtdDictionary<KtdGridItemRect>={};
536+
const dragElemClientRect: KtdDictionary<KtdClientRect> = {};
537+
const newGridItemRenderData: KtdDictionary<KtdGridItemRenderData<number>> = {};
538+
let draggedItemsPos: KtdDictionary<KtdGridItemRect> = {};
539539

540540
gridItems.forEach((gridItem)=>{
541541
// Retrieve gridItem (draggedElem) client rect.

projects/demo-app/src/app/app-routing.routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const APP_ROUTES: Routes = [
2828
data: {title: 'Angular Grid Layout - Row Height Fit'}
2929
},
3030
{
31-
path: 'multi-item-handler',
31+
path: 'multi-item-drag-and-resize',
3232
loadComponent: () => import('./multi-item-handler/multi-item-handler.component').then(m => m.KtdMultiItemHandlerComponent),
3333
data: {title: 'Angular Grid Layout - Multi-Item Drag & Resize'}
3434
},

projects/demo-app/src/app/components/footer/footer.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ <h2 style="margin-top: 16px">Other examples: </h2>
55
<a [routerLink]="['/real-life-example']">Real life example</a>
66
<a [routerLink]="['/scroll-test']">Scroll test</a>
77
<a [routerLink]="['/row-height-fit']">Row Height Fit</a>
8-
<a [routerLink]="['/multi-item-handler']">Multi Item Handler</a>
8+
<a [routerLink]="['/multi-item-drag-and-resize']">Multi Item Drag & Resize</a>
99
</div>

projects/demo-app/src/app/multi-item-handler/multi-item-handler.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
(selectionChange)="onCompactTypeChange($event)">
2828
<mat-option [value]="'vertical'">vertical</mat-option>
2929
<mat-option [value]="'horizontal'">horizontal</mat-option>
30-
<mat-option [value]="'none'">-</mat-option>
30+
<mat-option [value]="null">-</mat-option>
3131
</mat-select>
3232
</mat-form-field>
3333
<mat-checkbox

projects/demo-app/src/app/multi-item-handler/multi-item-handler.component.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ import { ktdArrayRemoveItem } from '../utils';
88
import { DOCUMENT, NgClass, NgFor } from '@angular/common';
99
import { MatCheckboxModule } from '@angular/material/checkbox';
1010
import { KtdFooterComponent } from '../components/footer/footer.component';
11-
import { ColorPickerModule } from 'ngx-color-picker';
12-
import { MatChipsModule } from '@angular/material/chips';
1311
import { MatInputModule } from '@angular/material/input';
1412
import { MatOptionModule } from '@angular/material/core';
1513
import { MatFormFieldModule } from '@angular/material/form-field';
1614
import { MatButtonModule } from '@angular/material/button';
1715
import { ktdGetOS } from './multi-item-handler.utils';
1816
import { fromEvent, merge, Subscription } from 'rxjs';
1917
import { debounceTime, filter } from 'rxjs/operators';
18+
import { ReactiveFormsModule } from '@angular/forms';
2019

2120
const realLifeLayout: KtdGridLayout = [
2221
{id: '0', x: 0, y: 0, w: 62, h: 3},
@@ -313,23 +312,21 @@ const multiItemSeparatedDragBug = [
313312

314313
@Component({
315314
standalone: true,
316-
selector: 'ktd-playground',
315+
selector: 'ktd-multi-item-handler',
317316
templateUrl: './multi-item-handler.component.html',
318317
styleUrls: ['./multi-item-handler.component.scss'],
319318
imports: [
320319
MatButtonModule,
321320
MatFormFieldModule,
321+
ReactiveFormsModule,
322322
MatSelectModule,
323323
MatOptionModule,
324324
MatInputModule,
325325
MatCheckboxModule,
326326
NgFor,
327327
NgClass,
328-
MatChipsModule,
329-
ColorPickerModule,
330328
KtdGridComponent,
331329
KtdGridItemComponent,
332-
KtdGridItemPlaceholder,
333330
KtdFooterComponent
334331
]
335332
})

projects/demo-app/src/app/playground/playground.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,12 @@ export class KtdPlaygroundComponent implements OnInit, OnDestroy {
122122
}
123123

124124
onDragEnded(event: KtdDragEnd) {
125+
console.log('dragEnded', event);
125126
this.isDragging = false;
126127
}
127128

128129
onResizeEnded(event: KtdResizeEnd) {
130+
console.log('resizeEnded', event);
129131
this.isResizing = false;
130132
}
131133

0 commit comments

Comments
 (0)