Skip to content

Commit ab0c4a2

Browse files
authored
Merge pull request #2329 from adumesny/master
angular wrapper - part 2
2 parents 3d7b44e + 4b1cd52 commit ab0c4a2

40 files changed

+342
-7530
lines changed

Gruntfile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ module.exports = function(grunt) {
4343
'dist/es5/gridstack-poly.js': ['src/gridstack-poly.js'],
4444
'dist/src/gridstack.scss': ['src/gridstack.scss'],
4545
'dist/src/gridstack-extra.scss': ['src/gridstack-extra.scss'],
46-
'dist/ng/README.md': ['demo/angular/README.md'],
47-
'dist/ng/src/gridstack.component.ts': ['demo/angular/src/gridstack.component.ts'],
48-
'dist/ng/src/gridstack-item.component.ts': ['demo/angular/src/gridstack-item.component.ts'],
49-
'dist/ng/src/gridstack.module.ts': ['demo/angular/src/gridstack.module.ts'],
46+
'dist/angular/README.md': ['angular/README.md'],
47+
'dist/angular/src/gridstack.component.ts': ['angular/projects/lib/src/lib/gridstack.component.ts'],
48+
'dist/angular/src/gridstack-item.component.ts': ['angular/projects/lib/src/lib/gridstack-item.component.ts'],
49+
'dist/angular/src/gridstack.module.ts': ['angular/projects/lib/src/lib/gridstack.module.ts'],
5050
}
5151
}
5252
},

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ GridStack no longer requires external dependencies as of v1.0.0 (lodash was remo
147147

148148
search for ['gridstack' under NPM](https://www.npmjs.com/search?q=gridstack&ranking=popularity) for latest, more to come...
149149

150-
- **Angular**: we now ship out of the box with Angular wrapper components - see <a href="https://github.com/gridstack/gridstack.js/tree/master/demo/angular" target="_blank">Angular Demo</a>.
150+
- **Angular**: we now ship out of the box with Angular wrapper components - see <a href="https://github.com/gridstack/gridstack.js/tree/master/angular" target="_blank">Angular Component</a>.
151151
- **Angular9**: [lb-gridstack](https://github.com/pfms84/lb-gridstack) Note: very old v0.3 gridstack instance so recommend for **concept ONLY if you wish to use directive instead**. teh code has been vented as I use components.
152152
- **AngularJS**: [gridstack-angular](https://github.com/kdietrich/gridstack-angular)
153153
- **Ember**: [ember-gridstack](https://github.com/yahoo/ember-gridstack)

angular/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Angular wrapper
22

3-
The Angular [wrapper component](src/gridstack.component.ts) <gridstack> is a better way to use Gridstack, but alternative raw [ngFor](src/app/ngFor.ts) or [simple](src/app/simple.ts) demos are also given.
4-
5-
**NOTE:** still having [issue](https://github.com/gridstack/gridstack.js/issues/2310) exporting the files to be included by Angular projects, so for now copy gridstack/dist/ng/src/* to your project and adjust the paths below.
3+
The Angular [wrapper component](projects/lib/src/lib/gridstack.component.ts) <gridstack> is a better way to use Gridstack, but alternative raw [ngFor](projects/demo/src/app/ngFor.ts) or [simple](projects/demo/src/app/simple.ts) demos are also given.
64

75
# Dynamic grid items
86
this is the recommended way if you are going to have multiple grids (alow drag&drop between) or drag from toolbar to create items, or drag to remove items, etc...
@@ -30,7 +28,7 @@ CSS
3028

3129
in your module Code
3230
```ts
33-
import { GridstackModule } from 'gridstack/dist/ng/src/gridstack.module';
31+
import { GridstackModule } from 'gridstack/dist/angular';
3432

3533
@NgModule({
3634
imports: [GridstackModule, ...]
@@ -70,7 +68,7 @@ Code
7068
```ts
7169
import { Component } from '@angular/core';
7270
import { GridStack, GridStackOptions } from 'gridstack';
73-
import { GridstackComponent, gsCreateNgComponents, NgGridStackWidget, nodesCB } from 'gridstack/dist/ng/gridstack.component';
71+
import { GridstackComponent, gsCreateNgComponents, NgGridStackWidget, nodesCB } from 'gridstack/dist/angular';
7472

7573
// some custom components
7674
@Component({
@@ -126,7 +124,7 @@ HTML
126124
Code
127125
```javascript
128126
import { GridStackOptions, GridStackWidget } from 'gridstack';
129-
import { nodesCB } from 'gridstack/dist/ng/gridstack.component';
127+
import { nodesCB } from 'gridstack/dist/angular';
130128

131129
/** sample grid options and items to load... */
132130
public gridOptions: GridStackOptions = {
@@ -153,9 +151,9 @@ public identify(index: number, w: GridStackWidget) {
153151
## Demo
154152
You can see a fuller example at [app.component.ts](src/app/app.component.ts)
155153

156-
to build the demo, go to demo/angular and run `yarn` + `yarn start` and navigate to `http://localhost:4200/`
154+
to build the demo, go to angular/projects/demo and run `yarn` + `yarn start` and navigate to `http://localhost:4200/`
157155

158-
Code now shipped starting with v8.0+ in dist/ng for people to use directly!
156+
Code now shipped starting with v8.1.2+ in `dist/angular` for people to use directly! (source code under `dist/angular/src`)
159157
## Caveats
160158

161159
- This wrapper needs:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.test-container {
2+
margin-top: 30px;
3+
}
4+
button.active {
5+
color: #fff;
6+
background-color: #007bff;
7+
}
8+
9+
.text-container {
10+
display: flex;
11+
}

0 commit comments

Comments
 (0)