ninegrid2 6.1152.0 → 6.1154.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.
@@ -121946,9 +121946,41 @@ class NxLayout2 extends HTMLElement {
121946
121946
  };
121947
121947
 
121948
121948
  #position = () => {
121949
+ // 임시로 숨겨진 요소의 너비를 측정하는 헬퍼 함수
121950
+ const getRenderedWidth = (element) => {
121951
+ // 요소의 현재 부모 노드를 저장
121952
+ const parent = element.parentNode;
121953
+
121954
+ // 1. 요소를 원래 위치에서 임시로 제거
121955
+ parent.removeChild(element);
121956
+
121957
+ // 2. 요소를 화면 밖으로 이동시킬 스타일을 적용
121958
+ element.style.position = 'absolute';
121959
+ element.style.left = '-9999px';
121960
+ element.style.visibility = 'hidden';
121961
+ element.style.display = 'block'; // display:none이 아님을 보장
121962
+
121963
+ // 3. body에 임시로 추가하여 렌더링되도록 함
121964
+ document.body.appendChild(element);
121965
+
121966
+ // 4. 너비 측정
121967
+ const width = element.getBoundingClientRect().width;
121968
+
121969
+ // 5. 원래 스타일을 복구
121970
+ element.style.position = '';
121971
+ element.style.left = '';
121972
+ element.style.visibility = '';
121973
+ element.style.display = '';
121974
+
121975
+ // 6. 요소를 다시 원래 부모의 위치로 복원
121976
+ document.body.removeChild(element);
121977
+ parent.appendChild(element);
121978
+
121979
+ return width;
121980
+ };
121981
+
121949
121982
  const allLabels = [];
121950
121983
 
121951
- // 1. 모든 .row에서 .label 요소를 찾아서 위치(인덱스)별로 그룹화
121952
121984
  this.querySelectorAll(".row").forEach((el) => {
121953
121985
  const labelsInRow = el.querySelectorAll(".label");
121954
121986
  labelsInRow.forEach((label, index) => {
@@ -121959,14 +121991,12 @@ class NxLayout2 extends HTMLElement {
121959
121991
  });
121960
121992
  });
121961
121993
 
121962
- // 2. 각 그룹(위치)별로 최대 너비 계산 및 적용
121963
121994
  allLabels.forEach((labelGroup) => {
121964
- // 그룹이 비어있지 않은지 확인
121965
121995
  if (labelGroup && labelGroup.length > 0) {
121966
- // 3. 그룹 모든 라벨의 너비 가장 큰 값(최대값) 찾기
121967
- const maxWidth = Math.max(...labelGroup.map(label => label.getBoundingClientRect().width));
121996
+ // ⭐⭐ 헬퍼 함수를 사용하여 너비 계산 ⭐⭐
121997
+ const renderedWidths = labelGroup.map(label => getRenderedWidth(label));
121998
+ const maxWidth = Math.max(...renderedWidths);
121968
121999
 
121969
- // 4. 계산된 최대 너비를 동일 그룹의 모든 라벨에 적용
121970
122000
  labelGroup.forEach(label => {
121971
122001
  label.style.width = `${maxWidth}px`;
121972
122002
  });
@@ -121942,9 +121942,41 @@ class NxLayout2 extends HTMLElement {
121942
121942
  };
121943
121943
 
121944
121944
  #position = () => {
121945
+ // 임시로 숨겨진 요소의 너비를 측정하는 헬퍼 함수
121946
+ const getRenderedWidth = (element) => {
121947
+ // 요소의 현재 부모 노드를 저장
121948
+ const parent = element.parentNode;
121949
+
121950
+ // 1. 요소를 원래 위치에서 임시로 제거
121951
+ parent.removeChild(element);
121952
+
121953
+ // 2. 요소를 화면 밖으로 이동시킬 스타일을 적용
121954
+ element.style.position = 'absolute';
121955
+ element.style.left = '-9999px';
121956
+ element.style.visibility = 'hidden';
121957
+ element.style.display = 'block'; // display:none이 아님을 보장
121958
+
121959
+ // 3. body에 임시로 추가하여 렌더링되도록 함
121960
+ document.body.appendChild(element);
121961
+
121962
+ // 4. 너비 측정
121963
+ const width = element.getBoundingClientRect().width;
121964
+
121965
+ // 5. 원래 스타일을 복구
121966
+ element.style.position = '';
121967
+ element.style.left = '';
121968
+ element.style.visibility = '';
121969
+ element.style.display = '';
121970
+
121971
+ // 6. 요소를 다시 원래 부모의 위치로 복원
121972
+ document.body.removeChild(element);
121973
+ parent.appendChild(element);
121974
+
121975
+ return width;
121976
+ };
121977
+
121945
121978
  const allLabels = [];
121946
121979
 
121947
- // 1. 모든 .row에서 .label 요소를 찾아서 위치(인덱스)별로 그룹화
121948
121980
  this.querySelectorAll(".row").forEach((el) => {
121949
121981
  const labelsInRow = el.querySelectorAll(".label");
121950
121982
  labelsInRow.forEach((label, index) => {
@@ -121955,14 +121987,12 @@ class NxLayout2 extends HTMLElement {
121955
121987
  });
121956
121988
  });
121957
121989
 
121958
- // 2. 각 그룹(위치)별로 최대 너비 계산 및 적용
121959
121990
  allLabels.forEach((labelGroup) => {
121960
- // 그룹이 비어있지 않은지 확인
121961
121991
  if (labelGroup && labelGroup.length > 0) {
121962
- // 3. 그룹 모든 라벨의 너비 가장 큰 값(최대값) 찾기
121963
- const maxWidth = Math.max(...labelGroup.map(label => label.getBoundingClientRect().width));
121992
+ // ⭐⭐ 헬퍼 함수를 사용하여 너비 계산 ⭐⭐
121993
+ const renderedWidths = labelGroup.map(label => getRenderedWidth(label));
121994
+ const maxWidth = Math.max(...renderedWidths);
121964
121995
 
121965
- // 4. 계산된 최대 너비를 동일 그룹의 모든 라벨에 적용
121966
121996
  labelGroup.forEach(label => {
121967
121997
  label.style.width = `${maxWidth}px`;
121968
121998
  });
@@ -59,9 +59,41 @@ class NxLayout2 extends HTMLElement {
59
59
  };
60
60
 
61
61
  #position = () => {
62
+ // 임시로 숨겨진 요소의 너비를 측정하는 헬퍼 함수
63
+ const getRenderedWidth = (element) => {
64
+ // 요소의 현재 부모 노드를 저장
65
+ const parent = element.parentNode;
66
+
67
+ // 1. 요소를 원래 위치에서 임시로 제거
68
+ parent.removeChild(element);
69
+
70
+ // 2. 요소를 화면 밖으로 이동시킬 스타일을 적용
71
+ element.style.position = 'absolute';
72
+ element.style.left = '-9999px';
73
+ element.style.visibility = 'hidden';
74
+ element.style.display = 'block'; // display:none이 아님을 보장
75
+
76
+ // 3. body에 임시로 추가하여 렌더링되도록 함
77
+ document.body.appendChild(element);
78
+
79
+ // 4. 너비 측정
80
+ const width = element.getBoundingClientRect().width;
81
+
82
+ // 5. 원래 스타일을 복구
83
+ element.style.position = '';
84
+ element.style.left = '';
85
+ element.style.visibility = '';
86
+ element.style.display = '';
87
+
88
+ // 6. 요소를 다시 원래 부모의 위치로 복원
89
+ document.body.removeChild(element);
90
+ parent.appendChild(element);
91
+
92
+ return width;
93
+ };
94
+
62
95
  const allLabels = [];
63
96
 
64
- // 1. 모든 .row에서 .label 요소를 찾아서 위치(인덱스)별로 그룹화
65
97
  this.querySelectorAll(".row").forEach((el) => {
66
98
  const labelsInRow = el.querySelectorAll(".label");
67
99
  labelsInRow.forEach((label, index) => {
@@ -72,14 +104,12 @@ class NxLayout2 extends HTMLElement {
72
104
  });
73
105
  });
74
106
 
75
- // 2. 각 그룹(위치)별로 최대 너비 계산 및 적용
76
107
  allLabels.forEach((labelGroup) => {
77
- // 그룹이 비어있지 않은지 확인
78
108
  if (labelGroup && labelGroup.length > 0) {
79
- // 3. 그룹 모든 라벨의 너비 가장 큰 값(최대값) 찾기
80
- const maxWidth = Math.max(...labelGroup.map(label => label.getBoundingClientRect().width));
109
+ // ⭐⭐ 헬퍼 함수를 사용하여 너비 계산 ⭐⭐
110
+ const renderedWidths = labelGroup.map(label => getRenderedWidth(label));
111
+ const maxWidth = Math.max(...renderedWidths);
81
112
 
82
- // 4. 계산된 최대 너비를 동일 그룹의 모든 라벨에 적용
83
113
  labelGroup.forEach(label => {
84
114
  label.style.width = `${maxWidth}px`;
85
115
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1152.0",
4
+ "version": "6.1154.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -59,9 +59,41 @@ class NxLayout2 extends HTMLElement {
59
59
  };
60
60
 
61
61
  #position = () => {
62
+ // 임시로 숨겨진 요소의 너비를 측정하는 헬퍼 함수
63
+ const getRenderedWidth = (element) => {
64
+ // 요소의 현재 부모 노드를 저장
65
+ const parent = element.parentNode;
66
+
67
+ // 1. 요소를 원래 위치에서 임시로 제거
68
+ parent.removeChild(element);
69
+
70
+ // 2. 요소를 화면 밖으로 이동시킬 스타일을 적용
71
+ element.style.position = 'absolute';
72
+ element.style.left = '-9999px';
73
+ element.style.visibility = 'hidden';
74
+ element.style.display = 'block'; // display:none이 아님을 보장
75
+
76
+ // 3. body에 임시로 추가하여 렌더링되도록 함
77
+ document.body.appendChild(element);
78
+
79
+ // 4. 너비 측정
80
+ const width = element.getBoundingClientRect().width;
81
+
82
+ // 5. 원래 스타일을 복구
83
+ element.style.position = '';
84
+ element.style.left = '';
85
+ element.style.visibility = '';
86
+ element.style.display = '';
87
+
88
+ // 6. 요소를 다시 원래 부모의 위치로 복원
89
+ document.body.removeChild(element);
90
+ parent.appendChild(element);
91
+
92
+ return width;
93
+ };
94
+
62
95
  const allLabels = [];
63
96
 
64
- // 1. 모든 .row에서 .label 요소를 찾아서 위치(인덱스)별로 그룹화
65
97
  this.querySelectorAll(".row").forEach((el) => {
66
98
  const labelsInRow = el.querySelectorAll(".label");
67
99
  labelsInRow.forEach((label, index) => {
@@ -72,14 +104,12 @@ class NxLayout2 extends HTMLElement {
72
104
  });
73
105
  });
74
106
 
75
- // 2. 각 그룹(위치)별로 최대 너비 계산 및 적용
76
107
  allLabels.forEach((labelGroup) => {
77
- // 그룹이 비어있지 않은지 확인
78
108
  if (labelGroup && labelGroup.length > 0) {
79
- // 3. 그룹 모든 라벨의 너비 가장 큰 값(최대값) 찾기
80
- const maxWidth = Math.max(...labelGroup.map(label => label.getBoundingClientRect().width));
109
+ // ⭐⭐ 헬퍼 함수를 사용하여 너비 계산 ⭐⭐
110
+ const renderedWidths = labelGroup.map(label => getRenderedWidth(label));
111
+ const maxWidth = Math.max(...renderedWidths);
81
112
 
82
- // 4. 계산된 최대 너비를 동일 그룹의 모든 라벨에 적용
83
113
  labelGroup.forEach(label => {
84
114
  label.style.width = `${maxWidth}px`;
85
115
  });