polarvo-layout 1.0.34 → 1.0.36
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 +1 -1
- package/src/components/Layout/FreeLayout.vue +1 -1
- package/src/components/Layout/GridLayout.vue +7 -0
- package/src/components/SideBar/ElementSideBar.vue +1 -1
- package/src/core/engines/FreeDropEngine.js +1 -2
- package/src/core/engines/GridDropEngine.js +1 -1
- package/src/core/managers/EngineManager.js +41 -0
- package/src/library/DisplayLibrary.js +1 -1
- package/src/library/FreeDropLibrary.js +1 -1
- package/src/library/LayoutLibrary.js +1 -1
package/package.json
CHANGED
|
@@ -77,13 +77,13 @@ watch(
|
|
|
77
77
|
setActiveDesign(null);
|
|
78
78
|
setActiveMenu(null);
|
|
79
79
|
}
|
|
80
|
-
|
|
81
80
|
_isElementSwitching = true;
|
|
82
81
|
// selectedElement.value = structuredClone(toRaw(activeElement.value));
|
|
83
82
|
selectedElement.value = cloneDeep(activeElement.value);
|
|
84
83
|
|
|
85
84
|
// activeElement 바뀌면 편집 모드 해제
|
|
86
85
|
activeEditMode.value = false;
|
|
86
|
+
|
|
87
87
|
},
|
|
88
88
|
);
|
|
89
89
|
|
|
@@ -77,6 +77,13 @@ const debouncedUpdate = debounce(() => {
|
|
|
77
77
|
// gridRows 업데이트
|
|
78
78
|
}, 10);
|
|
79
79
|
|
|
80
|
+
watch(
|
|
81
|
+
() => `${props.sectionData?.config?.gridColumns}-${props.sectionData?.config?.gridRows}`,
|
|
82
|
+
() => {
|
|
83
|
+
initData();
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
|
|
80
87
|
function setMergedData() {
|
|
81
88
|
const grid = Array.from({ length: gridRows.value + 1 }, () => Array(gridColumns.value + 1).fill(false));
|
|
82
89
|
// const filled = elements.value.filter((el) => props.elementIds?.includes(el.id) && el.section === props.sectionKey);
|
|
@@ -43,7 +43,7 @@ function getPropsDefaults(props) {
|
|
|
43
43
|
if (!props) return {};
|
|
44
44
|
|
|
45
45
|
return Object.fromEntries(Object.entries(props).map(([key, prop]) => {
|
|
46
|
-
if (['size'].includes(key)) return null;
|
|
46
|
+
if (['size', 'preview'].includes(key)) return null;
|
|
47
47
|
|
|
48
48
|
if (prop.default !== undefined) {
|
|
49
49
|
return [key, typeof prop.default === 'function' ? prop.default() : prop.default];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cloneDeep } from 'lodash-es';
|
|
2
|
-
import { nextTick } from 'vue';
|
|
3
2
|
|
|
4
3
|
// event 발행 시 'freeDrop'으로 시작하는 이름 사용
|
|
5
4
|
class FreeDropEngine {
|
|
@@ -130,7 +129,7 @@ class FreeDropEngine {
|
|
|
130
129
|
});
|
|
131
130
|
|
|
132
131
|
this._subscribe('system:restoredState', ({ domain, state: snapShot }) => {
|
|
133
|
-
if (domain === 'all') {
|
|
132
|
+
if (domain === 'all' || domain === 'draft') {
|
|
134
133
|
this._elements = snapShot.manager.elements || [];
|
|
135
134
|
this._elementsUpdate = true;
|
|
136
135
|
this.setActiveElement(null);
|
|
@@ -109,7 +109,7 @@ class GridDropEngine {
|
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
this._subscribe('system:restoredState', ({ domain, state: snapShot }) => {
|
|
112
|
-
if (domain === 'all') {
|
|
112
|
+
if (domain === 'all'|| domain === 'draft') {
|
|
113
113
|
this._elements = snapShot.manager.elements || [];
|
|
114
114
|
this._elementsUpdate = true;
|
|
115
115
|
|
|
@@ -72,6 +72,22 @@ class EngineManager {
|
|
|
72
72
|
|
|
73
73
|
restoreState(domain, state) {
|
|
74
74
|
switch (domain) {
|
|
75
|
+
case 'draft': {
|
|
76
|
+
// manager
|
|
77
|
+
this.setState(state.manager);
|
|
78
|
+
|
|
79
|
+
// layout
|
|
80
|
+
this.getEngine('layout').setState(state.layout);
|
|
81
|
+
this.state.layoutData = state.layout.layoutData;
|
|
82
|
+
|
|
83
|
+
// display
|
|
84
|
+
this.getEngine('display')?.setState(state.display);
|
|
85
|
+
this._displaySize = state.display.displaySize;
|
|
86
|
+
|
|
87
|
+
this.setActiveSection(state.manager?.activeSection, true);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
|
|
75
91
|
// all
|
|
76
92
|
case 'all': {
|
|
77
93
|
// manager
|
|
@@ -625,6 +641,21 @@ class EngineManager {
|
|
|
625
641
|
await this._createEngines();
|
|
626
642
|
await this._setupEngineConnections();
|
|
627
643
|
this._initialized = true;
|
|
644
|
+
|
|
645
|
+
// 세션 복원
|
|
646
|
+
const saved = sessionStorage.getItem('polarvo-session');
|
|
647
|
+
if (saved) {
|
|
648
|
+
this.restoreState('draft', JSON.parse(saved));
|
|
649
|
+
|
|
650
|
+
this.eventBus.emit('system:historyCheckpoint', {
|
|
651
|
+
domain: 'draft',
|
|
652
|
+
state: {
|
|
653
|
+
manager: this.getState() || null,
|
|
654
|
+
layout: this.getEngine('layout')?.getState() || null,
|
|
655
|
+
display: this.getEngine('display')?.getState() || null,
|
|
656
|
+
},
|
|
657
|
+
});
|
|
658
|
+
}
|
|
628
659
|
}
|
|
629
660
|
}
|
|
630
661
|
|
|
@@ -701,6 +732,16 @@ class EngineManager {
|
|
|
701
732
|
}
|
|
702
733
|
});
|
|
703
734
|
|
|
735
|
+
// 가장 최신 상태를 세션 스토리지에 저장 (새로고침 대비)
|
|
736
|
+
this.eventBus.subscribe('system:historyCheckpoint', () => {
|
|
737
|
+
const snapshot = {
|
|
738
|
+
manager: this.getState(),
|
|
739
|
+
layout: this.getEngine('layout')?.getState() || null,
|
|
740
|
+
display: this.getEngine('display')?.getState() || null,
|
|
741
|
+
};
|
|
742
|
+
sessionStorage.setItem('polarvo-session', JSON.stringify(snapshot));
|
|
743
|
+
});
|
|
744
|
+
|
|
704
745
|
// 모든 연결 설정 완료 후 초기화 완료 이벤트 발행
|
|
705
746
|
this.eventBus.emit('system:engineInitialized', {
|
|
706
747
|
state: this.state,
|
|
@@ -61,7 +61,7 @@ function useDisplay(api) {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
_subscribe('system:restoredState', ({ domain, state: snapShot }) => {
|
|
64
|
-
if (domain === 'all') {
|
|
64
|
+
if (domain === 'all'|| domain === 'draft') {
|
|
65
65
|
state.displayMode = snapShot.display.displayMode;
|
|
66
66
|
state.displaySize = { ...snapShot.display.displaySize };
|
|
67
67
|
}
|
|
@@ -117,7 +117,7 @@ function useLayout(api) {
|
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
_subscribe('system:restoredState', ({ domain, state: snapShot }) => {
|
|
120
|
-
if (domain === 'all') {
|
|
120
|
+
if (domain === 'all'|| domain === 'draft') {
|
|
121
121
|
state.elements = snapShot.manager.elements;
|
|
122
122
|
// state.layoutData = snapShot.manager.layoutData
|
|
123
123
|
|