@carbon/charts-react 1.12.0 → 1.13.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.
package/dist/index.mjs CHANGED
@@ -10240,13 +10240,21 @@ class Je {
10240
10240
  }
10241
10241
  exportToCSV() {
10242
10242
  const t = this.getTabularDataArray().map(
10243
- (i) => i.map((s) => `"${s === "–" ? "–" : s}"`)
10243
+ (o) => o.map((l) => `"${l === "–" ? "–" : l}"`)
10244
10244
  );
10245
10245
  let n = "", r = "";
10246
- t.forEach(function(i, s) {
10247
- r = i.join(","), n += s < t.length ? r + `
10246
+ t.forEach(function(o, l) {
10247
+ r = o.join(","), n += l < t.length ? r + `
10248
10248
  ` : r;
10249
- }), this.services.files.downloadCSV(n, "myChart.csv");
10249
+ });
10250
+ const i = this.getOptions();
10251
+ let s = "myChart";
10252
+ const a = b(
10253
+ i,
10254
+ "fileDownload",
10255
+ "fileName"
10256
+ );
10257
+ typeof a == "function" ? s = a("csv") : typeof a == "string" && (s = a), this.services.files.downloadCSV(n, `${s}.csv`);
10250
10258
  }
10251
10259
  getTabularData(t) {
10252
10260
  return Array.isArray(t) ? t : this.transformToTabularData(t);
@@ -11632,27 +11640,39 @@ class D extends En {
11632
11640
  return this.model.get("holder");
11633
11641
  }
11634
11642
  exportToJPG() {
11635
- const t = this, n = this.getHolder(), r = R(n);
11636
- r.classed("filled", !0), AD(this.getMainContainer(), {
11643
+ const t = this, n = this.model.getOptions(), r = this.getHolder(), i = R(r);
11644
+ i.classed("filled", !0), AD(this.getMainContainer(), {
11637
11645
  quality: 1,
11638
11646
  // Remove toolbar
11639
- filter: (i) => !(i.classList && i.classList.contains("cds--cc--toolbar"))
11640
- }).then(function(i) {
11641
- var s;
11642
- (s = t.services.files) == null || s.downloadImage(i, "myChart.jpg"), r.classed("filled", !1);
11647
+ filter: (s) => !(s.classList && s.classList.contains("cds--cc--toolbar"))
11648
+ }).then(function(s) {
11649
+ var a;
11650
+ let o = "myChart";
11651
+ const l = b(
11652
+ n,
11653
+ "fileDownload",
11654
+ "fileName"
11655
+ );
11656
+ typeof l == "function" ? o = l("jpg") : typeof l == "string" && (o = l), (a = t.services.files) == null || a.downloadImage(s, `${o}.jpg`), i.classed("filled", !1);
11643
11657
  });
11644
11658
  }
11645
11659
  exportToPNG() {
11646
- const t = this, n = this.getHolder(), r = R(n);
11647
- r.classed("filled", !0), $D(this.getMainContainer(), {
11660
+ const t = this, n = this.model.getOptions(), r = this.getHolder(), i = R(r);
11661
+ i.classed("filled", !0), $D(this.getMainContainer(), {
11648
11662
  quality: 1,
11649
11663
  // Remove toolbar
11650
- filter: (i) => !(i.classList && i.classList.contains("cds--cc--toolbar"))
11651
- }).then(function(i) {
11652
- var s;
11653
- (s = t.services.files) == null || s.downloadImage(i, "myChart.png"), r.classed("filled", !1);
11654
- }).catch(function(i) {
11655
- console.error("oops, something went wrong!", i);
11664
+ filter: (s) => !(s.classList && s.classList.contains("cds--cc--toolbar"))
11665
+ }).then(function(s) {
11666
+ var a;
11667
+ let o = "myChart";
11668
+ const l = b(
11669
+ n,
11670
+ "fileDownload",
11671
+ "fileName"
11672
+ );
11673
+ typeof l == "function" ? o = l("png") : typeof l == "string" && (o = l), (a = t.services.files) == null || a.downloadImage(s, `${o}.png`), i.classed("filled", !1);
11674
+ }).catch(function(s) {
11675
+ console.error("oops, something went wrong!", s);
11656
11676
  });
11657
11677
  }
11658
11678
  toggleFullscreen() {