neo.mjs 10.1.0 → 10.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ # Neo.mjs v10.1.1 Release Notes
2
+
3
+ This is a patch release that addresses a critical regression bug affecting drag-and-drop operations in grids.
4
+
5
+ ## Bug Fixes
6
+
7
+ ### Grid Column Drag & Drop
8
+
9
+ - Fixed a bug in `Neo.collection.Base` where the `move()` method would fail to correctly swap adjacent items. This was caused by an unsafe, nested `splice()` operation that could lead to unpredictable behavior.
10
+ - The direct impact of this bug was the failure of drag-and-drop for grid column reordering, which is a significant regression.
11
+ - The `move()` method has been refactored to use a safer, two-step approach, ensuring the stability of all collection-based move operations.
12
+
13
+ This fix restores the expected drag-and-drop functionality for grid columns.
package/ServiceWorker.mjs CHANGED
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='10.1.0'
23
+ * @member {String} version='10.1.1'
24
24
  */
25
- version: '10.1.0'
25
+ version: '10.1.1'
26
26
  }
27
27
 
28
28
  /**
@@ -108,7 +108,7 @@ class FooterContainer extends Container {
108
108
  }, {
109
109
  module: Component,
110
110
  cls : ['neo-version'],
111
- text : 'v10.1.0'
111
+ text : 'v10.1.1'
112
112
  }]
113
113
  }],
114
114
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name" : "neo.mjs",
3
- "version" : "10.1.0",
3
+ "version" : "10.1.1",
4
4
  "description" : "Neo.mjs: The multi-threaded UI framework for building ultra-fast, desktop-like web applications with uncompromised responsiveness, inherent security, and a transpilation-free dev mode.",
5
5
  "type" : "module",
6
6
  "repository" : {
@@ -299,12 +299,12 @@ const DefaultConfig = {
299
299
  useVdomWorker: true,
300
300
  /**
301
301
  * buildScripts/injectPackageVersion.mjs will update this value
302
- * @default '10.1.0'
302
+ * @default '10.1.1'
303
303
  * @memberOf! module:Neo
304
304
  * @name config.version
305
305
  * @type String
306
306
  */
307
- version: '10.1.0'
307
+ version: '10.1.1'
308
308
  };
309
309
 
310
310
  Object.assign(DefaultConfig, {
@@ -1051,16 +1051,21 @@ class Collection extends Base {
1051
1051
  */
1052
1052
  move(fromIndex, toIndex) {
1053
1053
  if (fromIndex === toIndex) {
1054
- return
1054
+ return;
1055
1055
  }
1056
1056
 
1057
- let {items} = this;
1057
+ let items = this._items;
1058
1058
 
1059
1059
  if (fromIndex >= items.length) {
1060
1060
  fromIndex = items.length - 1
1061
1061
  }
1062
1062
 
1063
- items.splice(toIndex, 0, items.splice(fromIndex, 1)[0])
1063
+ // The splice operations are intentionally separated.
1064
+ // Using the common one-liner `items.splice(toIndex, 0, items.splice(fromIndex, 1)[0])`
1065
+ // can lead to unpredictable side effects, as the inner splice can alter the array
1066
+ // before the outer splice's index is resolved. This two-step approach is safer.
1067
+ const item = items.splice(fromIndex, 1)[0];
1068
+ items.splice(toIndex, 0, item)
1064
1069
  }
1065
1070
 
1066
1071
  /**
@@ -275,4 +275,50 @@ StartTest(t => {
275
275
  {id: 'e'}
276
276
  ], 'collection.getRange()');
277
277
  });
278
+
279
+ t.it('Move collection items', t => {
280
+ let moveCollection = Neo.create(Collection, {
281
+ items: [
282
+ {id: 'a'},
283
+ {id: 'b'},
284
+ {id: 'c'},
285
+ {id: 'd'},
286
+ {id: 'e'}
287
+ ]
288
+ });
289
+
290
+ t.isDeeplyStrict(moveCollection.getRange(), [{id: 'a'}, {id: 'b'}, {id: 'c'}, {id: 'd'}, {id: 'e'}], 'Initial order');
291
+
292
+ // Move item forward
293
+ moveCollection.move(1, 2);
294
+ t.isDeeplyStrict(moveCollection.getRange(), [{id: 'a'}, {id: 'c'}, {id: 'b'}, {id: 'd'}, {id: 'e'}], 'Move item forward (1 -> 2)');
295
+
296
+ // Swap adjacent items (backward)
297
+ moveCollection.move(2, 1);
298
+ t.isDeeplyStrict(moveCollection.getRange(), [{id: 'a'}, {id: 'b'}, {id: 'c'}, {id: 'd'}, {id: 'e'}], 'Swap adjacent items back (2 -> 1)');
299
+
300
+ // Move item backward
301
+ moveCollection.move(3, 1);
302
+ t.isDeeplyStrict(moveCollection.getRange(), [{id: 'a'}, {id: 'd'}, {id: 'b'}, {id: 'c'}, {id: 'e'}], 'Move item backward (3 -> 1)');
303
+
304
+ // Move item forward
305
+ moveCollection.move(1, 3);
306
+ t.isDeeplyStrict(moveCollection.getRange(), [{id: 'a'}, {id: 'b'}, {id: 'c'}, {id: 'd'}, {id: 'e'}], 'Move item forward (1 -> 3)');
307
+
308
+ // Swap adjacent items (forward)
309
+ moveCollection.move(0, 1);
310
+ t.isDeeplyStrict(moveCollection.getRange(), [{id: 'b'}, {id: 'a'}, {id: 'c'}, {id: 'd'}, {id: 'e'}], 'Swap adjacent items (0 -> 1)');
311
+
312
+ // Swap adjacent items (backward)
313
+ moveCollection.move(1, 0);
314
+ t.isDeeplyStrict(moveCollection.getRange(), [{id: 'a'}, {id: 'b'}, {id: 'c'}, {id: 'd'}, {id: 'e'}], 'Swap adjacent items back (1 -> 0)');
315
+
316
+ // Move to end
317
+ moveCollection.move(0, 4);
318
+ t.isDeeplyStrict(moveCollection.getRange(), [{id: 'b'}, {id: 'c'}, {id: 'd'}, {id: 'e'}, {id: 'a'}], 'Move to end (0 -> 4)');
319
+
320
+ // Move to start
321
+ moveCollection.move(4, 0);
322
+ t.isDeeplyStrict(moveCollection.getRange(), [{id: 'a'}, {id: 'b'}, {id: 'c'}, {id: 'd'}, {id: 'e'}], 'Move to start (4 -> 0)');
323
+ });
278
324
  });