Skip to content

Commit 0d6a078

Browse files
committed
docs(api): document API
1 parent 16eb1ee commit 0d6a078

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
- [Download the module](#download-the-module)
1515
- [Apply the directive](#apply-the-directive)
1616
- [React on changes](#react-on-changes)
17+
- [API](#api)
18+
- [Inputs](#inputs)
19+
- [Outputs](#outputs)
1720

1821
# Getting started
1922
## Download the module
@@ -98,3 +101,20 @@ at the top of your page. In this case you need to scroll once you drag an elemen
98101
The *scrollSpeed* property accepts a number and allows you to specify the scrolling speed.
99102

100103
[Check out the scroll demo](https://kreuzerk.github.io/ng-sortgrid/scrolling)
104+
105+
# API
106+
107+
## Inputs
108+
| Value | Description | Default|
109+
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------|--------|
110+
| ngSortGridGroup: string | Groups a grid - avoids that items from one grid can be dragged to another grid |undefined|
111+
| ngSortGridItems: any[] | Sort grid items. Pass down a list of all your items. This list is needed to enable the sorting feature.|undefined|
112+
| autoScroll: boolean | Flag to enable autoscrolling|false|
113+
| scrollPointTop: number | Custom top scrollpoint in pixels|if autoscroll is applied we start scrolling if we pass the top border|
114+
| scrollPointBottom: number | Custom bottom scrollpoint in pixels|if autoscroll is applied we start scrolling if we pass the bottom border|
115+
| scrollSpeed: number | Scrollspeed, the higher the value, the higher we scroll.|50 - only applies if autoscrolling is on|
116+
117+
## Outputs
118+
| Value | Description | Default|
119+
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------|--------|
120+
| sorted: EventEmitter<NgsgOrderChange<T> | Emits an event after we sorted the items, each event is of type NgsgOrderChange. The NgsgOrderChange contains the previousOrder and the currentOrder |undefined|

projects/ng-sortgrid/src/lib/ngsg-item.directive.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ const selector = '[ngSortgridItem]';
2828
@Directive({selector})
2929
export class NgsgItemDirective implements OnInit, OnChanges, AfterViewInit, OnDestroy {
3030
@Input() ngSortGridGroup = 'defaultGroup';
31-
@Input() ngSortGridItems;
32-
@Input() scrollPointTop;
33-
@Input() scrollPointBottom;
34-
@Input() scrollSpeed;
31+
@Input() ngSortGridItems: any[];
32+
@Input() scrollPointTop: number;
33+
@Input() scrollPointBottom: number;
34+
@Input() scrollSpeed: number;
3535
@Input() autoScroll = false;
3636

3737
@Output() sorted = new EventEmitter<NgsgOrderChange<any>>();

0 commit comments

Comments
 (0)