polarvo-layout 1.0.36 → 1.0.37

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.36",
3
+ "version": "1.0.37",
4
4
  "type": "module",
5
5
  "author": "unigence <unigencelab@gmail.com>",
6
6
  "repository": {
@@ -7,7 +7,7 @@
7
7
  :polarvo="props.polarvo"
8
8
  :sectionKey="props.sectionKey"
9
9
  ></FreeItem>
10
-
10
+
11
11
  <!-- 오버레이 -->
12
12
  <div v-if="activeEditMode" class="absolute inset-0 bg-black opacity-50"></div>
13
13
 
@@ -68,7 +68,8 @@ const selectedElement = inject('selectedElement');
68
68
  const activeEditMode = inject('activeEditMode');
69
69
 
70
70
  let _isElementSwitching = false;
71
- import { omit, cloneDeep } from 'lodash-es';
71
+ import { omit, cloneDeep, debounce } from 'lodash-es';
72
+
72
73
  watch(
73
74
  () => activeElement.value?.id,
74
75
  (newId, oldId) => {
@@ -83,7 +84,6 @@ watch(
83
84
 
84
85
  // activeElement 바뀌면 편집 모드 해제
85
86
  activeEditMode.value = false;
86
-
87
87
  },
88
88
  );
89
89
 
@@ -68,11 +68,11 @@ const filteredElements = computed(() => {
68
68
  watch(
69
69
  () => filteredElements.value,
70
70
  () => {
71
- debouncedUpdate();
71
+ debouncedUpdateMergedData();
72
72
  },
73
73
  { deep: true },
74
74
  );
75
- const debouncedUpdate = debounce(() => {
75
+ const debouncedUpdateMergedData = debounce(() => {
76
76
  setMergedData();
77
77
  // gridRows 업데이트
78
78
  }, 10);
@@ -132,7 +132,7 @@ watch(
132
132
  _isElementSwitching = false;
133
133
  return;
134
134
  }
135
- updateActiveElement(selectedElement.value?.id, newElement);
135
+ updateActiveElement(selectedElement.value?.id, newElement);
136
136
  },
137
137
  { deep: true },
138
138
  );
@@ -11,6 +11,7 @@ const props = defineProps({
11
11
  default: 'free',
12
12
  },
13
13
  });
14
+
14
15
  </script>
15
16
 
16
17
  <style scoped>
@@ -38,6 +38,9 @@ class EngineManager {
38
38
 
39
39
  this._subscriptions = [];
40
40
  this._initialized = false;
41
+
42
+ this._beforeUnloadHandler = () => this.saveSession();
43
+ window.addEventListener('beforeunload', this._beforeUnloadHandler);
41
44
  }
42
45
 
43
46
  /** activeSection 데이터 반환
@@ -140,6 +143,15 @@ class EngineManager {
140
143
  this.eventBus.emit('system:restoredState', { domain, state });
141
144
  }
142
145
 
146
+ saveSession() {
147
+ const snapshot = {
148
+ manager: this.getState(),
149
+ layout: this.getEngine('layout')?.getState() || null,
150
+ display: this.getEngine('display')?.getState() || null,
151
+ };
152
+ sessionStorage.setItem('polarvo-session', JSON.stringify(snapshot));
153
+ }
154
+
143
155
  /** [내부함수] activeSection의 설정값 업데이트
144
156
  * @param {string} type - 설정 타입 (mode, config)
145
157
  * @param {object} updates - 업데이트할 설정 값 객체
@@ -734,12 +746,7 @@ class EngineManager {
734
746
 
735
747
  // 가장 최신 상태를 세션 스토리지에 저장 (새로고침 대비)
736
748
  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));
749
+ this.saveSession();
743
750
  });
744
751
 
745
752
  // 모든 연결 설정 완료 후 초기화 완료 이벤트 발행
@@ -814,6 +821,8 @@ class EngineManager {
814
821
  destroy() {
815
822
  console.log('[EngineManager] 엔진 매니저 삭제 시작');
816
823
 
824
+ window.removeEventListener('beforeunload', this._beforeUnloadHandler);
825
+
817
826
  // 모든 구독 해제
818
827
  this._subscriptions.forEach((unsubscribe) => {
819
828
  if (typeof unsubscribe === 'function') {