polarvo-layout 1.0.24 → 1.0.26

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polarvo-layout",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "type": "module",
5
5
  "author": "unigence <unigencelab@gmail.com>",
6
6
  "repository": {
@@ -246,10 +246,10 @@ class GridDropEngine {
246
246
  return;
247
247
  }
248
248
  this._activeElement.isLocked = !this._activeElement.isLocked;
249
- // this._elementsUpdate = true;
250
249
 
251
250
  this.eventBus.emit('gridDrop:toggleLock', {
252
251
  elementId: this._activeElement.id,
252
+ isLocked: this._activeElement.isLocked,
253
253
  timestamp: Date.now(),
254
254
  });
255
255
  }
@@ -337,10 +337,10 @@ class GridDropEngine {
337
337
  isLocked: false,
338
338
  };
339
339
 
340
- this.setActiveElement(element, 'add');
340
+ this.setActiveElement(null, 'add');
341
341
 
342
342
  this.eventBus.emit('gridDrop:requestAddElement', {
343
- element: this._activeElement,
343
+ element: element,
344
344
  timestamp: Date.now(),
345
345
  });
346
346
  }
@@ -56,10 +56,10 @@ function useGridDrop(api) {
56
56
  }
57
57
  });
58
58
 
59
- _subscribe('gridDrop:toggleLock', ({ elementId }) => {
60
- const element = state.elements.find((el) => el.id === elementId);
61
- if (element) {
62
- element.isLocked = !element.isLocked;
59
+ _subscribe('gridDrop:toggleLock', ({ elementId, isLocked }) => {
60
+ const index = state.elements.findIndex((el) => el.id === elementId);
61
+ if (index !== -1) {
62
+ state.elements = state.elements.map((el, i) => (i === index ? { ...el, isLocked } : el));
63
63
  }
64
64
  });
65
65