ninegrid2 6.188.0 → 6.193.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.
@@ -18459,7 +18459,7 @@ class ngFilterPanel extends HTMLElement
18459
18459
  open = (filterButton) => {
18460
18460
 
18461
18461
  const owner = this.shadow.closest("nine-grid");
18462
- const colnms = [...new Set(filterButton.filterOptions.map(item => item.colnm))];
18462
+
18463
18463
 
18464
18464
  //console.log(this, owner, filterButton.filterOptions, colnms);
18465
18465
 
@@ -18487,18 +18487,18 @@ class ngFilterPanel extends HTMLElement
18487
18487
 
18488
18488
  let data = owner.data.getValidDataNF();
18489
18489
 
18490
- console.log(data);
18490
+ //console.log(data);
18491
18491
 
18492
18492
  owner.body.querySelectorAll("ng-filter-button").forEach(el => {
18493
- console.log(el);
18493
+ //console.log(el);
18494
18494
  if (el.closest('th,td').dataset.col != col || el.filterOptions) {
18495
18495
 
18496
- console.log("================", el.filterOptions);
18496
+ //console.log("================", el.filterOptions);
18497
18497
 
18498
18498
  el.filterOptions.forEach(filterOption => {
18499
18499
  var idx = owner.fields.indexOf(filterOption.colnm);
18500
18500
 
18501
- console.log(idx);
18501
+ //console.log(idx);
18502
18502
 
18503
18503
  if (idx >= 0) {
18504
18504
  data = data.filter(m => { return filterOption.data.nineBinarySearch(m.v[idx] || '') >= 0; });
@@ -18533,54 +18533,54 @@ class ngFilterPanel extends HTMLElement
18533
18533
 
18534
18534
  var ds = [];
18535
18535
  //colnms = [...new Set(colnms)];
18536
- colnms.forEach((colnm,i) => {
18537
18536
 
18538
- console.log(colnm);
18537
+ //const colnms = [...new Set(filterButton.filterOptions.map(item => item.colnm))];
18538
+
18539
+ filterButton.filterOptions.forEach((filterOption,i) => {
18540
+
18541
+ //const colnm = filterOption.colnm;
18542
+ console.log(filterOption);
18539
18543
 
18540
18544
  ds.push({
18541
18545
  LVL: 1,
18542
18546
  CHK: 'N',
18543
- DATA2: '<span class="group">' + $(filterButton).closest('th,td').text() + (colnms.length > 1 ? ` #${i+1} (${colnm})` : '') + '</span>',
18547
+ DATA2: '<span class="group">' + $(filterButton).closest('th,td').text() + (filterButton.filterOptions.length > 1 ? ` #${i+1} (${filterOption.colnm})` : '') + '</span>',
18544
18548
  });
18545
18549
 
18546
- var filterData = [];
18547
- if (filterButton.filterData) {
18548
- var idx = filterButton.filterData.findIndex(item => item.colnm == colnm);
18549
- if (idx >= 0) {
18550
- filterData = filterButton.filterData[idx].data;
18551
- }
18552
- }
18550
+
18553
18551
 
18554
18552
  /**
18555
- var cell = $(`[data-col=${col}][data-bind=${colnm}]`, owner.template);
18553
+ var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, owner.template);
18556
18554
  var expr = cell.attr("data-expr");
18557
18555
  var exprFunc = (expr) ? owner.exprFunction(expr) : null;
18558
18556
  */
18559
18557
 
18560
- const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${colnm}"]`, owner.tmpl).elem();
18558
+ const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, owner.tmpl).elem();
18561
18559
  const expr = cell.getAttribute("data-expr");
18562
18560
  const exprFunc = (expr) ? owner.exprFunction(expr) : null;
18563
18561
 
18564
18562
  var data2 = [];
18565
18563
  for (var rowData of data) {
18566
- var idx = owner.fields.indexOf(colnm);
18564
+ var idx = owner.fields.indexOf(filterOption.colnm);
18567
18565
 
18568
18566
  if (expr) {
18569
18567
  var o = owner.data.conv(rowData);
18570
- data2.push({v:o[colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
18568
+ data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
18571
18569
  }
18572
18570
  else {
18573
18571
  data2.push({v:rowData.v[idx],v2:rowData.v[idx]});
18574
18572
  }
18575
18573
  }
18576
18574
 
18575
+ console.log(data, data2);
18576
+
18577
18577
  [...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 => {
18578
18578
  ds.push({
18579
18579
  LVL : 2,
18580
18580
  DATA : o.v,
18581
18581
  DATA2 : o.v2 || ` <span class="empty">(empty)</span> ${o.v}`,
18582
- COLNM : colnm,
18583
- CHK : filterData.length == 0 || filterData.nineBinarySearch(o.v || '') >= 0 ? "Y" : "N",
18582
+ COLNM : filterOption.colnm,
18583
+ CHK : filterOption.data.length == 0 || filterOption.data.nineBinarySearch(o.v || '') >= 0 ? "Y" : "N",
18584
18584
  });
18585
18585
  });
18586
18586
  });
@@ -18457,7 +18457,7 @@ class ngFilterPanel extends HTMLElement
18457
18457
  open = (filterButton) => {
18458
18458
 
18459
18459
  const owner = this.shadow.closest("nine-grid");
18460
- const colnms = [...new Set(filterButton.filterOptions.map(item => item.colnm))];
18460
+
18461
18461
 
18462
18462
  //console.log(this, owner, filterButton.filterOptions, colnms);
18463
18463
 
@@ -18485,18 +18485,18 @@ class ngFilterPanel extends HTMLElement
18485
18485
 
18486
18486
  let data = owner.data.getValidDataNF();
18487
18487
 
18488
- console.log(data);
18488
+ //console.log(data);
18489
18489
 
18490
18490
  owner.body.querySelectorAll("ng-filter-button").forEach(el => {
18491
- console.log(el);
18491
+ //console.log(el);
18492
18492
  if (el.closest('th,td').dataset.col != col || el.filterOptions) {
18493
18493
 
18494
- console.log("================", el.filterOptions);
18494
+ //console.log("================", el.filterOptions);
18495
18495
 
18496
18496
  el.filterOptions.forEach(filterOption => {
18497
18497
  var idx = owner.fields.indexOf(filterOption.colnm);
18498
18498
 
18499
- console.log(idx);
18499
+ //console.log(idx);
18500
18500
 
18501
18501
  if (idx >= 0) {
18502
18502
  data = data.filter(m => { return filterOption.data.nineBinarySearch(m.v[idx] || '') >= 0; });
@@ -18531,54 +18531,54 @@ class ngFilterPanel extends HTMLElement
18531
18531
 
18532
18532
  var ds = [];
18533
18533
  //colnms = [...new Set(colnms)];
18534
- colnms.forEach((colnm,i) => {
18535
18534
 
18536
- console.log(colnm);
18535
+ //const colnms = [...new Set(filterButton.filterOptions.map(item => item.colnm))];
18536
+
18537
+ filterButton.filterOptions.forEach((filterOption,i) => {
18538
+
18539
+ //const colnm = filterOption.colnm;
18540
+ console.log(filterOption);
18537
18541
 
18538
18542
  ds.push({
18539
18543
  LVL: 1,
18540
18544
  CHK: 'N',
18541
- DATA2: '<span class="group">' + $(filterButton).closest('th,td').text() + (colnms.length > 1 ? ` #${i+1} (${colnm})` : '') + '</span>',
18545
+ DATA2: '<span class="group">' + $(filterButton).closest('th,td').text() + (filterButton.filterOptions.length > 1 ? ` #${i+1} (${filterOption.colnm})` : '') + '</span>',
18542
18546
  });
18543
18547
 
18544
- var filterData = [];
18545
- if (filterButton.filterData) {
18546
- var idx = filterButton.filterData.findIndex(item => item.colnm == colnm);
18547
- if (idx >= 0) {
18548
- filterData = filterButton.filterData[idx].data;
18549
- }
18550
- }
18548
+
18551
18549
 
18552
18550
  /**
18553
- var cell = $(`[data-col=${col}][data-bind=${colnm}]`, owner.template);
18551
+ var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, owner.template);
18554
18552
  var expr = cell.attr("data-expr");
18555
18553
  var exprFunc = (expr) ? owner.exprFunction(expr) : null;
18556
18554
  */
18557
18555
 
18558
- const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${colnm}"]`, owner.tmpl).elem();
18556
+ const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, owner.tmpl).elem();
18559
18557
  const expr = cell.getAttribute("data-expr");
18560
18558
  const exprFunc = (expr) ? owner.exprFunction(expr) : null;
18561
18559
 
18562
18560
  var data2 = [];
18563
18561
  for (var rowData of data) {
18564
- var idx = owner.fields.indexOf(colnm);
18562
+ var idx = owner.fields.indexOf(filterOption.colnm);
18565
18563
 
18566
18564
  if (expr) {
18567
18565
  var o = owner.data.conv(rowData);
18568
- data2.push({v:o[colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
18566
+ data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
18569
18567
  }
18570
18568
  else {
18571
18569
  data2.push({v:rowData.v[idx],v2:rowData.v[idx]});
18572
18570
  }
18573
18571
  }
18574
18572
 
18573
+ console.log(data, data2);
18574
+
18575
18575
  [...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 => {
18576
18576
  ds.push({
18577
18577
  LVL : 2,
18578
18578
  DATA : o.v,
18579
18579
  DATA2 : o.v2 || ` <span class="empty">(empty)</span> ${o.v}`,
18580
- COLNM : colnm,
18581
- CHK : filterData.length == 0 || filterData.nineBinarySearch(o.v || '') >= 0 ? "Y" : "N",
18580
+ COLNM : filterOption.colnm,
18581
+ CHK : filterOption.data.length == 0 || filterOption.data.nineBinarySearch(o.v || '') >= 0 ? "Y" : "N",
18582
18582
  });
18583
18583
  });
18584
18584
  });
@@ -529,7 +529,7 @@ class ngFilterPanel extends HTMLElement
529
529
  open = (filterButton) => {
530
530
 
531
531
  const owner = this.shadow.closest("nine-grid");
532
- const colnms = [...new Set(filterButton.filterOptions.map(item => item.colnm))];
532
+
533
533
 
534
534
  //console.log(this, owner, filterButton.filterOptions, colnms);
535
535
 
@@ -557,18 +557,18 @@ class ngFilterPanel extends HTMLElement
557
557
 
558
558
  let data = owner.data.getValidDataNF();
559
559
 
560
- console.log(data);
560
+ //console.log(data);
561
561
 
562
562
  owner.body.querySelectorAll("ng-filter-button").forEach(el => {
563
- console.log(el);
563
+ //console.log(el);
564
564
  if (el.closest('th,td').dataset.col != col || el.filterOptions) {
565
565
 
566
- console.log("================", el.filterOptions);
566
+ //console.log("================", el.filterOptions);
567
567
 
568
568
  el.filterOptions.forEach(filterOption => {
569
569
  var idx = owner.fields.indexOf(filterOption.colnm);
570
570
 
571
- console.log(idx);
571
+ //console.log(idx);
572
572
 
573
573
  if (idx >= 0) {
574
574
  data = data.filter(m => { return filterOption.data.nineBinarySearch(m.v[idx] || '') >= 0; });
@@ -603,54 +603,54 @@ class ngFilterPanel extends HTMLElement
603
603
 
604
604
  var ds = [];
605
605
  //colnms = [...new Set(colnms)];
606
- colnms.forEach((colnm,i) => {
607
606
 
608
- console.log(colnm);
607
+ //const colnms = [...new Set(filterButton.filterOptions.map(item => item.colnm))];
608
+
609
+ filterButton.filterOptions.forEach((filterOption,i) => {
610
+
611
+ //const colnm = filterOption.colnm;
612
+ console.log(filterOption);
609
613
 
610
614
  ds.push({
611
615
  LVL: 1,
612
616
  CHK: 'N',
613
- DATA2: '<span class="group">' + $(filterButton).closest('th,td').text() + (colnms.length > 1 ? ` #${i+1} (${colnm})` : '') + '</span>',
617
+ DATA2: '<span class="group">' + $(filterButton).closest('th,td').text() + (filterButton.filterOptions.length > 1 ? ` #${i+1} (${filterOption.colnm})` : '') + '</span>',
614
618
  });
615
619
 
616
- var filterData = [];
617
- if (filterButton.filterData) {
618
- var idx = filterButton.filterData.findIndex(item => item.colnm == colnm);
619
- if (idx >= 0) {
620
- filterData = filterButton.filterData[idx].data;
621
- }
622
- }
620
+
623
621
 
624
622
  /**
625
- var cell = $(`[data-col=${col}][data-bind=${colnm}]`, owner.template);
623
+ var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, owner.template);
626
624
  var expr = cell.attr("data-expr");
627
625
  var exprFunc = (expr) ? owner.exprFunction(expr) : null;
628
626
  */
629
627
 
630
- const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${colnm}"]`, owner.tmpl).elem();
628
+ const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, owner.tmpl).elem();
631
629
  const expr = cell.getAttribute("data-expr");
632
630
  const exprFunc = (expr) ? owner.exprFunction(expr) : null;
633
631
 
634
632
  var data2 = [];
635
633
  for (var rowData of data) {
636
- var idx = owner.fields.indexOf(colnm);
634
+ var idx = owner.fields.indexOf(filterOption.colnm);
637
635
 
638
636
  if (expr) {
639
637
  var o = owner.data.conv(rowData);
640
- data2.push({v:o[colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
638
+ data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
641
639
  }
642
640
  else {
643
641
  data2.push({v:rowData.v[idx],v2:rowData.v[idx]});
644
642
  }
645
643
  }
646
644
 
645
+ console.log(data, data2);
646
+
647
647
  [...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 => {
648
648
  ds.push({
649
649
  LVL : 2,
650
650
  DATA : o.v,
651
651
  DATA2 : o.v2 || ` <span class="empty">(empty)</span> ${o.v}`,
652
- COLNM : colnm,
653
- CHK : filterData.length == 0 || filterData.nineBinarySearch(o.v || '') >= 0 ? "Y" : "N",
652
+ COLNM : filterOption.colnm,
653
+ CHK : filterOption.data.length == 0 || filterOption.data.nineBinarySearch(o.v || '') >= 0 ? "Y" : "N",
654
654
  });
655
655
  });
656
656
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.188.0",
4
+ "version": "6.193.0",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  "import": "./dist/index.js",
@@ -529,7 +529,7 @@ class ngFilterPanel extends HTMLElement
529
529
  open = (filterButton) => {
530
530
 
531
531
  const owner = this.shadow.closest("nine-grid");
532
- const colnms = [...new Set(filterButton.filterOptions.map(item => item.colnm))];
532
+
533
533
 
534
534
  //console.log(this, owner, filterButton.filterOptions, colnms);
535
535
 
@@ -557,18 +557,18 @@ class ngFilterPanel extends HTMLElement
557
557
 
558
558
  let data = owner.data.getValidDataNF();
559
559
 
560
- console.log(data);
560
+ //console.log(data);
561
561
 
562
562
  owner.body.querySelectorAll("ng-filter-button").forEach(el => {
563
- console.log(el);
563
+ //console.log(el);
564
564
  if (el.closest('th,td').dataset.col != col || el.filterOptions) {
565
565
 
566
- console.log("================", el.filterOptions);
566
+ //console.log("================", el.filterOptions);
567
567
 
568
568
  el.filterOptions.forEach(filterOption => {
569
569
  var idx = owner.fields.indexOf(filterOption.colnm);
570
570
 
571
- console.log(idx);
571
+ //console.log(idx);
572
572
 
573
573
  if (idx >= 0) {
574
574
  data = data.filter(m => { return filterOption.data.nineBinarySearch(m.v[idx] || '') >= 0; });
@@ -603,54 +603,54 @@ class ngFilterPanel extends HTMLElement
603
603
 
604
604
  var ds = [];
605
605
  //colnms = [...new Set(colnms)];
606
- colnms.forEach((colnm,i) => {
607
606
 
608
- console.log(colnm);
607
+ //const colnms = [...new Set(filterButton.filterOptions.map(item => item.colnm))];
608
+
609
+ filterButton.filterOptions.forEach((filterOption,i) => {
610
+
611
+ //const colnm = filterOption.colnm;
612
+ console.log(filterOption);
609
613
 
610
614
  ds.push({
611
615
  LVL: 1,
612
616
  CHK: 'N',
613
- DATA2: '<span class="group">' + $(filterButton).closest('th,td').text() + (colnms.length > 1 ? ` #${i+1} (${colnm})` : '') + '</span>',
617
+ DATA2: '<span class="group">' + $(filterButton).closest('th,td').text() + (filterButton.filterOptions.length > 1 ? ` #${i+1} (${filterOption.colnm})` : '') + '</span>',
614
618
  });
615
619
 
616
- var filterData = [];
617
- if (filterButton.filterData) {
618
- var idx = filterButton.filterData.findIndex(item => item.colnm == colnm);
619
- if (idx >= 0) {
620
- filterData = filterButton.filterData[idx].data;
621
- }
622
- }
620
+
623
621
 
624
622
  /**
625
- var cell = $(`[data-col=${col}][data-bind=${colnm}]`, owner.template);
623
+ var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, owner.template);
626
624
  var expr = cell.attr("data-expr");
627
625
  var exprFunc = (expr) ? owner.exprFunction(expr) : null;
628
626
  */
629
627
 
630
- const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${colnm}"]`, owner.tmpl).elem();
628
+ const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, owner.tmpl).elem();
631
629
  const expr = cell.getAttribute("data-expr");
632
630
  const exprFunc = (expr) ? owner.exprFunction(expr) : null;
633
631
 
634
632
  var data2 = [];
635
633
  for (var rowData of data) {
636
- var idx = owner.fields.indexOf(colnm);
634
+ var idx = owner.fields.indexOf(filterOption.colnm);
637
635
 
638
636
  if (expr) {
639
637
  var o = owner.data.conv(rowData);
640
- data2.push({v:o[colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
638
+ data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
641
639
  }
642
640
  else {
643
641
  data2.push({v:rowData.v[idx],v2:rowData.v[idx]});
644
642
  }
645
643
  }
646
644
 
645
+ console.log(data, data2);
646
+
647
647
  [...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 => {
648
648
  ds.push({
649
649
  LVL : 2,
650
650
  DATA : o.v,
651
651
  DATA2 : o.v2 || ` <span class="empty">(empty)</span> ${o.v}`,
652
- COLNM : colnm,
653
- CHK : filterData.length == 0 || filterData.nineBinarySearch(o.v || '') >= 0 ? "Y" : "N",
652
+ COLNM : filterOption.colnm,
653
+ CHK : filterOption.data.length == 0 || filterOption.data.nineBinarySearch(o.v || '') >= 0 ? "Y" : "N",
654
654
  });
655
655
  });
656
656
  });