@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
|
@@ -18,24 +18,91 @@ export declare const styles: {
|
|
|
18
18
|
};
|
|
19
19
|
footerWrapper: {
|
|
20
20
|
padding: ({ spacing }: Theme) => string;
|
|
21
|
-
position: "relative";
|
|
22
|
-
};
|
|
23
|
-
footerCorner: {
|
|
24
|
-
position: "absolute";
|
|
25
|
-
bottom: string;
|
|
26
|
-
right: string;
|
|
27
|
-
margin: string;
|
|
28
21
|
};
|
|
29
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Rounded input box, matching the reference ChatFooter. A two-column grid:
|
|
24
|
+
* main column (input + optional slots) | send button, bottom-aligned so it
|
|
25
|
+
* stays at the end as the input grows. NO vertical padding — the textarea's own
|
|
26
|
+
* padding sets the ~32px single-line height, so the box hugs the input.
|
|
27
|
+
*/
|
|
28
|
+
footerBox: {
|
|
30
29
|
maxWidth: number;
|
|
30
|
+
width: string;
|
|
31
31
|
margin: string;
|
|
32
|
-
|
|
32
|
+
display: "grid";
|
|
33
|
+
gridTemplateColumns: string;
|
|
34
|
+
alignItems: "end";
|
|
35
|
+
columnGap: ({ spacing }: Theme) => string;
|
|
36
|
+
backgroundColor: ({ palette }: Theme) => string;
|
|
37
|
+
borderRadius: ({ spacing }: Theme) => string;
|
|
38
|
+
paddingInline: ({ spacing }: Theme) => string;
|
|
39
|
+
};
|
|
40
|
+
/** Main grid area: input stacked above the (optional) slots row. */
|
|
41
|
+
footerMain: {
|
|
42
|
+
minWidth: number;
|
|
43
|
+
display: "flex";
|
|
44
|
+
flexDirection: "column";
|
|
45
|
+
gap: ({ spacing }: Theme) => string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Send-button grid area, bottom-aligned (matches the reference flex-end row) so
|
|
49
|
+
* the button stays at the bottom as the input grows. The small bottom padding
|
|
50
|
+
* keeps it off the box edge — in the single-line state it reads as vertically
|
|
51
|
+
* centered (4px top / 4px bottom around the 24px button in the 32px row).
|
|
52
|
+
*/
|
|
53
|
+
footerSend: {
|
|
54
|
+
alignSelf: "end";
|
|
55
|
+
paddingBottom: ({ spacing }: Theme) => string;
|
|
56
|
+
'& .MuiIconButton-root': {
|
|
57
|
+
padding: ({ spacing }: Theme) => string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/** The chrome-less multiline input (no underline / no filled affordance). */
|
|
61
|
+
footerInput: {
|
|
62
|
+
width: string;
|
|
63
|
+
typography: string;
|
|
64
|
+
minHeight: string;
|
|
65
|
+
'& textarea': {
|
|
66
|
+
fontSize: ({ typography }: Theme) => string;
|
|
67
|
+
lineHeight: ({ typography }: Theme) => string;
|
|
68
|
+
letterSpacing: ({ typography }: Theme) => string;
|
|
69
|
+
};
|
|
70
|
+
'& textarea:not([aria-hidden])': {
|
|
33
71
|
resize: "none";
|
|
34
|
-
|
|
35
|
-
overflowY: "auto !important";
|
|
36
|
-
paddingRight: ({ spacing }: Theme) => string;
|
|
72
|
+
padding: ({ spacing }: Theme) => string;
|
|
37
73
|
};
|
|
38
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Slots row under the input: start slot + model selector + end slot. The left
|
|
77
|
+
* padding lines the row's content up with the input text above it: the input
|
|
78
|
+
* text is inset ~12px from the box edge (InputBase root padding + the textarea's
|
|
79
|
+
* 10px left padding) while the model-selector text button only insets ~8px, so a
|
|
80
|
+
* 4px indent here makes the slot label share the placeholder's left edge instead
|
|
81
|
+
* of sitting further out.
|
|
82
|
+
*/
|
|
83
|
+
footerSlots: {
|
|
84
|
+
display: "flex";
|
|
85
|
+
alignItems: "center";
|
|
86
|
+
gap: ({ spacing }: Theme) => string;
|
|
87
|
+
minWidth: number;
|
|
88
|
+
flexWrap: "wrap";
|
|
89
|
+
paddingLeft: ({ spacing }: Theme) => string;
|
|
90
|
+
paddingBottom: ({ spacing }: Theme) => string;
|
|
91
|
+
};
|
|
92
|
+
modelSelector: {
|
|
93
|
+
textTransform: "none";
|
|
94
|
+
color: ({ palette }: Theme) => string;
|
|
95
|
+
maxWidth: string;
|
|
96
|
+
minWidth: number;
|
|
97
|
+
'& .MuiButton-endIcon': {
|
|
98
|
+
marginLeft: ({ spacing }: Theme) => string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
modelSelectorLabel: {
|
|
102
|
+
overflow: "hidden";
|
|
103
|
+
textOverflow: "ellipsis";
|
|
104
|
+
whiteSpace: "nowrap";
|
|
105
|
+
};
|
|
39
106
|
footerCaption: {
|
|
40
107
|
textAlign: "center";
|
|
41
108
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ChatSxProps, ChatErrorAction, ChatUserMessageProps, ChatAgentMessageProps, ChatErrorMessageProps, ChatSuggestionButtonProps, ChatThinkingProps, ChatLoaderProps, ChatContentProps, ChatContentRef, ChatHeaderProps, ChatFooterProps, ChatStarterItem, ChatStarterProps, ChatRatingActionProps, ChatToolItem, ChatToolTraceProps, ChatToolCodeAreaProps, ChatToolFullViewDialogProps, ChatToolGroupProps, } from './types';
|
|
1
|
+
export type { ChatSxProps, ChatErrorAction, ChatUserMessageProps, ChatAgentMessageProps, ChatErrorMessageProps, ChatSuggestionButtonProps, ChatThinkingProps, ChatLoaderProps, ChatContentProps, ChatContentRef, ChatHeaderProps, ChatFooterProps, ChatModelOption, ChatStarterItem, ChatStarterProps, ChatRatingActionProps, ChatToolItem, ChatToolTraceProps, ChatToolCodeAreaProps, ChatToolFullViewDialogProps, ChatToolGroupProps, } from './types';
|
|
2
2
|
export { CHAT_MAX_WIDTH, CHAT_SCROLL_DELAY, CHAT_DIVIDER_DELAY, CHAT_TOOL_CODE_AREA_MAX_HEIGHT, } from './const';
|
|
3
3
|
export { useTypewriter } from './use-typewriter';
|
|
4
4
|
export { ChatUserMessage } from './bubbles/chat-user-message';
|
|
@@ -91,9 +91,30 @@ export interface ChatFooterProps extends ChatSxProps {
|
|
|
91
91
|
send?: string;
|
|
92
92
|
/** Defaults to `'Stop'`. */
|
|
93
93
|
stop?: string;
|
|
94
|
+
/** `aria-label` for the model-selector trigger. Defaults to `'Select model'`. */
|
|
95
|
+
model?: string;
|
|
94
96
|
};
|
|
95
97
|
/** Helper text rendered under the input. Defaults to an AI disclaimer; pass `null` to hide. */
|
|
96
98
|
caption?: ReactNode;
|
|
99
|
+
/**
|
|
100
|
+
* Selectable models for the in-toolbar model selector. The selector is only
|
|
101
|
+
* rendered when this is a non-empty array; the component is otherwise
|
|
102
|
+
* model-agnostic (the host owns the list, selection, and default).
|
|
103
|
+
*/
|
|
104
|
+
models?: ChatModelOption[];
|
|
105
|
+
/** Currently selected model `value`. Controlled — the host owns the state. */
|
|
106
|
+
selectedModel?: string;
|
|
107
|
+
/** Called with the picked model `value` when the user selects one. */
|
|
108
|
+
onModelChange?: (value: string) => void;
|
|
109
|
+
/** Extra controls rendered at the start (left) of the toolbar, before the model selector. */
|
|
110
|
+
startToolbarSlot?: ReactNode;
|
|
111
|
+
/** Extra controls rendered at the end (right) of the toolbar, before the send/stop button. */
|
|
112
|
+
endToolbarSlot?: ReactNode;
|
|
113
|
+
}
|
|
114
|
+
/** An option for the `ChatFooter` model selector. */
|
|
115
|
+
export interface ChatModelOption {
|
|
116
|
+
value: string;
|
|
117
|
+
label: string;
|
|
97
118
|
}
|
|
98
119
|
export interface ChatStarterItem {
|
|
99
120
|
label: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
interface UseTypewriterOptions {
|
|
2
2
|
/** Characters revealed per second (default: `500`). */
|
|
3
3
|
speed?: number;
|
|
4
|
-
/** When true
|
|
4
|
+
/** When true, reveal the full text immediately (and snap to it if it grows). */
|
|
5
5
|
skipAnimation?: boolean;
|
|
6
6
|
}
|
|
7
7
|
interface UseTypewriterResult {
|
|
@@ -12,8 +12,10 @@ interface UseTypewriterResult {
|
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Reveals a string character-by-character at a steady rate via
|
|
15
|
-
* `requestAnimationFrame`.
|
|
16
|
-
*
|
|
15
|
+
* `requestAnimationFrame`. Designed for bursty, streamed agent text: as
|
|
16
|
+
* `fullText` grows the reveal keeps chasing the new end, and flipping
|
|
17
|
+
* `skipAnimation` to `true` (e.g. once generation finishes) snaps to the full
|
|
18
|
+
* text. Pair it with `ChatAgentMessage`.
|
|
17
19
|
*
|
|
18
20
|
* @example
|
|
19
21
|
* ```tsx
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical `DownloadItem.id`s for the built-in download formats. Centralised
|
|
3
|
+
* so the per-format builders — and anything that keys off the id (menu logic,
|
|
4
|
+
* tests) — reference one source of truth instead of re-typing string literals.
|
|
5
|
+
* The Markdown format keeps the short `'md'` id to match its `.md` extension.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DOWNLOAD_ITEM_IDS: {
|
|
8
|
+
readonly png: "png";
|
|
9
|
+
readonly csv: "csv";
|
|
10
|
+
readonly markdown: "md";
|
|
11
|
+
};
|
|
12
|
+
export type DownloadItemId = (typeof DOWNLOAD_ITEM_IDS)[keyof typeof DOWNLOAD_ITEM_IDS];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DownloadItem } from './types';
|
|
2
|
+
interface BuildCsvDownloadItemBase {
|
|
3
|
+
/** Base filename (without extension). The item appends `.csv`. */
|
|
4
|
+
filename: string;
|
|
5
|
+
/** Override the menu label. Default `'CSV'`. */
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Args for {@link buildCsvDownloadItem}. A discriminated union: a caller must
|
|
10
|
+
* supply exactly one content source — `getRows` (rows serialised through the
|
|
11
|
+
* shared `toCsvString`) or `getCsv` (a pre-built CSV string). The `?: never`
|
|
12
|
+
* arms make passing both — or neither — a compile-time error.
|
|
13
|
+
*/
|
|
14
|
+
export type BuildCsvDownloadItemArgs = (BuildCsvDownloadItemBase & {
|
|
15
|
+
/**
|
|
16
|
+
* Builds the CSV rows at click time. Used by most widgets — rows are run
|
|
17
|
+
* through `toCsvString` so escaping (incl. the spreadsheet
|
|
18
|
+
* formula-injection guard) stays consistent across widgets.
|
|
19
|
+
*/
|
|
20
|
+
getRows: () => readonly (readonly unknown[])[];
|
|
21
|
+
getCsv?: never;
|
|
22
|
+
}) | (BuildCsvDownloadItemBase & {
|
|
23
|
+
/**
|
|
24
|
+
* Returns a pre-built CSV string at click time. Escape hatch for widgets
|
|
25
|
+
* (e.g. Table) that already serialise their own CSV with bespoke
|
|
26
|
+
* header/cell handling.
|
|
27
|
+
*/
|
|
28
|
+
getCsv: () => string;
|
|
29
|
+
getRows?: never;
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Builds the standard CSV `DownloadItem` used by every per-widget download
|
|
33
|
+
* config. Centralised so the menu label, icon, and `.csv` filename suffix stay
|
|
34
|
+
* consistent across widgets — mirrors {@link buildPngDownloadItem} so neither
|
|
35
|
+
* format can drift again.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildCsvDownloadItem(args: BuildCsvDownloadItemArgs): DownloadItem;
|
|
38
|
+
export {};
|
|
@@ -5,6 +5,12 @@ import { SvgIconProps } from '@mui/material';
|
|
|
5
5
|
* config's `icon` override without pulling MUI directly.
|
|
6
6
|
*/
|
|
7
7
|
export declare function PNGIcon(props: SvgIconProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Generic "document" glyph used for the Markdown download item. Wraps MUI's
|
|
10
|
+
* `ArticleOutlined`, mirroring {@link PNGIcon}, so the Markdown menu item
|
|
11
|
+
* carries an icon consistent with the other download formats.
|
|
12
|
+
*/
|
|
13
|
+
export declare function MarkdownIcon(props: SvgIconProps): import("react/jsx-runtime").JSX.Element;
|
|
8
14
|
/**
|
|
9
15
|
* "CSV" rectangle with the letters spelled inside — matches v1 visual and is
|
|
10
16
|
* easier to recognise in a download menu than a generic table glyph.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { Download, type DownloadProps } from './download';
|
|
2
2
|
export { downloadToCSV, downloadDOMToPNG, toCsvString, triggerLinkDownload, type DownloadHandle, type DownloadDOMToPNGOptions, } from './exports';
|
|
3
|
-
export { CSVIcon, PNGIcon } from './icons';
|
|
3
|
+
export { CSVIcon, PNGIcon, MarkdownIcon } from './icons';
|
|
4
4
|
export { buildPngDownloadItem, type BuildPngDownloadItemArgs } from './png-item';
|
|
5
|
+
export { buildCsvDownloadItem, type BuildCsvDownloadItemArgs } from './csv-item';
|
|
6
|
+
export { DOWNLOAD_ITEM_IDS, type DownloadItemId } from './constants';
|
|
5
7
|
export type { DownloadItem } from './types';
|
|
6
8
|
export { DEFAULT_DOWNLOAD_LABELS, type DownloadLabels } from './labels';
|
|
@@ -4,7 +4,7 @@ export { ShowAllToggle, setShowAll, SHOW_ALL_ID, DEFAULT_SHOW_ALL_LABELS, type S
|
|
|
4
4
|
export { ZoomToggle, addZoom, createAddZoom, ZOOM_LAYOUT, DEFAULT_ZOOM_TOGGLE_LABELS, type ZoomToggleProps, type ZoomToggleLabels, } from './zoom-toggle';
|
|
5
5
|
export { BrushToggle, addBrush, DEFAULT_BRUSH_TOGGLE_LABELS, type BrushToggleProps, type BrushToggleLabels, } from './brush-toggle';
|
|
6
6
|
export { RelativeData, toRelativeData, createPercentFormatter, DEFAULT_RELATIVE_DATA_LABELS, type RelativeDataProps, type RelativeDataLabels, } from './relative-data';
|
|
7
|
-
export { Download, downloadToCSV, downloadDOMToPNG, toCsvString, triggerLinkDownload, buildPngDownloadItem, CSVIcon, PNGIcon, DEFAULT_DOWNLOAD_LABELS, type DownloadProps, type DownloadItem, type DownloadHandle, type DownloadDOMToPNGOptions, type BuildPngDownloadItemArgs, type DownloadLabels, } from './download';
|
|
7
|
+
export { Download, downloadToCSV, downloadDOMToPNG, toCsvString, triggerLinkDownload, buildPngDownloadItem, buildCsvDownloadItem, CSVIcon, PNGIcon, MarkdownIcon, DEFAULT_DOWNLOAD_LABELS, DOWNLOAD_ITEM_IDS, type DownloadProps, type DownloadItem, type DownloadItemId, type DownloadHandle, type DownloadDOMToPNGOptions, type BuildPngDownloadItemArgs, type BuildCsvDownloadItemArgs, type DownloadLabels, } from './download';
|
|
8
8
|
export { FullScreen, DEFAULT_FULLSCREEN_LABELS, type FullScreenTriggerProps, type FullScreenSlotProps, type FullScreenLabels, type FullScreenWidgetState, } from './fullscreen';
|
|
9
9
|
export { LockSelection, filterByLockedItems, DEFAULT_LOCK_SELECTION_LABELS, type LockSelectionProps, type LockSelectionKey, type LockSelectionLabels, } from './lock-selection';
|
|
10
10
|
export { ChangeColumn, DEFAULT_CHANGE_COLUMN_LABELS, type ChangeColumnProps, type ChangeColumnItem, type ChangeColumnLabels, type ChangeColumnWidgetState, } from './change-column';
|
|
@@ -1,47 +1,51 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
import { Z as
|
|
3
|
-
import { d as
|
|
4
|
-
import { C as V, P as
|
|
1
|
+
import { B as L, C as o, D as e, a as A, b as E, c as r, d as t, e as S, f as _, g as T, h as l, i as D, j as d, F as n, L as c, R as O, S as g, k as B, l as C, m, n as F, Z as U, o as i, p as I, q as h, r as w, s as G, t as f, u as N, v as R } from "../change-column-DjjwoPt1.js";
|
|
2
|
+
import { Z as u, a as x, c as M } from "../transforms-Cdx4fkU5.js";
|
|
3
|
+
import { d as b, a as p, t as v, b as H } from "../exports-Cx-f6m6U.js";
|
|
4
|
+
import { C as W, D as V, M as y, P as K, b as j } from "../png-item-9dNbB37T.js";
|
|
5
|
+
import { b as Y } from "../csv-item-hH_Gt7ur.js";
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
L as BrushToggle,
|
|
8
|
+
W as CSVIcon,
|
|
9
|
+
o as ChangeColumn,
|
|
10
|
+
e as DEFAULT_BRUSH_TOGGLE_LABELS,
|
|
10
11
|
A as DEFAULT_CHANGE_COLUMN_LABELS,
|
|
11
12
|
E as DEFAULT_DOWNLOAD_LABELS,
|
|
12
|
-
|
|
13
|
+
r as DEFAULT_FULLSCREEN_LABELS,
|
|
13
14
|
t as DEFAULT_LOCK_SELECTION_LABELS,
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
S as DEFAULT_RELATIVE_DATA_LABELS,
|
|
16
|
+
_ as DEFAULT_SEARCHER_LABELS,
|
|
16
17
|
T as DEFAULT_SHOW_ALL_LABELS,
|
|
17
18
|
l as DEFAULT_STACK_TOGGLE_LABELS,
|
|
18
19
|
D as DEFAULT_ZOOM_TOGGLE_LABELS,
|
|
20
|
+
V as DOWNLOAD_ITEM_IDS,
|
|
19
21
|
d as Download,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
n as FullScreen,
|
|
23
|
+
c as LockSelection,
|
|
24
|
+
y as MarkdownIcon,
|
|
25
|
+
K as PNGIcon,
|
|
26
|
+
O as RelativeData,
|
|
27
|
+
g as SHOW_ALL_ID,
|
|
28
|
+
B as Searcher,
|
|
26
29
|
C as SearcherToggle,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
m as ShowAllToggle,
|
|
31
|
+
F as StackToggle,
|
|
32
|
+
u as ZOOM_LAYOUT,
|
|
33
|
+
U as ZoomToggle,
|
|
34
|
+
i as addBrush,
|
|
35
|
+
I as addStack,
|
|
36
|
+
x as addZoom,
|
|
37
|
+
Y as buildCsvDownloadItem,
|
|
38
|
+
j as buildPngDownloadItem,
|
|
39
|
+
M as createAddZoom,
|
|
40
|
+
h as createPercentFormatter,
|
|
41
|
+
b as downloadDOMToPNG,
|
|
42
|
+
p as downloadToCSV,
|
|
43
|
+
w as filterByLockedItems,
|
|
44
|
+
G as filterBySearchText,
|
|
45
|
+
f as setSearcherText,
|
|
46
|
+
N as setShowAll,
|
|
47
|
+
v as toCsvString,
|
|
48
|
+
R as toRelativeData,
|
|
49
|
+
H as triggerLinkDownload
|
|
46
50
|
};
|
|
47
51
|
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
package/dist/widgets-v2/bar.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { n as y, d as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { c as
|
|
5
|
-
import { Box as
|
|
1
|
+
import * as G from "echarts";
|
|
2
|
+
import { n as y, d as N, g as R, c as z, f as H } from "../option-builders-F-c9ELi1.js";
|
|
3
|
+
import { jsx as f, jsxs as O } from "react/jsx-runtime";
|
|
4
|
+
import { c as W } from "react/compiler-runtime";
|
|
5
|
+
import { Box as u, Skeleton as I } from "@mui/material";
|
|
6
6
|
import "../widget-store-Bw5zRUGg.js";
|
|
7
7
|
import "zustand/shallow";
|
|
8
8
|
import "@mui/icons-material";
|
|
@@ -21,23 +21,23 @@ import "zustand/vanilla";
|
|
|
21
21
|
import "zustand/middleware";
|
|
22
22
|
import "zustand/react/shallow";
|
|
23
23
|
import { Z as B } from "../transforms-Cdx4fkU5.js";
|
|
24
|
-
import { m as
|
|
25
|
-
import { p as
|
|
26
|
-
import {
|
|
27
|
-
import { b as J
|
|
28
|
-
function
|
|
24
|
+
import { m as Y, r as q } from "../resolve-theme-color-BdojIw0K.js";
|
|
25
|
+
import { p as U } from "../data-zoom-layout-CkVnm6ej.js";
|
|
26
|
+
import { b as V } from "../png-item-9dNbB37T.js";
|
|
27
|
+
import { b as J } from "../csv-item-hH_Gt7ur.js";
|
|
28
|
+
function K({
|
|
29
29
|
theme: e,
|
|
30
30
|
formatter: o,
|
|
31
31
|
labelFormatter: t
|
|
32
32
|
}) {
|
|
33
|
-
let s = 0,
|
|
33
|
+
let s = 0, n = 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
|
+
...z(!1, e),
|
|
41
41
|
containLabel: !0
|
|
42
42
|
},
|
|
43
43
|
tooltip: {
|
|
@@ -53,13 +53,13 @@ function Q({
|
|
|
53
53
|
axisPointer: {
|
|
54
54
|
type: "line"
|
|
55
55
|
},
|
|
56
|
-
position:
|
|
56
|
+
position: R(e),
|
|
57
57
|
formatter: _(o, t)
|
|
58
58
|
},
|
|
59
59
|
// Legend styling baked here; `show` is toggled by the merger based on
|
|
60
60
|
// series count.
|
|
61
61
|
legend: {
|
|
62
|
-
...
|
|
62
|
+
...N({
|
|
63
63
|
hasLegend: !1,
|
|
64
64
|
labelFormatter: t
|
|
65
65
|
})
|
|
@@ -90,7 +90,7 @@ function Q({
|
|
|
90
90
|
yAxis: {
|
|
91
91
|
type: "value",
|
|
92
92
|
min: (a) => (s = a.min < 0 ? y(a.min) : 0, s),
|
|
93
|
-
max: (a) => (
|
|
93
|
+
max: (a) => (n = a.max <= 0 ? 1 : y(a.max), n),
|
|
94
94
|
axisLine: {
|
|
95
95
|
show: !1
|
|
96
96
|
},
|
|
@@ -112,53 +112,53 @@ function Q({
|
|
|
112
112
|
showMinLabel: !0,
|
|
113
113
|
verticalAlign: "bottom",
|
|
114
114
|
inside: !0,
|
|
115
|
-
formatter: (a) => a !==
|
|
115
|
+
formatter: (a) => a !== n && a !== s || a === 0 ? "" : o ? o(a) : String(a)
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function ke(e) {
|
|
121
121
|
const {
|
|
122
122
|
theme: o,
|
|
123
123
|
formatter: t,
|
|
124
124
|
labelFormatter: s,
|
|
125
|
-
optionsOverride:
|
|
126
|
-
} = e, a = e.series, c = e.selection,
|
|
127
|
-
return (
|
|
128
|
-
if (
|
|
129
|
-
const r =
|
|
125
|
+
optionsOverride: n
|
|
126
|
+
} = e, a = e.series, c = e.selection, d = c && c.length > 0 ? new Set(c) : null;
|
|
127
|
+
return (i, v, C) => {
|
|
128
|
+
if (i == null) {
|
|
129
|
+
const r = K({
|
|
130
130
|
theme: o,
|
|
131
131
|
formatter: t,
|
|
132
132
|
labelFormatter: s
|
|
133
133
|
});
|
|
134
|
-
return
|
|
134
|
+
return n ? Y(r, n) : r;
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
136
|
+
const g = Array.isArray(v) ? v : [];
|
|
137
|
+
if (g.length === 0)
|
|
138
138
|
return {
|
|
139
|
-
...
|
|
139
|
+
...i,
|
|
140
140
|
dataset: [],
|
|
141
141
|
series: []
|
|
142
142
|
};
|
|
143
|
-
const b =
|
|
144
|
-
let
|
|
145
|
-
const
|
|
143
|
+
const b = g.length > 1, D = typeof i.legend == "object" && !Array.isArray(i.legend) ? i.legend : {}, x = typeof i.grid == "object" && !Array.isArray(i.grid) ? i.grid : {}, F = typeof i.tooltip == "object" && !Array.isArray(i.tooltip) ? i.tooltip : {}, k = typeof i.yAxis == "object" && !Array.isArray(i.yAxis) ? i.yAxis : {}, T = Array.isArray(i.series) ? i.series : [], M = T[0] ?? {}, h = C?.formatter, Z = C?.labelFormatter;
|
|
144
|
+
let w = 0, A = 1;
|
|
145
|
+
const S = U(i.dataZoom, b), P = typeof x.bottom == "number" ? x.bottom : 24, j = b ? 56 : P, $ = S ? j + B.sliderHeight + B.sliderGap : j, E = {
|
|
146
146
|
color: (r) => {
|
|
147
147
|
const l = r.color;
|
|
148
|
-
if (!
|
|
149
|
-
const
|
|
150
|
-
return
|
|
148
|
+
if (!d) return l;
|
|
149
|
+
const m = r.value?.name ?? r.name;
|
|
150
|
+
return m != null && d.has(m) ? l : G.color.modifyAlpha(l, 0.15);
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
153
|
return {
|
|
154
|
-
...
|
|
155
|
-
dataset:
|
|
154
|
+
...i,
|
|
155
|
+
dataset: g.map((r) => ({
|
|
156
156
|
source: r
|
|
157
157
|
})),
|
|
158
|
-
series:
|
|
159
|
-
const
|
|
158
|
+
series: g.map((r, l) => {
|
|
159
|
+
const L = T[l] ?? M, m = q(o, a?.[l]?.color);
|
|
160
160
|
return {
|
|
161
|
-
...typeof
|
|
161
|
+
...typeof L == "object" ? L : {},
|
|
162
162
|
type: "bar",
|
|
163
163
|
datasetIndex: l,
|
|
164
164
|
name: a?.[l]?.name ?? `Series ${l + 1}`,
|
|
@@ -170,51 +170,51 @@ function Te(e) {
|
|
|
170
170
|
emphasis: {
|
|
171
171
|
focus: "series"
|
|
172
172
|
},
|
|
173
|
-
itemStyle:
|
|
174
|
-
...
|
|
175
|
-
color:
|
|
173
|
+
itemStyle: E,
|
|
174
|
+
...m ? {
|
|
175
|
+
color: m
|
|
176
176
|
} : {}
|
|
177
177
|
};
|
|
178
178
|
}),
|
|
179
179
|
legend: {
|
|
180
|
-
...
|
|
180
|
+
...D,
|
|
181
181
|
show: b
|
|
182
182
|
},
|
|
183
183
|
grid: {
|
|
184
184
|
...x,
|
|
185
185
|
bottom: $
|
|
186
186
|
},
|
|
187
|
-
...
|
|
188
|
-
dataZoom:
|
|
187
|
+
...S ? {
|
|
188
|
+
dataZoom: S
|
|
189
189
|
} : {},
|
|
190
190
|
yAxis: {
|
|
191
191
|
...k,
|
|
192
|
-
min: (r) => (
|
|
192
|
+
min: (r) => (w = r.min < 0 ? y(r.min) : 0, w),
|
|
193
193
|
max: (r) => (A = r.max <= 0 ? 1 : y(r.max), A),
|
|
194
194
|
axisLabel: {
|
|
195
195
|
...k.axisLabel ?? {},
|
|
196
|
-
formatter: (r) => r !== A && r !==
|
|
196
|
+
formatter: (r) => r !== A && r !== w || r === 0 ? "" : h ? h(r) : String(r)
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
199
|
tooltip: {
|
|
200
|
-
...
|
|
201
|
-
formatter: _(h,
|
|
200
|
+
...F,
|
|
201
|
+
formatter: _(h, Z)
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
};
|
|
205
205
|
}
|
|
206
206
|
function _(e, o) {
|
|
207
207
|
return H((t) => {
|
|
208
|
-
const
|
|
208
|
+
const n = t.value?.value, a = typeof n == "number" && e ? e(n) : n ?? "", c = typeof t.marker == "string" ? t.marker : "", d = t.seriesName ? `${t.seriesName}: ` : "", i = o ? String(o(t.name ?? "")) : t.name ?? "";
|
|
209
209
|
return {
|
|
210
|
-
name: String(
|
|
211
|
-
seriesName:
|
|
210
|
+
name: String(i),
|
|
211
|
+
seriesName: d,
|
|
212
212
|
marker: c,
|
|
213
213
|
value: a
|
|
214
214
|
};
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
|
-
const
|
|
217
|
+
const p = {
|
|
218
218
|
container: {
|
|
219
219
|
display: "flex",
|
|
220
220
|
alignItems: "center",
|
|
@@ -262,56 +262,49 @@ const f = {
|
|
|
262
262
|
spacing: e
|
|
263
263
|
}) => e(1.5)
|
|
264
264
|
}
|
|
265
|
-
},
|
|
266
|
-
function
|
|
267
|
-
const e =
|
|
265
|
+
}, Q = ["20%", "40%", "60%", "20%", "80%"];
|
|
266
|
+
function Te() {
|
|
267
|
+
const e = W(2);
|
|
268
268
|
let o;
|
|
269
|
-
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */
|
|
269
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ f(u, { sx: p.grid, children: Q.map(ee) }), e[0] = o) : o = e[0];
|
|
270
270
|
let t;
|
|
271
|
-
return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ O(
|
|
271
|
+
return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ O(u, { sx: p.container, children: [
|
|
272
272
|
o,
|
|
273
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ f(u, { sx: p.legend, children: [0, 1].map(X) })
|
|
274
274
|
] }), e[1] = t) : t = e[1], t;
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
return /* @__PURE__ */ O(
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
/* @__PURE__ */
|
|
276
|
+
function X(e) {
|
|
277
|
+
return /* @__PURE__ */ O(u, { sx: p.legendItem, children: [
|
|
278
|
+
/* @__PURE__ */ f(I, { variant: "circular", width: 8, height: 8 }),
|
|
279
|
+
/* @__PURE__ */ f(I, { width: 48, height: 8 })
|
|
280
280
|
] }, `legend-${e}`);
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
return /* @__PURE__ */
|
|
282
|
+
function ee(e, o) {
|
|
283
|
+
return /* @__PURE__ */ f(I, { sx: p.bar, variant: "rectangular", height: e }, `bar-${o}`);
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function je(e) {
|
|
286
286
|
const o = [];
|
|
287
|
-
return e.getCaptureEl && o.push(
|
|
287
|
+
return e.getCaptureEl && o.push(V({
|
|
288
288
|
filename: e.filename,
|
|
289
289
|
getCaptureEl: e.getCaptureEl,
|
|
290
290
|
pixelRatio: e.pngPixelRatio,
|
|
291
291
|
backgroundColor: e.pngBackgroundColor
|
|
292
|
-
})), o.push({
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
icon: /* @__PURE__ */ p(K, { fontSize: "small" }),
|
|
296
|
-
resolve: () => {
|
|
292
|
+
})), o.push(J({
|
|
293
|
+
filename: e.filename,
|
|
294
|
+
getRows: () => {
|
|
297
295
|
const t = e.getData(), s = [];
|
|
298
|
-
for (const [
|
|
299
|
-
|
|
300
|
-
for (const
|
|
296
|
+
for (const [n, a] of t.entries()) {
|
|
297
|
+
n > 0 && s.push([]), s.push(["name", "value"]);
|
|
298
|
+
for (const c of a) s.push([c.name, c.value]);
|
|
301
299
|
}
|
|
302
|
-
|
|
303
|
-
return Promise.resolve({
|
|
304
|
-
url: i.url,
|
|
305
|
-
filename: `${e.filename}.csv`,
|
|
306
|
-
revoke: i.revoke
|
|
307
|
-
});
|
|
300
|
+
return s;
|
|
308
301
|
}
|
|
309
|
-
}), o;
|
|
302
|
+
})), o;
|
|
310
303
|
}
|
|
311
304
|
export {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
305
|
+
Te as BarSkeleton,
|
|
306
|
+
K as barOptions,
|
|
307
|
+
je as createBarDownloadConfig,
|
|
308
|
+
ke as createBarOptionFactory
|
|
316
309
|
};
|
|
317
310
|
//# sourceMappingURL=bar.js.map
|