ninegrid2 6.685.0 → 6.687.0

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.
@@ -121127,29 +121127,33 @@ class nxSplitter extends HTMLElement {
121127
121127
  };
121128
121128
 
121129
121129
 
121130
- const onUp = e => {
121130
+ const onUp = (e) => {
121131
121131
  window.removeEventListener("mousemove", onMove);
121132
121132
  window.removeEventListener("mouseup", onUp);
121133
121133
  dragBar.remove();
121134
121134
 
121135
121135
  const parentRect = parent.getBoundingClientRect();
121136
-
121137
- // 현재 드래그 위치 계산 (부모 기준)
121138
- const position = (this.#mode === "h")
121136
+ const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
121137
+ const position = this.#mode === "h"
121139
121138
  ? e.clientX - parentRect.left
121140
121139
  : e.clientY - parentRect.top;
121141
121140
 
121141
+ const prev = this.previousElementSibling;
121142
+ const next = this.nextElementSibling;
121143
+ if (!prev || !next) return;
121144
+
121145
+ // 📌 리사이즈 적용: 사용자 의도에 따라 prev, next 모두 업데이트
121142
121146
  if (this.#mode === "h") {
121143
121147
  prev.style.width = `${position}px`;
121144
- next.style.width = `${parentRect.width - position - this.offsetWidth}px`;
121145
- //next.style.width = `100%`;
121148
+ next.style.width = `${parentRect.width - position - splitterSize}px`;
121146
121149
  } else {
121147
121150
  prev.style.height = `${position}px`;
121148
- next.style.height = `${parentRect.height - position - this.offsetHeight}px`;
121151
+ next.style.height = `${parentRect.height - position - splitterSize}px`;
121149
121152
  }
121150
121153
  };
121151
121154
 
121152
121155
 
121156
+
121153
121157
  window.addEventListener("mousemove", onMove);
121154
121158
  window.addEventListener("mouseup", onUp);
121155
121159
  };
@@ -121187,6 +121191,15 @@ class nxSplitter extends HTMLElement {
121187
121191
  };
121188
121192
 
121189
121193
  #prepareLayout = () => {
121194
+ const isLastSplitter = () => {
121195
+ const parent = this.parentElement;
121196
+ if (!parent) return false;
121197
+
121198
+ const allSplitters = [...parent.querySelectorAll("nx-splitter")];
121199
+ return allSplitters.at(-1) === this;
121200
+ };
121201
+
121202
+
121190
121203
  const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
121191
121204
  const prev = this.previousElementSibling;
121192
121205
  const next = this.nextElementSibling;
@@ -121203,13 +121216,13 @@ class nxSplitter extends HTMLElement {
121203
121216
  prev.style.width = `${eachSize}px`;
121204
121217
 
121205
121218
  // ✔ 정확하게 마지막 splitter일 때만 next 조정
121206
- if (this.#isLastSplitter()) {
121219
+ if (isLastSplitter()) {
121207
121220
  next.style.width = `${eachSize}px`;
121208
121221
  }
121209
121222
  } else {
121210
121223
  prev.style.height = `${eachSize}px`;
121211
121224
 
121212
- if (this.#isLastSplitter()) {
121225
+ if (isLastSplitter()) {
121213
121226
  next.style.height = `${eachSize}px`;
121214
121227
  }
121215
121228
  }
@@ -121123,29 +121123,33 @@ class nxSplitter extends HTMLElement {
121123
121123
  };
121124
121124
 
121125
121125
 
121126
- const onUp = e => {
121126
+ const onUp = (e) => {
121127
121127
  window.removeEventListener("mousemove", onMove);
121128
121128
  window.removeEventListener("mouseup", onUp);
121129
121129
  dragBar.remove();
121130
121130
 
121131
121131
  const parentRect = parent.getBoundingClientRect();
121132
-
121133
- // 현재 드래그 위치 계산 (부모 기준)
121134
- const position = (this.#mode === "h")
121132
+ const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
121133
+ const position = this.#mode === "h"
121135
121134
  ? e.clientX - parentRect.left
121136
121135
  : e.clientY - parentRect.top;
121137
121136
 
121137
+ const prev = this.previousElementSibling;
121138
+ const next = this.nextElementSibling;
121139
+ if (!prev || !next) return;
121140
+
121141
+ // 📌 리사이즈 적용: 사용자 의도에 따라 prev, next 모두 업데이트
121138
121142
  if (this.#mode === "h") {
121139
121143
  prev.style.width = `${position}px`;
121140
- next.style.width = `${parentRect.width - position - this.offsetWidth}px`;
121141
- //next.style.width = `100%`;
121144
+ next.style.width = `${parentRect.width - position - splitterSize}px`;
121142
121145
  } else {
121143
121146
  prev.style.height = `${position}px`;
121144
- next.style.height = `${parentRect.height - position - this.offsetHeight}px`;
121147
+ next.style.height = `${parentRect.height - position - splitterSize}px`;
121145
121148
  }
121146
121149
  };
121147
121150
 
121148
121151
 
121152
+
121149
121153
  window.addEventListener("mousemove", onMove);
121150
121154
  window.addEventListener("mouseup", onUp);
121151
121155
  };
@@ -121183,6 +121187,15 @@ class nxSplitter extends HTMLElement {
121183
121187
  };
121184
121188
 
121185
121189
  #prepareLayout = () => {
121190
+ const isLastSplitter = () => {
121191
+ const parent = this.parentElement;
121192
+ if (!parent) return false;
121193
+
121194
+ const allSplitters = [...parent.querySelectorAll("nx-splitter")];
121195
+ return allSplitters.at(-1) === this;
121196
+ };
121197
+
121198
+
121186
121199
  const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
121187
121200
  const prev = this.previousElementSibling;
121188
121201
  const next = this.nextElementSibling;
@@ -121199,13 +121212,13 @@ class nxSplitter extends HTMLElement {
121199
121212
  prev.style.width = `${eachSize}px`;
121200
121213
 
121201
121214
  // ✔ 정확하게 마지막 splitter일 때만 next 조정
121202
- if (this.#isLastSplitter()) {
121215
+ if (isLastSplitter()) {
121203
121216
  next.style.width = `${eachSize}px`;
121204
121217
  }
121205
121218
  } else {
121206
121219
  prev.style.height = `${eachSize}px`;
121207
121220
 
121208
- if (this.#isLastSplitter()) {
121221
+ if (isLastSplitter()) {
121209
121222
  next.style.height = `${eachSize}px`;
121210
121223
  }
121211
121224
  }
@@ -82,29 +82,33 @@ class nxSplitter extends HTMLElement {
82
82
  };
83
83
 
84
84
 
85
- const onUp = e => {
85
+ const onUp = (e) => {
86
86
  window.removeEventListener("mousemove", onMove);
87
87
  window.removeEventListener("mouseup", onUp);
88
88
  dragBar.remove();
89
89
 
90
90
  const parentRect = parent.getBoundingClientRect();
91
-
92
- // 현재 드래그 위치 계산 (부모 기준)
93
- const position = (this.#mode === "h")
91
+ const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
92
+ const position = this.#mode === "h"
94
93
  ? e.clientX - parentRect.left
95
94
  : e.clientY - parentRect.top;
96
95
 
96
+ const prev = this.previousElementSibling;
97
+ const next = this.nextElementSibling;
98
+ if (!prev || !next) return;
99
+
100
+ // 📌 리사이즈 적용: 사용자 의도에 따라 prev, next 모두 업데이트
97
101
  if (this.#mode === "h") {
98
102
  prev.style.width = `${position}px`;
99
- next.style.width = `${parentRect.width - position - this.offsetWidth}px`;
100
- //next.style.width = `100%`;
103
+ next.style.width = `${parentRect.width - position - splitterSize}px`;
101
104
  } else {
102
105
  prev.style.height = `${position}px`;
103
- next.style.height = `${parentRect.height - position - this.offsetHeight}px`;
106
+ next.style.height = `${parentRect.height - position - splitterSize}px`;
104
107
  }
105
108
  };
106
109
 
107
110
 
111
+
108
112
  window.addEventListener("mousemove", onMove);
109
113
  window.addEventListener("mouseup", onUp);
110
114
  };
@@ -142,6 +146,15 @@ class nxSplitter extends HTMLElement {
142
146
  };
143
147
 
144
148
  #prepareLayout = () => {
149
+ const isLastSplitter = () => {
150
+ const parent = this.parentElement;
151
+ if (!parent) return false;
152
+
153
+ const allSplitters = [...parent.querySelectorAll("nx-splitter")];
154
+ return allSplitters.at(-1) === this;
155
+ };
156
+
157
+
145
158
  const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
146
159
  const prev = this.previousElementSibling;
147
160
  const next = this.nextElementSibling;
@@ -158,13 +171,13 @@ class nxSplitter extends HTMLElement {
158
171
  prev.style.width = `${eachSize}px`;
159
172
 
160
173
  // ✔ 정확하게 마지막 splitter일 때만 next 조정
161
- if (this.#isLastSplitter()) {
174
+ if (isLastSplitter()) {
162
175
  next.style.width = `${eachSize}px`;
163
176
  }
164
177
  } else {
165
178
  prev.style.height = `${eachSize}px`;
166
179
 
167
- if (this.#isLastSplitter()) {
180
+ if (isLastSplitter()) {
168
181
  next.style.height = `${eachSize}px`;
169
182
  }
170
183
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.685.0",
4
+ "version": "6.687.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -82,29 +82,33 @@ class nxSplitter extends HTMLElement {
82
82
  };
83
83
 
84
84
 
85
- const onUp = e => {
85
+ const onUp = (e) => {
86
86
  window.removeEventListener("mousemove", onMove);
87
87
  window.removeEventListener("mouseup", onUp);
88
88
  dragBar.remove();
89
89
 
90
90
  const parentRect = parent.getBoundingClientRect();
91
-
92
- // 현재 드래그 위치 계산 (부모 기준)
93
- const position = (this.#mode === "h")
91
+ const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
92
+ const position = this.#mode === "h"
94
93
  ? e.clientX - parentRect.left
95
94
  : e.clientY - parentRect.top;
96
95
 
96
+ const prev = this.previousElementSibling;
97
+ const next = this.nextElementSibling;
98
+ if (!prev || !next) return;
99
+
100
+ // 📌 리사이즈 적용: 사용자 의도에 따라 prev, next 모두 업데이트
97
101
  if (this.#mode === "h") {
98
102
  prev.style.width = `${position}px`;
99
- next.style.width = `${parentRect.width - position - this.offsetWidth}px`;
100
- //next.style.width = `100%`;
103
+ next.style.width = `${parentRect.width - position - splitterSize}px`;
101
104
  } else {
102
105
  prev.style.height = `${position}px`;
103
- next.style.height = `${parentRect.height - position - this.offsetHeight}px`;
106
+ next.style.height = `${parentRect.height - position - splitterSize}px`;
104
107
  }
105
108
  };
106
109
 
107
110
 
111
+
108
112
  window.addEventListener("mousemove", onMove);
109
113
  window.addEventListener("mouseup", onUp);
110
114
  };
@@ -142,6 +146,15 @@ class nxSplitter extends HTMLElement {
142
146
  };
143
147
 
144
148
  #prepareLayout = () => {
149
+ const isLastSplitter = () => {
150
+ const parent = this.parentElement;
151
+ if (!parent) return false;
152
+
153
+ const allSplitters = [...parent.querySelectorAll("nx-splitter")];
154
+ return allSplitters.at(-1) === this;
155
+ };
156
+
157
+
145
158
  const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
146
159
  const prev = this.previousElementSibling;
147
160
  const next = this.nextElementSibling;
@@ -158,13 +171,13 @@ class nxSplitter extends HTMLElement {
158
171
  prev.style.width = `${eachSize}px`;
159
172
 
160
173
  // ✔ 정확하게 마지막 splitter일 때만 next 조정
161
- if (this.#isLastSplitter()) {
174
+ if (isLastSplitter()) {
162
175
  next.style.width = `${eachSize}px`;
163
176
  }
164
177
  } else {
165
178
  prev.style.height = `${eachSize}px`;
166
179
 
167
- if (this.#isLastSplitter()) {
180
+ if (isLastSplitter()) {
168
181
  next.style.height = `${eachSize}px`;
169
182
  }
170
183
  }