ninegrid2 6.1270.0 → 6.1272.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.
@@ -118765,8 +118765,8 @@ class NineGridContainer extends HTMLElement
118765
118765
 
118766
118766
 
118767
118767
  //this.querySelectorAll("buttons *").forEach(v => {v.grid = this;});
118768
- this.querySelectorAll("nx-buttons *").forEach(v => {v.grid = this;});
118769
- $(this.shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-custom")).append(this.querySelectorAll("nx-buttons"));
118768
+ this.querySelectorAll("buttons *").forEach(v => {v.grid = this;});
118769
+ $(this.shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-custom")).append(this.querySelectorAll("buttons"));
118770
118770
 
118771
118771
  this.#prepare();
118772
118772
 
@@ -122260,12 +122260,49 @@ class nxButtons extends HTMLElement {
122260
122260
  }
122261
122261
 
122262
122262
  connectedCallback() {
122263
- if (super.connectedCallback()) this.#init();
122263
+ //if (super.connectedCallback()) this.#init();
122264
122264
  };
122265
122265
 
122266
122266
  #init = () => {
122267
122267
 
122268
- return;
122268
+ const target = this.shadowRoot || this;
122269
+
122270
+ const htmlTmpl = document.createElement("template");
122271
+ htmlTmpl.innerHTML = `
122272
+ <style>
122273
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxButtons.css";
122274
+ ${ninegrid.getCustomPath(this,"nxButtons.css")}
122275
+ </style>
122276
+
122277
+ ${this.originContents}
122278
+ `;
122279
+
122280
+ //console.log(htmlTmpl);
122281
+
122282
+ target.appendChild(htmlTmpl.content.cloneNode(true));
122283
+
122284
+ target.addEventListener('click', (e) => {
122285
+
122286
+ const btn = e.target.closest('button');
122287
+ if (!btn) return;
122288
+
122289
+ //const actionName = btn.getAttribute('on-click') || btn.getAttribute('onClick') || btn.getAttribute('onclick');
122290
+
122291
+ const actionName = btn.getAttribute('on-click');
122292
+
122293
+ console.log(btn, actionName, this[actionName]);
122294
+ console.log(typeof this[actionName]);
122295
+ if (actionName) {
122296
+ // 1. 먼저 엘리먼트 자체(this)에 해당 이름의 함수가 있는지 확인
122297
+ if (typeof this[actionName] === 'function') {
122298
+ this[actionName](e);
122299
+ }
122300
+ // 2. 없으면 전역 window에서 확인
122301
+ else if (typeof window[actionName] === 'function') {
122302
+ window[actionName](e);
122303
+ }
122304
+ }
122305
+ });
122269
122306
  }
122270
122307
  }
122271
122308
 
@@ -118761,8 +118761,8 @@ class NineGridContainer extends HTMLElement
118761
118761
 
118762
118762
 
118763
118763
  //this.querySelectorAll("buttons *").forEach(v => {v.grid = this;});
118764
- this.querySelectorAll("nx-buttons *").forEach(v => {v.grid = this;});
118765
- $(this.shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-custom")).append(this.querySelectorAll("nx-buttons"));
118764
+ this.querySelectorAll("buttons *").forEach(v => {v.grid = this;});
118765
+ $(this.shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-custom")).append(this.querySelectorAll("buttons"));
118766
118766
 
118767
118767
  this.#prepare();
118768
118768
 
@@ -122256,12 +122256,49 @@ class nxButtons extends HTMLElement {
122256
122256
  }
122257
122257
 
122258
122258
  connectedCallback() {
122259
- if (super.connectedCallback()) this.#init();
122259
+ //if (super.connectedCallback()) this.#init();
122260
122260
  };
122261
122261
 
122262
122262
  #init = () => {
122263
122263
 
122264
- return;
122264
+ const target = this.shadowRoot || this;
122265
+
122266
+ const htmlTmpl = document.createElement("template");
122267
+ htmlTmpl.innerHTML = `
122268
+ <style>
122269
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxButtons.css";
122270
+ ${ninegrid.getCustomPath(this,"nxButtons.css")}
122271
+ </style>
122272
+
122273
+ ${this.originContents}
122274
+ `;
122275
+
122276
+ //console.log(htmlTmpl);
122277
+
122278
+ target.appendChild(htmlTmpl.content.cloneNode(true));
122279
+
122280
+ target.addEventListener('click', (e) => {
122281
+
122282
+ const btn = e.target.closest('button');
122283
+ if (!btn) return;
122284
+
122285
+ //const actionName = btn.getAttribute('on-click') || btn.getAttribute('onClick') || btn.getAttribute('onclick');
122286
+
122287
+ const actionName = btn.getAttribute('on-click');
122288
+
122289
+ console.log(btn, actionName, this[actionName]);
122290
+ console.log(typeof this[actionName]);
122291
+ if (actionName) {
122292
+ // 1. 먼저 엘리먼트 자체(this)에 해당 이름의 함수가 있는지 확인
122293
+ if (typeof this[actionName] === 'function') {
122294
+ this[actionName](e);
122295
+ }
122296
+ // 2. 없으면 전역 window에서 확인
122297
+ else if (typeof window[actionName] === 'function') {
122298
+ window[actionName](e);
122299
+ }
122300
+ }
122301
+ });
122265
122302
  }
122266
122303
  }
122267
122304
 
@@ -650,8 +650,8 @@ export class NineGridContainer extends HTMLElement
650
650
 
651
651
 
652
652
  //this.querySelectorAll("buttons *").forEach(v => {v.grid = this;});
653
- this.querySelectorAll("nx-buttons *").forEach(v => {v.grid = this;});
654
- $(this.shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-custom")).append(this.querySelectorAll("nx-buttons"));
653
+ this.querySelectorAll("buttons *").forEach(v => {v.grid = this;});
654
+ $(this.shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-custom")).append(this.querySelectorAll("buttons"));
655
655
 
656
656
  this.#prepare();
657
657
 
@@ -8,13 +8,11 @@ class nxButtons extends HTMLElement {
8
8
  }
9
9
 
10
10
  connectedCallback() {
11
- if (super.connectedCallback()) this.#init();
11
+ //if (super.connectedCallback()) this.#init();
12
12
  };
13
13
 
14
14
  #init = () => {
15
15
 
16
- return;
17
-
18
16
  const target = this.shadowRoot || this;
19
17
 
20
18
  const htmlTmpl = document.createElement("template");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1270.0",
4
+ "version": "6.1272.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -650,8 +650,8 @@ export class NineGridContainer extends HTMLElement
650
650
 
651
651
 
652
652
  //this.querySelectorAll("buttons *").forEach(v => {v.grid = this;});
653
- this.querySelectorAll("nx-buttons *").forEach(v => {v.grid = this;});
654
- $(this.shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-custom")).append(this.querySelectorAll("nx-buttons"));
653
+ this.querySelectorAll("buttons *").forEach(v => {v.grid = this;});
654
+ $(this.shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-custom")).append(this.querySelectorAll("buttons"));
655
655
 
656
656
  this.#prepare();
657
657
 
@@ -8,13 +8,11 @@ class nxButtons extends HTMLElement {
8
8
  }
9
9
 
10
10
  connectedCallback() {
11
- if (super.connectedCallback()) this.#init();
11
+ //if (super.connectedCallback()) this.#init();
12
12
  };
13
13
 
14
14
  #init = () => {
15
15
 
16
- return;
17
-
18
16
  const target = this.shadowRoot || this;
19
17
 
20
18
  const htmlTmpl = document.createElement("template");