ninegrid2 6.996.0 → 6.997.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.
@@ -121897,7 +121897,19 @@ customElements.define("nx-title", nxTitle);
121897
121897
 
121898
121898
  class NxLayout extends HTMLElement {
121899
121899
 
121900
+ #originalChildren;
121901
+
121902
+ constructor() {
121903
+ super();
121904
+ // constructor에서 원본 자식 요소를 저장합니다.
121905
+ // 이때는 아직 DOM에 추가되기 전이므로 children은 비어있습니다.
121906
+ // connectedCallback에서 다시 가져오는 방식이 더 안정적입니다.
121907
+ }
121908
+
121900
121909
  connectedCallback() {
121910
+ // 컴포넌트가 DOM에 추가된 후, 원본 자식 요소들을 저장합니다.
121911
+ // filter를 사용하여 nx-splitter를 제외합니다.
121912
+ this.#originalChildren = Array.from(this.children);
121901
121913
  this.#render();
121902
121914
  }
121903
121915
 
@@ -121926,7 +121938,6 @@ class NxLayout extends HTMLElement {
121926
121938
  const columnsLayout = (this.getAttribute('columns') || '1').split(',').map(Number);
121927
121939
  const numRows = columnsLayout.length;
121928
121940
 
121929
- // 메인 컨테이너의 CSS Grid 템플릿 설정
121930
121941
  let gridRows = '';
121931
121942
  for (let i = 0; i < numRows; i++) {
121932
121943
  gridRows += '1fr ';
@@ -121939,37 +121950,45 @@ class NxLayout extends HTMLElement {
121939
121950
  this.style.width = '100%';
121940
121951
  this.style.height = '100%';
121941
121952
  this.style.gridTemplateRows = gridRows.trim();
121942
- this.style.gridTemplateColumns = '1fr'; // 메인 그리드는 하나의 열만 갖도록 설정
121943
121953
 
121944
121954
  let childIndex = 0;
121945
- let gridRowOffset = 1;
121946
121955
 
121947
121956
  for (let row = 0; row < numRows; row++) {
121948
121957
  const numColumns = columnsLayout[row];
121949
121958
 
121950
- // 행의 패널과 가로 스플리터를 직접 배치
121951
- for (let col = 0; col < numColumns; col++) {
121959
+ const rowWrapper = document.createElement('div');
121960
+ rowWrapper.style.display = 'grid';
121961
+ rowWrapper.style.height = '100%';
121952
121962
 
121953
- console.log(numColumns, childIndex, children[childIndex]);
121963
+ let columnTemplate = '';
121964
+ for (let i = 0; i < numColumns; i++) {
121965
+ columnTemplate += '1fr ';
121966
+ if (i < numColumns - 1) {
121967
+ columnTemplate += '8px ';
121968
+ }
121969
+ }
121970
+ rowWrapper.style.gridTemplateColumns = columnTemplate.trim();
121954
121971
 
121972
+ for (let col = 0; col < numColumns; col++) {
121955
121973
  if (children[childIndex]) {
121956
121974
  const panel = children[childIndex];
121957
- panel.style.gridRow = `${gridRowOffset}`;
121958
- panel.style.gridColumn = `${col * 2 + 1}`;
121959
- this.appendChild(panel);
121975
+ rowWrapper.appendChild(panel);
121960
121976
  childIndex++;
121961
121977
  }
121962
-
121963
121978
  if (col < numColumns - 1) {
121964
121979
  const splitter = document.createElement('nx-splitter');
121965
121980
  splitter.setAttribute('direction', 'horizontal');
121966
- splitter.style.gridRow = `${gridRowOffset}`;
121967
- splitter.style.gridColumn = `${col * 2 + 2}`;
121968
- this.appendChild(splitter);
121981
+ rowWrapper.appendChild(splitter);
121969
121982
  }
121970
121983
  }
121971
121984
 
121972
- gridRowOffset += 2; // 다음 행으로 이동
121985
+ this.appendChild(rowWrapper);
121986
+
121987
+ if (row < numRows - 1) {
121988
+ const splitter = document.createElement('nx-splitter');
121989
+ splitter.setAttribute('direction', 'vertical');
121990
+ this.appendChild(splitter);
121991
+ }
121973
121992
  }
121974
121993
  }
121975
121994
  }
@@ -121893,7 +121893,19 @@ customElements.define("nx-title", nxTitle);
121893
121893
 
121894
121894
  class NxLayout extends HTMLElement {
121895
121895
 
121896
+ #originalChildren;
121897
+
121898
+ constructor() {
121899
+ super();
121900
+ // constructor에서 원본 자식 요소를 저장합니다.
121901
+ // 이때는 아직 DOM에 추가되기 전이므로 children은 비어있습니다.
121902
+ // connectedCallback에서 다시 가져오는 방식이 더 안정적입니다.
121903
+ }
121904
+
121896
121905
  connectedCallback() {
121906
+ // 컴포넌트가 DOM에 추가된 후, 원본 자식 요소들을 저장합니다.
121907
+ // filter를 사용하여 nx-splitter를 제외합니다.
121908
+ this.#originalChildren = Array.from(this.children);
121897
121909
  this.#render();
121898
121910
  }
121899
121911
 
@@ -121922,7 +121934,6 @@ class NxLayout extends HTMLElement {
121922
121934
  const columnsLayout = (this.getAttribute('columns') || '1').split(',').map(Number);
121923
121935
  const numRows = columnsLayout.length;
121924
121936
 
121925
- // 메인 컨테이너의 CSS Grid 템플릿 설정
121926
121937
  let gridRows = '';
121927
121938
  for (let i = 0; i < numRows; i++) {
121928
121939
  gridRows += '1fr ';
@@ -121935,37 +121946,45 @@ class NxLayout extends HTMLElement {
121935
121946
  this.style.width = '100%';
121936
121947
  this.style.height = '100%';
121937
121948
  this.style.gridTemplateRows = gridRows.trim();
121938
- this.style.gridTemplateColumns = '1fr'; // 메인 그리드는 하나의 열만 갖도록 설정
121939
121949
 
121940
121950
  let childIndex = 0;
121941
- let gridRowOffset = 1;
121942
121951
 
121943
121952
  for (let row = 0; row < numRows; row++) {
121944
121953
  const numColumns = columnsLayout[row];
121945
121954
 
121946
- // 행의 패널과 가로 스플리터를 직접 배치
121947
- for (let col = 0; col < numColumns; col++) {
121955
+ const rowWrapper = document.createElement('div');
121956
+ rowWrapper.style.display = 'grid';
121957
+ rowWrapper.style.height = '100%';
121948
121958
 
121949
- console.log(numColumns, childIndex, children[childIndex]);
121959
+ let columnTemplate = '';
121960
+ for (let i = 0; i < numColumns; i++) {
121961
+ columnTemplate += '1fr ';
121962
+ if (i < numColumns - 1) {
121963
+ columnTemplate += '8px ';
121964
+ }
121965
+ }
121966
+ rowWrapper.style.gridTemplateColumns = columnTemplate.trim();
121950
121967
 
121968
+ for (let col = 0; col < numColumns; col++) {
121951
121969
  if (children[childIndex]) {
121952
121970
  const panel = children[childIndex];
121953
- panel.style.gridRow = `${gridRowOffset}`;
121954
- panel.style.gridColumn = `${col * 2 + 1}`;
121955
- this.appendChild(panel);
121971
+ rowWrapper.appendChild(panel);
121956
121972
  childIndex++;
121957
121973
  }
121958
-
121959
121974
  if (col < numColumns - 1) {
121960
121975
  const splitter = document.createElement('nx-splitter');
121961
121976
  splitter.setAttribute('direction', 'horizontal');
121962
- splitter.style.gridRow = `${gridRowOffset}`;
121963
- splitter.style.gridColumn = `${col * 2 + 2}`;
121964
- this.appendChild(splitter);
121977
+ rowWrapper.appendChild(splitter);
121965
121978
  }
121966
121979
  }
121967
121980
 
121968
- gridRowOffset += 2; // 다음 행으로 이동
121981
+ this.appendChild(rowWrapper);
121982
+
121983
+ if (row < numRows - 1) {
121984
+ const splitter = document.createElement('nx-splitter');
121985
+ splitter.setAttribute('direction', 'vertical');
121986
+ this.appendChild(splitter);
121987
+ }
121969
121988
  }
121970
121989
  }
121971
121990
  }
@@ -2,7 +2,19 @@ import ninegrid from "../index.js";
2
2
 
3
3
  class NxLayout extends HTMLElement {
4
4
 
5
+ #originalChildren;
6
+
7
+ constructor() {
8
+ super();
9
+ // constructor에서 원본 자식 요소를 저장합니다.
10
+ // 이때는 아직 DOM에 추가되기 전이므로 children은 비어있습니다.
11
+ // connectedCallback에서 다시 가져오는 방식이 더 안정적입니다.
12
+ }
13
+
5
14
  connectedCallback() {
15
+ // 컴포넌트가 DOM에 추가된 후, 원본 자식 요소들을 저장합니다.
16
+ // filter를 사용하여 nx-splitter를 제외합니다.
17
+ this.#originalChildren = Array.from(this.children);
6
18
  this.#render();
7
19
  }
8
20
 
@@ -31,7 +43,6 @@ class NxLayout extends HTMLElement {
31
43
  const columnsLayout = (this.getAttribute('columns') || '1').split(',').map(Number);
32
44
  const numRows = columnsLayout.length;
33
45
 
34
- // 메인 컨테이너의 CSS Grid 템플릿 설정
35
46
  let gridRows = '';
36
47
  for (let i = 0; i < numRows; i++) {
37
48
  gridRows += '1fr ';
@@ -44,46 +55,45 @@ class NxLayout extends HTMLElement {
44
55
  this.style.width = '100%';
45
56
  this.style.height = '100%';
46
57
  this.style.gridTemplateRows = gridRows.trim();
47
- this.style.gridTemplateColumns = '1fr'; // 메인 그리드는 하나의 열만 갖도록 설정
48
58
 
49
59
  let childIndex = 0;
50
- let gridRowOffset = 1;
51
60
 
52
61
  for (let row = 0; row < numRows; row++) {
53
62
  const numColumns = columnsLayout[row];
54
63
 
55
- // 가로 스플리터와 패널을 위한 그리드 템플릿을 생성
56
- let gridColumns = '';
64
+ const rowWrapper = document.createElement('div');
65
+ rowWrapper.style.display = 'grid';
66
+ rowWrapper.style.height = '100%';
67
+
68
+ let columnTemplate = '';
57
69
  for (let i = 0; i < numColumns; i++) {
58
- gridColumns += '1fr ';
70
+ columnTemplate += '1fr ';
59
71
  if (i < numColumns - 1) {
60
- gridColumns += '8px '; // 가로 스플리터 너비
72
+ columnTemplate += '8px ';
61
73
  }
62
74
  }
75
+ rowWrapper.style.gridTemplateColumns = columnTemplate.trim();
63
76
 
64
- // 각 행의 패널과 가로 스플리터를 직접 배치
65
77
  for (let col = 0; col < numColumns; col++) {
66
-
67
- console.log(numColumns, childIndex, children[childIndex]);
68
-
69
78
  if (children[childIndex]) {
70
79
  const panel = children[childIndex];
71
- panel.style.gridRow = `${gridRowOffset}`;
72
- panel.style.gridColumn = `${col * 2 + 1}`;
73
- this.appendChild(panel);
80
+ rowWrapper.appendChild(panel);
74
81
  childIndex++;
75
82
  }
76
-
77
83
  if (col < numColumns - 1) {
78
84
  const splitter = document.createElement('nx-splitter');
79
85
  splitter.setAttribute('direction', 'horizontal');
80
- splitter.style.gridRow = `${gridRowOffset}`;
81
- splitter.style.gridColumn = `${col * 2 + 2}`;
82
- this.appendChild(splitter);
86
+ rowWrapper.appendChild(splitter);
83
87
  }
84
88
  }
85
89
 
86
- gridRowOffset += 2; // 다음 행으로 이동
90
+ this.appendChild(rowWrapper);
91
+
92
+ if (row < numRows - 1) {
93
+ const splitter = document.createElement('nx-splitter');
94
+ splitter.setAttribute('direction', 'vertical');
95
+ this.appendChild(splitter);
96
+ }
87
97
  }
88
98
  }
89
99
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.996.0",
4
+ "version": "6.997.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -2,7 +2,19 @@ import ninegrid from "../index.js";
2
2
 
3
3
  class NxLayout extends HTMLElement {
4
4
 
5
+ #originalChildren;
6
+
7
+ constructor() {
8
+ super();
9
+ // constructor에서 원본 자식 요소를 저장합니다.
10
+ // 이때는 아직 DOM에 추가되기 전이므로 children은 비어있습니다.
11
+ // connectedCallback에서 다시 가져오는 방식이 더 안정적입니다.
12
+ }
13
+
5
14
  connectedCallback() {
15
+ // 컴포넌트가 DOM에 추가된 후, 원본 자식 요소들을 저장합니다.
16
+ // filter를 사용하여 nx-splitter를 제외합니다.
17
+ this.#originalChildren = Array.from(this.children);
6
18
  this.#render();
7
19
  }
8
20
 
@@ -31,7 +43,6 @@ class NxLayout extends HTMLElement {
31
43
  const columnsLayout = (this.getAttribute('columns') || '1').split(',').map(Number);
32
44
  const numRows = columnsLayout.length;
33
45
 
34
- // 메인 컨테이너의 CSS Grid 템플릿 설정
35
46
  let gridRows = '';
36
47
  for (let i = 0; i < numRows; i++) {
37
48
  gridRows += '1fr ';
@@ -44,46 +55,45 @@ class NxLayout extends HTMLElement {
44
55
  this.style.width = '100%';
45
56
  this.style.height = '100%';
46
57
  this.style.gridTemplateRows = gridRows.trim();
47
- this.style.gridTemplateColumns = '1fr'; // 메인 그리드는 하나의 열만 갖도록 설정
48
58
 
49
59
  let childIndex = 0;
50
- let gridRowOffset = 1;
51
60
 
52
61
  for (let row = 0; row < numRows; row++) {
53
62
  const numColumns = columnsLayout[row];
54
63
 
55
- // 가로 스플리터와 패널을 위한 그리드 템플릿을 생성
56
- let gridColumns = '';
64
+ const rowWrapper = document.createElement('div');
65
+ rowWrapper.style.display = 'grid';
66
+ rowWrapper.style.height = '100%';
67
+
68
+ let columnTemplate = '';
57
69
  for (let i = 0; i < numColumns; i++) {
58
- gridColumns += '1fr ';
70
+ columnTemplate += '1fr ';
59
71
  if (i < numColumns - 1) {
60
- gridColumns += '8px '; // 가로 스플리터 너비
72
+ columnTemplate += '8px ';
61
73
  }
62
74
  }
75
+ rowWrapper.style.gridTemplateColumns = columnTemplate.trim();
63
76
 
64
- // 각 행의 패널과 가로 스플리터를 직접 배치
65
77
  for (let col = 0; col < numColumns; col++) {
66
-
67
- console.log(numColumns, childIndex, children[childIndex]);
68
-
69
78
  if (children[childIndex]) {
70
79
  const panel = children[childIndex];
71
- panel.style.gridRow = `${gridRowOffset}`;
72
- panel.style.gridColumn = `${col * 2 + 1}`;
73
- this.appendChild(panel);
80
+ rowWrapper.appendChild(panel);
74
81
  childIndex++;
75
82
  }
76
-
77
83
  if (col < numColumns - 1) {
78
84
  const splitter = document.createElement('nx-splitter');
79
85
  splitter.setAttribute('direction', 'horizontal');
80
- splitter.style.gridRow = `${gridRowOffset}`;
81
- splitter.style.gridColumn = `${col * 2 + 2}`;
82
- this.appendChild(splitter);
86
+ rowWrapper.appendChild(splitter);
83
87
  }
84
88
  }
85
89
 
86
- gridRowOffset += 2; // 다음 행으로 이동
90
+ this.appendChild(rowWrapper);
91
+
92
+ if (row < numRows - 1) {
93
+ const splitter = document.createElement('nx-splitter');
94
+ splitter.setAttribute('direction', 'vertical');
95
+ this.appendChild(splitter);
96
+ }
87
97
  }
88
98
  }
89
99
  }