Skip to content

Commit 3be9f50

Browse files
authored
Merge pull request #17 from kreuzerk/feature/customScrollPoints
Feature/custom scroll points
2 parents 026e75a + 1a007db commit 3be9f50

File tree

61 files changed

+459
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+459
-225
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
![Grid demo](https://raw.githubusercontent.com/kreuzerk/ng-sortgrid/master/projects/ng-sortgrid-demo/src/assets/grid-demo.gif)
1010

11-
Read the README or just simply check out our demo at: https://kreuzerk.github.io/ng-sortgrid/
11+
[Demo](https://kreuzerk.github.io/ng-sortgrid/)
1212

1313
- [Getting started](#getting-started)
1414
- [Download the module](#download-the-module)
@@ -80,3 +80,21 @@ Alternative you can provide custom styles for the different classes listed bello
8080
| ng-sg-placeholder | This class is added to the placeholder item which previews where the item is inserted |
8181
| ng-sg-dropped | This class is added as soon after you drop an item. The class will be on the item for 500 milliseconds before it gets removed |
8282
| ng-sg-selected | This class is added when you press the CMD or the Ctrl Key and Click on an item. It indicates which items are selected for the multi drag&drop |
83+
84+
# Scrolling
85+
The ng-sortgrid has a *autoScroll* flag which you can use to enable autoScroll. If you enable autoScroll the screen will start to scroll
86+
in the following scenario.
87+
88+
![Grid demo](https://raw.githubusercontent.com/kreuzerk/ng-sortgrid/master/projects/ng-sortgrid-demo/src/assets/scrolling.png)
89+
90+
- If you drag an element in the top 50px of the screen
91+
- If you drag an element in the bottom 50px of the screen
92+
93+
## Custom scroll points
94+
Sometimes its not enough to onyl scroll once you drag over the top view port border. Imagine that you have a fixed navbar
95+
at the top of your page. In this case you need to scroll once you drag an element over the navbar.
96+
97+
## Scroll speed (*default 50*)
98+
The *scrollSpeed* property accepts a number and allows you to specify the scrolling speed.
99+
100+
[Check out the scroll demo](https://kreuzerk.github.io/ng-sortgrid/scrolling)

projects/ng-sortgrid-demo/src/app/app.component.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,28 @@
1111
color: #333; /* old IE */
1212
background-color: #333; /* Modern Browsers */
1313
}
14+
15+
/*
16+
Custom styles
17+
*/
18+
.container-fluid {
19+
padding: 20px;
20+
}
21+
22+
.example-list {
23+
list-style-type: none;
24+
padding: 0;
25+
}
26+
27+
.example-list li {
28+
display: table-cell;
29+
padding: 4px;
30+
}
31+
32+
.example-container {
33+
display: flex;
34+
flex-wrap: wrap;
35+
width: 100%;
36+
justify-content: center;
37+
}
38+

projects/ng-sortgrid-demo/src/app/app.component.html

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,4 @@
1-
<ngsg-demo-nav></ngsg-demo-nav>
2-
<ngsg-demo-header></ngsg-demo-header>
3-
4-
<div class="container">
5-
<h1>1. Getting started</h1>
6-
<ngsg-demo-step title="Loop over your elements with *ngFor. 🛎️ the items needs to be an array. Alternate you can also use the async pipe - see below" image="gs1.png"></ngsg-demo-step>
7-
<ngsg-demo-step title="Apply the ngSortgridItem directive" image="gs2.png"></ngsg-demo-step>
8-
<ngsg-demo-memory></ngsg-demo-memory>
9-
10-
<hr class="chaptor-separator"/>
11-
12-
<h1>2. React on changes</h1>
13-
<p>In most cases you are interested in the new sort order. Often you want to store them in local storage or even send them
14-
to the backend. To do so the following two steps are needed in addition to the "Getting started" step.</p>
15-
<ngsg-demo-step title="Pass your items to the directive via the ngSortGridItems input." image="gs3.png"></ngsg-demo-step>
16-
<ngsg-demo-step title="React on the 'sorted' output events" image="gs4.png"></ngsg-demo-step>
17-
<ngsg-demo-react-on-changes-memory></ngsg-demo-react-on-changes-memory>
18-
19-
<hr class="chaptor-separator"/>
20-
<h1>3. Group sortgrids</h1>
21-
<p>In case you have more than one sortgriditem on the page you need to group the sortgriditems to avoid dropping drags from
22-
one group in another group.</p>
23-
<ngsg-demo-step title="Pass in a unique name to the ngSortGridGroup input" image="gs5.png"></ngsg-demo-step>
24-
<ngsg-demo-groups-memory></ngsg-demo-groups-memory>
25-
26-
<hr class="chaptor-separator"/>
27-
<h1>4. Use the async pipe</h1>
28-
<ngsg-demo-step title="Use the async pipe to loop over the items and to pass in the ngSortGridItems" image="gs6.png"></ngsg-demo-step>
29-
<ngsg-demo-async></ngsg-demo-async>
30-
</div>
31-
1+
<router-outlet></router-outlet>
322
<footer class="py-5 bg-dark">
333
<div class="container">
344
<p class="m-0 text-center text-white">Made with ♥️ by <a href="https://twitter.com/KevinKreuzer90" target="_blank">Kevin Kreuzer</a></p>

projects/ng-sortgrid-demo/src/app/app.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Component } from '@angular/core';
1+
import {Component, ViewEncapsulation} from '@angular/core';
22

33
@Component({
44
selector: 'app-root',
55
templateUrl: './app.component.html',
6-
styleUrls: ['./app.component.css']
6+
styleUrls: ['./app.component.css'],
7+
encapsulation: ViewEncapsulation.None
78
})
89
export class AppComponent {
910
public items = [1, 2, 3, 4, 5, 6, 7, 8, 9];

projects/ng-sortgrid-demo/src/app/app.module.ts

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,11 @@ import {BrowserModule} from '@angular/platform-browser';
22
import {NgModule} from '@angular/core';
33

44
import {AppComponent} from './app.component';
5-
import {NgsgModule} from '../../../ng-sortgrid/src/lib/ngsg.module';
6-
import {NavComponent} from './nav/nav.component';
7-
import {HeaderComponent} from './header/header.component';
8-
import {GettingStartedMemoryComponent} from './examples/getting-started/getting-started-memory.component';
9-
import {StepComponent} from './examples/step/step.component';
10-
import {ReactOnChangesMemoryComponent} from './examples/react-on-changes/react-on-changes-memory.component';
11-
import {GroupsMemoryComponent} from './examples/groups/groups-memory.component';
12-
import {CardComponent} from './examples/card/card.component';
13-
import {AsyncPipeMemoryComponent} from './examples/async-pipe/async-pipe-memory.component';
5+
import {AppRoutingModule} from './app.routing.module';
146

157
@NgModule({
16-
declarations: [
17-
AppComponent,
18-
NavComponent,
19-
HeaderComponent,
20-
GettingStartedMemoryComponent,
21-
StepComponent,
22-
ReactOnChangesMemoryComponent,
23-
GroupsMemoryComponent,
24-
CardComponent,
25-
AsyncPipeMemoryComponent
26-
],
27-
imports: [BrowserModule, NgsgModule],
28-
providers: [],
8+
declarations: [AppComponent],
9+
imports: [BrowserModule, AppRoutingModule],
2910
bootstrap: [AppComponent]
3011
})
3112
export class AppModule {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {NgModule} from '@angular/core';
2+
import {RouterModule} from '@angular/router';
3+
4+
5+
@NgModule({
6+
imports: [RouterModule.forRoot([
7+
{path: '', loadChildren: './introduction/introduction.module#IntroductionModule'},
8+
{path: 'scrolling', loadChildren: './scrolling/scrolling.module#ScrollingModule'}
9+
])],
10+
exports: [RouterModule]
11+
})
12+
export class AppRoutingModule {
13+
}

projects/ng-sortgrid-demo/src/app/examples/memory-demo.css

Lines changed: 0 additions & 20 deletions
This file was deleted.

projects/ng-sortgrid-demo/src/app/examples/step/step.component.html

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)