polarvo-layout 1.0.21 → 1.0.22

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.21",
3
+ "version": "1.0.22",
4
4
  "type": "module",
5
5
  "author": "unigence <unigencelab@gmail.com>",
6
6
  "repository": {
@@ -2,8 +2,9 @@
2
2
  <div
3
3
  :id="preview ? 'previewLayout' : 'baseLayout'"
4
4
  class="grid h-full p-2 bg-transparent rounded-lg"
5
- :class="[layoutType + '-layout', `grid-cols-${gridNumber?.column}`, 'mb-4' ? layoutType === 'three-column-split' : '']"
5
+ :class="[layoutType + '-layout', `grid-cols-${gridNumber?.column}`, { 'mb-4': layoutType === 'three-column-split' }]"
6
6
  :style="getBaseStyle"
7
+ @contextmenu.prevent
7
8
  >
8
9
  <template v-for="(section, key) in layoutData" :key="key">
9
10
  <PolarLayout
@@ -50,9 +51,9 @@ import FreeLayout from './FreeLayout.vue';
50
51
  import GridLayout from './GridLayout.vue';
51
52
 
52
53
  // 우클릭 방지
53
- window.oncontextmenu = () => {
54
- return false;
55
- };
54
+ // window.oncontextmenu = () => {
55
+ // return false;
56
+ // };
56
57
 
57
58
  const emit = defineEmits(['click:section']);
58
59
  const props = defineProps({
@@ -67,7 +68,7 @@ const props = defineProps({
67
68
  });
68
69
 
69
70
  const layoutType = computed(() => {
70
- if (layoutName.value.eng == null) return 'no-split';
71
+ if (layoutName.value.eng === null) return 'no-split';
71
72
  return layoutName.value.eng
72
73
  .replace(/([A-Z])/g, '-$1')
73
74
  .toLowerCase()
@@ -78,16 +79,16 @@ const { layoutName, layoutData, activeSection, gapSize, gridNumber, gridRatio }
78
79
 
79
80
  const getBaseStyle = computed(() => {
80
81
  return {
81
- gridTemplateColumns: gridRatio.value?.column.map((ratio) => `${ratio}%`).join(' '),
82
- gridTemplateRows: gridRatio.value?.row.map((ratio) => `${ratio}%`).join(' '),
83
- marginRight: layoutType.value === 'no-split' ? '0' : layoutType.value === 'three-column-split' ? '14px' : '8px',
82
+ // gridTemplateColumns: gridRatio.value?.column.map((ratio) => `${ratio}%`).join(' '),
83
+ // gridTemplateRows: gridRatio.value?.row.map((ratio) => `${ratio}%`).join(' '),
84
+ // marginRight: layoutType.value === 'no-split' ? '0' : layoutType.value === 'three-column-split' ? '14px' : '8px',
84
85
  gap: `${gapSize.value}px`,
85
86
  };
86
87
  });
87
88
 
88
89
  const getSectionStyle = (section) => ({
89
- '--grid-columns': section.config?.gridColumns || 3,
90
- '--grid-gap': `${section.config?.gridGap || 5}px`,
90
+ '--grid-columns': section.config?.gridColumns ?? 3,
91
+ '--grid-gap': `${section.config?.gridGap ?? 5}px`,
91
92
  position: 'relative',
92
93
  });
93
94
 
@@ -95,7 +96,7 @@ const getSectionClass = (key, section) => ({
95
96
  [key]: true,
96
97
  [section.mode]: true,
97
98
  'section-active': activeSection.value === key,
98
- disabled: activeSection.value != key && !props.preview,
99
+ disabled: activeSection.value !== key && !props.preview,
99
100
  });
100
101
  </script>
101
102
 
@@ -5,7 +5,7 @@
5
5
  <div class="grid gap-1 grid-cols-1 mx-1 mb-3">
6
6
  <div
7
7
  class="item flex flex-col items-center gap-1 p-2 border border-gray-200 rounded-md bg-white cursor-pointer hover:border-gray-400"
8
- :class="{ active: layoutName.eng == 'NoSplit' }"
8
+ :class="{ active: layoutName.eng === 'NoSplit' }"
9
9
  @click="setLayoutName('NoSplit')"
10
10
  >
11
11
  <component class="text-gray-600" :is="layoutSource.noSplit.icon"></component>
@@ -18,7 +18,7 @@
18
18
  v-for="(layout, key) in layoutSource.split"
19
19
  :key="key"
20
20
  class="item flex flex-col items-center gap-1 p-2 border border-gray-200 rounded-md bg-white cursor-pointer hover:border-gray-400"
21
- :class="{ active: layoutName.eng == key }"
21
+ :class="{ active: layoutName.eng === key }"
22
22
  @click="setLayoutName(key)"
23
23
  >
24
24
  <component class="text-gray-600" :is="layout.icon"></component>
@@ -45,8 +45,7 @@ watch(
45
45
  () => layoutName.value,
46
46
  () => {
47
47
  emits('click:layout');
48
- },
49
- { deep: true }
48
+ }
50
49
  );
51
50
  </script>
52
51
 
@@ -10,7 +10,7 @@
10
10
  </button>
11
11
  </div>
12
12
 
13
- <div v-if="layoutName.eng != 'NoSplit'">
13
+ <div v-if="layoutName.eng !== 'NoSplit'">
14
14
  <h5 class="mt-4 block text-sm font-bold text-gray-600">레이아웃 설정</h5>
15
15
  <div class="mt-2 border border-gray-200 rounded-md bg-gray-100">
16
16
  <div class="px-4 py-2">
@@ -21,7 +21,7 @@
21
21
  type="number"
22
22
  id="section-gap"
23
23
  :value="gapSize"
24
- @change="setGapSize($event.target.value)"
24
+ @change="handleGapSize($event)"
25
25
  />
26
26
  </div>
27
27
  </div>
@@ -91,10 +91,25 @@ function handleGridRatio(type, index, event) {
91
91
  return;
92
92
  }
93
93
 
94
- const { result, message } = setRatio(type, index, value)
94
+ const { result, message } = setRatio(type, index, Number(value));
95
95
 
96
96
  if (!result) {
97
- alert(message)
97
+ alert(message);
98
+ }
99
+ }
100
+
101
+ function handleGapSize(event) {
102
+ const value = event.target.value;
103
+ if (Number(value) < 0 || isNaN(Number(value))) {
104
+ alert('갭 크기는 0 이상의 숫자여야 합니다.');
105
+ event.target.value = gapSize.value; // 원래 값으로 복원
106
+ return;
107
+ }
108
+
109
+ const { result, message } = setGapSize(Number(value));
110
+
111
+ if (!result) {
112
+ alert(message);
98
113
  }
99
114
  }
100
115
  </script>
@@ -267,14 +267,14 @@ class LayoutEngine {
267
267
  * @param {number} size - 새로운 갭 사이즈
268
268
  */
269
269
  setGapSize(size) {
270
- if (Number(size) < 0 || isNaN(Number(size))) return;
271
-
272
270
  this.gapSize = size;
273
271
 
274
272
  this.eventBus.emit('layout:updateGapSize', {
275
273
  $gapSize: this.gapSize,
276
274
  timestamp: Date.now(),
277
275
  });
276
+
277
+ return { result: true, message: '갭 사이즈가 성공적으로 변경되었습니다.' };
278
278
  }
279
279
 
280
280
  /** 섹션 비율 변경
@@ -177,7 +177,7 @@ function useLayout(api) {
177
177
 
178
178
  const setGapSize = (size) => {
179
179
  try {
180
- api.layout.setGapSize(size);
180
+ return api.layout.setGapSize(size);
181
181
  } catch (error) {
182
182
  console.error('[useLayout] setGapSize 실행 중 오류 발생:', error);
183
183
  }