ninegrid2 6.1259.0 → 6.1260.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.
@@ -122261,6 +122261,8 @@ class nxButtons extends nxDiv {
122261
122261
  };
122262
122262
 
122263
122263
  #init = () => {
122264
+ const target = this.shadowRoot || this;
122265
+
122264
122266
  const htmlTmpl = document.createElement("template");
122265
122267
  htmlTmpl.innerHTML = `
122266
122268
  <style>
@@ -122271,12 +122273,24 @@ class nxButtons extends nxDiv {
122271
122273
  ${this.originContents}
122272
122274
  `;
122273
122275
 
122274
- if (this.shadowRoot) {
122275
- this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
122276
- }
122277
- else {
122278
- this.appendChild(htmlTmpl.content.cloneNode(true));
122279
- }
122276
+ target.appendChild(htmlTmpl.content.cloneNode(true));
122277
+
122278
+ target.addEventListener('click', (e) => {
122279
+ const btn = e.target.closest('button');
122280
+ if (!btn) return;
122281
+
122282
+ const actionName = btn.getAttribute('on-click') || btn.getAttribute('onClick') || btn.getAttribute('onclick');
122283
+ if (actionName) {
122284
+ // 1. 먼저 엘리먼트 자체(this)에 해당 이름의 함수가 있는지 확인
122285
+ if (typeof this[actionName] === 'function') {
122286
+ this[actionName](e);
122287
+ }
122288
+ // 2. 없으면 전역 window에서 확인
122289
+ else if (typeof window[actionName] === 'function') {
122290
+ window[actionName](e);
122291
+ }
122292
+ }
122293
+ });
122280
122294
  }
122281
122295
  }
122282
122296
 
@@ -122257,6 +122257,8 @@ class nxButtons extends nxDiv {
122257
122257
  };
122258
122258
 
122259
122259
  #init = () => {
122260
+ const target = this.shadowRoot || this;
122261
+
122260
122262
  const htmlTmpl = document.createElement("template");
122261
122263
  htmlTmpl.innerHTML = `
122262
122264
  <style>
@@ -122267,12 +122269,24 @@ class nxButtons extends nxDiv {
122267
122269
  ${this.originContents}
122268
122270
  `;
122269
122271
 
122270
- if (this.shadowRoot) {
122271
- this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
122272
- }
122273
- else {
122274
- this.appendChild(htmlTmpl.content.cloneNode(true));
122275
- }
122272
+ target.appendChild(htmlTmpl.content.cloneNode(true));
122273
+
122274
+ target.addEventListener('click', (e) => {
122275
+ const btn = e.target.closest('button');
122276
+ if (!btn) return;
122277
+
122278
+ const actionName = btn.getAttribute('on-click') || btn.getAttribute('onClick') || btn.getAttribute('onclick');
122279
+ if (actionName) {
122280
+ // 1. 먼저 엘리먼트 자체(this)에 해당 이름의 함수가 있는지 확인
122281
+ if (typeof this[actionName] === 'function') {
122282
+ this[actionName](e);
122283
+ }
122284
+ // 2. 없으면 전역 window에서 확인
122285
+ else if (typeof window[actionName] === 'function') {
122286
+ window[actionName](e);
122287
+ }
122288
+ }
122289
+ });
122276
122290
  }
122277
122291
  }
122278
122292
 
@@ -12,6 +12,8 @@ class nxButtons extends nxDiv {
12
12
  };
13
13
 
14
14
  #init = () => {
15
+ const target = this.shadowRoot || this;
16
+
15
17
  const htmlTmpl = document.createElement("template");
16
18
  htmlTmpl.innerHTML = `
17
19
  <style>
@@ -22,12 +24,24 @@ class nxButtons extends nxDiv {
22
24
  ${this.originContents}
23
25
  `;
24
26
 
25
- if (this.shadowRoot) {
26
- this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
27
- }
28
- else {
29
- this.appendChild(htmlTmpl.content.cloneNode(true));
30
- }
27
+ target.appendChild(htmlTmpl.content.cloneNode(true));
28
+
29
+ target.addEventListener('click', (e) => {
30
+ const btn = e.target.closest('button');
31
+ if (!btn) return;
32
+
33
+ const actionName = btn.getAttribute('on-click') || btn.getAttribute('onClick') || btn.getAttribute('onclick');
34
+ if (actionName) {
35
+ // 1. 먼저 엘리먼트 자체(this)에 해당 이름의 함수가 있는지 확인
36
+ if (typeof this[actionName] === 'function') {
37
+ this[actionName](e);
38
+ }
39
+ // 2. 없으면 전역 window에서 확인
40
+ else if (typeof window[actionName] === 'function') {
41
+ window[actionName](e);
42
+ }
43
+ }
44
+ });
31
45
  }
32
46
  }
33
47
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1259.0",
4
+ "version": "6.1260.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -12,6 +12,8 @@ class nxButtons extends nxDiv {
12
12
  };
13
13
 
14
14
  #init = () => {
15
+ const target = this.shadowRoot || this;
16
+
15
17
  const htmlTmpl = document.createElement("template");
16
18
  htmlTmpl.innerHTML = `
17
19
  <style>
@@ -22,12 +24,24 @@ class nxButtons extends nxDiv {
22
24
  ${this.originContents}
23
25
  `;
24
26
 
25
- if (this.shadowRoot) {
26
- this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
27
- }
28
- else {
29
- this.appendChild(htmlTmpl.content.cloneNode(true));
30
- }
27
+ target.appendChild(htmlTmpl.content.cloneNode(true));
28
+
29
+ target.addEventListener('click', (e) => {
30
+ const btn = e.target.closest('button');
31
+ if (!btn) return;
32
+
33
+ const actionName = btn.getAttribute('on-click') || btn.getAttribute('onClick') || btn.getAttribute('onclick');
34
+ if (actionName) {
35
+ // 1. 먼저 엘리먼트 자체(this)에 해당 이름의 함수가 있는지 확인
36
+ if (typeof this[actionName] === 'function') {
37
+ this[actionName](e);
38
+ }
39
+ // 2. 없으면 전역 window에서 확인
40
+ else if (typeof window[actionName] === 'function') {
41
+ window[actionName](e);
42
+ }
43
+ }
44
+ });
31
45
  }
32
46
  }
33
47