ninegrid2 6.452.0 → 6.454.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- require('exceljs');
3
+ var ExcelJS$1 = require('exceljs');
4
4
 
5
5
  function getDefaultExportFromCjs (x) {
6
6
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -17500,16 +17500,300 @@ class ngExportExcel
17500
17500
  export = () => {
17501
17501
 
17502
17502
  var _option = {
17503
- fileName : (this.#owner.getAttribute("caption") || "export").replace(/[`~!@#$%^&*|\\\'\";:\/?]/gi, "")};
17503
+ fileName : (this.#owner.getAttribute("caption") || "export").replace(/[`~!@#$%^&*|\\\'\";:\/?]/gi, ""),
17504
+ afterFunc : () => {},
17505
+ };
17504
17506
 
17505
- ninegrid.nvl(_option.fileName, "temp");
17507
+ var fileName = ninegrid.nvl(_option.fileName, "temp");
17508
+
17509
+ const _download = async (workbook, fileName) => {
17510
+
17511
+ console.log("export....");
17512
+
17513
+ workbook.xlsx.writeBuffer().then((data) => {
17514
+ var blob = new Blob([data], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
17515
+ const url = window.URL.createObjectURL(blob);
17516
+
17517
+ const a = document.createElement("a");
17518
+ document.body.appendChild(a);
17519
+ a.href = url;
17520
+ a.download = fileName + ".xlsx";
17521
+ a.click();
17522
+
17523
+ setTimeout(() => {
17524
+ window.URL.revokeObjectURL(url);
17525
+ document.body.removeChild(a);
17526
+
17527
+ console.log("completed");
17528
+ }, 0);
17529
+ });
17530
+
17531
+ };
17532
+
17533
+ const getImportFill = () => {
17534
+ return {
17535
+ type : "pattern",
17536
+ pattern : "solid",
17537
+ fgColor : { argb: "FFCCCCCC" },
17538
+ };
17539
+ };
17540
+ const getImportBorder = () => {
17541
+ return {
17542
+ top : { style: "thin", color: { argb: "FF999999" } },
17543
+ left : { style: "thin", color: { argb: "FF999999" } },
17544
+ bottom : { style: "thin", color: { argb: "FF999999" } },
17545
+ right : { style: "thin", color: { argb: "FF999999" } },
17546
+ };
17547
+ };
17548
+
17549
+ const setRowData = (rowIndex) => {
17550
+
17551
+ var startRow = $(".ng-container-body thead tr:not(.col-indicator-rowgroup)", this.#owner.body).length + 1 + this.#owner.template.length;
17552
+ var rowData = this.#owner.data.get(rowIndex);
17553
+ //var rowData = this.#owner.data.getRow(rowIndex);
17554
+
17555
+ $(this.#owner.template).each((i, tr) => {
17556
+ var row = parseInt(rowIndex * this.#owner.template.length) + startRow + i;
17557
+
17558
+ if (i == 0) {
17559
+ var cell = sheet.getCell(row, 1);
17560
+ cell.alignment = {
17561
+ horizontal : "center",
17562
+ vertical : "middle",
17563
+ wrapText : true,
17564
+ };
17565
+ cell.dataValidation = {
17566
+ type: 'list',
17567
+ allowBlank: true,
17568
+ formulae: ['"NONE,INSERT,UPDATE,DELETE"'],
17569
+ };
17570
+ cell.fill = getImportFill();
17571
+ cell.border = getImportBorder();
17572
+
17573
+ if (this.#owner.template.length > 1) sheet.mergeCells(row, 1, row + this.#owner.template.length - 1, 1);
17574
+ }
17575
+
17576
+ $("th,td", tr).not(".dummy").not(".first").not(".last").each((j, td) => {
17577
+
17578
+ var index = parseInt(td.dataset.index);
17579
+ var cell = sheet.getCell(row, index);
17580
+
17581
+ var v = "";
17582
+
17583
+ if (!ninegrid.isNull(td.dataset.expr)) {
17584
+ try {
17585
+ //v = this.#owner.exprFunction2(td.dataset.expr).call(this, rowData, rowIndex);
17586
+ v = this.#owner.exprFunction(td.dataset.expr).call(this, rowData, rowIndex);
17587
+ } catch(e) {
17588
+ console.error(e, rowIndex, td.dataset.bind, td.dataset.expr);
17589
+ //v = this.#owner.exprFunction2(td.dataset.expr).call(this, rowData, rowIndex);
17590
+ }
17591
+ }
17592
+ else if (!ninegrid.isNull(td.dataset.bind)) {
17593
+ //const COL_IDX = this.#owner.fields.indexOf(td.dataset.bind);
17594
+ //v = rowData.v[COL_IDX] || "";
17595
+ v = rowData[td.dataset.bind] || "";
17596
+ }
17597
+
17598
+ cell.value = v;
17599
+
17600
+ var combo = td.querySelector("ng-combo");
17601
+ if (combo) {
17602
+ var dataSource = combo.getAttribute("data-source");
17603
+ if (dataSource) {
17604
+ const value = combo.getAttribute("value");
17605
+
17606
+ dataSource = this.#owner.exprFunction(dataSource).call(this, rowData, rowIndex);
17607
+
17608
+ const formulae = [...new Set(dataSource.map(m => { return m[value].replaceAll(",", " "); }))];
17609
+
17610
+ if (formulae.length > 0) {
17611
+ cell.dataValidation = {
17612
+ type: 'list',
17613
+ allowBlank: true,
17614
+ formulae: ["\"" + formulae.join(",") + "\""],
17615
+ };
17616
+ }
17617
+ }
17618
+ }
17619
+
17620
+ var radio = td.querySelector("ng-radio");
17621
+ if (radio) {
17622
+ var dataSource = radio.getAttribute("data-source");
17623
+ if (dataSource) {
17624
+ radio.getAttribute("value");
17625
+
17626
+ dataSource = this.#owner.exprFunction(dataSource).call(this, rowData, rowIndex);
17627
+
17628
+ const formulae = [...new Set(dataSource.map(m => { return m["value"]; }))];
17629
+
17630
+ if (formulae.length > 0) {
17631
+ cell.dataValidation = {
17632
+ type: 'list',
17633
+ allowBlank: true,
17634
+ formulae: ["\"" + formulae.join(",") + "\""],
17635
+ };
17636
+ }
17637
+ }
17638
+ }
17639
+
17640
+
17641
+ cell.alignment = {
17642
+ horizontal : td.getAttribute("text-align") || "left",
17643
+ vertical : "middle",
17644
+ wrapText : true,
17645
+ };
17646
+
17647
+ if (td.colSpan > 1 || td.rowSpan > 1) {
17648
+ sheet.mergeCells(row, index, row + td.rowSpan - 1, index + td.colSpan - 1);
17649
+ }
17650
+ });
17651
+ });
17652
+ };
17506
17653
 
17507
17654
  $(this.#messageBox).html("generate...");
17508
17655
  this.#progressBar.setAttribute("max", this.#owner.data.count());
17509
17656
  this.#progressBar.setAttribute("value", 0);
17510
17657
 
17511
17658
 
17512
- throw "aa";
17659
+ //this.#progressBar.
17660
+
17661
+ const workbook = new ExcelJS$1.Workbook();
17662
+ const sheet = workbook.addWorksheet('Sheet1');
17663
+
17664
+ var index = 0;
17665
+ sheet.getColumn(++index).width = 10;
17666
+ $(".col-indicator-rowgroup .col-indicator:not(.dummy)", this.#owner.body).not(".first").not(".last").each((i, td) => {
17667
+
17668
+ if (i == 0) return true;
17669
+
17670
+ td.dataset.index = ++index;
17671
+ $(`[data-col="${td.dataset.col}"]`, this.#owner.template).each((i,v) => {
17672
+ v.dataset.index = index;
17673
+ });
17674
+
17675
+ this.#owner.body.querySelectorAll(`thead [data-col="${td.dataset.col}"]`).forEach(v => {
17676
+ v.dataset.index = index;
17677
+ });
17678
+
17679
+ sheet.getColumn(index).width = $(td).width() / 7;
17680
+ });
17681
+
17682
+
17683
+ $(this.#owner.template).each((i, tr) => {
17684
+
17685
+ var row = i + 1;
17686
+
17687
+ if (i == 0) {
17688
+ var cell = sheet.getCell(row, 1);
17689
+ cell.fill = getImportFill();
17690
+ cell.border = getImportBorder();
17691
+ if (this.#owner.template.length > 1) sheet.mergeCells(row, 1, row + this.#owner.template.length - 1, 1);
17692
+ }
17693
+
17694
+ $("th:not(.dummy),td:not(.dummy)", tr).not(".first").not(".last").each((j, td) => {
17695
+ var index = parseInt(td.dataset.index);
17696
+ var cell = sheet.getCell(row, index);
17697
+
17698
+ if (!["rowState"].includes(td.dataset.bind)) cell.value = td.dataset.bind;
17699
+
17700
+ if (td.colSpan > 1 || td.rowSpan > 1) {
17701
+ sheet.mergeCells(row, index, row + td.rowSpan - 1, index + td.colSpan - 1);
17702
+ }
17703
+
17704
+ cell.font = {
17705
+ size : 6,
17706
+ //color : {argb: color.replace("#", "")}
17707
+ };
17708
+ cell.fill = getImportFill();
17709
+ cell.border = getImportBorder();
17710
+ });
17711
+ });
17712
+
17713
+
17714
+ $("thead tr:not(.col-indicator-rowgroup)", this.#owner.body).each((i, tr) => {
17715
+
17716
+ var row = tr.sectionRowIndex + this.#owner.template.length;
17717
+
17718
+ if (i == 0) {
17719
+ var cell = sheet.getCell(row, 1);
17720
+ cell.value = "CRUD";
17721
+ cell.alignment = {
17722
+ horizontal : "center",
17723
+ vertical : "middle",
17724
+ wrapText : true,
17725
+ };
17726
+ cell.fill = getImportFill();
17727
+ cell.border = getImportBorder();
17728
+
17729
+ if (this.#owner.template.length > 1) sheet.mergeCells(row, 1, row + this.#owner.template.length - 1, 1);
17730
+ }
17731
+
17732
+ $("th:not(.dummy),td:not(.dummy)", tr).not(".first").not(".last").each((j, td) => {
17733
+ var index = parseInt(td.dataset.index);
17734
+ var cell = sheet.getCell(row, index);
17735
+ cell.value = $(td).text();
17736
+
17737
+ if (td.colSpan > 1 || td.rowSpan > 1) {
17738
+ sheet.mergeCells(row, index, row + td.rowSpan - 1, index + td.colSpan - 1);
17739
+ }
17740
+
17741
+ //cell.font = getCellFontInfo(oCell, -1);
17742
+ cell.alignment = {
17743
+ horizontal : "center",
17744
+ vertical : "middle",
17745
+ wrapText : true,
17746
+ };
17747
+
17748
+ cell.fill = {
17749
+ type : "pattern",
17750
+ pattern : "solid",
17751
+ fgColor : { argb: "FFEEEEEE" },
17752
+ };
17753
+
17754
+ cell.border = {
17755
+ top : { style: "thin", color: { argb: "FFCCCCCC" } },
17756
+ left : { style: "thin", color: { argb: "FFCCCCCC" } },
17757
+ bottom : { style: "thin", color: { argb: "FFCCCCCC" } },
17758
+ right : { style: "thin", color: { argb: "FFCCCCCC" } },
17759
+ };
17760
+ });
17761
+ });
17762
+
17763
+
17764
+ /**
17765
+ * Data Export (Table Body)
17766
+ */
17767
+ var data = this.#owner.data.getValidData();
17768
+ //setTimeout(() => {
17769
+ var rowIndex = 0;
17770
+ for (var i = 0; i < data.length; i++) {
17771
+ setTimeout(() => {
17772
+ setRowData(rowIndex++);
17773
+ //});
17774
+
17775
+ //setTimeout(() => {
17776
+ this.#progressBar.setAttribute("value", rowIndex+1);
17777
+ $(this.#messageBox).html(rowIndex+1 >= data.length ? "downloading..." : "processing... " + rowIndex.toLocaleString() + " / " + data.length.toLocaleString());
17778
+ });
17779
+ }
17780
+ //});
17781
+
17782
+ var interval = setInterval(() => {
17783
+ if (parseInt(this.#progressBar.getAttribute("value")) >= parseInt(this.#progressBar.getAttribute("max"))) {
17784
+ clearInterval(interval);
17785
+
17786
+ setTimeout(() => {
17787
+ _download(workbook, fileName).then(r => {});
17788
+
17789
+ if (_option.afterFunc) _option.afterFunc.call(this.#owner);
17790
+ });
17791
+
17792
+ setTimeout(() => {
17793
+ this.#dialog.close();
17794
+ });
17795
+ }
17796
+ }, 500);
17513
17797
  };
17514
17798
 
17515
17799
  exportPdf = () => {
@@ -17592,9 +17876,12 @@ class ngExport extends HTMLElement
17592
17876
  };
17593
17877
 
17594
17878
  exportExcel = () => {
17595
- console.log("export Excel...");
17596
- this.#dialog.showModal();
17597
- $(".title", this.#dialog).html("Export Excel");
17879
+ //console.log("export Excel...");
17880
+ if (this.#owner.data.count() > 100) {
17881
+ this.#dialog.showModal();
17882
+ $(".title", this.#dialog).html("Export Excel");
17883
+ }
17884
+
17598
17885
  this.#excel.export();
17599
17886
  };
17600
17887
  }
@@ -1,4 +1,4 @@
1
- import 'exceljs';
1
+ import ExcelJS$1 from 'exceljs';
2
2
 
3
3
  function getDefaultExportFromCjs (x) {
4
4
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -17498,16 +17498,300 @@ class ngExportExcel
17498
17498
  export = () => {
17499
17499
 
17500
17500
  var _option = {
17501
- fileName : (this.#owner.getAttribute("caption") || "export").replace(/[`~!@#$%^&*|\\\'\";:\/?]/gi, "")};
17501
+ fileName : (this.#owner.getAttribute("caption") || "export").replace(/[`~!@#$%^&*|\\\'\";:\/?]/gi, ""),
17502
+ afterFunc : () => {},
17503
+ };
17502
17504
 
17503
- ninegrid.nvl(_option.fileName, "temp");
17505
+ var fileName = ninegrid.nvl(_option.fileName, "temp");
17506
+
17507
+ const _download = async (workbook, fileName) => {
17508
+
17509
+ console.log("export....");
17510
+
17511
+ workbook.xlsx.writeBuffer().then((data) => {
17512
+ var blob = new Blob([data], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
17513
+ const url = window.URL.createObjectURL(blob);
17514
+
17515
+ const a = document.createElement("a");
17516
+ document.body.appendChild(a);
17517
+ a.href = url;
17518
+ a.download = fileName + ".xlsx";
17519
+ a.click();
17520
+
17521
+ setTimeout(() => {
17522
+ window.URL.revokeObjectURL(url);
17523
+ document.body.removeChild(a);
17524
+
17525
+ console.log("completed");
17526
+ }, 0);
17527
+ });
17528
+
17529
+ };
17530
+
17531
+ const getImportFill = () => {
17532
+ return {
17533
+ type : "pattern",
17534
+ pattern : "solid",
17535
+ fgColor : { argb: "FFCCCCCC" },
17536
+ };
17537
+ };
17538
+ const getImportBorder = () => {
17539
+ return {
17540
+ top : { style: "thin", color: { argb: "FF999999" } },
17541
+ left : { style: "thin", color: { argb: "FF999999" } },
17542
+ bottom : { style: "thin", color: { argb: "FF999999" } },
17543
+ right : { style: "thin", color: { argb: "FF999999" } },
17544
+ };
17545
+ };
17546
+
17547
+ const setRowData = (rowIndex) => {
17548
+
17549
+ var startRow = $(".ng-container-body thead tr:not(.col-indicator-rowgroup)", this.#owner.body).length + 1 + this.#owner.template.length;
17550
+ var rowData = this.#owner.data.get(rowIndex);
17551
+ //var rowData = this.#owner.data.getRow(rowIndex);
17552
+
17553
+ $(this.#owner.template).each((i, tr) => {
17554
+ var row = parseInt(rowIndex * this.#owner.template.length) + startRow + i;
17555
+
17556
+ if (i == 0) {
17557
+ var cell = sheet.getCell(row, 1);
17558
+ cell.alignment = {
17559
+ horizontal : "center",
17560
+ vertical : "middle",
17561
+ wrapText : true,
17562
+ };
17563
+ cell.dataValidation = {
17564
+ type: 'list',
17565
+ allowBlank: true,
17566
+ formulae: ['"NONE,INSERT,UPDATE,DELETE"'],
17567
+ };
17568
+ cell.fill = getImportFill();
17569
+ cell.border = getImportBorder();
17570
+
17571
+ if (this.#owner.template.length > 1) sheet.mergeCells(row, 1, row + this.#owner.template.length - 1, 1);
17572
+ }
17573
+
17574
+ $("th,td", tr).not(".dummy").not(".first").not(".last").each((j, td) => {
17575
+
17576
+ var index = parseInt(td.dataset.index);
17577
+ var cell = sheet.getCell(row, index);
17578
+
17579
+ var v = "";
17580
+
17581
+ if (!ninegrid.isNull(td.dataset.expr)) {
17582
+ try {
17583
+ //v = this.#owner.exprFunction2(td.dataset.expr).call(this, rowData, rowIndex);
17584
+ v = this.#owner.exprFunction(td.dataset.expr).call(this, rowData, rowIndex);
17585
+ } catch(e) {
17586
+ console.error(e, rowIndex, td.dataset.bind, td.dataset.expr);
17587
+ //v = this.#owner.exprFunction2(td.dataset.expr).call(this, rowData, rowIndex);
17588
+ }
17589
+ }
17590
+ else if (!ninegrid.isNull(td.dataset.bind)) {
17591
+ //const COL_IDX = this.#owner.fields.indexOf(td.dataset.bind);
17592
+ //v = rowData.v[COL_IDX] || "";
17593
+ v = rowData[td.dataset.bind] || "";
17594
+ }
17595
+
17596
+ cell.value = v;
17597
+
17598
+ var combo = td.querySelector("ng-combo");
17599
+ if (combo) {
17600
+ var dataSource = combo.getAttribute("data-source");
17601
+ if (dataSource) {
17602
+ const value = combo.getAttribute("value");
17603
+
17604
+ dataSource = this.#owner.exprFunction(dataSource).call(this, rowData, rowIndex);
17605
+
17606
+ const formulae = [...new Set(dataSource.map(m => { return m[value].replaceAll(",", " "); }))];
17607
+
17608
+ if (formulae.length > 0) {
17609
+ cell.dataValidation = {
17610
+ type: 'list',
17611
+ allowBlank: true,
17612
+ formulae: ["\"" + formulae.join(",") + "\""],
17613
+ };
17614
+ }
17615
+ }
17616
+ }
17617
+
17618
+ var radio = td.querySelector("ng-radio");
17619
+ if (radio) {
17620
+ var dataSource = radio.getAttribute("data-source");
17621
+ if (dataSource) {
17622
+ radio.getAttribute("value");
17623
+
17624
+ dataSource = this.#owner.exprFunction(dataSource).call(this, rowData, rowIndex);
17625
+
17626
+ const formulae = [...new Set(dataSource.map(m => { return m["value"]; }))];
17627
+
17628
+ if (formulae.length > 0) {
17629
+ cell.dataValidation = {
17630
+ type: 'list',
17631
+ allowBlank: true,
17632
+ formulae: ["\"" + formulae.join(",") + "\""],
17633
+ };
17634
+ }
17635
+ }
17636
+ }
17637
+
17638
+
17639
+ cell.alignment = {
17640
+ horizontal : td.getAttribute("text-align") || "left",
17641
+ vertical : "middle",
17642
+ wrapText : true,
17643
+ };
17644
+
17645
+ if (td.colSpan > 1 || td.rowSpan > 1) {
17646
+ sheet.mergeCells(row, index, row + td.rowSpan - 1, index + td.colSpan - 1);
17647
+ }
17648
+ });
17649
+ });
17650
+ };
17504
17651
 
17505
17652
  $(this.#messageBox).html("generate...");
17506
17653
  this.#progressBar.setAttribute("max", this.#owner.data.count());
17507
17654
  this.#progressBar.setAttribute("value", 0);
17508
17655
 
17509
17656
 
17510
- throw "aa";
17657
+ //this.#progressBar.
17658
+
17659
+ const workbook = new ExcelJS$1.Workbook();
17660
+ const sheet = workbook.addWorksheet('Sheet1');
17661
+
17662
+ var index = 0;
17663
+ sheet.getColumn(++index).width = 10;
17664
+ $(".col-indicator-rowgroup .col-indicator:not(.dummy)", this.#owner.body).not(".first").not(".last").each((i, td) => {
17665
+
17666
+ if (i == 0) return true;
17667
+
17668
+ td.dataset.index = ++index;
17669
+ $(`[data-col="${td.dataset.col}"]`, this.#owner.template).each((i,v) => {
17670
+ v.dataset.index = index;
17671
+ });
17672
+
17673
+ this.#owner.body.querySelectorAll(`thead [data-col="${td.dataset.col}"]`).forEach(v => {
17674
+ v.dataset.index = index;
17675
+ });
17676
+
17677
+ sheet.getColumn(index).width = $(td).width() / 7;
17678
+ });
17679
+
17680
+
17681
+ $(this.#owner.template).each((i, tr) => {
17682
+
17683
+ var row = i + 1;
17684
+
17685
+ if (i == 0) {
17686
+ var cell = sheet.getCell(row, 1);
17687
+ cell.fill = getImportFill();
17688
+ cell.border = getImportBorder();
17689
+ if (this.#owner.template.length > 1) sheet.mergeCells(row, 1, row + this.#owner.template.length - 1, 1);
17690
+ }
17691
+
17692
+ $("th:not(.dummy),td:not(.dummy)", tr).not(".first").not(".last").each((j, td) => {
17693
+ var index = parseInt(td.dataset.index);
17694
+ var cell = sheet.getCell(row, index);
17695
+
17696
+ if (!["rowState"].includes(td.dataset.bind)) cell.value = td.dataset.bind;
17697
+
17698
+ if (td.colSpan > 1 || td.rowSpan > 1) {
17699
+ sheet.mergeCells(row, index, row + td.rowSpan - 1, index + td.colSpan - 1);
17700
+ }
17701
+
17702
+ cell.font = {
17703
+ size : 6,
17704
+ //color : {argb: color.replace("#", "")}
17705
+ };
17706
+ cell.fill = getImportFill();
17707
+ cell.border = getImportBorder();
17708
+ });
17709
+ });
17710
+
17711
+
17712
+ $("thead tr:not(.col-indicator-rowgroup)", this.#owner.body).each((i, tr) => {
17713
+
17714
+ var row = tr.sectionRowIndex + this.#owner.template.length;
17715
+
17716
+ if (i == 0) {
17717
+ var cell = sheet.getCell(row, 1);
17718
+ cell.value = "CRUD";
17719
+ cell.alignment = {
17720
+ horizontal : "center",
17721
+ vertical : "middle",
17722
+ wrapText : true,
17723
+ };
17724
+ cell.fill = getImportFill();
17725
+ cell.border = getImportBorder();
17726
+
17727
+ if (this.#owner.template.length > 1) sheet.mergeCells(row, 1, row + this.#owner.template.length - 1, 1);
17728
+ }
17729
+
17730
+ $("th:not(.dummy),td:not(.dummy)", tr).not(".first").not(".last").each((j, td) => {
17731
+ var index = parseInt(td.dataset.index);
17732
+ var cell = sheet.getCell(row, index);
17733
+ cell.value = $(td).text();
17734
+
17735
+ if (td.colSpan > 1 || td.rowSpan > 1) {
17736
+ sheet.mergeCells(row, index, row + td.rowSpan - 1, index + td.colSpan - 1);
17737
+ }
17738
+
17739
+ //cell.font = getCellFontInfo(oCell, -1);
17740
+ cell.alignment = {
17741
+ horizontal : "center",
17742
+ vertical : "middle",
17743
+ wrapText : true,
17744
+ };
17745
+
17746
+ cell.fill = {
17747
+ type : "pattern",
17748
+ pattern : "solid",
17749
+ fgColor : { argb: "FFEEEEEE" },
17750
+ };
17751
+
17752
+ cell.border = {
17753
+ top : { style: "thin", color: { argb: "FFCCCCCC" } },
17754
+ left : { style: "thin", color: { argb: "FFCCCCCC" } },
17755
+ bottom : { style: "thin", color: { argb: "FFCCCCCC" } },
17756
+ right : { style: "thin", color: { argb: "FFCCCCCC" } },
17757
+ };
17758
+ });
17759
+ });
17760
+
17761
+
17762
+ /**
17763
+ * Data Export (Table Body)
17764
+ */
17765
+ var data = this.#owner.data.getValidData();
17766
+ //setTimeout(() => {
17767
+ var rowIndex = 0;
17768
+ for (var i = 0; i < data.length; i++) {
17769
+ setTimeout(() => {
17770
+ setRowData(rowIndex++);
17771
+ //});
17772
+
17773
+ //setTimeout(() => {
17774
+ this.#progressBar.setAttribute("value", rowIndex+1);
17775
+ $(this.#messageBox).html(rowIndex+1 >= data.length ? "downloading..." : "processing... " + rowIndex.toLocaleString() + " / " + data.length.toLocaleString());
17776
+ });
17777
+ }
17778
+ //});
17779
+
17780
+ var interval = setInterval(() => {
17781
+ if (parseInt(this.#progressBar.getAttribute("value")) >= parseInt(this.#progressBar.getAttribute("max"))) {
17782
+ clearInterval(interval);
17783
+
17784
+ setTimeout(() => {
17785
+ _download(workbook, fileName).then(r => {});
17786
+
17787
+ if (_option.afterFunc) _option.afterFunc.call(this.#owner);
17788
+ });
17789
+
17790
+ setTimeout(() => {
17791
+ this.#dialog.close();
17792
+ });
17793
+ }
17794
+ }, 500);
17511
17795
  };
17512
17796
 
17513
17797
  exportPdf = () => {
@@ -17590,9 +17874,12 @@ class ngExport extends HTMLElement
17590
17874
  };
17591
17875
 
17592
17876
  exportExcel = () => {
17593
- console.log("export Excel...");
17594
- this.#dialog.showModal();
17595
- $(".title", this.#dialog).html("Export Excel");
17877
+ //console.log("export Excel...");
17878
+ if (this.#owner.data.count() > 100) {
17879
+ this.#dialog.showModal();
17880
+ $(".title", this.#dialog).html("Export Excel");
17881
+ }
17882
+
17596
17883
  this.#excel.export();
17597
17884
  };
17598
17885
  }
@@ -202,7 +202,6 @@ export class ngExportExcel
202
202
  this.#progressBar.setAttribute("value", 0);
203
203
 
204
204
 
205
- throw "aa";
206
205
  //this.#progressBar.
207
206
 
208
207
  const workbook = new ExcelJS.Workbook();
@@ -423,9 +422,12 @@ export class ngExport extends HTMLElement
423
422
  };
424
423
 
425
424
  exportExcel = () => {
426
- console.log("export Excel...");
427
- this.#dialog.showModal();
428
- $(".title", this.#dialog).html("Export Excel");
425
+ //console.log("export Excel...");
426
+ if (this.#owner.data.count() > 100) {
427
+ this.#dialog.showModal();
428
+ $(".title", this.#dialog).html("Export Excel");
429
+ }
430
+
429
431
  this.#excel.export();
430
432
  };
431
433
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.452.0",
4
+ "version": "6.454.0",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  "import": "./dist/index.js",
@@ -202,7 +202,6 @@ export class ngExportExcel
202
202
  this.#progressBar.setAttribute("value", 0);
203
203
 
204
204
 
205
- throw "aa";
206
205
  //this.#progressBar.
207
206
 
208
207
  const workbook = new ExcelJS.Workbook();
@@ -423,9 +422,12 @@ export class ngExport extends HTMLElement
423
422
  };
424
423
 
425
424
  exportExcel = () => {
426
- console.log("export Excel...");
427
- this.#dialog.showModal();
428
- $(".title", this.#dialog).html("Export Excel");
425
+ //console.log("export Excel...");
426
+ if (this.#owner.data.count() > 100) {
427
+ this.#dialog.showModal();
428
+ $(".title", this.#dialog).html("Export Excel");
429
+ }
430
+
429
431
  this.#excel.export();
430
432
  };
431
433
  }