polarvo-layout 1.0.59 → 1.0.61
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
|
@@ -18,19 +18,11 @@
|
|
|
18
18
|
{{ key }}
|
|
19
19
|
</div>
|
|
20
20
|
<template v-if="section.mode === 'grid'">
|
|
21
|
-
<GridLayout
|
|
22
|
-
:id="`grid-${key}`"
|
|
23
|
-
:polarvo="polarvo"
|
|
24
|
-
:preview="preview"
|
|
25
|
-
:sectionKey="key"
|
|
26
|
-
:sectionData="section"
|
|
27
|
-
:elementIds="section.elementIds"
|
|
28
|
-
/>
|
|
21
|
+
<GridLayout :polarvo="polarvo" :preview="preview" :sectionKey="key" :sectionData="section" :elementIds="section.elementIds" />
|
|
29
22
|
</template>
|
|
30
23
|
|
|
31
24
|
<template v-else>
|
|
32
25
|
<FreeLayout
|
|
33
|
-
:id="`free-${key}`"
|
|
34
26
|
:polarvo="polarvo"
|
|
35
27
|
:preview="preview"
|
|
36
28
|
:sectionKey="key"
|
|
@@ -156,14 +156,14 @@ class EngineManager {
|
|
|
156
156
|
* @param {string} type - 설정 타입 (mode, config)
|
|
157
157
|
* @param {object} updates - 업데이트할 설정 값 객체
|
|
158
158
|
*/
|
|
159
|
-
_updateActiveSectionConfig(type, updates) {
|
|
160
|
-
if (!this.state.layoutData || !
|
|
159
|
+
_updateActiveSectionConfig(type, updates, section = this.state.activeSection) {
|
|
160
|
+
if (!this.state.layoutData || !section) {
|
|
161
161
|
console.error('[EngineManager] activeData를 업데이트할 수 없습니다.');
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
this.eventBus.emit('system:updateActiveSectionConfig', {
|
|
166
|
-
$section:
|
|
166
|
+
$section: section,
|
|
167
167
|
changes: { type: type, ...updates },
|
|
168
168
|
timestamp: Date.now(),
|
|
169
169
|
});
|
|
@@ -333,6 +333,7 @@ class EngineManager {
|
|
|
333
333
|
|
|
334
334
|
const prevGridRatio = $prev?.gridRatio || { column: [100], row: [100] };
|
|
335
335
|
this._updateElementsScaleByRatio('column', prevGridRatio, $gridRatio);
|
|
336
|
+
this._updateElementsScaleByRatio('row', prevGridRatio, $gridRatio);
|
|
336
337
|
|
|
337
338
|
nextTick(() => {
|
|
338
339
|
this.eventBus.emit('system:historyCheckpoint', {
|
|
@@ -534,7 +535,8 @@ class EngineManager {
|
|
|
534
535
|
}
|
|
535
536
|
|
|
536
537
|
this.state.elements.push(element);
|
|
537
|
-
|
|
538
|
+
const targetSectionData = this.state.layoutData?.[element.section];
|
|
539
|
+
this._updateActiveSectionConfig('elementIds', { elementIds: [...(targetSectionData?.elementIds || []), element.id] }, element.section);
|
|
538
540
|
|
|
539
541
|
this.eventBus.emit('system:requestUpdateElement', {
|
|
540
542
|
action: 'add',
|
|
@@ -551,10 +553,12 @@ class EngineManager {
|
|
|
551
553
|
|
|
552
554
|
// 배치요소 삭제 요청
|
|
553
555
|
this._subscribe('freeDrop:requestDeleteElement', ({ elementId }) => {
|
|
556
|
+
const target = this.state.elements.find((el) => el.id === elementId);
|
|
554
557
|
this.state.elements = this.state.elements.filter((el) => el.id !== elementId);
|
|
558
|
+
const targetSectionData = this.state.layoutData?.[target?.section];
|
|
555
559
|
this._updateActiveSectionConfig('elementIds', {
|
|
556
|
-
elementIds: (
|
|
557
|
-
});
|
|
560
|
+
elementIds: (targetSectionData?.elementIds || []).filter((elId) => elId !== elementId),
|
|
561
|
+
}, target?.section);
|
|
558
562
|
// this._updateActiveElementIds(this.activeData.elementIds.filter((elId) => elId !== elementId));
|
|
559
563
|
|
|
560
564
|
this.eventBus.emit('system:requestUpdateElement', {
|
|
@@ -566,11 +570,7 @@ class EngineManager {
|
|
|
566
570
|
|
|
567
571
|
this.eventBus.emit('system:historyCheckpoint', {
|
|
568
572
|
domain: 'manager',
|
|
569
|
-
state:
|
|
570
|
-
manager: this.getState() || null,
|
|
571
|
-
layout: this.getEngine('layout')?.getState() || null,
|
|
572
|
-
display: this.getEngine('display')?.getState() || null,
|
|
573
|
-
},
|
|
573
|
+
state: this.getState(),
|
|
574
574
|
});
|
|
575
575
|
});
|
|
576
576
|
|
|
@@ -609,7 +609,8 @@ class EngineManager {
|
|
|
609
609
|
}
|
|
610
610
|
|
|
611
611
|
this.state.elements.push(element);
|
|
612
|
-
|
|
612
|
+
const targetSectionData = this.state.layoutData?.[element.section];
|
|
613
|
+
this._updateActiveSectionConfig('elementIds', { elementIds: [...(targetSectionData?.elementIds || []), element.id] }, element.section);
|
|
613
614
|
// this._updateActiveElementIds([...this.activeData.elementIds, element.id]);
|
|
614
615
|
|
|
615
616
|
this.eventBus.emit('system:requestUpdateElement', {
|
|
@@ -627,10 +628,12 @@ class EngineManager {
|
|
|
627
628
|
|
|
628
629
|
// 배치요소 삭제 요청
|
|
629
630
|
this._subscribe('gridDrop:requestDeleteElement', ({ elementId }) => {
|
|
631
|
+
const target = this.state.elements.find((el) => el.id === elementId);
|
|
630
632
|
this.state.elements = this.state.elements.filter((el) => el.id !== elementId);
|
|
633
|
+
const targetSectionData = this.state.layoutData?.[target?.section];
|
|
631
634
|
this._updateActiveSectionConfig('elementIds', {
|
|
632
|
-
elementIds: (
|
|
633
|
-
});
|
|
635
|
+
elementIds: (targetSectionData?.elementIds || []).filter((elId) => elId !== elementId),
|
|
636
|
+
}, target?.section);
|
|
634
637
|
// this._updateActiveElementIds(this.activeData.elementIds.filter((elId) => elId !== elementId));
|
|
635
638
|
|
|
636
639
|
this.eventBus.emit('system:requestUpdateElement', {
|
|
@@ -120,11 +120,11 @@ function useLayout(api) {
|
|
|
120
120
|
|
|
121
121
|
_subscribe('system:restoredState', ({ domain, state: snapShot }) => {
|
|
122
122
|
if (domain === 'all'|| domain === 'draft') {
|
|
123
|
-
state.elements = snapShot.manager.elements;
|
|
123
|
+
state.elements = cloneDeep(snapShot.manager.elements);
|
|
124
124
|
// state.layoutData = snapShot.manager.layoutData
|
|
125
125
|
|
|
126
126
|
state.layoutName = snapShot.layout.layoutName;
|
|
127
|
-
state.layoutData = snapShot.layout.layoutData;
|
|
127
|
+
state.layoutData = cloneDeep(snapShot.layout.layoutData);
|
|
128
128
|
state.gridNumber = { ...snapShot.layout.gridNumber };
|
|
129
129
|
state.gridRatio = {
|
|
130
130
|
column: [...snapShot.layout.gridRatio.column],
|
|
@@ -134,13 +134,13 @@ function useLayout(api) {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
if (domain === 'manager') {
|
|
137
|
-
state.elements = snapShot.elements;
|
|
138
|
-
state.layoutData = snapShot.layoutData;
|
|
137
|
+
state.elements = cloneDeep(snapShot.elements);
|
|
138
|
+
state.layoutData = cloneDeep(snapShot.layoutData);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
if (domain === 'layout') {
|
|
142
142
|
state.layoutName = snapShot.layoutName;
|
|
143
|
-
state.layoutData = snapShot.layoutData;
|
|
143
|
+
state.layoutData = cloneDeep(snapShot.layoutData);
|
|
144
144
|
state.gridNumber = { ...snapShot.gridNumber };
|
|
145
145
|
state.gridRatio = {
|
|
146
146
|
column: [...snapShot.gridRatio.column],
|