ninegrid2 6.172.0 → 6.174.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.
@@ -10730,14 +10730,14 @@ class ninegrid {
10730
10730
  if (!("shadow" in Element.prototype)) {
10731
10731
  Object.defineProperty(Element.prototype, "shadow", {
10732
10732
  get: function () {
10733
- const self = this;
10733
+ let currentElement = this;
10734
10734
  return {
10735
10735
  closest: function (selector) {
10736
- let currentElement = self;
10736
+ //let currentElement = self;
10737
10737
 
10738
10738
  while (currentElement) {
10739
10739
 
10740
- console.log(currentElement);
10740
+ //console.log(currentElement);
10741
10741
  if (currentElement.matches(selector)) return currentElement;
10742
10742
 
10743
10743
  // ✅ Shadow Root를 가지고 있는 경우 내부에서 탐색
@@ -10751,6 +10751,35 @@ class ninegrid {
10751
10751
 
10752
10752
  return null;
10753
10753
  },
10754
+ querySelectorAll: (selector) => {
10755
+ let elements = [];
10756
+
10757
+ if (currentElement instanceof NodeList) {
10758
+ currentElement.forEach(ctx => {
10759
+ if (selector instanceof NodeList) {
10760
+ selector.forEach(sel => {
10761
+ elements.push(...ctx.querySelectorAll(sel));
10762
+ });
10763
+ } else if (selector instanceof HTMLElement) {
10764
+ elements.push(...ctx.querySelectorAll(selector));
10765
+ } else {
10766
+ elements.push(...ctx.querySelectorAll(selector));
10767
+ }
10768
+ });
10769
+ } else {
10770
+ if (selector instanceof HTMLElement) {
10771
+ elements = [selector];
10772
+ } else if (selector instanceof NodeList) {
10773
+ selector.forEach(sel => {
10774
+ elements.push(...currentElement.querySelectorAll(sel));
10775
+ });
10776
+ } else {
10777
+ elements = currentElement.querySelectorAll(selector);
10778
+ }
10779
+ }
10780
+
10781
+ return elements;
10782
+ },
10754
10783
  };
10755
10784
  }
10756
10785
  });
@@ -18193,11 +18222,11 @@ class ngFilterButton extends HTMLElement
18193
18222
  //console.log(panel.isHidden);
18194
18223
 
18195
18224
  //panel.style.display = 'flex' : 'none';
18196
- console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
18225
+ //console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
18197
18226
 
18198
18227
  if (panel.col === this.closest('th,td').dataset.col) {
18199
- panel.col = null;
18200
- panel.style.display = 'none';
18228
+ //panel.col = null;
18229
+ //panel.style.display = 'none';
18201
18230
  panel.close();
18202
18231
  }
18203
18232
  else {
@@ -18435,8 +18464,6 @@ class ngFilterPanel extends HTMLElement
18435
18464
 
18436
18465
  open = (owner, filterButton) => {
18437
18466
 
18438
-
18439
-
18440
18467
  var col = filterButton.closest('th,td').dataset.col;
18441
18468
  this.col = col;
18442
18469
 
@@ -18450,113 +18477,14 @@ class ngFilterPanel extends HTMLElement
18450
18477
  col : col,
18451
18478
  };
18452
18479
 
18453
- $(this).show();
18454
-
18455
- ninegrid.j.querySelectorAll(this).addClass("loading");
18456
-
18457
- $(this.shadowRoot).find("input[type=text]").val("");
18480
+ this.style.display = 'flex';
18481
+ //$(this).show();
18458
18482
 
18459
- setTimeout(() => {
18483
+ //console.log(document.shadow.querySelectorAll(this), ninegrid.j.querySelectorAll(this));
18484
+ //ninegrid.j.querySelectorAll(this).addClass("loading");
18485
+ this.classList.add("loading");
18460
18486
 
18461
- var ds = [];
18462
- var colnms = [];
18463
- $(owner.template).find(`[data-col=${col}]`).each((index,el) => {
18464
- if (el.dataset.bind) colnms.push(el.dataset.bind);
18465
- });
18466
-
18467
- var data = owner.data.getValidDataNF();
18468
- $("ng-filter-button", owner.body).each((index,el) => {
18469
-
18470
- if (el.closest('th,td').dataset.col == col || !el.filterData) return true;
18471
- /**
18472
- el.filterData.forEach(o => {
18473
- var idx = owner.fields.indexOf(o.colnm);
18474
-
18475
- if (idx >= 0) {
18476
- data = data.filter(m => { return o.data.nineBinarySearch(m.v[idx] || '') >= 0; });
18477
- }
18478
- });
18479
- */
18480
-
18481
- console.log(el.filterData, el.colnms, el.dataset.bind);
18482
-
18483
- el.colnms.forEach(colnm => {
18484
- var idx = owner.fields.indexOf(colnm);
18485
-
18486
- console.log(idx);
18487
-
18488
- if (idx >= 0) {
18489
- data = data.filter(m => { return el.filterData.nineBinarySearch(m.v[idx] || '') >= 0; });
18490
- }
18491
- });
18492
-
18493
- //data = data.filter(rowData => { return el.filterData.findIndex(item => (item.DATA || '') == (rowData[item.COLNM] || '') ) >= 0; });
18494
- });
18495
-
18496
-
18497
- colnms = [...new Set(colnms)];
18498
- colnms.forEach((colnm,i) => {
18499
-
18500
- ds.push({
18501
- LVL: 1,
18502
- CHK: 'N',
18503
- DATA2: '<span class="group">' + $(filterButton).closest('th,td').text() + (colnms.length > 1 ? ` #${i+1} (${colnm})` : '') + '</span>',
18504
- });
18505
-
18506
- var filterData = [];
18507
- if (filterButton.filterData) {
18508
- var idx = filterButton.filterData.findIndex(item => item.colnm == colnm);
18509
- if (idx >= 0) {
18510
- filterData = filterButton.filterData[idx].data;
18511
- }
18512
- }
18513
-
18514
- /**
18515
- var cell = $(`[data-col=${col}][data-bind=${colnm}]`, owner.template);
18516
- var expr = cell.attr("data-expr");
18517
- var exprFunc = (expr) ? owner.exprFunction(expr) : null;
18518
- */
18519
-
18520
- const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${colnm}"]`, owner.tmpl).elem();
18521
- const expr = cell.getAttribute("data-expr");
18522
- const exprFunc = (expr) ? owner.exprFunction(expr) : null;
18523
-
18524
- var data2 = [];
18525
- for (var rowData of data) {
18526
- var idx = owner.fields.indexOf(colnm);
18527
-
18528
- if (expr) {
18529
- var o = owner.data.conv(rowData);
18530
- data2.push({v:o[colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
18531
- }
18532
- else {
18533
- data2.push({v:rowData.v[idx],v2:rowData.v[idx]});
18534
- }
18535
- }
18536
-
18537
- [...new Set(data2.sort( (a,b) => { return (a.v2||'') > (b.v2||'') ? 1 : ((a.v2||'') < (b.v2||'') ? -1 : 0); } ).map((m) => JSON.stringify(m)))].map((m) => JSON.parse(m)).forEach(o => {
18538
- ds.push({
18539
- LVL : 2,
18540
- DATA : o.v,
18541
- DATA2 : o.v2 || ` <span class="empty">(empty)</span> ${o.v}`,
18542
- COLNM : colnm,
18543
- CHK : filterData.length == 0 || filterData.nineBinarySearch(o.v || '') >= 0 ? "Y" : "N",
18544
- });
18545
- });
18546
- });
18547
-
18548
- var grd = this.shadowRoot.querySelector("nine-grid");
18549
- //grd.dataSource = ds;
18550
- grd.fields.add(["DATA","DATA2","COLNM"]);
18551
-
18552
- grd.data.set(ds);
18553
-
18554
- $(this.shadowRoot).find("input[type=checkbox]").prop("checked", grd.data.getValidData().filter(item => { return item.LVL == 2 && item.CHK != "Y"; }).length == 0 ? true : false);
18555
-
18556
- this.shadowRoot.querySelector("input").focus();
18557
-
18558
- ninegrid.j.querySelectorAll(this).removeClass("loading");
18559
- });
18487
+ return;
18560
18488
  };
18561
18489
  }
18562
18490
 
@@ -10728,14 +10728,14 @@ class ninegrid {
10728
10728
  if (!("shadow" in Element.prototype)) {
10729
10729
  Object.defineProperty(Element.prototype, "shadow", {
10730
10730
  get: function () {
10731
- const self = this;
10731
+ let currentElement = this;
10732
10732
  return {
10733
10733
  closest: function (selector) {
10734
- let currentElement = self;
10734
+ //let currentElement = self;
10735
10735
 
10736
10736
  while (currentElement) {
10737
10737
 
10738
- console.log(currentElement);
10738
+ //console.log(currentElement);
10739
10739
  if (currentElement.matches(selector)) return currentElement;
10740
10740
 
10741
10741
  // ✅ Shadow Root를 가지고 있는 경우 내부에서 탐색
@@ -10749,6 +10749,35 @@ class ninegrid {
10749
10749
 
10750
10750
  return null;
10751
10751
  },
10752
+ querySelectorAll: (selector) => {
10753
+ let elements = [];
10754
+
10755
+ if (currentElement instanceof NodeList) {
10756
+ currentElement.forEach(ctx => {
10757
+ if (selector instanceof NodeList) {
10758
+ selector.forEach(sel => {
10759
+ elements.push(...ctx.querySelectorAll(sel));
10760
+ });
10761
+ } else if (selector instanceof HTMLElement) {
10762
+ elements.push(...ctx.querySelectorAll(selector));
10763
+ } else {
10764
+ elements.push(...ctx.querySelectorAll(selector));
10765
+ }
10766
+ });
10767
+ } else {
10768
+ if (selector instanceof HTMLElement) {
10769
+ elements = [selector];
10770
+ } else if (selector instanceof NodeList) {
10771
+ selector.forEach(sel => {
10772
+ elements.push(...currentElement.querySelectorAll(sel));
10773
+ });
10774
+ } else {
10775
+ elements = currentElement.querySelectorAll(selector);
10776
+ }
10777
+ }
10778
+
10779
+ return elements;
10780
+ },
10752
10781
  };
10753
10782
  }
10754
10783
  });
@@ -18191,11 +18220,11 @@ class ngFilterButton extends HTMLElement
18191
18220
  //console.log(panel.isHidden);
18192
18221
 
18193
18222
  //panel.style.display = 'flex' : 'none';
18194
- console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
18223
+ //console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
18195
18224
 
18196
18225
  if (panel.col === this.closest('th,td').dataset.col) {
18197
- panel.col = null;
18198
- panel.style.display = 'none';
18226
+ //panel.col = null;
18227
+ //panel.style.display = 'none';
18199
18228
  panel.close();
18200
18229
  }
18201
18230
  else {
@@ -18433,8 +18462,6 @@ class ngFilterPanel extends HTMLElement
18433
18462
 
18434
18463
  open = (owner, filterButton) => {
18435
18464
 
18436
-
18437
-
18438
18465
  var col = filterButton.closest('th,td').dataset.col;
18439
18466
  this.col = col;
18440
18467
 
@@ -18448,113 +18475,14 @@ class ngFilterPanel extends HTMLElement
18448
18475
  col : col,
18449
18476
  };
18450
18477
 
18451
- $(this).show();
18452
-
18453
- ninegrid.j.querySelectorAll(this).addClass("loading");
18454
-
18455
- $(this.shadowRoot).find("input[type=text]").val("");
18478
+ this.style.display = 'flex';
18479
+ //$(this).show();
18456
18480
 
18457
- setTimeout(() => {
18481
+ //console.log(document.shadow.querySelectorAll(this), ninegrid.j.querySelectorAll(this));
18482
+ //ninegrid.j.querySelectorAll(this).addClass("loading");
18483
+ this.classList.add("loading");
18458
18484
 
18459
- var ds = [];
18460
- var colnms = [];
18461
- $(owner.template).find(`[data-col=${col}]`).each((index,el) => {
18462
- if (el.dataset.bind) colnms.push(el.dataset.bind);
18463
- });
18464
-
18465
- var data = owner.data.getValidDataNF();
18466
- $("ng-filter-button", owner.body).each((index,el) => {
18467
-
18468
- if (el.closest('th,td').dataset.col == col || !el.filterData) return true;
18469
- /**
18470
- el.filterData.forEach(o => {
18471
- var idx = owner.fields.indexOf(o.colnm);
18472
-
18473
- if (idx >= 0) {
18474
- data = data.filter(m => { return o.data.nineBinarySearch(m.v[idx] || '') >= 0; });
18475
- }
18476
- });
18477
- */
18478
-
18479
- console.log(el.filterData, el.colnms, el.dataset.bind);
18480
-
18481
- el.colnms.forEach(colnm => {
18482
- var idx = owner.fields.indexOf(colnm);
18483
-
18484
- console.log(idx);
18485
-
18486
- if (idx >= 0) {
18487
- data = data.filter(m => { return el.filterData.nineBinarySearch(m.v[idx] || '') >= 0; });
18488
- }
18489
- });
18490
-
18491
- //data = data.filter(rowData => { return el.filterData.findIndex(item => (item.DATA || '') == (rowData[item.COLNM] || '') ) >= 0; });
18492
- });
18493
-
18494
-
18495
- colnms = [...new Set(colnms)];
18496
- colnms.forEach((colnm,i) => {
18497
-
18498
- ds.push({
18499
- LVL: 1,
18500
- CHK: 'N',
18501
- DATA2: '<span class="group">' + $(filterButton).closest('th,td').text() + (colnms.length > 1 ? ` #${i+1} (${colnm})` : '') + '</span>',
18502
- });
18503
-
18504
- var filterData = [];
18505
- if (filterButton.filterData) {
18506
- var idx = filterButton.filterData.findIndex(item => item.colnm == colnm);
18507
- if (idx >= 0) {
18508
- filterData = filterButton.filterData[idx].data;
18509
- }
18510
- }
18511
-
18512
- /**
18513
- var cell = $(`[data-col=${col}][data-bind=${colnm}]`, owner.template);
18514
- var expr = cell.attr("data-expr");
18515
- var exprFunc = (expr) ? owner.exprFunction(expr) : null;
18516
- */
18517
-
18518
- const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${colnm}"]`, owner.tmpl).elem();
18519
- const expr = cell.getAttribute("data-expr");
18520
- const exprFunc = (expr) ? owner.exprFunction(expr) : null;
18521
-
18522
- var data2 = [];
18523
- for (var rowData of data) {
18524
- var idx = owner.fields.indexOf(colnm);
18525
-
18526
- if (expr) {
18527
- var o = owner.data.conv(rowData);
18528
- data2.push({v:o[colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
18529
- }
18530
- else {
18531
- data2.push({v:rowData.v[idx],v2:rowData.v[idx]});
18532
- }
18533
- }
18534
-
18535
- [...new Set(data2.sort( (a,b) => { return (a.v2||'') > (b.v2||'') ? 1 : ((a.v2||'') < (b.v2||'') ? -1 : 0); } ).map((m) => JSON.stringify(m)))].map((m) => JSON.parse(m)).forEach(o => {
18536
- ds.push({
18537
- LVL : 2,
18538
- DATA : o.v,
18539
- DATA2 : o.v2 || ` <span class="empty">(empty)</span> ${o.v}`,
18540
- COLNM : colnm,
18541
- CHK : filterData.length == 0 || filterData.nineBinarySearch(o.v || '') >= 0 ? "Y" : "N",
18542
- });
18543
- });
18544
- });
18545
-
18546
- var grd = this.shadowRoot.querySelector("nine-grid");
18547
- //grd.dataSource = ds;
18548
- grd.fields.add(["DATA","DATA2","COLNM"]);
18549
-
18550
- grd.data.set(ds);
18551
-
18552
- $(this.shadowRoot).find("input[type=checkbox]").prop("checked", grd.data.getValidData().filter(item => { return item.LVL == 2 && item.CHK != "Y"; }).length == 0 ? true : false);
18553
-
18554
- this.shadowRoot.querySelector("input").focus();
18555
-
18556
- ninegrid.j.querySelectorAll(this).removeClass("loading");
18557
- });
18485
+ return;
18558
18486
  };
18559
18487
  }
18560
18488
 
@@ -286,11 +286,11 @@ class ngFilterButton extends HTMLElement
286
286
  //console.log(panel.isHidden);
287
287
 
288
288
  //panel.style.display = 'flex' : 'none';
289
- console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
289
+ //console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
290
290
 
291
291
  if (panel.col === this.closest('th,td').dataset.col) {
292
- panel.col = null;
293
- panel.style.display = 'none';
292
+ //panel.col = null;
293
+ //panel.style.display = 'none';
294
294
  panel.close();
295
295
  }
296
296
  else {
@@ -530,8 +530,6 @@ class ngFilterPanel extends HTMLElement
530
530
 
531
531
  open = (owner, filterButton) => {
532
532
 
533
-
534
-
535
533
  var col = filterButton.closest('th,td').dataset.col;
536
534
  this.col = col;
537
535
 
@@ -548,10 +546,15 @@ class ngFilterPanel extends HTMLElement
548
546
  col : col,
549
547
  }
550
548
 
551
- $(this).show();
549
+ this.style.display = 'flex';
550
+ //$(this).show();
552
551
 
553
- ninegrid.j.querySelectorAll(this).addClass("loading");
552
+ //console.log(document.shadow.querySelectorAll(this), ninegrid.j.querySelectorAll(this));
553
+ //ninegrid.j.querySelectorAll(this).addClass("loading");
554
+ this.classList.add("loading");
554
555
 
556
+ return;
557
+
555
558
  $(this.shadowRoot).find("input[type=text]").val("");
556
559
 
557
560
  setTimeout(() => {
@@ -24,14 +24,14 @@ export class ninegrid {
24
24
  if (!("shadow" in Element.prototype)) {
25
25
  Object.defineProperty(Element.prototype, "shadow", {
26
26
  get: function () {
27
- const self = this;
27
+ let currentElement = this;
28
28
  return {
29
29
  closest: function (selector) {
30
- let currentElement = self;
30
+ //let currentElement = self;
31
31
 
32
32
  while (currentElement) {
33
33
 
34
- console.log(currentElement);
34
+ //console.log(currentElement);
35
35
  if (currentElement.matches(selector)) return currentElement;
36
36
 
37
37
  // ✅ Shadow Root를 가지고 있는 경우 내부에서 탐색
@@ -45,6 +45,35 @@ export class ninegrid {
45
45
 
46
46
  return null;
47
47
  },
48
+ querySelectorAll: (selector) => {
49
+ let elements = [];
50
+
51
+ if (currentElement instanceof NodeList) {
52
+ currentElement.forEach(ctx => {
53
+ if (selector instanceof NodeList) {
54
+ selector.forEach(sel => {
55
+ elements.push(...ctx.querySelectorAll(sel));
56
+ });
57
+ } else if (selector instanceof HTMLElement) {
58
+ elements.push(...ctx.querySelectorAll(selector));
59
+ } else {
60
+ elements.push(...ctx.querySelectorAll(selector));
61
+ }
62
+ });
63
+ } else {
64
+ if (selector instanceof HTMLElement) {
65
+ elements = [selector];
66
+ } else if (selector instanceof NodeList) {
67
+ selector.forEach(sel => {
68
+ elements.push(...currentElement.querySelectorAll(sel));
69
+ });
70
+ } else {
71
+ elements = currentElement.querySelectorAll(selector);
72
+ }
73
+ }
74
+
75
+ return elements;
76
+ },
48
77
  };
49
78
  }
50
79
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.172.0",
4
+ "version": "6.174.0",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  "import": "./dist/index.js",
@@ -286,11 +286,11 @@ class ngFilterButton extends HTMLElement
286
286
  //console.log(panel.isHidden);
287
287
 
288
288
  //panel.style.display = 'flex' : 'none';
289
- console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
289
+ //console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
290
290
 
291
291
  if (panel.col === this.closest('th,td').dataset.col) {
292
- panel.col = null;
293
- panel.style.display = 'none';
292
+ //panel.col = null;
293
+ //panel.style.display = 'none';
294
294
  panel.close();
295
295
  }
296
296
  else {
@@ -530,8 +530,6 @@ class ngFilterPanel extends HTMLElement
530
530
 
531
531
  open = (owner, filterButton) => {
532
532
 
533
-
534
-
535
533
  var col = filterButton.closest('th,td').dataset.col;
536
534
  this.col = col;
537
535
 
@@ -548,10 +546,15 @@ class ngFilterPanel extends HTMLElement
548
546
  col : col,
549
547
  }
550
548
 
551
- $(this).show();
549
+ this.style.display = 'flex';
550
+ //$(this).show();
552
551
 
553
- ninegrid.j.querySelectorAll(this).addClass("loading");
552
+ //console.log(document.shadow.querySelectorAll(this), ninegrid.j.querySelectorAll(this));
553
+ //ninegrid.j.querySelectorAll(this).addClass("loading");
554
+ this.classList.add("loading");
554
555
 
556
+ return;
557
+
555
558
  $(this.shadowRoot).find("input[type=text]").val("");
556
559
 
557
560
  setTimeout(() => {
@@ -24,14 +24,14 @@ export class ninegrid {
24
24
  if (!("shadow" in Element.prototype)) {
25
25
  Object.defineProperty(Element.prototype, "shadow", {
26
26
  get: function () {
27
- const self = this;
27
+ let currentElement = this;
28
28
  return {
29
29
  closest: function (selector) {
30
- let currentElement = self;
30
+ //let currentElement = self;
31
31
 
32
32
  while (currentElement) {
33
33
 
34
- console.log(currentElement);
34
+ //console.log(currentElement);
35
35
  if (currentElement.matches(selector)) return currentElement;
36
36
 
37
37
  // ✅ Shadow Root를 가지고 있는 경우 내부에서 탐색
@@ -45,6 +45,35 @@ export class ninegrid {
45
45
 
46
46
  return null;
47
47
  },
48
+ querySelectorAll: (selector) => {
49
+ let elements = [];
50
+
51
+ if (currentElement instanceof NodeList) {
52
+ currentElement.forEach(ctx => {
53
+ if (selector instanceof NodeList) {
54
+ selector.forEach(sel => {
55
+ elements.push(...ctx.querySelectorAll(sel));
56
+ });
57
+ } else if (selector instanceof HTMLElement) {
58
+ elements.push(...ctx.querySelectorAll(selector));
59
+ } else {
60
+ elements.push(...ctx.querySelectorAll(selector));
61
+ }
62
+ });
63
+ } else {
64
+ if (selector instanceof HTMLElement) {
65
+ elements = [selector];
66
+ } else if (selector instanceof NodeList) {
67
+ selector.forEach(sel => {
68
+ elements.push(...currentElement.querySelectorAll(sel));
69
+ });
70
+ } else {
71
+ elements = currentElement.querySelectorAll(selector);
72
+ }
73
+ }
74
+
75
+ return elements;
76
+ },
48
77
  };
49
78
  }
50
79
  });