Skip to content

Commit 4bbf2b6

Browse files
authored
feat: upgraded gridstack to v12 (#151)
BREAKING CHANGE: Major release bump for gridstack
1 parent bc9cfd3 commit 4bbf2b6

6 files changed

Lines changed: 39 additions & 26 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [5.0.0](https://github.com/yahoo/ember-gridstack/compare/v4.0.1...v5.0.0) (2025-05-22)
4+
5+
### Features
6+
7+
- BREAKING: update to gridstack v12.1.2 see https://github.com/gridstack/gridstack.js?tab=readme-ov-file#migrating-to-v8 for migration guides
8+
39
## [4.0.0](https://github.com/yahoo/ember-gridstack/compare/v3.2.0...v4.0.0) (2023-03-08)
410

511
### Features

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Ember components to build drag-and-drop multi-column grids powered by [gridstack
1414
ember install ember-gridstack
1515
```
1616

17-
## Migrating to v3
17+
## Migrating to v5
1818

19-
View the full [v3.0.0 release notes](./CHANGELOG.md#300) for updates and breaking changes.
19+
View the full [v5.0.0 release notes](./CHANGELOG.md#500-2025-05-22) for updates and breaking changes.
2020

2121
## Basic Usage
2222

@@ -125,7 +125,7 @@ The `<GridStackItem>` component uses the block form to yield the content of the
125125
export default class CustomComponent extends Component {
126126
didInsertElement() {
127127
super.didInsertElement(...arguments);
128-
this.parentContainer.element.addEventListener('resizestop', () => {
128+
this.parentContainer.element.addEventListener("resizestop", () => {
129129
//handle resize
130130
});
131131
}

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ module.exports = {
99
this._super.included.apply(this, arguments);
1010

1111
app.import(`${GRIDSTACK_DIR}/gridstack.css`);
12-
app.import(`${GRIDSTACK_DIR}/gridstack-extra.css`);
1312
},
1413
};

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-gridstack",
3-
"version": "4.0.0",
3+
"version": "5.0.0",
44
"description": "Ember Gridstack",
55
"keywords": [
66
"ember-addon",
@@ -40,7 +40,7 @@
4040
"ember-cli-babel": "^7.26.11",
4141
"ember-cli-htmlbars": "^6.2.0",
4242
"ember-modifier": "^3.0.0 || ^4.1.0",
43-
"gridstack": "^7.2.2"
43+
"gridstack": "^12.1.2"
4444
},
4545
"devDependencies": {
4646
"@babel/eslint-parser": "^7.21.3",

tests/integration/components/grid-stack-test.js

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module('Integration | Component | grid stack', function (hooks) {
1111
setupRenderingTest(hooks);
1212

1313
test('gridstack renders', async function (assert) {
14-
assert.expect(2);
14+
assert.expect(1);
1515

1616
await render(hbs`
1717
<GridStack class="test-grid">
@@ -22,12 +22,8 @@ module('Integration | Component | grid stack', function (hooks) {
2222
`);
2323

2424
assert
25-
.dom('.test-grid.grid-stack .grid-stack-item')
26-
.hasClass('ui-draggable', 'Dom elements with grid-stack-item class are initialized by gridstack');
27-
28-
assert
29-
.dom('.test-grid.grid-stack .grid-stack-item')
30-
.hasClass('ui-resizable', 'Dom elements with grid-stack-item class are initialized by gridstack');
25+
.dom('.test-grid.grid-stack .grid-stack-item > .ui-resizable-handle.ui-resizable-se')
26+
.exists('Dom elements with grid-stack-item class are initialized by gridstack');
3127
});
3228

3329
test('gridstack with items', async function (assert) {
@@ -46,15 +42,15 @@ module('Integration | Component | grid stack', function (hooks) {
4642
`);
4743

4844
assert
49-
.dom('.grid-stack .grid-stack-item.ui-draggable.ui-resizable')
45+
.dom('.grid-stack .grid-stack-item > .ui-resizable-handle.ui-resizable-se')
5046
.exists({ count: 2 }, 'initial grid-stack-item components are initialized by gridstack');
5147

5248
run(() => {
5349
this.items.pushObject(2);
5450
});
5551

5652
assert
57-
.dom('.grid-stack .grid-stack-item.ui-draggable.ui-resizable')
53+
.dom('.grid-stack .grid-stack-item > .ui-resizable-handle.ui-resizable-se')
5854
.exists(
5955
{ count: 3 },
6056
'new grid-stack-item components are initialized by gridstack when added through an each loop'
@@ -275,26 +271,38 @@ module('Integration | Component | grid stack', function (hooks) {
275271
`);
276272

277273
this.items.forEach(({ id, options }) => {
278-
assert.dom(`[data-id="${id}"]`).hasAttribute('gs-x', `${options.x}`, 'Initial grid-stack-item layout is correct');
279-
assert.dom(`[data-id="${id}"]`).hasAttribute('gs-y', `${options.y}`, 'Initial grid-stack-item layout is correct');
274+
if (options.x === 0) {
275+
assert.dom(`[data-id="${id}"]`).doesNotHaveAttribute('gs-x', 'Initial grid-stack-item layout is correct');
276+
} else {
277+
assert
278+
.dom(`[data-id="${id}"]`)
279+
.hasAttribute('gs-x', `${options.x}`, 'Initial grid-stack-item layout is correct');
280+
}
281+
282+
if (options.y === 0) {
283+
assert.dom(`[data-id="${id}"]`).doesNotHaveAttribute('gs-y', 'Initial grid-stack-item layout is correct');
284+
} else {
285+
assert
286+
.dom(`[data-id="${id}"]`)
287+
.hasAttribute('gs-y', `${options.y}`, 'Initial grid-stack-item layout is correct');
288+
}
280289
});
281290

282291
// Update the position of item 1
283292
this.set('items.1.options', { x: 2, y: 1, w: 12, h: 1 });
284-
285293
assert
286294
.dom(`[data-id="0"]`)
287-
.hasAttribute('gs-x', '0', 'Updating a grid-stack-item leaves unaffected items the same');
295+
.doesNotHaveAttribute('gs-x', 'Updating a grid-stack-item leaves unaffected items the same');
288296
assert
289297
.dom(`[data-id="0"]`)
290-
.hasAttribute('gs-y', '0', 'Updating a grid-stack-item leaves unaffected items the same');
298+
.doesNotHaveAttribute('gs-y', 'Updating a grid-stack-item leaves unaffected items the same');
291299

292-
assert.dom(`[data-id="1"]`).hasAttribute('gs-x', '2', 'Updating a grid-stack-item updates moves the item');
300+
assert.dom(`[data-id="1"]`).doesNotHaveAttribute('gs-x', 'Updating a grid-stack-item updates moves the item');
293301
assert.dom(`[data-id="1"]`).hasAttribute('gs-y', '1', 'Updating a grid-stack-item updates moves the item');
294302

295303
assert
296304
.dom(`[data-id="2"]`)
297-
.hasAttribute('gs-x', '0', 'Updating a grid-stack-item moves conflicting items to a different row');
305+
.doesNotHaveAttribute('gs-x', 'Updating a grid-stack-item moves conflicting items to a different row');
298306
assert
299307
.dom(`[data-id="2"]`)
300308
.hasAttribute('gs-y', '2', 'Updating a grid-stack-item moves conflicting items to a different row');

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8052,10 +8052,10 @@ graphemer@^1.4.0:
80528052
resolved "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz"
80538053
integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==
80548054

8055-
gridstack@^7.2.2:
8056-
version "7.3.0"
8057-
resolved "https://registry.npmjs.org/gridstack/-/gridstack-7.3.0.tgz"
8058-
integrity sha512-JKZgsHzm1ljkn1NnBZpf8j4NDOBCXTuw0m1ZC0sr6NKUh0BFWzXAONIxtX1hWGUVeKLj5l1VcmnTwCXw5ypDNw==
8055+
gridstack@^12.1.2:
8056+
version "12.1.2"
8057+
resolved "https://registry.yarnpkg.com/gridstack/-/gridstack-12.1.2.tgz#784f6d55873bb48fa9230c1284f769c9fbf785a8"
8058+
integrity sha512-IC1mkm5xonhAnftwIxsG+B3bawxC61ciKWEvX15ExpVQPbNVN7O9aZZhM7Y/eE4JaIR8PXrdkjd12gMnwNYRLQ==
80598059

80608060
growly@^1.3.0:
80618061
version "1.3.0"

0 commit comments

Comments
 (0)