ninegrid2 6.990.0 → 6.992.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.
@@ -121901,8 +121901,7 @@ class NxLayout extends HTMLElement {
121901
121901
  }
121902
121902
 
121903
121903
  attributeChangedCallback(name, oldValue, newValue) {
121904
- // 속성이 변경되면 레이아웃을 다시 렌더링합니다.
121905
- if (oldValue !== newValue) { // 값 변경이 있을 때만 실행하는 것이 효율적
121904
+ if (oldValue !== newValue) {
121906
121905
  this.#render();
121907
121906
  }
121908
121907
  }
@@ -121915,64 +121914,55 @@ class NxLayout extends HTMLElement {
121915
121914
  const children = Array.from(this.children);
121916
121915
  if (children.length === 0) return;
121917
121916
 
121917
+ // 기존 자식 노드를 모두 제거하여 초기화
121918
121918
  while (this.firstChild) {
121919
121919
  this.removeChild(this.firstChild);
121920
121920
  }
121921
121921
 
121922
- console.log("11111");
121923
-
121924
121922
  const columnsLayout = (this.getAttribute('columns') || '1').split(',').map(Number);
121925
121923
  const numRows = columnsLayout.length;
121926
121924
 
121927
- let gridTemplate = '';
121928
- for (const numCols of columnsLayout) {
121929
- gridTemplate += `1fr `; // 행의 높이
121925
+ // 메인 컨테이너의 CSS Grid 템플릿 설정
121926
+ let gridRows = '';
121927
+ for (let i = 0; i < numRows; i++) {
121928
+ gridRows += '1fr ';
121929
+ if (i < numRows - 1) {
121930
+ gridRows += '8px '; // 세로 스플리터 높이
121931
+ }
121930
121932
  }
121931
121933
 
121932
121934
  this.style.display = 'grid';
121933
121935
  this.style.width = '100%';
121934
121936
  this.style.height = '100%';
121935
- this.style.gridTemplateRows = gridTemplate.trim();
121937
+ this.style.gridTemplateRows = gridRows.trim();
121938
+ this.style.gridTemplateColumns = '1fr'; // 메인 그리드는 하나의 열만 갖도록 설정
121936
121939
 
121937
121940
  let childIndex = 0;
121941
+ let gridRowOffset = 1;
121938
121942
 
121939
121943
  for (let row = 0; row < numRows; row++) {
121940
121944
  const numColumns = columnsLayout[row];
121941
- const rowWrapper = document.createElement('div');
121942
- rowWrapper.style.display = 'grid';
121943
-
121944
- let columnTemplate = '';
121945
- for (let i = 0; i < numColumns; i++) {
121946
- columnTemplate += '1fr ';
121947
- if (i < numColumns - 1) {
121948
- columnTemplate += '8px ';
121949
- }
121950
- }
121951
- rowWrapper.style.gridTemplateColumns = columnTemplate.trim();
121952
- rowWrapper.style.height = '100%';
121953
121945
 
121946
+ // 각 행의 패널과 가로 스플리터를 직접 배치
121954
121947
  for (let col = 0; col < numColumns; col++) {
121955
121948
  if (children[childIndex]) {
121956
- // 불필요한 래퍼(wrapper)를 제거하고 원본 자식 요소를 직접 추가
121957
- rowWrapper.appendChild(children[childIndex]);
121949
+ const panel = children[childIndex];
121950
+ panel.style.gridRow = `${gridRowOffset}`;
121951
+ panel.style.gridColumn = `${col * 2 + 1}`;
121952
+ this.appendChild(panel);
121958
121953
  childIndex++;
121959
121954
  }
121960
121955
 
121961
121956
  if (col < numColumns - 1) {
121962
121957
  const splitter = document.createElement('nx-splitter');
121963
121958
  splitter.setAttribute('direction', 'horizontal');
121964
- rowWrapper.appendChild(splitter);
121959
+ splitter.style.gridRow = `${gridRowOffset}`;
121960
+ splitter.style.gridColumn = `${col * 2 + 2}`;
121961
+ this.appendChild(splitter);
121965
121962
  }
121966
121963
  }
121967
121964
 
121968
- this.appendChild(rowWrapper);
121969
-
121970
- if (row < numRows - 1) {
121971
- const splitter = document.createElement('nx-splitter');
121972
- splitter.setAttribute('direction', 'vertical');
121973
- splitter.style.gridColumn = `1 / -1`;
121974
- this.appendChild(splitter);
121975
- }
121965
+ gridRowOffset += 2; // 다음 행으로 이동
121976
121966
  }
121977
121967
  }
121978
121968
  }
@@ -121897,8 +121897,7 @@ class NxLayout extends HTMLElement {
121897
121897
  }
121898
121898
 
121899
121899
  attributeChangedCallback(name, oldValue, newValue) {
121900
- // 속성이 변경되면 레이아웃을 다시 렌더링합니다.
121901
- if (oldValue !== newValue) { // 값 변경이 있을 때만 실행하는 것이 효율적
121900
+ if (oldValue !== newValue) {
121902
121901
  this.#render();
121903
121902
  }
121904
121903
  }
@@ -121911,64 +121910,55 @@ class NxLayout extends HTMLElement {
121911
121910
  const children = Array.from(this.children);
121912
121911
  if (children.length === 0) return;
121913
121912
 
121913
+ // 기존 자식 노드를 모두 제거하여 초기화
121914
121914
  while (this.firstChild) {
121915
121915
  this.removeChild(this.firstChild);
121916
121916
  }
121917
121917
 
121918
- console.log("11111");
121919
-
121920
121918
  const columnsLayout = (this.getAttribute('columns') || '1').split(',').map(Number);
121921
121919
  const numRows = columnsLayout.length;
121922
121920
 
121923
- let gridTemplate = '';
121924
- for (const numCols of columnsLayout) {
121925
- gridTemplate += `1fr `; // 행의 높이
121921
+ // 메인 컨테이너의 CSS Grid 템플릿 설정
121922
+ let gridRows = '';
121923
+ for (let i = 0; i < numRows; i++) {
121924
+ gridRows += '1fr ';
121925
+ if (i < numRows - 1) {
121926
+ gridRows += '8px '; // 세로 스플리터 높이
121927
+ }
121926
121928
  }
121927
121929
 
121928
121930
  this.style.display = 'grid';
121929
121931
  this.style.width = '100%';
121930
121932
  this.style.height = '100%';
121931
- this.style.gridTemplateRows = gridTemplate.trim();
121933
+ this.style.gridTemplateRows = gridRows.trim();
121934
+ this.style.gridTemplateColumns = '1fr'; // 메인 그리드는 하나의 열만 갖도록 설정
121932
121935
 
121933
121936
  let childIndex = 0;
121937
+ let gridRowOffset = 1;
121934
121938
 
121935
121939
  for (let row = 0; row < numRows; row++) {
121936
121940
  const numColumns = columnsLayout[row];
121937
- const rowWrapper = document.createElement('div');
121938
- rowWrapper.style.display = 'grid';
121939
-
121940
- let columnTemplate = '';
121941
- for (let i = 0; i < numColumns; i++) {
121942
- columnTemplate += '1fr ';
121943
- if (i < numColumns - 1) {
121944
- columnTemplate += '8px ';
121945
- }
121946
- }
121947
- rowWrapper.style.gridTemplateColumns = columnTemplate.trim();
121948
- rowWrapper.style.height = '100%';
121949
121941
 
121942
+ // 각 행의 패널과 가로 스플리터를 직접 배치
121950
121943
  for (let col = 0; col < numColumns; col++) {
121951
121944
  if (children[childIndex]) {
121952
- // 불필요한 래퍼(wrapper)를 제거하고 원본 자식 요소를 직접 추가
121953
- rowWrapper.appendChild(children[childIndex]);
121945
+ const panel = children[childIndex];
121946
+ panel.style.gridRow = `${gridRowOffset}`;
121947
+ panel.style.gridColumn = `${col * 2 + 1}`;
121948
+ this.appendChild(panel);
121954
121949
  childIndex++;
121955
121950
  }
121956
121951
 
121957
121952
  if (col < numColumns - 1) {
121958
121953
  const splitter = document.createElement('nx-splitter');
121959
121954
  splitter.setAttribute('direction', 'horizontal');
121960
- rowWrapper.appendChild(splitter);
121955
+ splitter.style.gridRow = `${gridRowOffset}`;
121956
+ splitter.style.gridColumn = `${col * 2 + 2}`;
121957
+ this.appendChild(splitter);
121961
121958
  }
121962
121959
  }
121963
121960
 
121964
- this.appendChild(rowWrapper);
121965
-
121966
- if (row < numRows - 1) {
121967
- const splitter = document.createElement('nx-splitter');
121968
- splitter.setAttribute('direction', 'vertical');
121969
- splitter.style.gridColumn = `1 / -1`;
121970
- this.appendChild(splitter);
121971
- }
121961
+ gridRowOffset += 2; // 다음 행으로 이동
121972
121962
  }
121973
121963
  }
121974
121964
  }
@@ -6,8 +6,7 @@ class NxLayout extends HTMLElement {
6
6
  }
7
7
 
8
8
  attributeChangedCallback(name, oldValue, newValue) {
9
- // 속성이 변경되면 레이아웃을 다시 렌더링합니다.
10
- if (oldValue !== newValue) { // 값 변경이 있을 때만 실행하는 것이 효율적
9
+ if (oldValue !== newValue) {
11
10
  this.#render();
12
11
  }
13
12
  }
@@ -20,66 +19,66 @@ class NxLayout extends HTMLElement {
20
19
  const children = Array.from(this.children);
21
20
  if (children.length === 0) return;
22
21
 
22
+ // 기존 자식 노드를 모두 제거하여 초기화
23
23
  while (this.firstChild) {
24
24
  this.removeChild(this.firstChild);
25
25
  }
26
26
 
27
- console.log("11111")
28
-
29
27
  const columnsLayout = (this.getAttribute('columns') || '1').split(',').map(Number);
30
28
  const numRows = columnsLayout.length;
31
29
 
32
- let gridTemplate = '';
33
- for (const numCols of columnsLayout) {
34
- gridTemplate += `1fr `; // 행의 높이
30
+ // 메인 컨테이너의 CSS Grid 템플릿 설정
31
+ let gridRows = '';
32
+ for (let i = 0; i < numRows; i++) {
33
+ gridRows += '1fr ';
34
+ if (i < numRows - 1) {
35
+ gridRows += '8px '; // 세로 스플리터 높이
36
+ }
35
37
  }
36
38
 
37
39
  this.style.display = 'grid';
38
40
  this.style.width = '100%';
39
41
  this.style.height = '100%';
40
- this.style.gridTemplateRows = gridTemplate.trim();
42
+ this.style.gridTemplateRows = gridRows.trim();
43
+ this.style.gridTemplateColumns = '1fr'; // 메인 그리드는 하나의 열만 갖도록 설정
41
44
 
42
45
  let childIndex = 0;
46
+ let gridRowOffset = 1;
43
47
 
44
48
  for (let row = 0; row < numRows; row++) {
45
49
  const numColumns = columnsLayout[row];
46
- const rowWrapper = document.createElement('div');
47
- rowWrapper.style.display = 'grid';
48
50
 
49
- let columnTemplate = '';
51
+ // 가로 스플리터와 패널을 위한 그리드 템플릿을 생성
52
+ let gridColumns = '';
50
53
  for (let i = 0; i < numColumns; i++) {
51
- columnTemplate += '1fr ';
54
+ gridColumns += '1fr ';
52
55
  if (i < numColumns - 1) {
53
- columnTemplate += '8px ';
56
+ gridColumns += '8px '; // 가로 스플리터 너비
54
57
  }
55
58
  }
56
- rowWrapper.style.gridTemplateColumns = columnTemplate.trim();
57
- rowWrapper.style.height = '100%';
58
59
 
60
+ // 각 행의 패널과 가로 스플리터를 직접 배치
59
61
  for (let col = 0; col < numColumns; col++) {
60
62
  if (children[childIndex]) {
61
- // 불필요한 래퍼(wrapper)를 제거하고 원본 자식 요소를 직접 추가
62
- rowWrapper.appendChild(children[childIndex]);
63
+ const panel = children[childIndex];
64
+ panel.style.gridRow = `${gridRowOffset}`;
65
+ panel.style.gridColumn = `${col * 2 + 1}`;
66
+ this.appendChild(panel);
63
67
  childIndex++;
64
68
  }
65
69
 
66
70
  if (col < numColumns - 1) {
67
71
  const splitter = document.createElement('nx-splitter');
68
72
  splitter.setAttribute('direction', 'horizontal');
69
- rowWrapper.appendChild(splitter);
73
+ splitter.style.gridRow = `${gridRowOffset}`;
74
+ splitter.style.gridColumn = `${col * 2 + 2}`;
75
+ this.appendChild(splitter);
70
76
  }
71
77
  }
72
78
 
73
- this.appendChild(rowWrapper);
74
-
75
- if (row < numRows - 1) {
76
- const splitter = document.createElement('nx-splitter');
77
- splitter.setAttribute('direction', 'vertical');
78
- splitter.style.gridColumn = `1 / -1`;
79
- this.appendChild(splitter);
80
- }
79
+ gridRowOffset += 2; // 다음 행으로 이동
81
80
  }
82
81
  }
83
82
  }
84
83
 
85
- customElements.define('nx-layout', NxLayout);
84
+ customElements.define('nx-layout', NxLayout);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.990.0",
4
+ "version": "6.992.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -6,8 +6,7 @@ class NxLayout extends HTMLElement {
6
6
  }
7
7
 
8
8
  attributeChangedCallback(name, oldValue, newValue) {
9
- // 속성이 변경되면 레이아웃을 다시 렌더링합니다.
10
- if (oldValue !== newValue) { // 값 변경이 있을 때만 실행하는 것이 효율적
9
+ if (oldValue !== newValue) {
11
10
  this.#render();
12
11
  }
13
12
  }
@@ -20,66 +19,66 @@ class NxLayout extends HTMLElement {
20
19
  const children = Array.from(this.children);
21
20
  if (children.length === 0) return;
22
21
 
22
+ // 기존 자식 노드를 모두 제거하여 초기화
23
23
  while (this.firstChild) {
24
24
  this.removeChild(this.firstChild);
25
25
  }
26
26
 
27
- console.log("11111")
28
-
29
27
  const columnsLayout = (this.getAttribute('columns') || '1').split(',').map(Number);
30
28
  const numRows = columnsLayout.length;
31
29
 
32
- let gridTemplate = '';
33
- for (const numCols of columnsLayout) {
34
- gridTemplate += `1fr `; // 행의 높이
30
+ // 메인 컨테이너의 CSS Grid 템플릿 설정
31
+ let gridRows = '';
32
+ for (let i = 0; i < numRows; i++) {
33
+ gridRows += '1fr ';
34
+ if (i < numRows - 1) {
35
+ gridRows += '8px '; // 세로 스플리터 높이
36
+ }
35
37
  }
36
38
 
37
39
  this.style.display = 'grid';
38
40
  this.style.width = '100%';
39
41
  this.style.height = '100%';
40
- this.style.gridTemplateRows = gridTemplate.trim();
42
+ this.style.gridTemplateRows = gridRows.trim();
43
+ this.style.gridTemplateColumns = '1fr'; // 메인 그리드는 하나의 열만 갖도록 설정
41
44
 
42
45
  let childIndex = 0;
46
+ let gridRowOffset = 1;
43
47
 
44
48
  for (let row = 0; row < numRows; row++) {
45
49
  const numColumns = columnsLayout[row];
46
- const rowWrapper = document.createElement('div');
47
- rowWrapper.style.display = 'grid';
48
50
 
49
- let columnTemplate = '';
51
+ // 가로 스플리터와 패널을 위한 그리드 템플릿을 생성
52
+ let gridColumns = '';
50
53
  for (let i = 0; i < numColumns; i++) {
51
- columnTemplate += '1fr ';
54
+ gridColumns += '1fr ';
52
55
  if (i < numColumns - 1) {
53
- columnTemplate += '8px ';
56
+ gridColumns += '8px '; // 가로 스플리터 너비
54
57
  }
55
58
  }
56
- rowWrapper.style.gridTemplateColumns = columnTemplate.trim();
57
- rowWrapper.style.height = '100%';
58
59
 
60
+ // 각 행의 패널과 가로 스플리터를 직접 배치
59
61
  for (let col = 0; col < numColumns; col++) {
60
62
  if (children[childIndex]) {
61
- // 불필요한 래퍼(wrapper)를 제거하고 원본 자식 요소를 직접 추가
62
- rowWrapper.appendChild(children[childIndex]);
63
+ const panel = children[childIndex];
64
+ panel.style.gridRow = `${gridRowOffset}`;
65
+ panel.style.gridColumn = `${col * 2 + 1}`;
66
+ this.appendChild(panel);
63
67
  childIndex++;
64
68
  }
65
69
 
66
70
  if (col < numColumns - 1) {
67
71
  const splitter = document.createElement('nx-splitter');
68
72
  splitter.setAttribute('direction', 'horizontal');
69
- rowWrapper.appendChild(splitter);
73
+ splitter.style.gridRow = `${gridRowOffset}`;
74
+ splitter.style.gridColumn = `${col * 2 + 2}`;
75
+ this.appendChild(splitter);
70
76
  }
71
77
  }
72
78
 
73
- this.appendChild(rowWrapper);
74
-
75
- if (row < numRows - 1) {
76
- const splitter = document.createElement('nx-splitter');
77
- splitter.setAttribute('direction', 'vertical');
78
- splitter.style.gridColumn = `1 / -1`;
79
- this.appendChild(splitter);
80
- }
79
+ gridRowOffset += 2; // 다음 행으로 이동
81
80
  }
82
81
  }
83
82
  }
84
83
 
85
- customElements.define('nx-layout', NxLayout);
84
+ customElements.define('nx-layout', NxLayout);