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