Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 663b439

Browse files
authored
Merge pull request gridstack#2962 from adumesny/master
fix /angular circular dependencies
2 parents a3019b4 + cae38a1 commit 663b439

File tree

6 files changed

+36
-25
lines changed

6 files changed

+36
-25
lines changed

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.component.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
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.3.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};

doc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Change log
124124
## 11.3.0-dev (TBD)
125125
* fix: [#2921](https://github.com/gridstack/gridstack.js/pull/2921) replace initMouseEvent with MouseEvent constructor and added composed: true
126126
* fix: [#2939](https://github.com/gridstack/gridstack.js/issues/2939) custom drag handle not working with LazyLoad
127+
* fix: [#2955](https://github.com/gridstack/gridstack.js/issues/2955) angular circular dependency
127128

128129
## 11.3.0 (2025-01-26)
129130
* feat: added `isIgnoreChangeCB()` if changeCB should be ignored due to column change, sizeToContent, loading, etc...

0 commit comments

Comments
 (0)