@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.
- package/dist/chat.js +962 -733
- package/dist/chat.js.map +1 -1
- package/dist/csv-item-hH_Gt7ur.js +32 -0
- package/dist/csv-item-hH_Gt7ur.js.map +1 -0
- package/dist/png-item-9dNbB37T.js +57 -0
- package/dist/png-item-9dNbB37T.js.map +1 -0
- package/dist/table-B3ZWWhJt.js +383 -0
- package/dist/table-B3ZWWhJt.js.map +1 -0
- package/dist/types/chat/containers/chat-footer.d.ts +1 -1
- package/dist/types/chat/containers/styles.d.ts +79 -12
- package/dist/types/chat/index.d.ts +1 -1
- package/dist/types/chat/types.d.ts +21 -0
- package/dist/types/chat/use-typewriter.d.ts +5 -3
- package/dist/types/widgets-v2/actions/download/constants.d.ts +12 -0
- package/dist/types/widgets-v2/actions/download/csv-item.d.ts +38 -0
- package/dist/types/widgets-v2/actions/download/icons.d.ts +6 -0
- package/dist/types/widgets-v2/actions/download/index.d.ts +3 -1
- package/dist/types/widgets-v2/actions/index.d.ts +1 -1
- package/dist/widgets-v2/actions.js +40 -36
- package/dist/widgets-v2/actions.js.map +1 -1
- package/dist/widgets-v2/bar.js +77 -84
- package/dist/widgets-v2/bar.js.map +1 -1
- package/dist/widgets-v2/category.js +50 -55
- package/dist/widgets-v2/category.js.map +1 -1
- package/dist/widgets-v2/formula.js +37 -43
- package/dist/widgets-v2/formula.js.map +1 -1
- package/dist/widgets-v2/histogram.js +138 -144
- package/dist/widgets-v2/histogram.js.map +1 -1
- package/dist/widgets-v2/markdown.js +18 -17
- package/dist/widgets-v2/markdown.js.map +1 -1
- package/dist/widgets-v2/pie.js +67 -73
- package/dist/widgets-v2/pie.js.map +1 -1
- package/dist/widgets-v2/scatterplot.js +75 -81
- package/dist/widgets-v2/scatterplot.js.map +1 -1
- package/dist/widgets-v2/spread.js +36 -41
- package/dist/widgets-v2/spread.js.map +1 -1
- package/dist/widgets-v2/table.js +46 -55
- package/dist/widgets-v2/table.js.map +1 -1
- package/dist/widgets-v2/timeseries.js +81 -87
- package/dist/widgets-v2/timeseries.js.map +1 -1
- package/dist/widgets-v2.js +1 -1
- package/package.json +1 -1
- package/src/chat/bubbles/styles.ts +5 -1
- package/src/chat/containers/chat-content.tsx +4 -1
- package/src/chat/containers/chat-footer.test.tsx +59 -0
- package/src/chat/containers/chat-footer.tsx +124 -36
- package/src/chat/containers/styles.ts +107 -16
- package/src/chat/feedback/styles.ts +11 -4
- package/src/chat/index.ts +1 -0
- package/src/chat/types.ts +22 -0
- package/src/chat/use-typewriter.ts +32 -24
- package/src/widgets-v2/actions/download/constants.ts +14 -0
- package/src/widgets-v2/actions/download/csv-item.test.tsx +77 -0
- package/src/widgets-v2/actions/download/csv-item.tsx +71 -0
- package/src/widgets-v2/actions/download/icons.tsx +10 -1
- package/src/widgets-v2/actions/download/index.ts +3 -1
- package/src/widgets-v2/actions/download/png-item.tsx +2 -1
- package/src/widgets-v2/actions/index.ts +5 -0
- package/src/widgets-v2/bar/download.tsx +16 -22
- package/src/widgets-v2/category/download.test.ts +9 -0
- package/src/widgets-v2/category/download.ts +16 -20
- package/src/widgets-v2/formula/download.tsx +23 -29
- package/src/widgets-v2/histogram/download.ts +22 -26
- package/src/widgets-v2/markdown/{download.ts → download.tsx} +5 -2
- package/src/widgets-v2/pie/download.ts +16 -20
- package/src/widgets-v2/scatterplot/download.ts +16 -20
- package/src/widgets-v2/spread/download.ts +23 -27
- package/src/widgets-v2/table/download.test.ts +10 -0
- package/src/widgets-v2/table/download.ts +11 -15
- package/src/widgets-v2/table/helpers.test.ts +19 -0
- package/src/widgets-v2/table/helpers.ts +7 -12
- package/src/widgets-v2/timeseries/download.ts +36 -40
- package/dist/png-item-BE9uEqlD.js +0 -45
- package/dist/png-item-BE9uEqlD.js.map +0 -1
- package/dist/table-C9IMbTr0.js +0 -385
- package/dist/table-C9IMbTr0.js.map +0 -1
- 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
|
|
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 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,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AK,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;"}
|
package/dist/widgets-v2/table.js
CHANGED
|
@@ -1,77 +1,68 @@
|
|
|
1
|
-
import { s
|
|
2
|
-
import { D as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { c as
|
|
5
|
-
import { TableHead as w, TableRow as
|
|
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
|
|
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 =
|
|
15
|
-
rows:
|
|
16
|
-
columns:
|
|
17
|
-
size:
|
|
18
|
-
} = t,
|
|
19
|
-
let
|
|
20
|
-
e[0] !==
|
|
21
|
-
length:
|
|
22
|
-
}).map(
|
|
23
|
-
let
|
|
24
|
-
e[2] !==
|
|
25
|
-
length:
|
|
26
|
-
}), e[2] =
|
|
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] !==
|
|
29
|
-
length:
|
|
30
|
-
}).map((
|
|
31
|
-
let
|
|
32
|
-
return e[7] !==
|
|
33
|
-
|
|
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] =
|
|
36
|
+
] }) }), e[7] = m, e[8] = l, e[9] = i, e[10] = n) : n = e[10], n;
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
return /* @__PURE__ */
|
|
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
|
|
41
|
+
function Z(t) {
|
|
41
42
|
const e = [];
|
|
42
|
-
return t.getCaptureEl && e.push(
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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 {
|
|
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,IAAA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IAAAJ,EAAMc,YACrC,4BAACT,GAAA,EAAiB,SAAA,QAAa,OAAA,OAAc,QAAA,GAAA,CAAE,EAAA,WADzBC,CAAC,EAEzB;AAAY;AC9BnB,SAASS,EAA0BC,GAOvB;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,QAAQA,MAAMC,EAAeZ,EAAKa,QAAAA,GAAWb,EAAKlC,OAAO;AAAA,EAAA,CAC1D,CACH,GACOmC;AACT;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as G from "echarts";
|
|
2
|
-
import { n as A, d as K, g as
|
|
3
|
-
import { jsxs as
|
|
4
|
-
import { c as
|
|
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
|
|
24
|
-
import { m as
|
|
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 {
|
|
27
|
-
import { b as Q } from "../
|
|
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,
|
|
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
|
-
...
|
|
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:
|
|
57
|
-
formatter:
|
|
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) => (
|
|
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 !==
|
|
114
|
+
formatter: (o) => o !== s && o !== c || o === 0 ? "" : i ? i(o) : String(o)
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function De(e) {
|
|
120
120
|
const {
|
|
121
121
|
theme: i,
|
|
122
122
|
formatter: r,
|
|
123
123
|
labelFormatter: c,
|
|
124
|
-
optionsOverride:
|
|
125
|
-
} = e, o = e.series,
|
|
126
|
-
return (t,
|
|
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
|
|
133
|
+
return s ? U(n, s) : n;
|
|
134
134
|
}
|
|
135
|
-
const w = Array.isArray(
|
|
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
|
|
143
|
-
let
|
|
144
|
-
const D = W(t.dataZoom,
|
|
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
|
|
147
|
-
return !
|
|
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,
|
|
156
|
-
const
|
|
155
|
+
series: w.map((n, u) => {
|
|
156
|
+
const h = O[u] ?? N, p = V(i, o?.[u]?.color);
|
|
157
157
|
return {
|
|
158
|
-
...typeof
|
|
158
|
+
...typeof h == "object" ? h : {},
|
|
159
159
|
type: "line",
|
|
160
|
-
datasetIndex:
|
|
161
|
-
name: o?.[
|
|
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:
|
|
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:
|
|
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
|
-
...
|
|
179
|
-
color:
|
|
178
|
+
...p ? {
|
|
179
|
+
color: p,
|
|
180
180
|
lineStyle: {
|
|
181
|
-
color:
|
|
181
|
+
color: p
|
|
182
182
|
}
|
|
183
183
|
} : {}
|
|
184
184
|
};
|
|
185
185
|
}),
|
|
186
186
|
legend: {
|
|
187
|
-
...
|
|
188
|
-
show:
|
|
187
|
+
...P,
|
|
188
|
+
show: k
|
|
189
189
|
},
|
|
190
190
|
grid: {
|
|
191
|
-
...
|
|
191
|
+
...I,
|
|
192
192
|
bottom: z
|
|
193
193
|
},
|
|
194
194
|
...D ? {
|
|
195
195
|
dataZoom: D
|
|
196
196
|
} : {},
|
|
197
197
|
yAxis: {
|
|
198
|
-
...
|
|
199
|
-
min: (n) => (
|
|
200
|
-
max: (n) => (
|
|
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
|
-
...
|
|
203
|
-
formatter: (n) => 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
|
-
...
|
|
208
|
-
formatter:
|
|
207
|
+
...Z,
|
|
208
|
+
formatter: B(L, c)
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
return
|
|
215
|
-
const c = r.value,
|
|
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(
|
|
217
|
+
name: String(a),
|
|
218
218
|
seriesName: g,
|
|
219
|
-
marker:
|
|
219
|
+
marker: y,
|
|
220
220
|
value: o
|
|
221
221
|
};
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
const
|
|
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
|
|
281
|
-
const e =
|
|
280
|
+
function ve() {
|
|
281
|
+
const e = H(2);
|
|
282
282
|
let i;
|
|
283
|
-
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
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__ */
|
|
289
|
+
return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ v(S, { sx: f.container, children: [
|
|
290
290
|
i,
|
|
291
|
-
/* @__PURE__ */
|
|
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__ */
|
|
296
|
-
/* @__PURE__ */
|
|
297
|
-
/* @__PURE__ */
|
|
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(
|
|
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
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
|
318
|
-
for (let
|
|
319
|
-
g.push(e.seriesNames?.[
|
|
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
|
|
322
|
-
const
|
|
323
|
-
for (const
|
|
324
|
-
l.push(
|
|
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
|
-
|
|
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
|
-
|
|
333
|
+
ve as TimeseriesSkeleton,
|
|
340
334
|
Oe as createTimeseriesDownloadConfig,
|
|
341
|
-
|
|
335
|
+
De as createTimeseriesOptionFactory,
|
|
342
336
|
X as timeseriesOptions
|
|
343
337
|
};
|
|
344
338
|
//# sourceMappingURL=timeseries.js.map
|