@nine-lab/nine-mu 0.1.289 β 0.1.291
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/nine-mu.js +46 -39
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +1 -1
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NineDiffPopup.js +58 -42
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* π‘
|
|
22
|
+
* π‘ ν νμ΄μ§ μΈκ³½ νμ μ€λ¦¬μ§λ μ μ κ΅¬μ‘°λ‘ μμ νκ² ν보 (λ΄λΆ μλν° μ¬λ‘―μ λΉμλ )
|
|
23
23
|
*/
|
|
24
24
|
#renderScaffolding() {
|
|
25
25
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
@@ -32,14 +32,16 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
32
32
|
</style>
|
|
33
33
|
|
|
34
34
|
<nine-dialog>
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
<nine-tab theme="theme-3">
|
|
36
|
+
<nine-tab-page caption="MYBATIS" id="layer_MyBatis"></nine-tab-page>
|
|
37
|
+
<nine-tab-page caption="SERVICE" id="layer_Service"></nine-tab-page>
|
|
38
|
+
<nine-tab-page caption="CONTROLLER" id="layer_Controller"></nine-tab-page>
|
|
39
|
+
<nine-tab-page caption="JAVASCRIPT" id="layer_JavaScript"></nine-tab-page>
|
|
40
|
+
</nine-tab>
|
|
41
|
+
|
|
42
|
+
<div class="footer">
|
|
43
|
+
<button class="btn btn-cancel">μ·¨μ</button>
|
|
44
|
+
<button class="btn btn-confirm">λͺ¨λ μ μ₯</button>
|
|
43
45
|
</div>
|
|
44
46
|
</nine-dialog>
|
|
45
47
|
`;
|
|
@@ -57,17 +59,12 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
/**
|
|
60
|
-
* π‘ [
|
|
62
|
+
* π‘ [ν κ³ μ + μλν° λμ μΈμ€ν΄μ± μμ§]
|
|
61
63
|
*/
|
|
62
64
|
async data(fileList) {
|
|
63
65
|
if (!Array.isArray(fileList) || fileList.length === 0) return this;
|
|
64
66
|
this.#fileList = fileList;
|
|
65
67
|
|
|
66
|
-
// 1. π§Ό κΈ°μ‘΄ λμ λ²νΌ μμ 리μ
|
|
67
|
-
if (this.#tabContainer && typeof this.#tabContainer.clearTabs === 'function') {
|
|
68
|
-
this.#tabContainer.clearTabs();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
68
|
const detectLanguage = (path) => {
|
|
72
69
|
const lower = (path || "").toLowerCase();
|
|
73
70
|
if (lower.endsWith('.xml')) return 'xml';
|
|
@@ -76,40 +73,59 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
76
73
|
return 'javascript';
|
|
77
74
|
};
|
|
78
75
|
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
const fileName = full_path.split('/').pop() || "Unknown";
|
|
83
|
-
const captionName = `${layer.toUpperCase()} (${fileName})`;
|
|
76
|
+
// 1. β° nine-tab μ»΄ν¬λνΈμ μ€λ¦¬μ§λ μ μ νμ±(#renderTabs) μ°μ°μ΄ μλ£λ λκΉμ§ λ―ΈμΈν λ§μ§ ν보
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
const activeLayers = fileList.map(f => f.layer);
|
|
84
79
|
|
|
85
|
-
//
|
|
86
|
-
const
|
|
87
|
-
<div class="diff-wrapper">
|
|
88
|
-
<nine-diff class="${layer}"></nine-diff>
|
|
89
|
-
</div>
|
|
90
|
-
`;
|
|
80
|
+
// ν μ»΄ν¬λνΈ λ΄λΆ μλμ° λμΌλ‘ μ΄μ¬ κ° μ€μ ν νμ΄μ§ λ²νΌκ³Ό 컨ν
μΈ μ»¨ν
μ΄λ μμ ν보
|
|
81
|
+
const tabButtons = this.#tabContainer.shadowRoot.querySelectorAll('.tab-button');
|
|
91
82
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
});
|
|
83
|
+
// 4λ κ³ μ λ μ΄μ΄ λͺ
μΈ μ μ
|
|
84
|
+
const targetLayers = ["MyBatis", "Service", "Controller", "JavaScript"];
|
|
96
85
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const
|
|
86
|
+
targetLayers.forEach((layerName, index) => {
|
|
87
|
+
const currentBtn = tabButtons[index];
|
|
88
|
+
// nine-tab λ΄λΆ μλμ° λμ 쑰립λμ΄ λκΈ° μ€μΈ μ€μ νμ΄μ§ λͺΈμ²΄ λ³Έλ¬Έ div
|
|
89
|
+
const pageBody = this.#tabContainer.shadowRoot.getElementById(`content${index}`);
|
|
101
90
|
|
|
102
|
-
|
|
103
|
-
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
91
|
+
if (!pageBody) return;
|
|
104
92
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
// μ΄λ² λ°±μλ μλ£ μκ·Έλμ ν΄λΉ λ μ΄μ΄ μμ λͺ
μΈκ° ν¬ν¨λμ΄ μλ€λ©΄?
|
|
94
|
+
if (activeLayers.includes(layerName)) {
|
|
95
|
+
const fileData = fileList.find(f => f.layer === layerName);
|
|
96
|
+
const fileName = fileData.full_path.split('/').pop() || "Unknown";
|
|
97
|
+
|
|
98
|
+
// A. μλ¨ ν λ²νΌ ν
μ€νΈλ₯Ό μ€μ νμΌλͺ
μΌλ‘ λμ μ
λ°μ΄νΈ λ° λ
ΈμΆ
|
|
99
|
+
if (currentBtn) {
|
|
100
|
+
currentBtn.textContent = `${layerName.toUpperCase()} (${fileName})`;
|
|
101
|
+
currentBtn.style.display = "unset";
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// B. π₯ [ν΅μ¬ μμ ]: λ΄λΆ μλν° μ¬λ‘―λ§ λ°νμμ μ±μ±νκ² μμ ν μλ‘ κ΅¬μμ μ£Όμ
(μ§μ° μ°¨λ¨)
|
|
105
|
+
pageBody.innerHTML = `<nine-diff class="${layerName}"></nine-diff>`;
|
|
106
|
+
|
|
107
|
+
// C. μλ‘ νμ΄λ λμ μλν° λ¨λ§ μ₯μΉ μ¦μ μΈν°νμ΄μ€ μ΄κΈ°ν
|
|
108
|
+
const freshDiff = pageBody.querySelector(`nine-diff.${layerName}`);
|
|
109
|
+
if (freshDiff) {
|
|
110
|
+
const lang = detectLanguage(fileData.full_path);
|
|
111
|
+
freshDiff.initialize(fileData.asis_source || "", fileData.source || "", lang);
|
|
112
|
+
}
|
|
108
113
|
} else {
|
|
109
|
-
|
|
114
|
+
// μ΄λ² νμ€ν¬μμ μμ λμ§ μμ μ μΈ μμμ μλ¨ λ²νΌμ hide μ²λ¦¬νμ¬ κΉλνκ² λ§μ€νΉ
|
|
115
|
+
if (currentBtn) {
|
|
116
|
+
currentBtn.style.display = "none";
|
|
117
|
+
currentBtn.classList.remove("active");
|
|
118
|
+
}
|
|
119
|
+
pageBody.innerHTML = ""; // 컨ν
μΈ λ³Έλ¬Έ μ΄κΈ°ν
|
|
110
120
|
}
|
|
111
121
|
});
|
|
112
|
-
|
|
122
|
+
|
|
123
|
+
// 2. λμ μλν° κ°±μ λ° λ§μ€νΉ μλ£ ν, 첫 λ²μ§Έ νμ±ν(Visible)λ νμΌλ‘ μλ ν΄λ¦ μ΄λ
|
|
124
|
+
if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
|
|
125
|
+
this.#tabContainer.initialize();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}, 120);
|
|
113
129
|
|
|
114
130
|
return this;
|
|
115
131
|
}
|
|
@@ -123,7 +139,7 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
123
139
|
for (const file of this.#fileList) {
|
|
124
140
|
const { layer, full_path, asis_source } = file;
|
|
125
141
|
|
|
126
|
-
//
|
|
142
|
+
// nine-tab λ΄λΆ μλμ° μμ μμμ λμ κ°λ μ€μΈ μλν° μ»¨ν
μΈ νκ²ν
μΊ‘μ²
|
|
127
143
|
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
128
144
|
const currentContent = diff ? diff.getContents() : asis_source;
|
|
129
145
|
|