ninegrid2 6.684.0 → 6.685.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.
@@ -121182,7 +121182,38 @@ class nxSplitter extends HTMLElement {
121182
121182
  console.log(el);
121183
121183
  el.addEventListener("mousedown", e => this.#startDrag(e));
121184
121184
  });
121185
- }
121185
+
121186
+ this.#prepareLayout();
121187
+ };
121188
+
121189
+ #prepareLayout = () => {
121190
+ const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
121191
+ const prev = this.previousElementSibling;
121192
+ const next = this.nextElementSibling;
121193
+ const parent = this.parentElement;
121194
+
121195
+ if (!prev || !next || !parent) return;
121196
+
121197
+ const parentRect = parent.getBoundingClientRect();
121198
+ const total = this.#mode === "h" ? parentRect.width : parentRect.height;
121199
+ const available = total - splitterSize;
121200
+ const eachSize = available / 2;
121201
+
121202
+ if (this.#mode === "h") {
121203
+ prev.style.width = `${eachSize}px`;
121204
+
121205
+ // ✔ 정확하게 마지막 splitter일 때만 next 조정
121206
+ if (this.#isLastSplitter()) {
121207
+ next.style.width = `${eachSize}px`;
121208
+ }
121209
+ } else {
121210
+ prev.style.height = `${eachSize}px`;
121211
+
121212
+ if (this.#isLastSplitter()) {
121213
+ next.style.height = `${eachSize}px`;
121214
+ }
121215
+ }
121216
+ };
121186
121217
  }
121187
121218
 
121188
121219
  customElements.define("nx-splitter", nxSplitter);
@@ -121178,7 +121178,38 @@ class nxSplitter extends HTMLElement {
121178
121178
  console.log(el);
121179
121179
  el.addEventListener("mousedown", e => this.#startDrag(e));
121180
121180
  });
121181
- }
121181
+
121182
+ this.#prepareLayout();
121183
+ };
121184
+
121185
+ #prepareLayout = () => {
121186
+ const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
121187
+ const prev = this.previousElementSibling;
121188
+ const next = this.nextElementSibling;
121189
+ const parent = this.parentElement;
121190
+
121191
+ if (!prev || !next || !parent) return;
121192
+
121193
+ const parentRect = parent.getBoundingClientRect();
121194
+ const total = this.#mode === "h" ? parentRect.width : parentRect.height;
121195
+ const available = total - splitterSize;
121196
+ const eachSize = available / 2;
121197
+
121198
+ if (this.#mode === "h") {
121199
+ prev.style.width = `${eachSize}px`;
121200
+
121201
+ // ✔ 정확하게 마지막 splitter일 때만 next 조정
121202
+ if (this.#isLastSplitter()) {
121203
+ next.style.width = `${eachSize}px`;
121204
+ }
121205
+ } else {
121206
+ prev.style.height = `${eachSize}px`;
121207
+
121208
+ if (this.#isLastSplitter()) {
121209
+ next.style.height = `${eachSize}px`;
121210
+ }
121211
+ }
121212
+ };
121182
121213
  }
121183
121214
 
121184
121215
  customElements.define("nx-splitter", nxSplitter);
@@ -137,7 +137,38 @@ class nxSplitter extends HTMLElement {
137
137
  console.log(el);
138
138
  el.addEventListener("mousedown", e => this.#startDrag(e));
139
139
  });
140
- }
140
+
141
+ this.#prepareLayout();
142
+ };
143
+
144
+ #prepareLayout = () => {
145
+ const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
146
+ const prev = this.previousElementSibling;
147
+ const next = this.nextElementSibling;
148
+ const parent = this.parentElement;
149
+
150
+ if (!prev || !next || !parent) return;
151
+
152
+ const parentRect = parent.getBoundingClientRect();
153
+ const total = this.#mode === "h" ? parentRect.width : parentRect.height;
154
+ const available = total - splitterSize;
155
+ const eachSize = available / 2;
156
+
157
+ if (this.#mode === "h") {
158
+ prev.style.width = `${eachSize}px`;
159
+
160
+ // ✔ 정확하게 마지막 splitter일 때만 next 조정
161
+ if (this.#isLastSplitter()) {
162
+ next.style.width = `${eachSize}px`;
163
+ }
164
+ } else {
165
+ prev.style.height = `${eachSize}px`;
166
+
167
+ if (this.#isLastSplitter()) {
168
+ next.style.height = `${eachSize}px`;
169
+ }
170
+ }
171
+ };
141
172
  }
142
173
 
143
174
  customElements.define("nx-splitter", nxSplitter);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.684.0",
4
+ "version": "6.685.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -137,7 +137,38 @@ class nxSplitter extends HTMLElement {
137
137
  console.log(el);
138
138
  el.addEventListener("mousedown", e => this.#startDrag(e));
139
139
  });
140
- }
140
+
141
+ this.#prepareLayout();
142
+ };
143
+
144
+ #prepareLayout = () => {
145
+ const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
146
+ const prev = this.previousElementSibling;
147
+ const next = this.nextElementSibling;
148
+ const parent = this.parentElement;
149
+
150
+ if (!prev || !next || !parent) return;
151
+
152
+ const parentRect = parent.getBoundingClientRect();
153
+ const total = this.#mode === "h" ? parentRect.width : parentRect.height;
154
+ const available = total - splitterSize;
155
+ const eachSize = available / 2;
156
+
157
+ if (this.#mode === "h") {
158
+ prev.style.width = `${eachSize}px`;
159
+
160
+ // ✔ 정확하게 마지막 splitter일 때만 next 조정
161
+ if (this.#isLastSplitter()) {
162
+ next.style.width = `${eachSize}px`;
163
+ }
164
+ } else {
165
+ prev.style.height = `${eachSize}px`;
166
+
167
+ if (this.#isLastSplitter()) {
168
+ next.style.height = `${eachSize}px`;
169
+ }
170
+ }
171
+ };
141
172
  }
142
173
 
143
174
  customElements.define("nx-splitter", nxSplitter);