Skip to content

Commit 40240d1

Browse files
author
Alain Dumesny
authored
Merge pull request #2343 from adumesny/master
`GridStackWidget.id` is now string only
2 parents fb4286c + 847b27d commit 40240d1

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

doc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Change log
9292
## 8.2.0-dev (TBD)
9393
* fix: make sure `removeNode()` uses internal _id (unique) and not node itself (since we clone those often)
9494
* fix: after calling `addRemoveCB` make sure we don't makeWidget() (incorrectly) a second time
95+
* break: `GridStackWidget.id` is now string only (used to be numberOrString) as it causes usage to have to check and cast
9596

9697
## 8.2.0 (2023-05-24)
9798
* feat: `makeWidget()` now take optional `GridStackWidget` for sizing

src/gridstack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ export class GridStack {
682682

683683
// now add/update the widgets
684684
items.forEach(w => {
685-
let item = (w.id || w.id === 0) ? this.engine.nodes.find(n => n.id === w.id) : undefined;
685+
let item = (w.id !== undefined) ? this.engine.nodes.find(n => n.id === w.id) : undefined;
686686
if (item) {
687687
this.update(item.el, w);
688688
if (w.subGridOpts?.children) { // update any sub grid as well

src/types.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@ export interface GridStackOptions {
163163
/** draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) */
164164
handleClass?: string;
165165

166-
/** id used to debug grid instance, not currently stored in DOM attributes */
167-
id?: numberOrString;
168-
169166
/** additional widget class (default?: 'grid-stack-item') */
170167
itemClass?: string;
171168

@@ -309,7 +306,7 @@ export interface GridStackWidget extends GridStackPosition {
309306
/** prevents being moved by others during their (default?: undefined = un-constrained) */
310307
locked?: boolean;
311308
/** value for `gs-id` stored on the widget (default?: undefined) */
312-
id?: numberOrString;
309+
id?: string;
313310
/** html to append inside as content */
314311
content?: string;
315312
/** optional nested grid options and list of children, which then turns into actual instance at runtime to get options from */

0 commit comments

Comments
 (0)