ninegrid2 6.939.0 → 6.941.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 +41 -12
- package/dist/bundle.esm.js +41 -12
- package/dist/nx/nxTitle.js +35 -18
- package/package.json +1 -1
- package/src/nx/nxTitle.js +35 -18
package/dist/bundle.cjs.js
CHANGED
|
@@ -121711,7 +121711,6 @@ class nxTitle extends HTMLElement {
|
|
|
121711
121711
|
*/
|
|
121712
121712
|
ninegrid.delayQuerySelector('nx-side-menu-item.active')
|
|
121713
121713
|
.then((el) => {
|
|
121714
|
-
console.log(el);
|
|
121715
121714
|
this.#generateBreadcrumb(el); // 빵 부스러기 데이터 생성 및 최종 렌더링 트리거
|
|
121716
121715
|
this.#renderer(); // 초기 렌더링 (빵 부스러기 데이터는 아직 없음)
|
|
121717
121716
|
});
|
|
@@ -121721,8 +121720,6 @@ class nxTitle extends HTMLElement {
|
|
|
121721
121720
|
#generateBreadcrumb = (activeMenuItem) => {
|
|
121722
121721
|
this.#breadcrumbPath = [];
|
|
121723
121722
|
|
|
121724
|
-
// 현재 nx-title의 캡션을 현재 페이지 캡션으로 사용
|
|
121725
|
-
const currentPageCaption = this.getAttribute("caption") || "Current Page";
|
|
121726
121723
|
|
|
121727
121724
|
// 'active' 클래스를 가진 가장 하위 nx-side-menu-item 찾기
|
|
121728
121725
|
//const activeMenuItem = ninegrid.querySelector('nx-side-menu-item.active');
|
|
@@ -121732,7 +121729,6 @@ class nxTitle extends HTMLElement {
|
|
|
121732
121729
|
|
|
121733
121730
|
// 1. 현재 활성화된 메뉴 항목의 캡션을 추가 (예: '심의자료')
|
|
121734
121731
|
const currentActiveCaption = activeMenuItem.caption;//activeMenuItem.caption;
|
|
121735
|
-
console.log("nxTitle", activeMenuItem.caption);
|
|
121736
121732
|
|
|
121737
121733
|
if (currentActiveCaption) {
|
|
121738
121734
|
this.#breadcrumbPath.unshift({
|
|
@@ -121754,7 +121750,6 @@ class nxTitle extends HTMLElement {
|
|
|
121754
121750
|
|
|
121755
121751
|
// 이전 형제 탐색
|
|
121756
121752
|
currentElement = currentElement.previousElementSibling;
|
|
121757
|
-
console.log(currentElement);
|
|
121758
121753
|
|
|
121759
121754
|
if (currentElement && currentElement.tagName === 'NX-SIDE-MENU-ITEM') {
|
|
121760
121755
|
const caption = currentElement.caption;//.getAttribute('caption');
|
|
@@ -121762,6 +121757,7 @@ console.log(currentElement);
|
|
|
121762
121757
|
// 'group' 속성을 가진 메뉴 항목 찾기 (예: '자료관리')
|
|
121763
121758
|
if (currentElement.getAttribute('type') === "group") {
|
|
121764
121759
|
if (caption && !foundGroupParent) { // 이미 찾지 않은 경우에만 추가
|
|
121760
|
+
|
|
121765
121761
|
this.#breadcrumbPath.unshift({
|
|
121766
121762
|
path: currentElement.getAttribute("href"),
|
|
121767
121763
|
caption: caption,
|
|
@@ -121773,16 +121769,25 @@ console.log(currentElement);
|
|
|
121773
121769
|
}
|
|
121774
121770
|
}
|
|
121775
121771
|
}
|
|
121772
|
+
|
|
121773
|
+
// tempPath의 내용을 Home 다음으로 삽입
|
|
121774
|
+
// activeMenuItem이 '심의자료' 역할을 하고, 그 이전에 '자료관리' 그룹이 있다면
|
|
121775
|
+
// tempPath: ['자료관리', '심의자료']
|
|
121776
|
+
|
|
121776
121777
|
}
|
|
121778
|
+
|
|
121779
|
+
// 마지막으로 현재 페이지의 구체적인 제목 추가
|
|
121780
|
+
// 현재 nx-title의 캡션을 현재 페이지 캡션으로 사용
|
|
121777
121781
|
this.#breadcrumbPath.push({
|
|
121778
121782
|
path: "",
|
|
121779
|
-
caption:
|
|
121783
|
+
caption: this.getAttribute("caption") || "Current Page",
|
|
121780
121784
|
});
|
|
121781
121785
|
|
|
121782
121786
|
this.#breadcrumbPath.unshift({
|
|
121783
121787
|
path: "/",
|
|
121784
121788
|
caption: "Home",
|
|
121785
121789
|
});
|
|
121790
|
+
|
|
121786
121791
|
console.log(this.#breadcrumbPath);
|
|
121787
121792
|
//this.#breadcrumbPath = path;
|
|
121788
121793
|
//this.#renderer();
|
|
@@ -121813,18 +121818,42 @@ console.log(this.#breadcrumbPath);
|
|
|
121813
121818
|
<span class="title-text">${caption}</span>
|
|
121814
121819
|
</div>
|
|
121815
121820
|
<div class="breadcrumb-container">
|
|
121816
|
-
${this.#breadcrumbPath.map((item, index) =>
|
|
121817
|
-
|
|
121818
|
-
|
|
121819
|
-
|
|
121820
|
-
|
|
121821
|
-
|
|
121821
|
+
${this.#breadcrumbPath.map((item, index) => {
|
|
121822
|
+
|
|
121823
|
+
const isCurrent = index === this.#breadcrumbPath.length - 1;
|
|
121824
|
+
// static 메서드를 직접 호출하도록 수정
|
|
121825
|
+
const linkTag = item.path && !isCurrent
|
|
121826
|
+
? `<a href="javascript:void(0)"
|
|
121827
|
+
class="breadcrumb-item breadcrumb-link"
|
|
121828
|
+
onclick="nxTitle.#goto('${item.path}')">${item.caption}</a>`
|
|
121829
|
+
: `<span class="breadcrumb-item ${isCurrent ? 'breadcrumb-current' : ''}">${item.caption}</span>`;
|
|
121830
|
+
|
|
121831
|
+
const separator = index < this.#breadcrumbPath.length - 1
|
|
121832
|
+
? `<span class="breadcrumb-separator"> > </span>`
|
|
121833
|
+
: '';
|
|
121834
|
+
|
|
121835
|
+
return `${linkTag}${separator}`;
|
|
121836
|
+
}).join('')}
|
|
121822
121837
|
</div>
|
|
121823
121838
|
</div>
|
|
121824
121839
|
`;
|
|
121825
121840
|
|
|
121826
121841
|
this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
|
|
121827
121842
|
}
|
|
121843
|
+
|
|
121844
|
+
// static 메서드 aaa() 선언
|
|
121845
|
+
static #goto(path) {
|
|
121846
|
+
console.log('static aaa()가 호출되었습니다. Path:', path);
|
|
121847
|
+
|
|
121848
|
+
if (window.location.pathname === path) {
|
|
121849
|
+
console.log('현재 URL과 path가 동일합니다. 탭 로직을 실행합니다.');
|
|
121850
|
+
// 여기에 탭을 숨기거나 보여주는 로직을 작성합니다.
|
|
121851
|
+
// 예: ninegrid.showTab('tab-id');
|
|
121852
|
+
} else {
|
|
121853
|
+
console.log('현재 URL과 path가 다릅니다. 페이지를 이동합니다.');
|
|
121854
|
+
window.location.href = path;
|
|
121855
|
+
}
|
|
121856
|
+
}
|
|
121828
121857
|
}
|
|
121829
121858
|
|
|
121830
121859
|
customElements.define("nx-title", nxTitle);
|
package/dist/bundle.esm.js
CHANGED
|
@@ -121707,7 +121707,6 @@ class nxTitle extends HTMLElement {
|
|
|
121707
121707
|
*/
|
|
121708
121708
|
ninegrid.delayQuerySelector('nx-side-menu-item.active')
|
|
121709
121709
|
.then((el) => {
|
|
121710
|
-
console.log(el);
|
|
121711
121710
|
this.#generateBreadcrumb(el); // 빵 부스러기 데이터 생성 및 최종 렌더링 트리거
|
|
121712
121711
|
this.#renderer(); // 초기 렌더링 (빵 부스러기 데이터는 아직 없음)
|
|
121713
121712
|
});
|
|
@@ -121717,8 +121716,6 @@ class nxTitle extends HTMLElement {
|
|
|
121717
121716
|
#generateBreadcrumb = (activeMenuItem) => {
|
|
121718
121717
|
this.#breadcrumbPath = [];
|
|
121719
121718
|
|
|
121720
|
-
// 현재 nx-title의 캡션을 현재 페이지 캡션으로 사용
|
|
121721
|
-
const currentPageCaption = this.getAttribute("caption") || "Current Page";
|
|
121722
121719
|
|
|
121723
121720
|
// 'active' 클래스를 가진 가장 하위 nx-side-menu-item 찾기
|
|
121724
121721
|
//const activeMenuItem = ninegrid.querySelector('nx-side-menu-item.active');
|
|
@@ -121728,7 +121725,6 @@ class nxTitle extends HTMLElement {
|
|
|
121728
121725
|
|
|
121729
121726
|
// 1. 현재 활성화된 메뉴 항목의 캡션을 추가 (예: '심의자료')
|
|
121730
121727
|
const currentActiveCaption = activeMenuItem.caption;//activeMenuItem.caption;
|
|
121731
|
-
console.log("nxTitle", activeMenuItem.caption);
|
|
121732
121728
|
|
|
121733
121729
|
if (currentActiveCaption) {
|
|
121734
121730
|
this.#breadcrumbPath.unshift({
|
|
@@ -121750,7 +121746,6 @@ class nxTitle extends HTMLElement {
|
|
|
121750
121746
|
|
|
121751
121747
|
// 이전 형제 탐색
|
|
121752
121748
|
currentElement = currentElement.previousElementSibling;
|
|
121753
|
-
console.log(currentElement);
|
|
121754
121749
|
|
|
121755
121750
|
if (currentElement && currentElement.tagName === 'NX-SIDE-MENU-ITEM') {
|
|
121756
121751
|
const caption = currentElement.caption;//.getAttribute('caption');
|
|
@@ -121758,6 +121753,7 @@ console.log(currentElement);
|
|
|
121758
121753
|
// 'group' 속성을 가진 메뉴 항목 찾기 (예: '자료관리')
|
|
121759
121754
|
if (currentElement.getAttribute('type') === "group") {
|
|
121760
121755
|
if (caption && !foundGroupParent) { // 이미 찾지 않은 경우에만 추가
|
|
121756
|
+
|
|
121761
121757
|
this.#breadcrumbPath.unshift({
|
|
121762
121758
|
path: currentElement.getAttribute("href"),
|
|
121763
121759
|
caption: caption,
|
|
@@ -121769,16 +121765,25 @@ console.log(currentElement);
|
|
|
121769
121765
|
}
|
|
121770
121766
|
}
|
|
121771
121767
|
}
|
|
121768
|
+
|
|
121769
|
+
// tempPath의 내용을 Home 다음으로 삽입
|
|
121770
|
+
// activeMenuItem이 '심의자료' 역할을 하고, 그 이전에 '자료관리' 그룹이 있다면
|
|
121771
|
+
// tempPath: ['자료관리', '심의자료']
|
|
121772
|
+
|
|
121772
121773
|
}
|
|
121774
|
+
|
|
121775
|
+
// 마지막으로 현재 페이지의 구체적인 제목 추가
|
|
121776
|
+
// 현재 nx-title의 캡션을 현재 페이지 캡션으로 사용
|
|
121773
121777
|
this.#breadcrumbPath.push({
|
|
121774
121778
|
path: "",
|
|
121775
|
-
caption:
|
|
121779
|
+
caption: this.getAttribute("caption") || "Current Page",
|
|
121776
121780
|
});
|
|
121777
121781
|
|
|
121778
121782
|
this.#breadcrumbPath.unshift({
|
|
121779
121783
|
path: "/",
|
|
121780
121784
|
caption: "Home",
|
|
121781
121785
|
});
|
|
121786
|
+
|
|
121782
121787
|
console.log(this.#breadcrumbPath);
|
|
121783
121788
|
//this.#breadcrumbPath = path;
|
|
121784
121789
|
//this.#renderer();
|
|
@@ -121809,18 +121814,42 @@ console.log(this.#breadcrumbPath);
|
|
|
121809
121814
|
<span class="title-text">${caption}</span>
|
|
121810
121815
|
</div>
|
|
121811
121816
|
<div class="breadcrumb-container">
|
|
121812
|
-
${this.#breadcrumbPath.map((item, index) =>
|
|
121813
|
-
|
|
121814
|
-
|
|
121815
|
-
|
|
121816
|
-
|
|
121817
|
-
|
|
121817
|
+
${this.#breadcrumbPath.map((item, index) => {
|
|
121818
|
+
|
|
121819
|
+
const isCurrent = index === this.#breadcrumbPath.length - 1;
|
|
121820
|
+
// static 메서드를 직접 호출하도록 수정
|
|
121821
|
+
const linkTag = item.path && !isCurrent
|
|
121822
|
+
? `<a href="javascript:void(0)"
|
|
121823
|
+
class="breadcrumb-item breadcrumb-link"
|
|
121824
|
+
onclick="nxTitle.#goto('${item.path}')">${item.caption}</a>`
|
|
121825
|
+
: `<span class="breadcrumb-item ${isCurrent ? 'breadcrumb-current' : ''}">${item.caption}</span>`;
|
|
121826
|
+
|
|
121827
|
+
const separator = index < this.#breadcrumbPath.length - 1
|
|
121828
|
+
? `<span class="breadcrumb-separator"> > </span>`
|
|
121829
|
+
: '';
|
|
121830
|
+
|
|
121831
|
+
return `${linkTag}${separator}`;
|
|
121832
|
+
}).join('')}
|
|
121818
121833
|
</div>
|
|
121819
121834
|
</div>
|
|
121820
121835
|
`;
|
|
121821
121836
|
|
|
121822
121837
|
this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
|
|
121823
121838
|
}
|
|
121839
|
+
|
|
121840
|
+
// static 메서드 aaa() 선언
|
|
121841
|
+
static #goto(path) {
|
|
121842
|
+
console.log('static aaa()가 호출되었습니다. Path:', path);
|
|
121843
|
+
|
|
121844
|
+
if (window.location.pathname === path) {
|
|
121845
|
+
console.log('현재 URL과 path가 동일합니다. 탭 로직을 실행합니다.');
|
|
121846
|
+
// 여기에 탭을 숨기거나 보여주는 로직을 작성합니다.
|
|
121847
|
+
// 예: ninegrid.showTab('tab-id');
|
|
121848
|
+
} else {
|
|
121849
|
+
console.log('현재 URL과 path가 다릅니다. 페이지를 이동합니다.');
|
|
121850
|
+
window.location.href = path;
|
|
121851
|
+
}
|
|
121852
|
+
}
|
|
121824
121853
|
}
|
|
121825
121854
|
|
|
121826
121855
|
customElements.define("nx-title", nxTitle);
|
package/dist/nx/nxTitle.js
CHANGED
|
@@ -30,7 +30,6 @@ class nxTitle extends HTMLElement {
|
|
|
30
30
|
*/
|
|
31
31
|
ninegrid.delayQuerySelector('nx-side-menu-item.active')
|
|
32
32
|
.then((el) => {
|
|
33
|
-
console.log(el);
|
|
34
33
|
this.#generateBreadcrumb(el); // 빵 부스러기 데이터 생성 및 최종 렌더링 트리거
|
|
35
34
|
this.#renderer(); // 초기 렌더링 (빵 부스러기 데이터는 아직 없음)
|
|
36
35
|
});
|
|
@@ -38,25 +37,19 @@ class nxTitle extends HTMLElement {
|
|
|
38
37
|
|
|
39
38
|
// Breadcrumb 경로를 구성하는 비공개 메서드
|
|
40
39
|
#generateBreadcrumb = (activeMenuItem) => {
|
|
41
|
-
const path = ["Home"]; // 기본 경로 시작은 Home
|
|
42
40
|
this.#breadcrumbPath = [];
|
|
43
41
|
|
|
44
|
-
// 현재 nx-title의 캡션을 현재 페이지 캡션으로 사용
|
|
45
|
-
const currentPageCaption = this.getAttribute("caption") || "Current Page";
|
|
46
42
|
|
|
47
43
|
// 'active' 클래스를 가진 가장 하위 nx-side-menu-item 찾기
|
|
48
44
|
//const activeMenuItem = ninegrid.querySelector('nx-side-menu-item.active');
|
|
49
45
|
//console.log(activeMenuItem);
|
|
50
46
|
|
|
51
47
|
if (activeMenuItem) {
|
|
52
|
-
const tempPath = []; // 임시 경로를 저장하여 역순으로 처리
|
|
53
48
|
|
|
54
49
|
// 1. 현재 활성화된 메뉴 항목의 캡션을 추가 (예: '심의자료')
|
|
55
50
|
const currentActiveCaption = activeMenuItem.caption;//activeMenuItem.caption;
|
|
56
|
-
console.log("nxTitle", activeMenuItem.caption);
|
|
57
51
|
|
|
58
52
|
if (currentActiveCaption) {
|
|
59
|
-
tempPath.unshift(currentActiveCaption); // 맨 앞에 추가
|
|
60
53
|
this.#breadcrumbPath.unshift({
|
|
61
54
|
path: activeMenuItem.getAttribute("href"),
|
|
62
55
|
caption: currentActiveCaption,
|
|
@@ -77,7 +70,6 @@ class nxTitle extends HTMLElement {
|
|
|
77
70
|
|
|
78
71
|
// 이전 형제 탐색
|
|
79
72
|
currentElement = currentElement.previousElementSibling;
|
|
80
|
-
console.log(currentElement);
|
|
81
73
|
|
|
82
74
|
if (currentElement && currentElement.tagName === 'NX-SIDE-MENU-ITEM') {
|
|
83
75
|
const caption = currentElement.caption;//.getAttribute('caption');
|
|
@@ -85,7 +77,7 @@ console.log(currentElement);
|
|
|
85
77
|
// 'group' 속성을 가진 메뉴 항목 찾기 (예: '자료관리')
|
|
86
78
|
if (currentElement.getAttribute('type') === "group") {
|
|
87
79
|
if (caption && !foundGroupParent) { // 이미 찾지 않은 경우에만 추가
|
|
88
|
-
|
|
80
|
+
|
|
89
81
|
this.#breadcrumbPath.unshift({
|
|
90
82
|
path: currentElement.getAttribute("href"),
|
|
91
83
|
caption: caption,
|
|
@@ -116,20 +108,21 @@ console.log(currentElement);
|
|
|
116
108
|
// tempPath의 내용을 Home 다음으로 삽입
|
|
117
109
|
// activeMenuItem이 '심의자료' 역할을 하고, 그 이전에 '자료관리' 그룹이 있다면
|
|
118
110
|
// tempPath: ['자료관리', '심의자료']
|
|
119
|
-
|
|
111
|
+
|
|
120
112
|
}
|
|
121
113
|
|
|
122
114
|
// 마지막으로 현재 페이지의 구체적인 제목 추가
|
|
123
|
-
|
|
115
|
+
// 현재 nx-title의 캡션을 현재 페이지 캡션으로 사용
|
|
124
116
|
this.#breadcrumbPath.push({
|
|
125
117
|
path: "",
|
|
126
|
-
caption:
|
|
118
|
+
caption: this.getAttribute("caption") || "Current Page",
|
|
127
119
|
});
|
|
128
120
|
|
|
129
121
|
this.#breadcrumbPath.unshift({
|
|
130
122
|
path: "/",
|
|
131
123
|
caption: "Home",
|
|
132
124
|
});
|
|
125
|
+
|
|
133
126
|
console.log(this.#breadcrumbPath);
|
|
134
127
|
//this.#breadcrumbPath = path;
|
|
135
128
|
//this.#renderer();
|
|
@@ -160,18 +153,42 @@ console.log(this.#breadcrumbPath);
|
|
|
160
153
|
<span class="title-text">${caption}</span>
|
|
161
154
|
</div>
|
|
162
155
|
<div class="breadcrumb-container">
|
|
163
|
-
${this.#breadcrumbPath.map((item, index) =>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
156
|
+
${this.#breadcrumbPath.map((item, index) => {
|
|
157
|
+
|
|
158
|
+
const isCurrent = index === this.#breadcrumbPath.length - 1;
|
|
159
|
+
// static 메서드를 직접 호출하도록 수정
|
|
160
|
+
const linkTag = item.path && !isCurrent
|
|
161
|
+
? `<a href="javascript:void(0)"
|
|
162
|
+
class="breadcrumb-item breadcrumb-link"
|
|
163
|
+
onclick="nxTitle.#goto('${item.path}')">${item.caption}</a>`
|
|
164
|
+
: `<span class="breadcrumb-item ${isCurrent ? 'breadcrumb-current' : ''}">${item.caption}</span>`;
|
|
165
|
+
|
|
166
|
+
const separator = index < this.#breadcrumbPath.length - 1
|
|
167
|
+
? `<span class="breadcrumb-separator"> > </span>`
|
|
168
|
+
: '';
|
|
169
|
+
|
|
170
|
+
return `${linkTag}${separator}`;
|
|
171
|
+
}).join('')}
|
|
169
172
|
</div>
|
|
170
173
|
</div>
|
|
171
174
|
`;
|
|
172
175
|
|
|
173
176
|
this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
|
|
174
177
|
}
|
|
178
|
+
|
|
179
|
+
// static 메서드 aaa() 선언
|
|
180
|
+
static #goto(path) {
|
|
181
|
+
console.log('static aaa()가 호출되었습니다. Path:', path);
|
|
182
|
+
|
|
183
|
+
if (window.location.pathname === path) {
|
|
184
|
+
console.log('현재 URL과 path가 동일합니다. 탭 로직을 실행합니다.');
|
|
185
|
+
// 여기에 탭을 숨기거나 보여주는 로직을 작성합니다.
|
|
186
|
+
// 예: ninegrid.showTab('tab-id');
|
|
187
|
+
} else {
|
|
188
|
+
console.log('현재 URL과 path가 다릅니다. 페이지를 이동합니다.');
|
|
189
|
+
window.location.href = path;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
175
192
|
}
|
|
176
193
|
|
|
177
194
|
customElements.define("nx-title", nxTitle);
|
package/package.json
CHANGED
package/src/nx/nxTitle.js
CHANGED
|
@@ -30,7 +30,6 @@ class nxTitle extends HTMLElement {
|
|
|
30
30
|
*/
|
|
31
31
|
ninegrid.delayQuerySelector('nx-side-menu-item.active')
|
|
32
32
|
.then((el) => {
|
|
33
|
-
console.log(el);
|
|
34
33
|
this.#generateBreadcrumb(el); // 빵 부스러기 데이터 생성 및 최종 렌더링 트리거
|
|
35
34
|
this.#renderer(); // 초기 렌더링 (빵 부스러기 데이터는 아직 없음)
|
|
36
35
|
});
|
|
@@ -38,25 +37,19 @@ class nxTitle extends HTMLElement {
|
|
|
38
37
|
|
|
39
38
|
// Breadcrumb 경로를 구성하는 비공개 메서드
|
|
40
39
|
#generateBreadcrumb = (activeMenuItem) => {
|
|
41
|
-
const path = ["Home"]; // 기본 경로 시작은 Home
|
|
42
40
|
this.#breadcrumbPath = [];
|
|
43
41
|
|
|
44
|
-
// 현재 nx-title의 캡션을 현재 페이지 캡션으로 사용
|
|
45
|
-
const currentPageCaption = this.getAttribute("caption") || "Current Page";
|
|
46
42
|
|
|
47
43
|
// 'active' 클래스를 가진 가장 하위 nx-side-menu-item 찾기
|
|
48
44
|
//const activeMenuItem = ninegrid.querySelector('nx-side-menu-item.active');
|
|
49
45
|
//console.log(activeMenuItem);
|
|
50
46
|
|
|
51
47
|
if (activeMenuItem) {
|
|
52
|
-
const tempPath = []; // 임시 경로를 저장하여 역순으로 처리
|
|
53
48
|
|
|
54
49
|
// 1. 현재 활성화된 메뉴 항목의 캡션을 추가 (예: '심의자료')
|
|
55
50
|
const currentActiveCaption = activeMenuItem.caption;//activeMenuItem.caption;
|
|
56
|
-
console.log("nxTitle", activeMenuItem.caption);
|
|
57
51
|
|
|
58
52
|
if (currentActiveCaption) {
|
|
59
|
-
tempPath.unshift(currentActiveCaption); // 맨 앞에 추가
|
|
60
53
|
this.#breadcrumbPath.unshift({
|
|
61
54
|
path: activeMenuItem.getAttribute("href"),
|
|
62
55
|
caption: currentActiveCaption,
|
|
@@ -77,7 +70,6 @@ class nxTitle extends HTMLElement {
|
|
|
77
70
|
|
|
78
71
|
// 이전 형제 탐색
|
|
79
72
|
currentElement = currentElement.previousElementSibling;
|
|
80
|
-
console.log(currentElement);
|
|
81
73
|
|
|
82
74
|
if (currentElement && currentElement.tagName === 'NX-SIDE-MENU-ITEM') {
|
|
83
75
|
const caption = currentElement.caption;//.getAttribute('caption');
|
|
@@ -85,7 +77,7 @@ console.log(currentElement);
|
|
|
85
77
|
// 'group' 속성을 가진 메뉴 항목 찾기 (예: '자료관리')
|
|
86
78
|
if (currentElement.getAttribute('type') === "group") {
|
|
87
79
|
if (caption && !foundGroupParent) { // 이미 찾지 않은 경우에만 추가
|
|
88
|
-
|
|
80
|
+
|
|
89
81
|
this.#breadcrumbPath.unshift({
|
|
90
82
|
path: currentElement.getAttribute("href"),
|
|
91
83
|
caption: caption,
|
|
@@ -116,20 +108,21 @@ console.log(currentElement);
|
|
|
116
108
|
// tempPath의 내용을 Home 다음으로 삽입
|
|
117
109
|
// activeMenuItem이 '심의자료' 역할을 하고, 그 이전에 '자료관리' 그룹이 있다면
|
|
118
110
|
// tempPath: ['자료관리', '심의자료']
|
|
119
|
-
|
|
111
|
+
|
|
120
112
|
}
|
|
121
113
|
|
|
122
114
|
// 마지막으로 현재 페이지의 구체적인 제목 추가
|
|
123
|
-
|
|
115
|
+
// 현재 nx-title의 캡션을 현재 페이지 캡션으로 사용
|
|
124
116
|
this.#breadcrumbPath.push({
|
|
125
117
|
path: "",
|
|
126
|
-
caption:
|
|
118
|
+
caption: this.getAttribute("caption") || "Current Page",
|
|
127
119
|
});
|
|
128
120
|
|
|
129
121
|
this.#breadcrumbPath.unshift({
|
|
130
122
|
path: "/",
|
|
131
123
|
caption: "Home",
|
|
132
124
|
});
|
|
125
|
+
|
|
133
126
|
console.log(this.#breadcrumbPath);
|
|
134
127
|
//this.#breadcrumbPath = path;
|
|
135
128
|
//this.#renderer();
|
|
@@ -160,18 +153,42 @@ console.log(this.#breadcrumbPath);
|
|
|
160
153
|
<span class="title-text">${caption}</span>
|
|
161
154
|
</div>
|
|
162
155
|
<div class="breadcrumb-container">
|
|
163
|
-
${this.#breadcrumbPath.map((item, index) =>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
156
|
+
${this.#breadcrumbPath.map((item, index) => {
|
|
157
|
+
|
|
158
|
+
const isCurrent = index === this.#breadcrumbPath.length - 1;
|
|
159
|
+
// static 메서드를 직접 호출하도록 수정
|
|
160
|
+
const linkTag = item.path && !isCurrent
|
|
161
|
+
? `<a href="javascript:void(0)"
|
|
162
|
+
class="breadcrumb-item breadcrumb-link"
|
|
163
|
+
onclick="nxTitle.#goto('${item.path}')">${item.caption}</a>`
|
|
164
|
+
: `<span class="breadcrumb-item ${isCurrent ? 'breadcrumb-current' : ''}">${item.caption}</span>`;
|
|
165
|
+
|
|
166
|
+
const separator = index < this.#breadcrumbPath.length - 1
|
|
167
|
+
? `<span class="breadcrumb-separator"> > </span>`
|
|
168
|
+
: '';
|
|
169
|
+
|
|
170
|
+
return `${linkTag}${separator}`;
|
|
171
|
+
}).join('')}
|
|
169
172
|
</div>
|
|
170
173
|
</div>
|
|
171
174
|
`;
|
|
172
175
|
|
|
173
176
|
this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
|
|
174
177
|
}
|
|
178
|
+
|
|
179
|
+
// static 메서드 aaa() 선언
|
|
180
|
+
static #goto(path) {
|
|
181
|
+
console.log('static aaa()가 호출되었습니다. Path:', path);
|
|
182
|
+
|
|
183
|
+
if (window.location.pathname === path) {
|
|
184
|
+
console.log('현재 URL과 path가 동일합니다. 탭 로직을 실행합니다.');
|
|
185
|
+
// 여기에 탭을 숨기거나 보여주는 로직을 작성합니다.
|
|
186
|
+
// 예: ninegrid.showTab('tab-id');
|
|
187
|
+
} else {
|
|
188
|
+
console.log('현재 URL과 path가 다릅니다. 페이지를 이동합니다.');
|
|
189
|
+
window.location.href = path;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
175
192
|
}
|
|
176
193
|
|
|
177
194
|
customElements.define("nx-title", nxTitle);
|