polarvo-layout 1.0.31 → 1.0.33

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.31",
3
+ "version": "1.0.33",
4
4
  "type": "module",
5
5
  "author": "unigence <unigencelab@gmail.com>",
6
6
  "repository": {
@@ -41,14 +41,15 @@ const imageModules = import.meta.glob('@/assets/el_img/*.{png,gif}', { eager: tr
41
41
 
42
42
  function getPropsDefaults(props) {
43
43
  if (!props) return {};
44
- return Object.fromEntries(
45
- Object.entries(props).map(([key, prop]) => {
46
- if (prop.default !== undefined) {
47
- return [key, typeof prop.default === 'function' ? prop.default() : prop.default];
48
- }
49
- return [key, null];
50
- })
51
- );
44
+
45
+ return Object.fromEntries(Object.entries(props).map(([key, prop]) => {
46
+ if (['size'].includes(key)) return null;
47
+
48
+ if (prop.default !== undefined) {
49
+ return [key, typeof prop.default === 'function' ? prop.default() : prop.default];
50
+ }
51
+ return null; // 기본값이 없는 경우 null 반환
52
+ }).filter(entry => entry !== null));
52
53
  }
53
54
 
54
55
  async function getElements() {
@@ -61,6 +61,11 @@ class DisplayEngine {
61
61
  this.displaySize = { ...$screenConfig.displaySize };
62
62
  });
63
63
 
64
+ this._subscribe('freeDrop:setActiveElement', () => {
65
+ this.setActiveMenu(null);
66
+ this.setActiveDesign(null);
67
+ })
68
+
64
69
  this._subscribe('freeDrop:startDrag', () => {
65
70
  this.setActiveMenu(null);
66
71
  this.setActiveDesign(null);
@@ -379,7 +379,7 @@ class FreeDropEngine {
379
379
  size: elementSource[elName] || { w: 100, h: 100 },
380
380
  section: this._activeSection,
381
381
  isLocked: false,
382
- propDefaults: item.propDefaults || {}, // 아이템의 기본 props 설정
382
+ ...item.propDefaults || {}, // 아이템의 기본 props 설정
383
383
  };
384
384
 
385
385
  this.setActiveElement(element, 'add');
@@ -353,7 +353,7 @@ class GridDropEngine {
353
353
  size: { colSpan: 1, rowSpan: 1 },
354
354
  section: this._activeSection,
355
355
  isLocked: false,
356
- propDefaults: item.propDefaults || {}, // 아이템의 기본 props 설정
356
+ ...item.propDefaults || {}, // 아이템의 기본 props 설정
357
357
  };
358
358
 
359
359
  this.setActiveElement(null, 'add');
@@ -910,7 +910,7 @@ class EngineManager {
910
910
  // getGuides: () => freeDropEngine.guides,
911
911
  setActiveElement: (element, type) => freeDropEngine.setActiveElement(element, type),
912
912
 
913
- addElement: (event, elName) => freeDropEngine.addElement(event, elName),
913
+ addElement: (event, item) => freeDropEngine.addElement(event, item),
914
914
  toggleLock: () => freeDropEngine.toggleLock(),
915
915
  handleMouseDown: (event, id) => freeDropEngine.handleMouseDown(event, id),
916
916
  startResize: (event, direction) => freeDropEngine.startResize(event, direction),
@@ -924,7 +924,7 @@ class EngineManager {
924
924
  setActiveElement: (element, type) => gridDropEngine.setActiveElement(element, type),
925
925
  detectHoverCell: (cell) => gridDropEngine.detectHoverCell(cell),
926
926
 
927
- addElement: (elName) => gridDropEngine.addElement(elName),
927
+ addElement: (item) => gridDropEngine.addElement(item),
928
928
  toggleLock: () => gridDropEngine.toggleLock(),
929
929
  startDrag: (event, id) => gridDropEngine.startDrag(event, id),
930
930
  handleMouseDown: (event, id) => gridDropEngine.handleMouseDown(event, id),
@@ -150,9 +150,9 @@ function useFreeDrop(api) {
150
150
  }
151
151
  };
152
152
 
153
- const addElement = (event, elName) => {
153
+ const addElement = (event, item) => {
154
154
  try {
155
- api.freeDrop.addElement(event, elName);
155
+ api.freeDrop.addElement(event, item);
156
156
  } catch (error) {
157
157
  console.warn('[FreeDropLibrary] addElement 실행 중 오류 발생:', error);
158
158
  }
@@ -133,9 +133,9 @@ function useGridDrop(api) {
133
133
  // }
134
134
  // };
135
135
 
136
- const addElement = (elName) => {
136
+ const addElement = (item) => {
137
137
  try {
138
- api.gridDrop.addElement(elName);
138
+ api.gridDrop.addElement(item);
139
139
  } catch (error) {
140
140
  console.warn('[GridDropLibrary] addElement 호출 중 오류 발생:', error);
141
141
  }