Skip to content

Commit 09efe86

Browse files
authored
Merge branch 'gridstack:master' into master
2 parents a5b662e + 90a014d commit 09efe86

40 files changed

+262
-166
lines changed

ISSUE_TEMPLATE.md renamed to .github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
---
2+
name: Bug report
3+
about: bug report
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
110
## Subject of the issue
211
Describe your issue here.
312
If unsure if lib bug, use slack channel instead: https://join.slack.com/t/gridstackjs/shared_invite/zt-2qa21lnxz-vw29RdTFet3N6~ABqT9kwA

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,20 +472,20 @@ breaking change:
472472
473473
**Breaking change:**
474474
475-
* if you code relies on `GridStackWidget.content` with real HTML (like a few demos) it is up to you to do this:
475+
* if your code relies on `GridStackWidget.content` with real HTML (like a few demos) it is up to you to do this:
476476
```ts
477477
// NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736
478-
GridStack.renderCB = function(el, w) {
478+
GridStack.renderCB = function(el: HTMLElement, w: GridStackNode) {
479479
el.innerHTML = w.content;
480480
};
481481
```
482482
* V11 add new `GridStack.renderCB` that is called for you to create the widget content (entire GridStackWidget is passed so you can use id or some other field as logic) while GS creates the 2 needed parent divs + classes, unlike `GridStack.addRemoveCB` which doesn't create anything for you. Both can be handy for Angular/React/Vue frameworks.
483-
* `addWidget(w: GridStackWidget)` is now the only supported format, no more string content passing. You will need to create content yourself (`Util.createWidgetDivs()` can be used to create parent divs) then call `makeWidget(el)` instead.
483+
* `addWidget(w: GridStackWidget)` is now the only supported format, no more string content passing. You will need to create content yourself (`GridStack.createWidgetDivs()` can be used to create parent divs) then call `makeWidget(el)` instead.
484484
485485
**Potential breaking change:**
486486
487487
* BIG overall to how sidepanel helper drag&drop is done:
488-
1. `clone()` helper is now passed full HTML element dragged, not an event on `grid-stack-item-content` so can clone or set attr at the top.
488+
1. `clone()` helper is now passed full HTML element dragged, not an event on `grid-stack-item-content` so you can clone or set attr at the top.
489489
2. use any class/structure you want for side panel items (see two.html)
490490
3. `GridStack.setupDragIn()` now support associating a `GridStackWidget` for each sidepanel that will be used to define what to create on drop!
491491
4. if no `GridStackWidget` is defined, the helper will now be inserted as is, and NOT original sidepanel item.

angular/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ this is the recommended way if you are going to have multiple grids (alow drag&d
88

99
I.E. don't use Angular templating to create grid items as that is harder to sync when gridstack will also add/remove items.
1010

11-
HTML
11+
MyComponent HTML
1212

1313
```html
1414
<gridstack [options]="gridOptions"></gridstack>
1515
```
1616

17-
CSS
17+
MyComponent CSS
1818

1919
```css
2020
@import "gridstack/dist/gridstack.min.css";
@@ -30,7 +30,7 @@ CSS
3030
```
3131

3232

33-
Standalone Component Code
33+
Standalone MyComponent Code
3434

3535
```ts
3636
import { GridStackOptions } from 'gridstack';
@@ -47,7 +47,7 @@ export class MyComponent {
4747
// sample grid options + items to load...
4848
public gridOptions: GridStackOptions = {
4949
margin: 5,
50-
children: [ // or call load()/addWidget() with same data
50+
children: [ // or call load(children) or addWidget(children[0]) with same data
5151
{x:0, y:0, minW:2, content:'Item 1'},
5252
{x:1, y:0, content:'Item 2'},
5353
{x:0, y:1, content:'Item 3'},

angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@angular/platform-browser": "^14",
1919
"@angular/platform-browser-dynamic": "^14",
2020
"@angular/router": "^14",
21-
"gridstack": "^11.3.0",
21+
"gridstack": "^11.4.0",
2222
"rxjs": "~7.5.0",
2323
"tslib": "^2.3.0",
2424
"zone.js": "~0.11.4"

angular/projects/lib/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* Public API Surface of gridstack-angular
33
*/
44

5+
export * from './lib/types';
6+
export * from './lib/base-widget';
57
export * from './lib/gridstack-item.component';
68
export * from './lib/gridstack.component';
7-
export * from './lib/base-widget';
89
export * from './lib/gridstack.module';

angular/projects/lib/src/lib/base-widget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* gridstack-item.component.ts 11.3.0-dev
2+
* gridstack-item.component.ts 11.4.0-dev
33
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
44
*/
55

@@ -8,7 +8,7 @@
88
*/
99

1010
import { Injectable } from '@angular/core';
11-
import { NgCompInputs, NgGridStackWidget } from './gridstack.component';
11+
import { NgCompInputs, NgGridStackWidget } from './types';
1212

1313
@Injectable()
1414
export abstract class BaseWidget {

angular/projects/lib/src/lib/gridstack-item.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* gridstack-item.component.ts 11.3.0-dev
2+
* gridstack-item.component.ts 11.4.0-dev
33
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
44
*/
55

angular/projects/lib/src/lib/gridstack.component.ts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* gridstack.component.ts 11.3.0-dev
2+
* gridstack.component.ts 11.4.0-dev
33
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
44
*/
55

@@ -9,34 +9,16 @@ import { NgIf } from '@angular/common';
99
import { Subscription } from 'rxjs';
1010
import { GridHTMLElement, GridItemHTMLElement, GridStack, GridStackNode, GridStackOptions, GridStackWidget } from 'gridstack';
1111

12-
import { GridItemCompHTMLElement, GridstackItemComponent } from './gridstack-item.component';
12+
import { NgGridStackNode, NgGridStackWidget } from './types';
1313
import { BaseWidget } from './base-widget';
14+
import { GridItemCompHTMLElement, GridstackItemComponent } from './gridstack-item.component';
1415

1516
/** events handlers emitters signature for different events */
1617
export type eventCB = {event: Event};
1718
export type elementCB = {event: Event, el: GridItemHTMLElement};
1819
export type nodesCB = {event: Event, nodes: GridStackNode[]};
1920
export type droppedCB = {event: Event, previousNode: GridStackNode, newNode: GridStackNode};
2021

21-
export type NgCompInputs = {[key: string]: any};
22-
23-
/** extends to store Ng Component selector, instead/inAddition to content */
24-
export interface NgGridStackWidget extends GridStackWidget {
25-
/** Angular tag selector for this component to create at runtime */
26-
selector?: string;
27-
/** serialized data for the component input fields */
28-
input?: NgCompInputs;
29-
/** nested grid options */
30-
subGridOpts?: NgGridStackOptions;
31-
}
32-
export interface NgGridStackNode extends GridStackNode {
33-
selector?: string; // component type to create as content
34-
}
35-
export interface NgGridStackOptions extends GridStackOptions {
36-
children?: NgGridStackWidget[];
37-
subGridOpts?: NgGridStackOptions;
38-
}
39-
4022
/** store element to Ng Class pointer back */
4123
export interface GridCompHTMLElement extends GridHTMLElement {
4224
_gridComp?: GridstackComponent;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/**
2-
* gridstack.component.ts 11.3.0-dev
2+
* gridstack.component.ts 11.4.0-dev
33
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
44
*/
55

66
import { NgModule } from "@angular/core";
77

8-
import { GridstackComponent } from "./gridstack.component";
98
import { GridstackItemComponent } from "./gridstack-item.component";
9+
import { GridstackComponent } from "./gridstack.component";
1010

1111
// @deprecated use GridstackComponent and GridstackItemComponent as standalone components
1212
@NgModule({
1313
imports: [
14-
GridstackComponent,
1514
GridstackItemComponent,
15+
GridstackComponent,
1616
],
1717
exports: [
18-
GridstackComponent,
1918
GridstackItemComponent,
19+
GridstackComponent,
2020
],
2121
})
2222
export class GridstackModule {}

angular/projects/lib/src/lib/types.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* gridstack-item.component.ts 11.4.0-dev
3+
* Copyright (c) 2025 Alain Dumesny - see GridStack root license
4+
*/
5+
6+
import { GridStackNode, GridStackOptions, GridStackWidget } from "gridstack";
7+
8+
/** extends to store Ng Component selector, instead/inAddition to content */
9+
export interface NgGridStackWidget extends GridStackWidget {
10+
/** Angular tag selector for this component to create at runtime */
11+
selector?: string;
12+
/** serialized data for the component input fields */
13+
input?: NgCompInputs;
14+
/** nested grid options */
15+
subGridOpts?: NgGridStackOptions;
16+
}
17+
18+
export interface NgGridStackNode extends GridStackNode {
19+
selector?: string; // component type to create as content
20+
}
21+
22+
export interface NgGridStackOptions extends GridStackOptions {
23+
children?: NgGridStackWidget[];
24+
subGridOpts?: NgGridStackOptions;
25+
}
26+
27+
export type NgCompInputs = {[key: string]: any};

0 commit comments

Comments
 (0)