ninegrid2 6.1173.0 → 6.1175.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.
@@ -121803,6 +121803,125 @@ class nxTitle extends HTMLElement {
121803
121803
 
121804
121804
  customElements.define("nx-title", nxTitle);
121805
121805
 
121806
+ class nxDiv extends HTMLElement
121807
+ {
121808
+ originContents;
121809
+ #isInitialized = false;
121810
+
121811
+ constructor () {
121812
+ super();
121813
+ this.attachShadow({ mode: 'open' });
121814
+ }
121815
+
121816
+ connectedCallback() {
121817
+ if (!this.#isInitialized) {
121818
+ this.#init();
121819
+ this.#isInitialized = true; // 3. 초기화 후 플래그를 true로 변경합니다.
121820
+ return true;
121821
+ }
121822
+
121823
+ return false;
121824
+ }
121825
+
121826
+ getData = () => {
121827
+ const jsonData = {};
121828
+
121829
+ // Shadow DOM 내의 폼 요소만 선택
121830
+ ninegrid.querySelectorAll("input[name], textarea[name], select[name]", this.shadowRoot).forEach(el => {
121831
+ const key = el.name;
121832
+ if (!key) return; // name이 없는 요소는 건너뜁니다.
121833
+
121834
+ let value;
121835
+ if (el.tagName === "INPUT" && (el.type === "checkbox" || el.type === "radio")) {
121836
+ value = el.checked;
121837
+ } else {
121838
+ value = el.value;
121839
+ }
121840
+
121841
+ // 중복 name을 대비한 배열 처리
121842
+ if (jsonData[key]) {
121843
+ if (!Array.isArray(jsonData[key])) {
121844
+ jsonData[key] = [jsonData[key]];
121845
+ }
121846
+ jsonData[key].push(value);
121847
+ } else {
121848
+ jsonData[key] = value;
121849
+ }
121850
+ });
121851
+
121852
+ return jsonData;
121853
+ };
121854
+
121855
+ setData = (jsonData) => {
121856
+ if (!jsonData || typeof jsonData !== 'object') {
121857
+ console.error("setData: Invalid data provided. Expected an object.");
121858
+ return;
121859
+ }
121860
+
121861
+ ninegrid.querySelectorAll("input[name], textarea[name], select[name]", this.shadowRoot).forEach(el => {
121862
+ const key = el.name;
121863
+ if (!key || !jsonData.hasOwnProperty(key)) return;
121864
+
121865
+ const value = jsonData[key];
121866
+
121867
+ // 폼 요소에만 데이터를 설정합니다.
121868
+ if (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT") {
121869
+ if (el.type === "checkbox" || el.type === "radio") {
121870
+ el.checked = (el.value === String(value));
121871
+ } else {
121872
+ el.value = value;
121873
+ }
121874
+ } else {
121875
+ // 폼 요소가 아닌 경우, textContent를 사용합니다.
121876
+ el.textContent = value;
121877
+ }
121878
+ });
121879
+ };
121880
+
121881
+ #init = () => {
121882
+
121883
+ /**
121884
+ * css style 적용
121885
+ */
121886
+ for (const attr of this.attributes) {
121887
+ if (attr.name.startsWith("css-")) {
121888
+ // "css-" 접두사를 제거하고 CSS 속성명으로 변환
121889
+ this.style.setProperty(attr.name.substring(4), attr.value);
121890
+ }
121891
+ }
121892
+
121893
+ this.originContents = this.innerHTML.trim();
121894
+ this.innerHTML = ""; // 기존 내부 HTML 제거
121895
+ };
121896
+ }
121897
+
121898
+ class nxTitle2 extends nxDiv {
121899
+
121900
+ constructor() {
121901
+ super();
121902
+ }
121903
+
121904
+ connectedCallback() {
121905
+ if (super.connectedCallback()) this.#init();
121906
+ };
121907
+
121908
+ #init = () => {
121909
+ const htmlTmpl = document.createElement("template");
121910
+ htmlTmpl.innerHTML = `
121911
+ <style>
121912
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxTitle2.css";
121913
+ ${ninegrid.getCustomPath(this,"nxTitle2.css")}
121914
+ </style>
121915
+
121916
+ ${this.originContents}
121917
+ `;
121918
+
121919
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
121920
+ }
121921
+ }
121922
+
121923
+ customElements.define("nx-title2", nxTitle2);
121924
+
121806
121925
  class NxLayout extends HTMLElement {
121807
121926
 
121808
121927
  #originalChildren;
@@ -122005,94 +122124,6 @@ class NxLayout2 extends HTMLElement {
122005
122124
 
122006
122125
  customElements.define('nx-layout2', NxLayout2);
122007
122126
 
122008
- class nxDiv extends HTMLElement
122009
- {
122010
- originContents;
122011
- #isInitialized = false;
122012
-
122013
- constructor () {
122014
- super();
122015
- this.attachShadow({ mode: 'open' });
122016
- }
122017
-
122018
- connectedCallback() {
122019
- if (!this.#isInitialized) {
122020
- this.#init();
122021
- this.#isInitialized = true; // 3. 초기화 후 플래그를 true로 변경합니다.
122022
- return true;
122023
- }
122024
-
122025
- return false;
122026
- }
122027
-
122028
- getData = () => {
122029
- const jsonData = {};
122030
-
122031
- this.shadowRoot.querySelectorAll("input, textarea, select, [id], [name]").forEach(el => {
122032
- const key = el.id || el.name; // id가 있으면 우선, 없으면 name 사용
122033
- if (!key) return; // id도 name도 없으면 건너뛰기
122034
-
122035
- const value = (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT")
122036
- ? el.value
122037
- : el.textContent.trim();
122038
-
122039
- // 중복 키를 대비한 배열 처리
122040
- if (jsonData[key]) {
122041
- if (!Array.isArray(jsonData[key])) {
122042
- jsonData[key] = [jsonData[key]];
122043
- }
122044
- jsonData[key].push(value);
122045
- } else {
122046
- jsonData[key] = value;
122047
- }
122048
- });
122049
-
122050
- return jsonData;
122051
- };
122052
-
122053
- setData = (jsonData) => {
122054
- if (!jsonData || typeof jsonData !== 'object') {
122055
- console.error("setData: Invalid data provided. Expected an object.");
122056
- return;
122057
- }
122058
-
122059
- this.shadowRoot.querySelectorAll("input[name], textarea[name], select[name]").forEach(el => {
122060
- const key = el.name;
122061
- if (!key || !jsonData.hasOwnProperty(key)) return;
122062
-
122063
- const value = jsonData[key];
122064
-
122065
- // 폼 요소에만 데이터를 설정합니다.
122066
- if (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT") {
122067
- if (el.type === "checkbox" || el.type === "radio") {
122068
- el.checked = (el.value === String(value));
122069
- } else {
122070
- el.value = value;
122071
- }
122072
- } else {
122073
- // 폼 요소가 아닌 경우, textContent를 사용합니다.
122074
- el.textContent = value;
122075
- }
122076
- });
122077
- };
122078
-
122079
- #init = () => {
122080
-
122081
- /**
122082
- * css style 적용
122083
- */
122084
- for (const attr of this.attributes) {
122085
- if (attr.name.startsWith("css-")) {
122086
- // "css-" 접두사를 제거하고 CSS 속성명으로 변환
122087
- this.style.setProperty(attr.name.substring(4), attr.value);
122088
- }
122089
- }
122090
-
122091
- this.originContents = this.innerHTML.trim();
122092
- this.innerHTML = ""; // 기존 내부 HTML 제거
122093
- };
122094
- }
122095
-
122096
122127
  class nxPanel extends nxDiv {
122097
122128
 
122098
122129
  constructor() {
@@ -121799,6 +121799,125 @@ class nxTitle extends HTMLElement {
121799
121799
 
121800
121800
  customElements.define("nx-title", nxTitle);
121801
121801
 
121802
+ class nxDiv extends HTMLElement
121803
+ {
121804
+ originContents;
121805
+ #isInitialized = false;
121806
+
121807
+ constructor () {
121808
+ super();
121809
+ this.attachShadow({ mode: 'open' });
121810
+ }
121811
+
121812
+ connectedCallback() {
121813
+ if (!this.#isInitialized) {
121814
+ this.#init();
121815
+ this.#isInitialized = true; // 3. 초기화 후 플래그를 true로 변경합니다.
121816
+ return true;
121817
+ }
121818
+
121819
+ return false;
121820
+ }
121821
+
121822
+ getData = () => {
121823
+ const jsonData = {};
121824
+
121825
+ // Shadow DOM 내의 폼 요소만 선택
121826
+ ninegrid.querySelectorAll("input[name], textarea[name], select[name]", this.shadowRoot).forEach(el => {
121827
+ const key = el.name;
121828
+ if (!key) return; // name이 없는 요소는 건너뜁니다.
121829
+
121830
+ let value;
121831
+ if (el.tagName === "INPUT" && (el.type === "checkbox" || el.type === "radio")) {
121832
+ value = el.checked;
121833
+ } else {
121834
+ value = el.value;
121835
+ }
121836
+
121837
+ // 중복 name을 대비한 배열 처리
121838
+ if (jsonData[key]) {
121839
+ if (!Array.isArray(jsonData[key])) {
121840
+ jsonData[key] = [jsonData[key]];
121841
+ }
121842
+ jsonData[key].push(value);
121843
+ } else {
121844
+ jsonData[key] = value;
121845
+ }
121846
+ });
121847
+
121848
+ return jsonData;
121849
+ };
121850
+
121851
+ setData = (jsonData) => {
121852
+ if (!jsonData || typeof jsonData !== 'object') {
121853
+ console.error("setData: Invalid data provided. Expected an object.");
121854
+ return;
121855
+ }
121856
+
121857
+ ninegrid.querySelectorAll("input[name], textarea[name], select[name]", this.shadowRoot).forEach(el => {
121858
+ const key = el.name;
121859
+ if (!key || !jsonData.hasOwnProperty(key)) return;
121860
+
121861
+ const value = jsonData[key];
121862
+
121863
+ // 폼 요소에만 데이터를 설정합니다.
121864
+ if (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT") {
121865
+ if (el.type === "checkbox" || el.type === "radio") {
121866
+ el.checked = (el.value === String(value));
121867
+ } else {
121868
+ el.value = value;
121869
+ }
121870
+ } else {
121871
+ // 폼 요소가 아닌 경우, textContent를 사용합니다.
121872
+ el.textContent = value;
121873
+ }
121874
+ });
121875
+ };
121876
+
121877
+ #init = () => {
121878
+
121879
+ /**
121880
+ * css style 적용
121881
+ */
121882
+ for (const attr of this.attributes) {
121883
+ if (attr.name.startsWith("css-")) {
121884
+ // "css-" 접두사를 제거하고 CSS 속성명으로 변환
121885
+ this.style.setProperty(attr.name.substring(4), attr.value);
121886
+ }
121887
+ }
121888
+
121889
+ this.originContents = this.innerHTML.trim();
121890
+ this.innerHTML = ""; // 기존 내부 HTML 제거
121891
+ };
121892
+ }
121893
+
121894
+ class nxTitle2 extends nxDiv {
121895
+
121896
+ constructor() {
121897
+ super();
121898
+ }
121899
+
121900
+ connectedCallback() {
121901
+ if (super.connectedCallback()) this.#init();
121902
+ };
121903
+
121904
+ #init = () => {
121905
+ const htmlTmpl = document.createElement("template");
121906
+ htmlTmpl.innerHTML = `
121907
+ <style>
121908
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxTitle2.css";
121909
+ ${ninegrid.getCustomPath(this,"nxTitle2.css")}
121910
+ </style>
121911
+
121912
+ ${this.originContents}
121913
+ `;
121914
+
121915
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
121916
+ }
121917
+ }
121918
+
121919
+ customElements.define("nx-title2", nxTitle2);
121920
+
121802
121921
  class NxLayout extends HTMLElement {
121803
121922
 
121804
121923
  #originalChildren;
@@ -122001,94 +122120,6 @@ class NxLayout2 extends HTMLElement {
122001
122120
 
122002
122121
  customElements.define('nx-layout2', NxLayout2);
122003
122122
 
122004
- class nxDiv extends HTMLElement
122005
- {
122006
- originContents;
122007
- #isInitialized = false;
122008
-
122009
- constructor () {
122010
- super();
122011
- this.attachShadow({ mode: 'open' });
122012
- }
122013
-
122014
- connectedCallback() {
122015
- if (!this.#isInitialized) {
122016
- this.#init();
122017
- this.#isInitialized = true; // 3. 초기화 후 플래그를 true로 변경합니다.
122018
- return true;
122019
- }
122020
-
122021
- return false;
122022
- }
122023
-
122024
- getData = () => {
122025
- const jsonData = {};
122026
-
122027
- this.shadowRoot.querySelectorAll("input, textarea, select, [id], [name]").forEach(el => {
122028
- const key = el.id || el.name; // id가 있으면 우선, 없으면 name 사용
122029
- if (!key) return; // id도 name도 없으면 건너뛰기
122030
-
122031
- const value = (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT")
122032
- ? el.value
122033
- : el.textContent.trim();
122034
-
122035
- // 중복 키를 대비한 배열 처리
122036
- if (jsonData[key]) {
122037
- if (!Array.isArray(jsonData[key])) {
122038
- jsonData[key] = [jsonData[key]];
122039
- }
122040
- jsonData[key].push(value);
122041
- } else {
122042
- jsonData[key] = value;
122043
- }
122044
- });
122045
-
122046
- return jsonData;
122047
- };
122048
-
122049
- setData = (jsonData) => {
122050
- if (!jsonData || typeof jsonData !== 'object') {
122051
- console.error("setData: Invalid data provided. Expected an object.");
122052
- return;
122053
- }
122054
-
122055
- this.shadowRoot.querySelectorAll("input[name], textarea[name], select[name]").forEach(el => {
122056
- const key = el.name;
122057
- if (!key || !jsonData.hasOwnProperty(key)) return;
122058
-
122059
- const value = jsonData[key];
122060
-
122061
- // 폼 요소에만 데이터를 설정합니다.
122062
- if (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT") {
122063
- if (el.type === "checkbox" || el.type === "radio") {
122064
- el.checked = (el.value === String(value));
122065
- } else {
122066
- el.value = value;
122067
- }
122068
- } else {
122069
- // 폼 요소가 아닌 경우, textContent를 사용합니다.
122070
- el.textContent = value;
122071
- }
122072
- });
122073
- };
122074
-
122075
- #init = () => {
122076
-
122077
- /**
122078
- * css style 적용
122079
- */
122080
- for (const attr of this.attributes) {
122081
- if (attr.name.startsWith("css-")) {
122082
- // "css-" 접두사를 제거하고 CSS 속성명으로 변환
122083
- this.style.setProperty(attr.name.substring(4), attr.value);
122084
- }
122085
- }
122086
-
122087
- this.originContents = this.innerHTML.trim();
122088
- this.innerHTML = ""; // 기존 내부 HTML 제거
122089
- };
122090
- }
122091
-
122092
122123
  class nxPanel extends nxDiv {
122093
122124
 
122094
122125
  constructor() {
package/dist/index.js CHANGED
@@ -106,6 +106,7 @@ import "./nx/nxTab.js";
106
106
  import "./nx/nxSplitter.js";
107
107
  import "./nx/nxForm.js";
108
108
  import "./nx/nxTitle.js";
109
+ import "./nx/nxTitle2.js";
109
110
  import "./nx/nxLayout.js";
110
111
  import "./nx/nxLayout2.js";
111
112
  import "./nx/nxPanel.js";
package/dist/nx/_nxDiv.js CHANGED
@@ -23,15 +23,19 @@ export class nxDiv extends HTMLElement
23
23
  getData = () => {
24
24
  const jsonData = {};
25
25
 
26
- this.shadowRoot.querySelectorAll("input, textarea, select, [id], [name]").forEach(el => {
27
- const key = el.id || el.name; // id가 있으면 우선, 없으면 name 사용
28
- if (!key) return; // id도 name도 없으면 건너뛰기
26
+ // Shadow DOM 내의 요소만 선택
27
+ ninegrid.querySelectorAll("input[name], textarea[name], select[name]", this.shadowRoot).forEach(el => {
28
+ const key = el.name;
29
+ if (!key) return; // name이 없는 요소는 건너뜁니다.
29
30
 
30
- const value = (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT")
31
- ? el.value
32
- : el.textContent.trim();
31
+ let value;
32
+ if (el.tagName === "INPUT" && (el.type === "checkbox" || el.type === "radio")) {
33
+ value = el.checked;
34
+ } else {
35
+ value = el.value;
36
+ }
33
37
 
34
- // 중복 키를 대비한 배열 처리
38
+ // 중복 name을 대비한 배열 처리
35
39
  if (jsonData[key]) {
36
40
  if (!Array.isArray(jsonData[key])) {
37
41
  jsonData[key] = [jsonData[key]];
@@ -51,7 +55,7 @@ export class nxDiv extends HTMLElement
51
55
  return;
52
56
  }
53
57
 
54
- this.shadowRoot.querySelectorAll("input[name], textarea[name], select[name]").forEach(el => {
58
+ ninegrid.querySelectorAll("input[name], textarea[name], select[name]", this.shadowRoot).forEach(el => {
55
59
  const key = el.name;
56
60
  if (!key || !jsonData.hasOwnProperty(key)) return;
57
61
 
@@ -0,0 +1,29 @@
1
+ import ninegrid from "../index.js";
2
+ import {nxDiv} from "./_nxDiv.js";
3
+
4
+ class nxTitle2 extends nxDiv {
5
+
6
+ constructor() {
7
+ super();
8
+ }
9
+
10
+ connectedCallback() {
11
+ if (super.connectedCallback()) this.#init();
12
+ };
13
+
14
+ #init = () => {
15
+ const htmlTmpl = document.createElement("template");
16
+ htmlTmpl.innerHTML = `
17
+ <style>
18
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxTitle2.css";
19
+ ${ninegrid.getCustomPath(this,"nxTitle2.css")}
20
+ </style>
21
+
22
+ ${this.originContents}
23
+ `;
24
+
25
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
26
+ }
27
+ }
28
+
29
+ customElements.define("nx-title2", nxTitle2);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1173.0",
4
+ "version": "6.1175.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
package/src/index.js CHANGED
@@ -106,6 +106,7 @@ import "./nx/nxTab.js";
106
106
  import "./nx/nxSplitter.js";
107
107
  import "./nx/nxForm.js";
108
108
  import "./nx/nxTitle.js";
109
+ import "./nx/nxTitle2.js";
109
110
  import "./nx/nxLayout.js";
110
111
  import "./nx/nxLayout2.js";
111
112
  import "./nx/nxPanel.js";
package/src/nx/_nxDiv.js CHANGED
@@ -23,15 +23,19 @@ export class nxDiv extends HTMLElement
23
23
  getData = () => {
24
24
  const jsonData = {};
25
25
 
26
- this.shadowRoot.querySelectorAll("input, textarea, select, [id], [name]").forEach(el => {
27
- const key = el.id || el.name; // id가 있으면 우선, 없으면 name 사용
28
- if (!key) return; // id도 name도 없으면 건너뛰기
26
+ // Shadow DOM 내의 요소만 선택
27
+ ninegrid.querySelectorAll("input[name], textarea[name], select[name]", this.shadowRoot).forEach(el => {
28
+ const key = el.name;
29
+ if (!key) return; // name이 없는 요소는 건너뜁니다.
29
30
 
30
- const value = (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT")
31
- ? el.value
32
- : el.textContent.trim();
31
+ let value;
32
+ if (el.tagName === "INPUT" && (el.type === "checkbox" || el.type === "radio")) {
33
+ value = el.checked;
34
+ } else {
35
+ value = el.value;
36
+ }
33
37
 
34
- // 중복 키를 대비한 배열 처리
38
+ // 중복 name을 대비한 배열 처리
35
39
  if (jsonData[key]) {
36
40
  if (!Array.isArray(jsonData[key])) {
37
41
  jsonData[key] = [jsonData[key]];
@@ -51,7 +55,7 @@ export class nxDiv extends HTMLElement
51
55
  return;
52
56
  }
53
57
 
54
- this.shadowRoot.querySelectorAll("input[name], textarea[name], select[name]").forEach(el => {
58
+ ninegrid.querySelectorAll("input[name], textarea[name], select[name]", this.shadowRoot).forEach(el => {
55
59
  const key = el.name;
56
60
  if (!key || !jsonData.hasOwnProperty(key)) return;
57
61
 
@@ -0,0 +1,29 @@
1
+ import ninegrid from "../index.js";
2
+ import {nxDiv} from "./_nxDiv.js";
3
+
4
+ class nxTitle2 extends nxDiv {
5
+
6
+ constructor() {
7
+ super();
8
+ }
9
+
10
+ connectedCallback() {
11
+ if (super.connectedCallback()) this.#init();
12
+ };
13
+
14
+ #init = () => {
15
+ const htmlTmpl = document.createElement("template");
16
+ htmlTmpl.innerHTML = `
17
+ <style>
18
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxTitle2.css";
19
+ ${ninegrid.getCustomPath(this,"nxTitle2.css")}
20
+ </style>
21
+
22
+ ${this.originContents}
23
+ `;
24
+
25
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
26
+ }
27
+ }
28
+
29
+ customElements.define("nx-title2", nxTitle2);