17.0.0 • Published 5 months ago

angular-gridster2 v17.0.0

Weekly downloads
42,698
License
MIT
Repository
github
Last release
5 months ago

angular-gridster2

npm version Node CI downloads Donate

Angular implementation of angular-gridster Demo

Requires Angular 17.x

For other Angular versions check the other branches.

Browser support

What Angular supports here

Install

npm install angular-gridster2 --save

How to use

import {NgForOf} from '@angular/common';
import {Component} from '@angular/core';
import {GridsterComponent, GridsterItemComponent} from 'angular-gridster2';

@Component({
  standalone: true,
  imports: [NgForOf, GridsterComponent, GridsterItemComponent],
  ...
})
<gridster [options]="options">
  <gridster-item [item]="item" *ngFor="let item of dashboard">
    <!-- your content here -->
  </gridster-item>
</gridster>

Initialize a simple dashboard:

   import { GridsterConfig, GridsterItem }  from 'angular-gridster2';
   options: GridsterConfig;
   dashboard: Array<GridsterItem>;

   static itemChange(item, itemComponent) {
     console.info('itemChanged', item, itemComponent);
   }

   static itemResize(item, itemComponent) {
     console.info('itemResized', item, itemComponent);
   }

   ngOnInit() {
     this.options = {
       itemChangeCallback: AppComponent.itemChange,
       itemResizeCallback: AppComponent.itemResize,
     };

     this.dashboard = [
       {cols: 2, rows: 1, y: 0, x: 0},
       {cols: 2, rows: 2, y: 0, x: 2}
     ];
   }

   changedOptions() {
     this.options.api.optionsChanged();
   }

   removeItem(item) {
     this.dashboard.splice(this.dashboard.indexOf(item), 1);
   }

   addItem() {
     this.dashboard.push({});
   }
Note: The gridster will take all the available space from the parent. It will not size depending on content. The parent of the component needs to have a size.

Having iFrame in widgets content

iFrames can interfere with drag/resize of widgets. For a workaround please read this issue #233

Interact with content without dragging

Option 1 (without text selection):

<gridster-item>
  <div (mousedown)="$event.stopPropagation()" (touchstart)="$event.stopPropagation()">Some content to click without dragging the widget</div>
  <div class="item-buttons">
    <button md-icon-button md-raised-button class="drag-handler">
      <md-icon>open_with</md-icon>
    </button>
    <button md-icon-button md-raised-button class="remove-button" (click)="removeItem($event, item)" (touchstart)="removeItem($event, item)" mdTooltip="Remove">
      <md-icon>clear</md-icon>
    </button>
  </div>
</gridster-item>

Option 2 (with text selection):

<gridster-item>
  <div class="gridster-item-content">Some content to select and click without dragging the widget</div>
  <div class="item-buttons">
    <button md-icon-button md-raised-button class="drag-handler">
      <md-icon>open_with</md-icon>
    </button>
    <button md-icon-button md-raised-button class="remove-button" (click)="removeItem($event, item)" (touchstart)="removeItem($event, item)" mdTooltip="Remove">
      <md-icon>clear</md-icon>
    </button>
  </div>
</gridster-item>

Contributors here

Donate

License

The MIT License

Copyright (c) 2023 Tiberiu Zuld

@acorex/acorex-uisedapta-core-devbrael-solarenginesabp-zero-templates-gabp-zero-template-gmanualabp-zero-templat-gabp-zero-template-grelease-tracker-libecharts-dashboarddashboardingcointervu@everything-registry/sub-chunk-1133valmirizm-zzz@rublixht/hedge-charts-dashboarddtihystegy-sorobanelite3e8elite3e9elite3eelite3e1elite3e2elite3e3elite3e33elite3e4elite3e5elite3e6@serengeti/serengeti-dashboard@yuuvis/widget-gridabp-zero-manualabp-zero-template-cardsabp-zero-template-redabp-zero-template-redsabp-zero-templates-cards@anviltech/wuf-ang-gridstergame-chatabp-zero-carabp-zero-cardsabp-zero-laoxieabp-zero-templates-localabp-zero-templates-redabp-zero-templatexabp-zero-template-rr6abp-zero-template_bojunabp-zero-template_bojun_jabp-zero-templatejj1abp-zero-templatep-cardsadm-clientangular-hivedash-x-dashboardconintervulookecyinngrantsconnect-frontend@digitaldealers/communication-centremappls-insight-sdkmicrofrontendworkspace@biosoftcl/open-layers-moduledashx-testbehnam-test-component-with-dependencies@dotgov/interfacebuildersaukaccountancysaukaccountants@infinitebrahmanuniverse/nolb-angular-gnpo-platform-uiportal-frontendsprintteksprinttek-cardssprinttek-dev-templatessprinttek-dev-templates-cardssprinttek-dev-templates-redsprinttek-redsprinttek-templatessprinttek-templates-1sprinttek-templates-cadssprinttek-templates-cardingsprinttek-templates-cardssprinttek-templates-jursprinttek-templates-namsprinttek-templates-nambriasprinttek-templates-redsprinttek-templates-yowsprinttek-templates0cardssprinttek-templatesssprinttek-templatessxsprinttek-templatesx1sprinttektestsprinttektest1@kengic/fe-ng@kengic/ng-commontabidoo-libspeacock-cxssportoteka
17.0.0

5 months ago

16.0.0

12 months ago

14.1.5

1 year ago

15.0.4

1 year ago

13.3.1

1 year ago

13.3.2

1 year ago

14.1.4

1 year ago

15.0.3

1 year ago

14.1.3

1 year ago

15.0.2

1 year ago

15.0.1

1 year ago

14.1.0

2 years ago

14.1.1

2 years ago

14.1.2

2 years ago

15.0.0

1 year ago

13.3.0

2 years ago

13.2.0

2 years ago

14.0.0

2 years ago

13.2.1

2 years ago

14.0.1

2 years ago

13.1.1

2 years ago

13.1.0

2 years ago

11.2.1

2 years ago

13.0.0

2 years ago

12.1.1

3 years ago

12.1.0

3 years ago

12.0.1

3 years ago

12.0.0

3 years ago

11.2.0

3 years ago

11.1.5

3 years ago

11.1.4

3 years ago

11.1.3

3 years ago

11.1.2

3 years ago

11.1.1

3 years ago

11.1.0

3 years ago

11.0.1

3 years ago

8.4.2

3 years ago

11.0.0

3 years ago

9.3.4

4 years ago

10.1.7

4 years ago

10.1.6

4 years ago

10.1.5

4 years ago

10.1.4

4 years ago

10.1.3

4 years ago

10.1.1

4 years ago

10.1.2

4 years ago

8.4.1

4 years ago

9.3.3

4 years ago

10.1.0

4 years ago

10.0.2

4 years ago

10.0.0

4 years ago

10.0.1

4 years ago

9.3.2

4 years ago

9.3.1

4 years ago

9.3.0

4 years ago

8.4.0

4 years ago

9.2.0

4 years ago

9.1.0

4 years ago

9.0.2

4 years ago

9.0.1

4 years ago

9.0.0

4 years ago

8.3.0

4 years ago

8.2.0

5 years ago

8.1.0

5 years ago

8.0.0

5 years ago

7.2.0

5 years ago

7.1.0

5 years ago

7.0.1

5 years ago

7.0.0

6 years ago

6.0.10

6 years ago

6.0.9

6 years ago

6.0.8

6 years ago

6.0.7

6 years ago

5.3.5

6 years ago

5.3.4

6 years ago

6.0.6

6 years ago

6.0.5

6 years ago

6.0.4

6 years ago

6.0.3

6 years ago

6.0.2

6 years ago

6.0.1

6 years ago

6.0.0

6 years ago

5.3.3

6 years ago

5.3.2

6 years ago

5.3.1

6 years ago

5.3.0

6 years ago

5.2.1

6 years ago

5.2.0

6 years ago

5.1.0

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

4.7.2

6 years ago

4.7.1

6 years ago

4.7.0

6 years ago

4.6.3

6 years ago

4.6.2

6 years ago

3.19.0

6 years ago

4.6.1

6 years ago

4.6.0

6 years ago

4.5.0

6 years ago

4.4.2

6 years ago

4.4.1

6 years ago

1.21.0

6 years ago

4.4.0

6 years ago

1.20.0

6 years ago

3.18.2

6 years ago

4.3.3

6 years ago

3.18.1

6 years ago

4.3.2

6 years ago

4.3.1

6 years ago

1.19.0

6 years ago

3.18.0

6 years ago

4.3.0

6 years ago

1.18.0

6 years ago

4.2.0

6 years ago

1.17.0

6 years ago

2.4.20

6 years ago

3.17.0

6 years ago

4.1.0

6 years ago

1.16.3

6 years ago

2.4.19

6 years ago

3.16.3

6 years ago

4.0.3

6 years ago

1.16.2

6 years ago

2.4.18

6 years ago

3.16.2

6 years ago

4.0.2

6 years ago

1.16.1

6 years ago

2.4.17

6 years ago

3.16.1

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

1.16.0

6 years ago

2.4.16

6 years ago

3.16.0

6 years ago

2.4.15

7 years ago

3.15.3

7 years ago

1.15.2

7 years ago

2.4.14

7 years ago

3.15.2

7 years ago

3.15.1

7 years ago

1.15.1

7 years ago

2.4.13

7 years ago

2.4.12

7 years ago

1.15.0

7 years ago

3.15.0

7 years ago

3.14.2

7 years ago

3.14.1

7 years ago

2.4.11

7 years ago

3.14.0

7 years ago

3.13.0

7 years ago

1.12.0

7 years ago

3.12.0

7 years ago

1.11.6

7 years ago

3.11.6

7 years ago

3.11.5

7 years ago

1.11.4

7 years ago

3.11.4

7 years ago

1.11.3

7 years ago

3.11.3

7 years ago

3.11.2

7 years ago

1.11.1

7 years ago

3.11.1

7 years ago

1.11.0

7 years ago

3.11.0

7 years ago

1.10.0

7 years ago

3.10.0

7 years ago

3.9.0

7 years ago

3.8.3

7 years ago

3.8.2

7 years ago

3.8.1

7 years ago

1.8.0

7 years ago

3.8.0

7 years ago

3.7.2

7 years ago

3.7.1

7 years ago

1.7.0

7 years ago

3.7.0

7 years ago

1.6.0

7 years ago

3.6.0

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

3.5.0

7 years ago

1.4.0

7 years ago

3.4.0

7 years ago

3.3.1

7 years ago

3.3.0

7 years ago

3.2.0

7 years ago

3.1.0

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.10.6

7 years ago

1.3.0

7 years ago

2.10.5

7 years ago

2.10.4

7 years ago

2.10.3

7 years ago

2.10.2

7 years ago

2.10.1

7 years ago

2.10.0

7 years ago

2.9.2

7 years ago

2.9.1

7 years ago

2.9.0

7 years ago

2.8.1

7 years ago

2.8.0

7 years ago

2.4.10

7 years ago

2.7.7

7 years ago

2.4.9

7 years ago

2.7.6

7 years ago

2.7.5

7 years ago

2.4.8

7 years ago

2.7.4

7 years ago

2.4.7

7 years ago

2.4.6

7 years ago

2.4.5

7 years ago

2.7.3

7 years ago

2.7.2

7 years ago

2.7.1

7 years ago

2.7.0

7 years ago

2.6.1

7 years ago

2.6.0

7 years ago

2.5.0

7 years ago

2.4.4

7 years ago

2.4.3

7 years ago

2.4.2

7 years ago

2.4.1

7 years ago

2.4.0

7 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.8

7 years ago

2.0.7

7 years ago

2.0.6

7 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.2.0

7 years ago

1.1.4

7 years ago