ninegrid2 6.1378.0 → 6.1380.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.
@@ -28501,6 +28501,45 @@ class nxDiv extends HTMLElement {
28501
28501
  return jsonData;
28502
28502
  };
28503
28503
 
28504
+ clearData = (jsonData) => {
28505
+ this.#getElements().forEach(el => {
28506
+ el.removeEventListener("input", this.#changeHandler);
28507
+ el.addEventListener("input", this.#changeHandler);
28508
+ });
28509
+
28510
+ //if (!jsonData || typeof jsonData !== 'object') return;
28511
+
28512
+ //let bChanged = false;
28513
+ this.#getElements().forEach(el => {
28514
+ const key = el.name;
28515
+ if (!key) return; // name이 없는 요소는 스킵
28516
+ //console.log(el.tagName, key, el.name);
28517
+
28518
+ // 2. jsonData에 해당 key가 없으면 공백("") 할당
28519
+ const value = (jsonData && jsonData[key] !== undefined) ? jsonData[key] : "";
28520
+
28521
+ const tagName = el.tagName.toUpperCase();
28522
+ const inputTags = ["INPUT", "TEXTAREA", "SELECT", "NX-EDITOR"];
28523
+
28524
+ if (inputTags.includes(tagName)) {
28525
+ if (el.type === "checkbox") {
28526
+ // 3. true-value 속성을 읽어와서 체크 여부 결정
28527
+ let t = el.getAttribute("true-value") || "Y";
28528
+ el.checked = (String(t) === String(value));
28529
+ } else if (el.type === "radio") {
28530
+ // 라디오 버튼 그룹 내에서 값 일치 여부 확인
28531
+ el.checked = (String(el.value) === String(value));
28532
+ } else {
28533
+ el.value = value;
28534
+ }
28535
+ } else {
28536
+ el.textContent = value;
28537
+ }
28538
+ });
28539
+
28540
+ this.#changed(false);
28541
+ };
28542
+
28504
28543
  setData = (jsonData) => {
28505
28544
  this.#getElements().forEach(el => {
28506
28545
  el.removeEventListener("input", this.#changeHandler);
@@ -28529,6 +28568,7 @@ class nxDiv extends HTMLElement {
28529
28568
  } else if (el.type === "radio") {
28530
28569
  const isChecked = (String(el.value) === String(value));
28531
28570
  if (el.checked !== isChecked) bChanged = true;
28571
+ // 라디오 버튼 그룹 내에서 값 일치 여부 확인
28532
28572
  el.checked = isChecked;
28533
28573
  } else {
28534
28574
  if (el.value !== value) bChanged = true;
@@ -28497,6 +28497,45 @@ class nxDiv extends HTMLElement {
28497
28497
  return jsonData;
28498
28498
  };
28499
28499
 
28500
+ clearData = (jsonData) => {
28501
+ this.#getElements().forEach(el => {
28502
+ el.removeEventListener("input", this.#changeHandler);
28503
+ el.addEventListener("input", this.#changeHandler);
28504
+ });
28505
+
28506
+ //if (!jsonData || typeof jsonData !== 'object') return;
28507
+
28508
+ //let bChanged = false;
28509
+ this.#getElements().forEach(el => {
28510
+ const key = el.name;
28511
+ if (!key) return; // name이 없는 요소는 스킵
28512
+ //console.log(el.tagName, key, el.name);
28513
+
28514
+ // 2. jsonData에 해당 key가 없으면 공백("") 할당
28515
+ const value = (jsonData && jsonData[key] !== undefined) ? jsonData[key] : "";
28516
+
28517
+ const tagName = el.tagName.toUpperCase();
28518
+ const inputTags = ["INPUT", "TEXTAREA", "SELECT", "NX-EDITOR"];
28519
+
28520
+ if (inputTags.includes(tagName)) {
28521
+ if (el.type === "checkbox") {
28522
+ // 3. true-value 속성을 읽어와서 체크 여부 결정
28523
+ let t = el.getAttribute("true-value") || "Y";
28524
+ el.checked = (String(t) === String(value));
28525
+ } else if (el.type === "radio") {
28526
+ // 라디오 버튼 그룹 내에서 값 일치 여부 확인
28527
+ el.checked = (String(el.value) === String(value));
28528
+ } else {
28529
+ el.value = value;
28530
+ }
28531
+ } else {
28532
+ el.textContent = value;
28533
+ }
28534
+ });
28535
+
28536
+ this.#changed(false);
28537
+ };
28538
+
28500
28539
  setData = (jsonData) => {
28501
28540
  this.#getElements().forEach(el => {
28502
28541
  el.removeEventListener("input", this.#changeHandler);
@@ -28525,6 +28564,7 @@ class nxDiv extends HTMLElement {
28525
28564
  } else if (el.type === "radio") {
28526
28565
  const isChecked = (String(el.value) === String(value));
28527
28566
  if (el.checked !== isChecked) bChanged = true;
28567
+ // 라디오 버튼 그룹 내에서 값 일치 여부 확인
28528
28568
  el.checked = isChecked;
28529
28569
  } else {
28530
28570
  if (el.value !== value) bChanged = true;
package/dist/nx/_nxDiv.js CHANGED
@@ -68,6 +68,45 @@ export class nxDiv extends HTMLElement {
68
68
  return jsonData;
69
69
  };
70
70
 
71
+ clearData = (jsonData) => {
72
+ this.#getElements().forEach(el => {
73
+ el.removeEventListener("input", this.#changeHandler);
74
+ el.addEventListener("input", this.#changeHandler);
75
+ });
76
+
77
+ //if (!jsonData || typeof jsonData !== 'object') return;
78
+
79
+ //let bChanged = false;
80
+ this.#getElements().forEach(el => {
81
+ const key = el.name;
82
+ if (!key) return; // name이 없는 요소는 스킵
83
+ //console.log(el.tagName, key, el.name);
84
+
85
+ // 2. jsonData에 해당 key가 없으면 공백("") 할당
86
+ const value = (jsonData && jsonData[key] !== undefined) ? jsonData[key] : "";
87
+
88
+ const tagName = el.tagName.toUpperCase();
89
+ const inputTags = ["INPUT", "TEXTAREA", "SELECT", "NX-EDITOR"];
90
+
91
+ if (inputTags.includes(tagName)) {
92
+ if (el.type === "checkbox") {
93
+ // 3. true-value 속성을 읽어와서 체크 여부 결정
94
+ let t = el.getAttribute("true-value") || "Y";
95
+ el.checked = (String(t) === String(value));
96
+ } else if (el.type === "radio") {
97
+ // 라디오 버튼 그룹 내에서 값 일치 여부 확인
98
+ el.checked = (String(el.value) === String(value));
99
+ } else {
100
+ el.value = value;
101
+ }
102
+ } else {
103
+ el.textContent = value;
104
+ }
105
+ });
106
+
107
+ this.#changed(false);
108
+ };
109
+
71
110
  setData = (jsonData) => {
72
111
  this.#getElements().forEach(el => {
73
112
  el.removeEventListener("input", this.#changeHandler);
@@ -96,6 +135,7 @@ export class nxDiv extends HTMLElement {
96
135
  } else if (el.type === "radio") {
97
136
  const isChecked = (String(el.value) === String(value));
98
137
  if (el.checked !== isChecked) bChanged = true;
138
+ // 라디오 버튼 그룹 내에서 값 일치 여부 확인
99
139
  el.checked = isChecked;
100
140
  } else {
101
141
  if (el.value !== value) bChanged = true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1378.0",
4
+ "version": "6.1380.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
package/src/nx/_nxDiv.js CHANGED
@@ -68,6 +68,45 @@ export class nxDiv extends HTMLElement {
68
68
  return jsonData;
69
69
  };
70
70
 
71
+ clearData = (jsonData) => {
72
+ this.#getElements().forEach(el => {
73
+ el.removeEventListener("input", this.#changeHandler);
74
+ el.addEventListener("input", this.#changeHandler);
75
+ });
76
+
77
+ //if (!jsonData || typeof jsonData !== 'object') return;
78
+
79
+ //let bChanged = false;
80
+ this.#getElements().forEach(el => {
81
+ const key = el.name;
82
+ if (!key) return; // name이 없는 요소는 스킵
83
+ //console.log(el.tagName, key, el.name);
84
+
85
+ // 2. jsonData에 해당 key가 없으면 공백("") 할당
86
+ const value = (jsonData && jsonData[key] !== undefined) ? jsonData[key] : "";
87
+
88
+ const tagName = el.tagName.toUpperCase();
89
+ const inputTags = ["INPUT", "TEXTAREA", "SELECT", "NX-EDITOR"];
90
+
91
+ if (inputTags.includes(tagName)) {
92
+ if (el.type === "checkbox") {
93
+ // 3. true-value 속성을 읽어와서 체크 여부 결정
94
+ let t = el.getAttribute("true-value") || "Y";
95
+ el.checked = (String(t) === String(value));
96
+ } else if (el.type === "radio") {
97
+ // 라디오 버튼 그룹 내에서 값 일치 여부 확인
98
+ el.checked = (String(el.value) === String(value));
99
+ } else {
100
+ el.value = value;
101
+ }
102
+ } else {
103
+ el.textContent = value;
104
+ }
105
+ });
106
+
107
+ this.#changed(false);
108
+ };
109
+
71
110
  setData = (jsonData) => {
72
111
  this.#getElements().forEach(el => {
73
112
  el.removeEventListener("input", this.#changeHandler);
@@ -96,6 +135,7 @@ export class nxDiv extends HTMLElement {
96
135
  } else if (el.type === "radio") {
97
136
  const isChecked = (String(el.value) === String(value));
98
137
  if (el.checked !== isChecked) bChanged = true;
138
+ // 라디오 버튼 그룹 내에서 값 일치 여부 확인
99
139
  el.checked = isChecked;
100
140
  } else {
101
141
  if (el.value !== value) bChanged = true;