polarvo-layout 1.0.10 → 1.0.12
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/IconBar/IconBar.vue +9 -0
- package/src/components/Layout/FreeLayout.vue +4 -1
- package/src/components/Layout/GridLayout.vue +18 -7
- package/src/core/engines/GridDropEngine.js +8 -5
- package/src/core/managers/EngineManager.js +1 -1
- package/src/library/GridDropLibrary.js +4 -0
package/package.json
CHANGED
|
@@ -43,6 +43,15 @@
|
|
|
43
43
|
<font-awesome-icon :icon="['fas', 'shield-halved']" class="text-xl"/>
|
|
44
44
|
<div class="text-xs text-center col-span-1 w-max">정책설정</div>
|
|
45
45
|
</div>
|
|
46
|
+
<div
|
|
47
|
+
class="icon-wrapper text-2xl text-gray-400 p-2"
|
|
48
|
+
title="인쇄설정"
|
|
49
|
+
:class="{ active: activeMenu === 'printList' }"
|
|
50
|
+
@click="polarvo.display.setActiveMenu('printList')"
|
|
51
|
+
>
|
|
52
|
+
<font-awesome-icon :icon="['fas', 'print']" class="text-xl"/>
|
|
53
|
+
<div class="text-xs text-center col-span-1 w-max">인쇄설정</div>
|
|
54
|
+
</div>
|
|
46
55
|
</div>
|
|
47
56
|
<div id="divider" class="h-px bg-gray-200 w-8"></div>
|
|
48
57
|
<div class="icon-group">
|
|
@@ -34,9 +34,11 @@
|
|
|
34
34
|
</div>
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|
|
37
|
+
|
|
37
38
|
<component
|
|
38
39
|
:is="dynamicComponent(item.type)"
|
|
39
40
|
:id="`${sectionKey}-${index}`"
|
|
41
|
+
:rootId="item.id"
|
|
40
42
|
:ref="(el) => setComponentRef(el, item.id)"
|
|
41
43
|
v-bind="item"
|
|
42
44
|
class="hover:opacity-80"
|
|
@@ -124,8 +126,8 @@ function setComponentRef(el, elementId) {
|
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
const selectedElement = inject('selectedElement');
|
|
127
|
-
|
|
128
129
|
const activeEditMode = inject('activeEditMode');
|
|
130
|
+
|
|
129
131
|
function toggleEditMode() {
|
|
130
132
|
activeEditMode.value = !activeEditMode.value;
|
|
131
133
|
}
|
|
@@ -159,6 +161,7 @@ watch(
|
|
|
159
161
|
|
|
160
162
|
onMounted(() => {
|
|
161
163
|
props.polarvo.components.register('sections', props.sectionKey, getCurrentInstance());
|
|
164
|
+
activeEditMode.value = false;
|
|
162
165
|
});
|
|
163
166
|
|
|
164
167
|
onUnmounted(() => {
|
|
@@ -5,15 +5,12 @@
|
|
|
5
5
|
:key="index"
|
|
6
6
|
:id="item.id"
|
|
7
7
|
class="relative bg-gray-200"
|
|
8
|
-
:class="{
|
|
9
|
-
'z-50': activeElement?.id === item.id,
|
|
10
|
-
'bg-white border-2 border-blue-400': activeElement?.id === item.id,
|
|
11
|
-
}"
|
|
12
8
|
:style="getElementStyle('element', item)"
|
|
9
|
+
:class="{ 'z-50': item.id === activeId, 'bg-white border-2 border-blue-400': item.id === activeId }"
|
|
13
10
|
@mousedown.stop="activeEditMode ? null : startDrag($event, item.id)"
|
|
14
11
|
>
|
|
15
12
|
<!-- 리사이즈 핸들 -->
|
|
16
|
-
<div v-if="
|
|
13
|
+
<div v-if="item.id === activeId">
|
|
17
14
|
<div class="absolute w-4 h-4 bottom-0 right-0 bg-blue-400 z-10 cursor-se-resize" @mousedown="startResize($event, item.id)"></div>
|
|
18
15
|
<div class="flex gap-1 m-1">
|
|
19
16
|
<!-- 잠금 토글-->
|
|
@@ -36,6 +33,7 @@
|
|
|
36
33
|
<component
|
|
37
34
|
:is="dynamicComponent(item.type)"
|
|
38
35
|
:id="`${sectionKey}-${index}`"
|
|
36
|
+
:rootId="item.id"
|
|
39
37
|
:ref="(el) => setComponentRef(el, item.id)"
|
|
40
38
|
v-bind="item"
|
|
41
39
|
class="hover:opacity-80"
|
|
@@ -68,7 +66,19 @@
|
|
|
68
66
|
import LockIcon from '../../icons/action/LockIcon.vue';
|
|
69
67
|
import UnlockIcon from '../../icons/action/UnlockIcon.vue';
|
|
70
68
|
|
|
71
|
-
import {
|
|
69
|
+
import {
|
|
70
|
+
nextTick,
|
|
71
|
+
toRefs,
|
|
72
|
+
defineAsyncComponent,
|
|
73
|
+
markRaw,
|
|
74
|
+
getCurrentInstance,
|
|
75
|
+
onMounted,
|
|
76
|
+
onUnmounted,
|
|
77
|
+
inject,
|
|
78
|
+
watch,
|
|
79
|
+
toRaw,
|
|
80
|
+
computed,
|
|
81
|
+
} from 'vue';
|
|
72
82
|
const emit = defineEmits(['click:element']);
|
|
73
83
|
const props = defineProps({
|
|
74
84
|
polarvo: {
|
|
@@ -91,7 +101,7 @@ const props = defineProps({
|
|
|
91
101
|
|
|
92
102
|
const { setActiveDesign } = props.polarvo.display;
|
|
93
103
|
const { updateActiveElement } = props.polarvo.layout;
|
|
94
|
-
const { elements, emptyData, activeCell, activeElement } = toRefs(props.polarvo.gridDrop.state);
|
|
104
|
+
const { elements, emptyData, activeId, activeCell, activeElement } = toRefs(props.polarvo.gridDrop.state);
|
|
95
105
|
const { getElementStyle, setActiveElement, toggleLock, startDrag, detectHoverCell, startResize } = props.polarvo.gridDrop;
|
|
96
106
|
const filteredElements = computed(() => {
|
|
97
107
|
return elements.value.filter((el) => props.elementIds?.includes(el.id) && el.section === props.sectionKey);
|
|
@@ -155,6 +165,7 @@ watch(
|
|
|
155
165
|
|
|
156
166
|
onMounted(() => {
|
|
157
167
|
props.polarvo.components.register('sections', props.sectionKey, getCurrentInstance());
|
|
168
|
+
activeEditMode.value = false;
|
|
158
169
|
});
|
|
159
170
|
|
|
160
171
|
onUnmounted(() => {
|
|
@@ -108,9 +108,15 @@ class GridDropEngine {
|
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
this._subscribe('system:requestUpdateActiveElement', ({ elements }) => {
|
|
111
|
+
this._subscribe('system:requestUpdateActiveElement', ({ elements, elementId }) => {
|
|
112
112
|
this._elements = elements;
|
|
113
113
|
this._elementsUpdate = true;
|
|
114
|
+
this.setActiveElement(this._elements.find((x) => x.id === elementId) || null);
|
|
115
|
+
|
|
116
|
+
this.eventBus.emit('gridDrop:requestUpdateActiveElement', {
|
|
117
|
+
elements: cloneDeep(this.gridElements),
|
|
118
|
+
timestamp: Date.now(),
|
|
119
|
+
});
|
|
114
120
|
});
|
|
115
121
|
|
|
116
122
|
this._subscribe('system:requestUpdateElements', ({ elements }) => {
|
|
@@ -291,6 +297,7 @@ class GridDropEngine {
|
|
|
291
297
|
this._elementsUpdate = true;
|
|
292
298
|
}
|
|
293
299
|
|
|
300
|
+
|
|
294
301
|
this.eventBus.emit('gridDrop:setActiveElement', {
|
|
295
302
|
action: action,
|
|
296
303
|
activeElement: this._activeElement,
|
|
@@ -479,10 +486,6 @@ class GridDropEngine {
|
|
|
479
486
|
}
|
|
480
487
|
this.setActiveElement(element);
|
|
481
488
|
|
|
482
|
-
if (!this._activeElement) {
|
|
483
|
-
console.error('[GridDropEngine] 활성화된 아이템 정보를 찾을 수 없습니다.');
|
|
484
|
-
return false;
|
|
485
|
-
}
|
|
486
489
|
// 배치요소 잠겨 있으면 드래그/삭제 불가
|
|
487
490
|
if (this._activeElement.isLocked) return;
|
|
488
491
|
|
|
@@ -222,7 +222,7 @@ class EngineManager {
|
|
|
222
222
|
this._subscribe('layout:setLayoutName', ({ screenConfig }) => {
|
|
223
223
|
this._layoutData = screenConfig.layoutData;
|
|
224
224
|
this._dataUpdate = true;
|
|
225
|
-
this.setActiveSection(
|
|
225
|
+
this.setActiveSection('section1', true);
|
|
226
226
|
|
|
227
227
|
this.eventBus.emit('system:updateLayoutData', {
|
|
228
228
|
layoutData: cloneDeep(this._layoutData),
|
|
@@ -54,6 +54,10 @@ function useGridDrop(api) {
|
|
|
54
54
|
state.activeId = activeElement?.id ?? null;
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
_subscribe('gridDrop:requestUpdateActiveElement', ({ elements }) => {
|
|
58
|
+
state.elements = elements;
|
|
59
|
+
});
|
|
60
|
+
|
|
57
61
|
_subscribe('gridDrop:toggleLock', ({ elementId }) => {
|
|
58
62
|
const element = state.elements.find((el) => el.id === elementId);
|
|
59
63
|
if (element) {
|