@carto/ps-react-ui 4.11.3 → 4.12.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.
Files changed (77) hide show
  1. package/dist/chat.js +962 -733
  2. package/dist/chat.js.map +1 -1
  3. package/dist/csv-item-hH_Gt7ur.js +32 -0
  4. package/dist/csv-item-hH_Gt7ur.js.map +1 -0
  5. package/dist/png-item-9dNbB37T.js +57 -0
  6. package/dist/png-item-9dNbB37T.js.map +1 -0
  7. package/dist/table-B3ZWWhJt.js +383 -0
  8. package/dist/table-B3ZWWhJt.js.map +1 -0
  9. package/dist/types/chat/containers/chat-footer.d.ts +1 -1
  10. package/dist/types/chat/containers/styles.d.ts +79 -12
  11. package/dist/types/chat/index.d.ts +1 -1
  12. package/dist/types/chat/types.d.ts +21 -0
  13. package/dist/types/chat/use-typewriter.d.ts +5 -3
  14. package/dist/types/widgets-v2/actions/download/constants.d.ts +12 -0
  15. package/dist/types/widgets-v2/actions/download/csv-item.d.ts +38 -0
  16. package/dist/types/widgets-v2/actions/download/icons.d.ts +6 -0
  17. package/dist/types/widgets-v2/actions/download/index.d.ts +3 -1
  18. package/dist/types/widgets-v2/actions/index.d.ts +1 -1
  19. package/dist/widgets-v2/actions.js +40 -36
  20. package/dist/widgets-v2/actions.js.map +1 -1
  21. package/dist/widgets-v2/bar.js +77 -84
  22. package/dist/widgets-v2/bar.js.map +1 -1
  23. package/dist/widgets-v2/category.js +50 -55
  24. package/dist/widgets-v2/category.js.map +1 -1
  25. package/dist/widgets-v2/formula.js +37 -43
  26. package/dist/widgets-v2/formula.js.map +1 -1
  27. package/dist/widgets-v2/histogram.js +138 -144
  28. package/dist/widgets-v2/histogram.js.map +1 -1
  29. package/dist/widgets-v2/markdown.js +18 -17
  30. package/dist/widgets-v2/markdown.js.map +1 -1
  31. package/dist/widgets-v2/pie.js +67 -73
  32. package/dist/widgets-v2/pie.js.map +1 -1
  33. package/dist/widgets-v2/scatterplot.js +75 -81
  34. package/dist/widgets-v2/scatterplot.js.map +1 -1
  35. package/dist/widgets-v2/spread.js +36 -41
  36. package/dist/widgets-v2/spread.js.map +1 -1
  37. package/dist/widgets-v2/table.js +46 -55
  38. package/dist/widgets-v2/table.js.map +1 -1
  39. package/dist/widgets-v2/timeseries.js +81 -87
  40. package/dist/widgets-v2/timeseries.js.map +1 -1
  41. package/dist/widgets-v2.js +1 -1
  42. package/package.json +1 -1
  43. package/src/chat/bubbles/styles.ts +5 -1
  44. package/src/chat/containers/chat-content.tsx +4 -1
  45. package/src/chat/containers/chat-footer.test.tsx +59 -0
  46. package/src/chat/containers/chat-footer.tsx +124 -36
  47. package/src/chat/containers/styles.ts +107 -16
  48. package/src/chat/feedback/styles.ts +11 -4
  49. package/src/chat/index.ts +1 -0
  50. package/src/chat/types.ts +22 -0
  51. package/src/chat/use-typewriter.ts +32 -24
  52. package/src/widgets-v2/actions/download/constants.ts +14 -0
  53. package/src/widgets-v2/actions/download/csv-item.test.tsx +77 -0
  54. package/src/widgets-v2/actions/download/csv-item.tsx +71 -0
  55. package/src/widgets-v2/actions/download/icons.tsx +10 -1
  56. package/src/widgets-v2/actions/download/index.ts +3 -1
  57. package/src/widgets-v2/actions/download/png-item.tsx +2 -1
  58. package/src/widgets-v2/actions/index.ts +5 -0
  59. package/src/widgets-v2/bar/download.tsx +16 -22
  60. package/src/widgets-v2/category/download.test.ts +9 -0
  61. package/src/widgets-v2/category/download.ts +16 -20
  62. package/src/widgets-v2/formula/download.tsx +23 -29
  63. package/src/widgets-v2/histogram/download.ts +22 -26
  64. package/src/widgets-v2/markdown/{download.ts → download.tsx} +5 -2
  65. package/src/widgets-v2/pie/download.ts +16 -20
  66. package/src/widgets-v2/scatterplot/download.ts +16 -20
  67. package/src/widgets-v2/spread/download.ts +23 -27
  68. package/src/widgets-v2/table/download.test.ts +10 -0
  69. package/src/widgets-v2/table/download.ts +11 -15
  70. package/src/widgets-v2/table/helpers.test.ts +19 -0
  71. package/src/widgets-v2/table/helpers.ts +7 -12
  72. package/src/widgets-v2/timeseries/download.ts +36 -40
  73. package/dist/png-item-BE9uEqlD.js +0 -45
  74. package/dist/png-item-BE9uEqlD.js.map +0 -1
  75. package/dist/table-C9IMbTr0.js +0 -385
  76. package/dist/table-C9IMbTr0.js.map +0 -1
  77. package/dist/types/chat/feedback/styles.d.ts +0 -211
@@ -1 +1 @@
1
- {"version":3,"file":"spread.js","sources":["../../src/widgets-v2/spread/skeleton.tsx","../../src/widgets-v2/spread/download.ts"],"sourcesContent":["import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n py: 1,\n },\n row: {\n display: 'flex',\n alignItems: 'center',\n gap: 1.5,\n },\n block: { width: 200, height: 32 },\n} satisfies Record<string, SxProps<Theme>>\n\nexport interface SpreadSkeletonProps {\n count?: number\n}\n\n/**\n * Loading placeholder for the Spread widget. Renders `count` rows, each\n * sized for the `min — max` pair so the layout doesn't jump once data\n * resolves. Mirrors the row-per-item structure of {@link SpreadUI}.\n */\nexport function SpreadSkeleton({ count = 1 }: SpreadSkeletonProps) {\n return (\n <Box sx={styles.root}>\n {Array.from({ length: count }).map((_, i) => (\n <Box key={`row-${i}`} sx={styles.row}>\n <Skeleton variant='rectangular' sx={styles.block} />\n </Box>\n ))}\n </Box>\n )\n}\n","import {\n buildPngDownloadItem,\n downloadToCSV,\n type DownloadItem,\n} from '../actions/download'\nimport type { SpreadWidgetData } from './types'\n\n/**\n * Download menu items for the Spread widget. Always includes a CSV item\n * with `series, prefix, min, max, suffix, note` columns (one row per\n * entry). When `getCaptureEl` is supplied, prepends a PNG item that\n * rasterises the captured element via `html2canvas`.\n */\nexport function createSpreadDownloadConfig(args: {\n filename: string\n getData: () => SpreadWidgetData\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push({\n id: 'csv',\n label: 'Download as CSV',\n resolve: () => {\n const data = args.getData()\n const rows: unknown[][] = [\n ['series', 'prefix', 'min', 'max', 'suffix', 'note'],\n ]\n for (const item of data) {\n rows.push([\n item.series?.name ?? '',\n item.prefix ?? '',\n item.min,\n item.max,\n item.suffix ?? '',\n item.note ?? '',\n ])\n }\n const handle = downloadToCSV(rows)\n return Promise.resolve({\n url: handle.url,\n filename: `${args.filename}.csv`,\n revoke: handle.revoke,\n })\n },\n })\n return items\n}\n"],"names":["styles","root","display","flexDirection","gap","py","row","alignItems","block","width","height","SpreadSkeleton","t0","$","_c","count","t1","undefined","t2","Box","Array","from","length","map","_temp","_","i","jsx","Skeleton","createSpreadDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","backgroundColor","pngBackgroundColor","id","label","resolve","data","getData","rows","item","series","name","prefix","min","max","suffix","note","handle","downloadToCSV","Promise","url","revoke"],"mappings":";;;;;;;;;;;AAGA,MAAMA,IAAS;AAAA,EACbC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,eAAe;AAAA,IACfC,KAAK;AAAA,IACLC,IAAI;AAAA,EAAA;AAAA,EAENC,KAAK;AAAA,IACHJ,SAAS;AAAA,IACTK,YAAY;AAAA,IACZH,KAAK;AAAA,EAAA;AAAA,EAEPI,OAAO;AAAA,IAAEC,OAAO;AAAA,IAAKC,QAAQ;AAAA,EAAA;AAC/B;AAWO,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAAwB;AAAA,IAAAC,OAAAC;AAAAA,EAAAA,IAAAJ,GAAEG,IAAAC,MAAAC,SAAA,IAAAD;AAAS,MAAAE;AAAA,SAAAL,SAAAE,KAEtCG,sBAACC,GAAA,EAAQ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.js","sources":["../../src/widgets-v2/spread/skeleton.tsx","../../src/widgets-v2/spread/download.ts"],"sourcesContent":["import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n py: 1,\n },\n row: {\n display: 'flex',\n alignItems: 'center',\n gap: 1.5,\n },\n block: { width: 200, height: 32 },\n} satisfies Record<string, SxProps<Theme>>\n\nexport interface SpreadSkeletonProps {\n count?: number\n}\n\n/**\n * Loading placeholder for the Spread widget. Renders `count` rows, each\n * sized for the `min — max` pair so the layout doesn't jump once data\n * resolves. Mirrors the row-per-item structure of {@link SpreadUI}.\n */\nexport function SpreadSkeleton({ count = 1 }: SpreadSkeletonProps) {\n return (\n <Box sx={styles.root}>\n {Array.from({ length: count }).map((_, i) => (\n <Box key={`row-${i}`} sx={styles.row}>\n <Skeleton variant='rectangular' sx={styles.block} />\n </Box>\n ))}\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadItem,\n} from '../actions/download'\nimport type { SpreadWidgetData } from './types'\n\n/**\n * Download menu items for the Spread widget. Always includes a CSV item\n * with `series, prefix, min, max, suffix, note` columns (one row per\n * entry). When `getCaptureEl` is supplied, prepends a PNG item that\n * rasterises the captured element via `html2canvas`.\n */\nexport function createSpreadDownloadConfig(args: {\n filename: string\n getData: () => SpreadWidgetData\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push(\n buildCsvDownloadItem({\n filename: args.filename,\n getRows: () => {\n const data = args.getData()\n const rows: unknown[][] = [\n ['series', 'prefix', 'min', 'max', 'suffix', 'note'],\n ]\n for (const item of data) {\n rows.push([\n item.series?.name ?? '',\n item.prefix ?? '',\n item.min,\n item.max,\n item.suffix ?? '',\n item.note ?? '',\n ])\n }\n return rows\n },\n }),\n )\n return items\n}\n"],"names":["styles","root","display","flexDirection","gap","py","row","alignItems","block","width","height","SpreadSkeleton","t0","$","_c","count","t1","undefined","t2","Box","Array","from","length","map","_temp","_","i","jsx","Skeleton","createSpreadDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","backgroundColor","pngBackgroundColor","buildCsvDownloadItem","getRows","data","getData","rows","item","series","name","prefix","min","max","suffix","note"],"mappings":";;;;;;;;;;;;AAGA,MAAMA,IAAS;AAAA,EACbC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,eAAe;AAAA,IACfC,KAAK;AAAA,IACLC,IAAI;AAAA,EAAA;AAAA,EAENC,KAAK;AAAA,IACHJ,SAAS;AAAA,IACTK,YAAY;AAAA,IACZH,KAAK;AAAA,EAAA;AAAA,EAEPI,OAAO;AAAA,IAAEC,OAAO;AAAA,IAAKC,QAAQ;AAAA,EAAA;AAC/B;AAWO,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAAwB;AAAA,IAAAC,OAAAC;AAAAA,EAAAA,IAAAJ,GAAEG,IAAAC,MAAAC,SAAA,IAAAD;AAAS,MAAAE;AAAA,SAAAL,SAAAE,KAEtCG,sBAACC,GAAA,EAAQ,IAAAnB,EAAMC,MACZmB,gBAAKC,KAAM;AAAA,IAAAC,QAAUP;AAAAA,EAAAA,CAAO,EAACQ,IAAKC,CAIlC,GACH,GAAMX,OAAAE,GAAAF,OAAAK,KAAAA,IAAAL,EAAA,CAAA,GANNK;AAMM;AARH,SAAAM,EAAAC,GAAAC,GAAA;AAAA,SAIC,gBAAAC,EAACR,GAAA,EAAyB,IAAAnB,EAAMM,KAC9B,UAAA,gBAAAqB,EAACC,GAAA,EAAiB,SAAA,eAAkB,IAAA5B,EAAMQ,MAAAA,CAAM,EAAA,GADxC,OAAOkB,CAAC,EAElB;AAAM;ACpBP,SAASG,EAA2BC,GAMxB;AACjB,QAAMC,IAAwB,CAAA;AAC9B,SAAID,EAAKE,gBACPD,EAAME,KACJC,EAAqB;AAAA,IACnBC,UAAUL,EAAKK;AAAAA,IACfH,cAAcF,EAAKE;AAAAA,IACnBI,YAAYN,EAAKO;AAAAA,IACjBC,iBAAiBR,EAAKS;AAAAA,EAAAA,CACvB,CACH,GAEFR,EAAME,KACJO,EAAqB;AAAA,IACnBL,UAAUL,EAAKK;AAAAA,IACfM,SAASA,MAAM;AACb,YAAMC,IAAOZ,EAAKa,QAAAA,GACZC,IAAoB,CACxB,CAAC,UAAU,UAAU,OAAO,OAAO,UAAU,MAAM,CAAC;AAEtD,iBAAWC,KAAQH;AACjBE,QAAAA,EAAKX,KAAK,CACRY,EAAKC,QAAQC,QAAQ,IACrBF,EAAKG,UAAU,IACfH,EAAKI,KACLJ,EAAKK,KACLL,EAAKM,UAAU,IACfN,EAAKO,QAAQ,EAAE,CAChB;AAEH,aAAOR;AAAAA,IACT;AAAA,EAAA,CACD,CACH,GACOb;AACT;"}
@@ -1,77 +1,68 @@
1
- import { s as d, t as g } from "../table-C9IMbTr0.js";
2
- import { D as z, a as N, b as q, T as J, c as K, d as M, e as Q, p as W, r as X, f as Y } from "../table-C9IMbTr0.js";
3
- import { jsx as r, jsxs as v } from "react/jsx-runtime";
4
- import { c as _ } from "react/compiler-runtime";
5
- import { TableHead as w, TableRow as u, TableBody as x, TableCell as h, Skeleton as p, Box as E, Table as A } from "@mui/material";
1
+ import { s, t as g } from "../table-B3ZWWhJt.js";
2
+ import { D as q, a as J, b as K, T as M, c as Q, d as W, e as X, p as Y, r as ee, f as te } from "../table-B3ZWWhJt.js";
3
+ import { jsx as a, jsxs as _ } from "react/jsx-runtime";
4
+ import { c as E } from "react/compiler-runtime";
5
+ import { TableHead as w, TableRow as h, TableBody as x, TableCell as u, Skeleton as b, Box as A, Table as C } from "@mui/material";
6
6
  import "react";
7
7
  import "@mui/icons-material";
8
8
  import "../lasso-tool-CDFj4zKY.js";
9
9
  import "../cjs-D4KH3azB.js";
10
10
  import "@carto/ps-utils";
11
11
  import "html2canvas";
12
- import { b as L } from "../png-item-BE9uEqlD.js";
12
+ import { b as v } from "../png-item-9dNbB37T.js";
13
+ import { b as D } from "../csv-item-hH_Gt7ur.js";
13
14
  function V(t) {
14
- const e = _(11), {
15
- rows: n,
16
- columns: c,
17
- size: l
18
- } = t, b = n === void 0 ? 5 : n, o = c === void 0 ? 4 : c;
19
- let a;
20
- e[0] !== o ? (a = /* @__PURE__ */ r(w, { children: /* @__PURE__ */ r(u, { children: Array.from({
21
- length: o
22
- }).map(C) }) }), e[0] = o, e[1] = a) : a = e[1];
23
- let s;
24
- e[2] !== b ? (s = Array.from({
25
- length: b
26
- }), e[2] = b, e[3] = s) : s = e[3];
15
+ const e = E(11), {
16
+ rows: d,
17
+ columns: f,
18
+ size: m
19
+ } = t, c = d === void 0 ? 5 : d, r = f === void 0 ? 4 : f;
20
+ let l;
21
+ e[0] !== r ? (l = /* @__PURE__ */ a(w, { children: /* @__PURE__ */ a(h, { children: Array.from({
22
+ length: r
23
+ }).map(L) }) }), e[0] = r, e[1] = l) : l = e[1];
24
+ let o;
25
+ e[2] !== c ? (o = Array.from({
26
+ length: c
27
+ }), e[2] = c, e[3] = o) : o = e[3];
27
28
  let i;
28
- e[4] !== o || e[5] !== s ? (i = /* @__PURE__ */ r(x, { children: s.map((R, f) => /* @__PURE__ */ r(u, { sx: d.row, children: Array.from({
29
- length: o
30
- }).map((D, T) => /* @__PURE__ */ r(h, { children: /* @__PURE__ */ r(p, { variant: "text", width: "70%", height: 20 }) }, `cell-${f}-${T}`)) }, `row-${f}`)) }), e[4] = o, e[5] = s, e[6] = i) : i = e[6];
31
- let m;
32
- return e[7] !== l || e[8] !== a || e[9] !== i ? (m = /* @__PURE__ */ r(E, { sx: d.container, "aria-label": "Table skeleton", children: /* @__PURE__ */ v(A, { size: l, sx: d.table, stickyHeader: !0, children: [
33
- a,
29
+ e[4] !== r || e[5] !== o ? (i = /* @__PURE__ */ a(x, { children: o.map((B, p) => /* @__PURE__ */ a(h, { sx: s.row, children: Array.from({
30
+ length: r
31
+ }).map((k, T) => /* @__PURE__ */ a(u, { children: /* @__PURE__ */ a(b, { variant: "text", width: "70%", height: 20 }) }, `cell-${p}-${T}`)) }, `row-${p}`)) }), e[4] = r, e[5] = o, e[6] = i) : i = e[6];
32
+ let n;
33
+ return e[7] !== m || e[8] !== l || e[9] !== i ? (n = /* @__PURE__ */ a(A, { sx: s.container, "aria-label": "Table skeleton", children: /* @__PURE__ */ _(C, { size: m, sx: s.table, stickyHeader: !0, children: [
34
+ l,
34
35
  i
35
- ] }) }), e[7] = l, e[8] = a, e[9] = i, e[10] = m) : m = e[10], m;
36
+ ] }) }), e[7] = m, e[8] = l, e[9] = i, e[10] = n) : n = e[10], n;
36
37
  }
37
- function C(t, e) {
38
- return /* @__PURE__ */ r(h, { sx: d.headerCell, children: /* @__PURE__ */ r(p, { variant: "text", width: "80%", height: 24 }) }, `head-${e}`);
38
+ function L(t, e) {
39
+ return /* @__PURE__ */ a(u, { sx: s.headerCell, children: /* @__PURE__ */ a(b, { variant: "text", width: "80%", height: 24 }) }, `head-${e}`);
39
40
  }
40
- function G(t) {
41
+ function Z(t) {
41
42
  const e = [];
42
- return t.getCaptureEl && e.push(L({
43
+ return t.getCaptureEl && e.push(v({
43
44
  filename: t.filename,
44
45
  getCaptureEl: t.getCaptureEl,
45
46
  pixelRatio: t.pngPixelRatio,
46
47
  backgroundColor: t.pngBackgroundColor
47
- })), e.push({
48
- id: "csv",
49
- label: "Download as CSV",
50
- resolve: () => {
51
- const n = g(t.getData(), t.columns), c = new Blob([n], {
52
- type: "text/csv;charset=utf-8;"
53
- }), l = URL.createObjectURL(c);
54
- return Promise.resolve({
55
- url: l,
56
- filename: `${t.filename}.csv`,
57
- revoke: () => URL.revokeObjectURL(l)
58
- });
59
- }
60
- }), e;
48
+ })), e.push(D({
49
+ filename: t.filename,
50
+ getCsv: () => g(t.getData(), t.columns)
51
+ })), e;
61
52
  }
62
53
  export {
63
- z as DEFAULT_TABLE_LABELS,
64
- N as DEFAULT_TABLE_PAGE_SIZE,
65
- q as DEFAULT_TABLE_PAGE_SIZE_OPTIONS,
66
- J as Table,
54
+ q as DEFAULT_TABLE_LABELS,
55
+ J as DEFAULT_TABLE_PAGE_SIZE,
56
+ K as DEFAULT_TABLE_PAGE_SIZE_OPTIONS,
57
+ M as Table,
67
58
  V as TableSkeleton,
68
- K as TableUI,
69
- M as compareValues,
70
- G as createTableDownloadConfig,
71
- Q as deriveVisibleRows,
72
- W as paginateRows,
73
- X as resolveColumns,
74
- Y as sortRows,
59
+ Q as TableUI,
60
+ W as compareValues,
61
+ Z as createTableDownloadConfig,
62
+ X as deriveVisibleRows,
63
+ Y as paginateRows,
64
+ ee as resolveColumns,
65
+ te as sortRows,
75
66
  g as tableDataToCsv
76
67
  };
77
68
  //# sourceMappingURL=table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","sources":["../../src/widgets-v2/table/skeleton.tsx","../../src/widgets-v2/table/download.ts"],"sourcesContent":["import {\n Box,\n Skeleton,\n Table as MuiTable,\n TableBody,\n TableCell,\n TableHead,\n TableRow as MuiTableRow,\n type TableProps as MuiTableProps,\n} from '@mui/material'\nimport { styles } from './style'\n\nexport interface TableSkeletonProps {\n /** Number of body rows to render. Defaults to `5` (matches v1). */\n rows?: number\n /** Number of columns to render. Defaults to `4` (matches v1). */\n columns?: number\n /**\n * Forwarded to MUI's `<Table size>` so the loading layout matches the\n * size you'll render in {@link TableUI}. Leave `undefined` (the\n * default) to use MUI's own default density.\n */\n size?: MuiTableProps['size']\n}\n\n/**\n * Loading placeholder for the Table widget. Renders the same MUI table\n * primitives that {@link TableUI} uses so the loading layout (column\n * widths, header band, row density) doesn't shift when data resolves.\n *\n * Mirrors the v1 widget's `<TableSkeleton>` structure with v2's themed\n * `styles.headerCell`.\n */\nexport function TableSkeleton({\n rows = 5,\n columns = 4,\n size,\n}: TableSkeletonProps) {\n return (\n <Box sx={styles.container} aria-label='Table skeleton'>\n <MuiTable size={size} sx={styles.table} stickyHeader>\n <TableHead>\n <MuiTableRow>\n {Array.from({ length: columns }).map((_, c) => (\n <TableCell key={`head-${c}`} sx={styles.headerCell}>\n <Skeleton variant='text' width='80%' height={24} />\n </TableCell>\n ))}\n </MuiTableRow>\n </TableHead>\n <TableBody>\n {Array.from({ length: rows }).map((_, r) => (\n <MuiTableRow key={`row-${r}`} sx={styles.row}>\n {Array.from({ length: columns }).map((__, c) => (\n <TableCell key={`cell-${r}-${c}`}>\n <Skeleton variant='text' width='70%' height={20} />\n </TableCell>\n ))}\n </MuiTableRow>\n ))}\n </TableBody>\n </MuiTable>\n </Box>\n )\n}\n","import { buildPngDownloadItem, type DownloadItem } from '../actions/download'\nimport { tableDataToCsv } from './helpers'\nimport type { TableColumn, TableWidgetData } from './types'\n\n/**\n * Download menu items for the Table widget. Always includes a CSV item\n * that pulls the latest data from the widget store via `getData()` (so\n * locked / sorted / filtered state is honored); headers come from\n * `column.label`, cells from `row[column.id]`. When `getCaptureEl` is\n * supplied, prepends a PNG item that rasterises the captured element via\n * `html2canvas`.\n */\nexport function createTableDownloadConfig(opts: {\n filename: string\n getData: () => TableWidgetData\n columns: readonly TableColumn[]\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (opts.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: opts.filename,\n getCaptureEl: opts.getCaptureEl,\n pixelRatio: opts.pngPixelRatio,\n backgroundColor: opts.pngBackgroundColor,\n }),\n )\n }\n items.push({\n id: 'csv',\n label: 'Download as CSV',\n resolve: () => {\n const csv = tableDataToCsv(opts.getData(), opts.columns)\n const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' })\n const url = URL.createObjectURL(blob)\n return Promise.resolve({\n url,\n filename: `${opts.filename}.csv`,\n revoke: () => URL.revokeObjectURL(url),\n })\n },\n })\n return items\n}\n"],"names":["TableSkeleton","t0","$","_c","rows","t1","columns","t2","size","undefined","t3","jsx","TableHead","MuiTableRow","Array","from","length","map","_temp","t4","t5","TableBody","__0","r","styles","row","__","c_0","TableCell","Skeleton","c","t6","Box","container","jsxs","MuiTable","table","_","headerCell","createTableDownloadConfig","opts","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","backgroundColor","pngBackgroundColor","id","label","resolve","csv","tableDataToCsv","getData","blob","Blob","type","url","URL","createObjectURL","Promise","revoke","revokeObjectURL"],"mappings":";;;;;;;;;;;;AAiCO,SAAAA,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAAuB;AAAA,IAAAC,MAAAC;AAAAA,IAAAC,SAAAC;AAAAA,IAAAC,MAAAA;AAAAA,EAAAA,IAAAP,GAC5BG,IAAAC,MAAAI,SAAA,IAAAJ,GACAC,IAAAC,MAAAE,SAAA,IAAAF;AAAW,MAAAG;AAAA,EAAAR,SAAAI,KAMLI,IAAA,gBAAAC,EAACC,GAAA,EACC,UAAA,gBAAAD,EAACE,GAAA,EACEC,gBAAKC,KAAM;AAAA,IAAAC,QAAUV;AAAAA,EAAAA,CAAS,EAACW,IAAKC,CAIpC,GACH,EAAA,CACF,GAAYhB,OAAAI,GAAAJ,OAAAQ,KAAAA,IAAAR,EAAA,CAAA;AAAA,MAAAiB;AAAA,EAAAjB,SAAAE,KAETe,IAAAL,MAAKC,KAAM;AAAA,IAAAC,QAAUZ;AAAAA,EAAAA,CAAM,GAACF,OAAAE,GAAAF,OAAAiB,KAAAA,IAAAjB,EAAA,CAAA;AAAA,MAAAkB;AAAA,EAAAlB,EAAA,CAAA,MAAAI,KAAAJ,SAAAiB,KAD/BC,IAAA,gBAAAT,EAACU,GAAA,EACEF,UAAAA,EAA4BF,IAAK,CAAAK,GAAAC,MACh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AiBR,EAAKS;AAAAA,EAAAA,CACvB,CACH,GAEFR,EAAME,KAAK;AAAA,IACTO,IAAI;AAAA,IACJC,OAAO;AAAA,IACPC,SAASA,MAAM;AACb,YAAMC,IAAMC,EAAed,EAAKe,QAAAA,GAAWf,EAAKlC,OAAO,GACjDkD,IAAO,IAAIC,KAAK,CAACJ,CAAG,GAAG;AAAA,QAAEK,MAAM;AAAA,MAAA,CAA2B,GAC1DC,IAAMC,IAAIC,gBAAgBL,CAAI;AACpC,aAAOM,QAAQV,QAAQ;AAAA,QACrBO,KAAAA;AAAAA,QACAd,UAAU,GAAGL,EAAKK,QAAQ;AAAA,QAC1BkB,QAAQA,MAAMH,IAAII,gBAAgBL,CAAG;AAAA,MAAA,CACtC;AAAA,IACH;AAAA,EAAA,CACD,GACMlB;AACT;"}
1
+ {"version":3,"file":"table.js","sources":["../../src/widgets-v2/table/skeleton.tsx","../../src/widgets-v2/table/download.ts"],"sourcesContent":["import {\n Box,\n Skeleton,\n Table as MuiTable,\n TableBody,\n TableCell,\n TableHead,\n TableRow as MuiTableRow,\n type TableProps as MuiTableProps,\n} from '@mui/material'\nimport { styles } from './style'\n\nexport interface TableSkeletonProps {\n /** Number of body rows to render. Defaults to `5` (matches v1). */\n rows?: number\n /** Number of columns to render. Defaults to `4` (matches v1). */\n columns?: number\n /**\n * Forwarded to MUI's `<Table size>` so the loading layout matches the\n * size you'll render in {@link TableUI}. Leave `undefined` (the\n * default) to use MUI's own default density.\n */\n size?: MuiTableProps['size']\n}\n\n/**\n * Loading placeholder for the Table widget. Renders the same MUI table\n * primitives that {@link TableUI} uses so the loading layout (column\n * widths, header band, row density) doesn't shift when data resolves.\n *\n * Mirrors the v1 widget's `<TableSkeleton>` structure with v2's themed\n * `styles.headerCell`.\n */\nexport function TableSkeleton({\n rows = 5,\n columns = 4,\n size,\n}: TableSkeletonProps) {\n return (\n <Box sx={styles.container} aria-label='Table skeleton'>\n <MuiTable size={size} sx={styles.table} stickyHeader>\n <TableHead>\n <MuiTableRow>\n {Array.from({ length: columns }).map((_, c) => (\n <TableCell key={`head-${c}`} sx={styles.headerCell}>\n <Skeleton variant='text' width='80%' height={24} />\n </TableCell>\n ))}\n </MuiTableRow>\n </TableHead>\n <TableBody>\n {Array.from({ length: rows }).map((_, r) => (\n <MuiTableRow key={`row-${r}`} sx={styles.row}>\n {Array.from({ length: columns }).map((__, c) => (\n <TableCell key={`cell-${r}-${c}`}>\n <Skeleton variant='text' width='70%' height={20} />\n </TableCell>\n ))}\n </MuiTableRow>\n ))}\n </TableBody>\n </MuiTable>\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadItem,\n} from '../actions/download'\nimport { tableDataToCsv } from './helpers'\nimport type { TableColumn, TableWidgetData } from './types'\n\n/**\n * Download menu items for the Table widget. Always includes a CSV item\n * that pulls the latest data from the widget store via `getData()` (so\n * locked / sorted / filtered state is honored); headers come from\n * `column.label`, cells from `row[column.id]`. When `getCaptureEl` is\n * supplied, prepends a PNG item that rasterises the captured element via\n * `html2canvas`.\n */\nexport function createTableDownloadConfig(opts: {\n filename: string\n getData: () => TableWidgetData\n columns: readonly TableColumn[]\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (opts.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: opts.filename,\n getCaptureEl: opts.getCaptureEl,\n pixelRatio: opts.pngPixelRatio,\n backgroundColor: opts.pngBackgroundColor,\n }),\n )\n }\n items.push(\n buildCsvDownloadItem({\n filename: opts.filename,\n getCsv: () => tableDataToCsv(opts.getData(), opts.columns),\n }),\n )\n return items\n}\n"],"names":["TableSkeleton","t0","$","_c","rows","t1","columns","t2","size","undefined","t3","jsx","TableHead","MuiTableRow","Array","from","length","map","_temp","t4","t5","TableBody","__0","r","styles","row","__","c_0","TableCell","Skeleton","c","t6","Box","container","jsxs","MuiTable","table","_","headerCell","createTableDownloadConfig","opts","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","backgroundColor","pngBackgroundColor","buildCsvDownloadItem","getCsv","tableDataToCsv","getData"],"mappings":";;;;;;;;;;;;;AAiCO,SAAAA,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAAuB;AAAA,IAAAC,MAAAC;AAAAA,IAAAC,SAAAC;AAAAA,IAAAC,MAAAA;AAAAA,EAAAA,IAAAP,GAC5BG,IAAAC,MAAAI,SAAA,IAAAJ,GACAC,IAAAC,MAAAE,SAAA,IAAAF;AAAW,MAAAG;AAAA,EAAAR,SAAAI,KAMLI,IAAA,gBAAAC,EAACC,GAAA,EACC,UAAA,gBAAAD,EAACE,GAAA,EACEC,gBAAKC,KAAM;AAAA,IAAAC,QAAUV;AAAAA,EAAAA,CAAS,EAACW,IAAKC,CAIpC,GACH,EAAA,CACF,GAAYhB,OAAAI,GAAAJ,OAAAQ,KAAAA,IAAAR,EAAA,CAAA;AAAA,MAAAiB;AAAA,EAAAjB,SAAAE,KAETe,IAAAL,MAAKC,KAAM;AAAA,IAAAC,QAAUZ;AAAAA,EAAAA,CAAM,GAACF,OAAAE,GAAAF,OAAAiB,KAAAA,IAAAjB,EAAA,CAAA;AAAA,MAAAkB;AAAA,EAAAlB,EAAA,CAAA,MAAAI,KAAAJ,SAAAiB,KAD/BC,IAAA,gBAAAT,EAACU,GAAA,EACEF,UAAAA,EAA4BF,IAAK,CAAAK,GAAAC,MAChC,gBAAAZ,EAACE,GAAA,EAAiC,IAAAW,EAAMC,KACrCX,gBAAKC,KAAM;AAAA,IAAAC,QAAUV;AAAAA,EAAAA,CAAS,EAACW,IAAK,CAAAS,GAAAC,MACnC,gBAAAhB,EAACiB,GAAA,EACC,UAAA,gBAAAjB,EAACkB,GAAA,EAAiB,SAAA,QAAa,OAAA,OAAc,QAAA,GAAA,MAD/B,QAAQN,CAAC,IAAIO,CAAC,EAE9B,CACD,EAAA,GALe,OAAOP,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{ jsxs as O, jsx as y } from "react/jsx-runtime";
4
- import { c as q } from "react/compiler-runtime";
2
+ import { n as A, d as K, g as R, c as Y, f as q } from "../option-builders-F-c9ELi1.js";
3
+ import { jsxs as v, jsx as d } from "react/jsx-runtime";
4
+ import { c as H } from "react/compiler-runtime";
5
5
  import { Box as S, Skeleton as b } from "@mui/material";
6
6
  import "../widget-store-Bw5zRUGg.js";
7
7
  import "zustand/shallow";
@@ -20,24 +20,24 @@ import "zustand";
20
20
  import "zustand/vanilla";
21
21
  import "zustand/middleware";
22
22
  import "zustand/react/shallow";
23
- import { Z as B } from "../transforms-Cdx4fkU5.js";
24
- import { m as H, r as U } from "../resolve-theme-color-BdojIw0K.js";
23
+ import { Z as _ } from "../transforms-Cdx4fkU5.js";
24
+ import { m as U, r as V } from "../resolve-theme-color-BdojIw0K.js";
25
25
  import { p as W } from "../data-zoom-layout-CkVnm6ej.js";
26
- import { a as J } from "../exports-Cx-f6m6U.js";
27
- import { b as Q } from "../png-item-BE9uEqlD.js";
26
+ import { b as J } from "../png-item-9dNbB37T.js";
27
+ import { b as Q } from "../csv-item-hH_Gt7ur.js";
28
28
  function X({
29
29
  theme: e,
30
30
  formatter: i,
31
31
  labelFormatter: r
32
32
  }) {
33
- let c = 0, a = 1;
33
+ let c = 0, s = 1;
34
34
  return {
35
35
  grid: {
36
36
  left: parseInt(e.spacing(1)),
37
37
  top: parseInt(e.spacing(3)),
38
38
  right: parseInt(e.spacing(1)),
39
39
  // Default: no legend. Merger bumps this when there are >1 series.
40
- ...R(!1, e),
40
+ ...Y(!1, e),
41
41
  containLabel: !0
42
42
  },
43
43
  tooltip: {
@@ -53,8 +53,8 @@ function X({
53
53
  axisPointer: {
54
54
  type: "line"
55
55
  },
56
- position: V(e),
57
- formatter: F(i, r)
56
+ position: R(e),
57
+ formatter: B(i, r)
58
58
  },
59
59
  // Legend styling baked here; `show` is toggled by the merger based on
60
60
  // series count.
@@ -89,7 +89,7 @@ function X({
89
89
  yAxis: {
90
90
  type: "value",
91
91
  min: (o) => (c = o.min < 0 ? A(o.min) : 0, c),
92
- max: (o) => (a = o.max <= 0 ? 1 : A(o.max), a),
92
+ max: (o) => (s = o.max <= 0 ? 1 : A(o.max), s),
93
93
  axisLine: {
94
94
  show: !1
95
95
  },
@@ -111,40 +111,40 @@ function X({
111
111
  showMinLabel: !0,
112
112
  verticalAlign: "bottom",
113
113
  inside: !0,
114
- formatter: (o) => o !== a && o !== c || o === 0 ? "" : i ? i(o) : String(o)
114
+ formatter: (o) => o !== s && o !== c || o === 0 ? "" : i ? i(o) : String(o)
115
115
  }
116
116
  }
117
117
  };
118
118
  }
119
- function Ie(e) {
119
+ function De(e) {
120
120
  const {
121
121
  theme: i,
122
122
  formatter: r,
123
123
  labelFormatter: c,
124
- optionsOverride: a
125
- } = e, o = e.series, h = e.smooth ?? !0, g = e.area ?? !1, l = e.selection, m = l && l.length > 0 ? new Set(l) : null, s = (t) => t instanceof Date ? t.getTime() : t;
126
- return (t, p, k) => {
124
+ optionsOverride: s
125
+ } = e, o = e.series, y = e.smooth ?? !0, g = e.area ?? !1, l = e.selection, a = l && l.length > 0 ? new Set(l) : null, m = (t) => t instanceof Date ? t.getTime() : t;
126
+ return (t, x, F) => {
127
127
  if (t == null) {
128
128
  const n = X({
129
129
  theme: i,
130
130
  formatter: r,
131
131
  labelFormatter: c
132
132
  });
133
- return a ? H(n, a) : n;
133
+ return s ? U(n, s) : n;
134
134
  }
135
- const w = Array.isArray(p) ? p : [];
135
+ const w = Array.isArray(x) ? x : [];
136
136
  if (w.length === 0)
137
137
  return {
138
138
  ...t,
139
139
  dataset: [],
140
140
  series: []
141
141
  };
142
- const v = w.length > 1, j = Array.isArray(t.series) ? t.series : [], N = j[0] ?? {}, M = typeof t.yAxis == "object" && !Array.isArray(t.yAxis) ? t.yAxis : {}, C = typeof t.grid == "object" && !Array.isArray(t.grid) ? t.grid : {}, P = typeof t.tooltip == "object" && !Array.isArray(t.tooltip) ? t.tooltip : {}, Z = typeof t.legend == "object" && !Array.isArray(t.legend) ? t.legend : {}, L = k?.formatter;
143
- let T = 0, I = 1;
144
- const D = W(t.dataZoom, v), $ = typeof C.bottom == "number" ? C.bottom : 24, _ = v ? 56 : $, z = D ? _ + B.sliderHeight + B.sliderGap : _, E = {
142
+ const k = w.length > 1, O = Array.isArray(t.series) ? t.series : [], N = O[0] ?? {}, j = typeof t.yAxis == "object" && !Array.isArray(t.yAxis) ? t.yAxis : {}, I = typeof t.grid == "object" && !Array.isArray(t.grid) ? t.grid : {}, Z = typeof t.tooltip == "object" && !Array.isArray(t.tooltip) ? t.tooltip : {}, P = typeof t.legend == "object" && !Array.isArray(t.legend) ? t.legend : {}, L = F?.formatter;
143
+ let C = 0, T = 1;
144
+ const D = W(t.dataZoom, k), $ = typeof I.bottom == "number" ? I.bottom : 24, M = k ? 56 : $, z = D ? M + _.sliderHeight + _.sliderGap : M, E = {
145
145
  color: (n) => {
146
- const x = n.value?.name, f = n.color;
147
- return !m || x == null || m.has(s(x)) ? f : G.color.modifyAlpha(f, 0.15);
146
+ const h = n.value?.name, p = n.color;
147
+ return !a || h == null || a.has(m(h)) ? p : G.color.modifyAlpha(p, 0.15);
148
148
  }
149
149
  };
150
150
  return {
@@ -152,22 +152,22 @@ function Ie(e) {
152
152
  dataset: w.map((n) => ({
153
153
  source: n
154
154
  })),
155
- series: w.map((n, d) => {
156
- const x = j[d] ?? N, f = U(i, o?.[d]?.color);
155
+ series: w.map((n, u) => {
156
+ const h = O[u] ?? N, p = V(i, o?.[u]?.color);
157
157
  return {
158
- ...typeof x == "object" ? x : {},
158
+ ...typeof h == "object" ? h : {},
159
159
  type: "line",
160
- datasetIndex: d,
161
- name: o?.[d]?.name ?? `Series ${d + 1}`,
160
+ datasetIndex: u,
161
+ name: o?.[u]?.name ?? `Series ${u + 1}`,
162
162
  encode: {
163
163
  x: "name",
164
164
  y: "value"
165
165
  },
166
- smooth: h,
166
+ smooth: y,
167
167
  // When a selection is active, surface markers so the per-point
168
168
  // color callback has something to dim — a continuous line would
169
169
  // hide the visual selection feedback.
170
- showSymbol: m != null,
170
+ showSymbol: a != null,
171
171
  ...g ? {
172
172
  areaStyle: {}
173
173
  } : {},
@@ -175,53 +175,53 @@ function Ie(e) {
175
175
  focus: "series"
176
176
  },
177
177
  itemStyle: E,
178
- ...f ? {
179
- color: f,
178
+ ...p ? {
179
+ color: p,
180
180
  lineStyle: {
181
- color: f
181
+ color: p
182
182
  }
183
183
  } : {}
184
184
  };
185
185
  }),
186
186
  legend: {
187
- ...Z,
188
- show: v
187
+ ...P,
188
+ show: k
189
189
  },
190
190
  grid: {
191
- ...C,
191
+ ...I,
192
192
  bottom: z
193
193
  },
194
194
  ...D ? {
195
195
  dataZoom: D
196
196
  } : {},
197
197
  yAxis: {
198
- ...M,
199
- min: (n) => (T = n.min < 0 ? A(n.min) : 0, T),
200
- max: (n) => (I = n.max <= 0 ? 1 : A(n.max), I),
198
+ ...j,
199
+ min: (n) => (C = n.min < 0 ? A(n.min) : 0, C),
200
+ max: (n) => (T = n.max <= 0 ? 1 : A(n.max), T),
201
201
  axisLabel: {
202
- ...M.axisLabel ?? {},
203
- formatter: (n) => n !== I && n !== T || n === 0 ? "" : L ? L(n) : String(n)
202
+ ...j.axisLabel ?? {},
203
+ formatter: (n) => n !== T && n !== C || n === 0 ? "" : L ? L(n) : String(n)
204
204
  }
205
205
  },
206
206
  tooltip: {
207
- ...P,
208
- formatter: F(L, c)
207
+ ...Z,
208
+ formatter: B(L, c)
209
209
  }
210
210
  };
211
211
  };
212
212
  }
213
- function F(e, i) {
214
- return Y((r) => {
215
- const c = r.value, a = c?.value, o = typeof a == "number" && e ? e(a) : a ?? "", h = typeof r.marker == "string" ? r.marker : "", g = r.seriesName ? `${r.seriesName}: ` : "", l = c?.name ?? r.name, m = i && l != null ? i(l instanceof Date ? l : new Date(l)) : l ?? "";
213
+ function B(e, i) {
214
+ return q((r) => {
215
+ const c = r.value, s = c?.value, o = typeof s == "number" && e ? e(s) : s ?? "", y = typeof r.marker == "string" ? r.marker : "", g = r.seriesName ? `${r.seriesName}: ` : "", l = c?.name ?? r.name, a = i && l != null ? i(l instanceof Date ? l : new Date(l)) : l ?? "";
216
216
  return {
217
- name: String(m),
217
+ name: String(a),
218
218
  seriesName: g,
219
- marker: h,
219
+ marker: y,
220
220
  value: o
221
221
  };
222
222
  });
223
223
  }
224
- const u = {
224
+ const f = {
225
225
  container: {
226
226
  display: "flex",
227
227
  flexDirection: "column",
@@ -277,68 +277,62 @@ const u = {
277
277
  }) => e(1.5)
278
278
  }
279
279
  };
280
- function De() {
281
- const e = q(2);
280
+ function ve() {
281
+ const e = H(2);
282
282
  let i;
283
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ O(S, { sx: u.graph, children: [
284
- /* @__PURE__ */ y(b, { variant: "rectangular", sx: u.segmentA }),
285
- /* @__PURE__ */ y(b, { variant: "rectangular", sx: u.segmentB }),
286
- /* @__PURE__ */ y(b, { variant: "rectangular", sx: u.segmentC })
283
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ v(S, { sx: f.graph, children: [
284
+ /* @__PURE__ */ d(b, { variant: "rectangular", sx: f.segmentA }),
285
+ /* @__PURE__ */ d(b, { variant: "rectangular", sx: f.segmentB }),
286
+ /* @__PURE__ */ d(b, { variant: "rectangular", sx: f.segmentC })
287
287
  ] }), e[0] = i) : i = e[0];
288
288
  let r;
289
- return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ O(S, { sx: u.container, children: [
289
+ return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ v(S, { sx: f.container, children: [
290
290
  i,
291
- /* @__PURE__ */ y(S, { sx: u.legend, children: [0, 1].map(ee) })
291
+ /* @__PURE__ */ d(S, { sx: f.legend, children: [0, 1].map(ee) })
292
292
  ] }), e[1] = r) : r = e[1], r;
293
293
  }
294
294
  function ee(e) {
295
- return /* @__PURE__ */ O(S, { sx: u.legendItem, children: [
296
- /* @__PURE__ */ y(b, { variant: "circular", width: 8, height: 8 }),
297
- /* @__PURE__ */ y(b, { width: 48, height: 8 })
295
+ return /* @__PURE__ */ v(S, { sx: f.legendItem, children: [
296
+ /* @__PURE__ */ d(b, { variant: "circular", width: 8, height: 8 }),
297
+ /* @__PURE__ */ d(b, { width: 48, height: 8 })
298
298
  ] }, `legend-${e}`);
299
299
  }
300
300
  function Oe(e) {
301
301
  const i = [];
302
- return e.getCaptureEl && i.push(Q({
302
+ return e.getCaptureEl && i.push(J({
303
303
  filename: e.filename,
304
304
  getCaptureEl: e.getCaptureEl,
305
305
  pixelRatio: e.pngPixelRatio,
306
306
  backgroundColor: e.pngBackgroundColor
307
- })), i.push({
308
- id: "csv",
309
- label: "Download as CSV",
310
- resolve: () => {
311
- const r = e.getData(), c = r.length, a = [], o = /* @__PURE__ */ new Set();
312
- for (const s of r)
313
- for (const t of s) {
314
- const p = String(t.name);
315
- o.has(p) || (o.add(p), a.push(t.name));
307
+ })), i.push(Q({
308
+ filename: e.filename,
309
+ getRows: () => {
310
+ const r = e.getData(), c = r.length, s = [], o = /* @__PURE__ */ new Set();
311
+ for (const a of r)
312
+ for (const m of a) {
313
+ const t = String(m.name);
314
+ o.has(t) || (o.add(t), s.push(m.name));
316
315
  }
317
- const h = r.map((s) => new Map(s.map((t) => [String(t.name), t.value]))), g = ["time"];
318
- for (let s = 0; s < c; s++)
319
- g.push(e.seriesNames?.[s] ?? `series_${s + 1}`);
316
+ const y = r.map((a) => new Map(a.map((m) => [String(m.name), m.value]))), g = ["time"];
317
+ for (let a = 0; a < c; a++)
318
+ g.push(e.seriesNames?.[a] ?? `series_${a + 1}`);
320
319
  const l = [g];
321
- for (const s of a) {
322
- const t = [te(s)], p = String(s);
323
- for (const k of h) t.push(k.get(p) ?? "");
324
- l.push(t);
320
+ for (const a of s) {
321
+ const m = [te(a)], t = String(a);
322
+ for (const x of y) m.push(x.get(t) ?? "");
323
+ l.push(m);
325
324
  }
326
- const m = J(l);
327
- return Promise.resolve({
328
- url: m.url,
329
- filename: `${e.filename}.csv`,
330
- revoke: m.revoke
331
- });
325
+ return l;
332
326
  }
333
- }), i;
327
+ })), i;
334
328
  }
335
329
  function te(e) {
336
330
  return e instanceof Date ? e.toISOString() : typeof e == "number" ? new Date(e).toISOString() : e;
337
331
  }
338
332
  export {
339
- De as TimeseriesSkeleton,
333
+ ve as TimeseriesSkeleton,
340
334
  Oe as createTimeseriesDownloadConfig,
341
- Ie as createTimeseriesOptionFactory,
335
+ De as createTimeseriesOptionFactory,
342
336
  X as timeseriesOptions
343
337
  };
344
338
  //# sourceMappingURL=timeseries.js.map