@carto/ps-react-ui 4.3.0-widgets.0 → 5.0.0-widgets.2
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/components.js +25 -23
- package/dist/components.js.map +1 -1
- package/dist/error-zHOU_QIB.js +38 -0
- package/dist/error-zHOU_QIB.js.map +1 -0
- package/dist/exports-Cr43OCul.js +51 -0
- package/dist/exports-Cr43OCul.js.map +1 -0
- package/dist/{lasso-tool-BC-rsMMW.js → lasso-tool-CYn3ivf-.js} +165 -183
- package/dist/lasso-tool-CYn3ivf-.js.map +1 -0
- package/dist/no-data-Cz80hEWj.js +61 -0
- package/dist/no-data-Cz80hEWj.js.map +1 -0
- package/dist/options-D9wflre6.js +49 -0
- package/dist/options-D9wflre6.js.map +1 -0
- package/dist/row-C_m1ovHv.js +35 -0
- package/dist/row-C_m1ovHv.js.map +1 -0
- package/dist/series-6xp-KQ0S.js +91 -0
- package/dist/series-6xp-KQ0S.js.map +1 -0
- package/dist/{smart-tooltip-BSlcAkBM.js → smart-tooltip-BEtBaIdz.js} +2 -2
- package/dist/{smart-tooltip-BSlcAkBM.js.map → smart-tooltip-BEtBaIdz.js.map} +1 -1
- package/dist/styles-dOu_pRNb.js +77 -0
- package/dist/styles-dOu_pRNb.js.map +1 -0
- package/dist/tooltip-BDnrRKrp.js +25 -0
- package/dist/tooltip-BDnrRKrp.js.map +1 -0
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/use-debounce.d.ts +19 -0
- package/dist/types/hooks/use-widget-ref.d.ts +17 -0
- package/dist/types/widgets/_shared/chart-config/config-factory.d.ts +5 -11
- package/dist/types/widgets/_shared/chart-config/option-builders.d.ts +3 -8
- package/dist/types/widgets/actions/change-column/change-column-icon.d.ts +1 -0
- package/dist/types/widgets/actions/change-column/change-column.d.ts +16 -0
- package/dist/types/widgets/actions/change-column/sortable-column-item.d.ts +9 -0
- package/dist/types/widgets/actions/change-column/types.d.ts +19 -0
- package/dist/types/widgets/actions/download/download.d.ts +1 -1
- package/dist/types/widgets/actions/download/exports.d.ts +1 -1
- package/dist/types/widgets/actions/download/types.d.ts +3 -11
- package/dist/types/widgets/actions/fullscreen/fullscreen.d.ts +1 -1
- package/dist/types/widgets/actions/fullscreen/styles.d.ts +6 -0
- package/dist/types/widgets/actions/fullscreen/types.d.ts +8 -9
- package/dist/types/widgets/actions/index.d.ts +14 -1
- package/dist/types/widgets/actions/lock-selection/lock-selection.d.ts +19 -0
- package/dist/types/widgets/actions/lock-selection/types.d.ts +38 -0
- package/dist/types/widgets/actions/relative-data/relative-data.d.ts +18 -0
- package/dist/types/widgets/actions/relative-data/style.d.ts +8 -0
- package/dist/types/widgets/actions/relative-data/types.d.ts +27 -0
- package/dist/types/widgets/actions/relative-data/utils.d.ts +9 -0
- package/dist/types/widgets/actions/relative-data/utils.test.d.ts +1 -0
- package/dist/types/widgets/actions/searcher/searcher-toggle.d.ts +18 -0
- package/dist/types/widgets/actions/searcher/searcher.d.ts +21 -0
- package/dist/types/widgets/actions/searcher/types.d.ts +64 -0
- package/dist/types/widgets/actions/shared/styles.d.ts +11 -0
- package/dist/types/widgets/actions/stack-toggle/grouped-bar-chart-icon.d.ts +1 -0
- package/dist/types/widgets/actions/stack-toggle/stack-toggle.d.ts +16 -0
- package/dist/types/widgets/actions/stack-toggle/types.d.ts +25 -0
- package/dist/types/widgets/actions/zoom-toggle/index.d.ts +2 -0
- package/dist/types/widgets/actions/zoom-toggle/style.d.ts +13 -0
- package/dist/types/widgets/actions/zoom-toggle/types.d.ts +41 -0
- package/dist/types/widgets/actions/zoom-toggle/zoom-toggle.d.ts +18 -0
- package/dist/types/widgets/bar/config.d.ts +5 -4
- package/dist/types/widgets/bar/index.d.ts +2 -2
- package/dist/types/widgets/bar/types.d.ts +6 -12
- package/dist/types/widgets/category/category-ui.d.ts +2 -0
- package/dist/types/widgets/category/components/category-bar.d.ts +7 -0
- package/dist/types/widgets/category/components/category-legend.d.ts +6 -0
- package/dist/types/widgets/category/components/category-row-multi.d.ts +11 -0
- package/dist/types/widgets/category/components/category-row-other.d.ts +6 -0
- package/dist/types/widgets/category/components/category-row-single.d.ts +11 -0
- package/dist/types/widgets/category/components/index.d.ts +10 -0
- package/dist/types/widgets/category/config.d.ts +15 -0
- package/dist/types/widgets/category/index.d.ts +6 -0
- package/dist/types/widgets/category/skeleton.d.ts +1 -0
- package/dist/types/widgets/category/style.d.ts +121 -0
- package/dist/types/widgets/category/types.d.ts +33 -0
- package/dist/types/widgets/echart/echart-ui.d.ts +1 -1
- package/dist/types/widgets/echart/index.d.ts +2 -2
- package/dist/types/widgets/echart/options.d.ts +2 -3
- package/dist/types/widgets/echart/types.d.ts +11 -10
- package/dist/types/widgets/echart/utils.d.ts +22 -16
- package/dist/types/widgets/error/error.d.ts +2 -0
- package/dist/types/widgets/error/index.d.ts +2 -0
- package/dist/types/widgets/error/types.d.ts +12 -0
- package/dist/types/widgets/formula/components/row.d.ts +1 -1
- package/dist/types/widgets/formula/config.d.ts +4 -2
- package/dist/types/widgets/formula/index.d.ts +2 -1
- package/dist/types/widgets/formula/types.d.ts +6 -18
- package/dist/types/widgets/histogram/config.d.ts +5 -4
- package/dist/types/widgets/histogram/index.d.ts +2 -2
- package/dist/types/widgets/histogram/types.d.ts +6 -12
- package/dist/types/widgets/index.d.ts +6 -4
- package/dist/types/widgets/markdown/config.d.ts +4 -2
- package/dist/types/widgets/markdown/index.d.ts +2 -2
- package/dist/types/widgets/markdown/markdown-ui.d.ts +1 -1
- package/dist/types/widgets/markdown/types.d.ts +6 -16
- package/dist/types/widgets/no-data/index.d.ts +2 -0
- package/dist/types/widgets/no-data/no-data.d.ts +35 -0
- package/dist/types/widgets/no-data/style.d.ts +6 -0
- package/dist/types/widgets/no-data/types.d.ts +67 -0
- package/dist/types/widgets/note/note.d.ts +1 -1
- package/dist/types/widgets/note/style.d.ts +12 -1
- package/dist/types/widgets/note/types.d.ts +4 -3
- package/dist/types/widgets/pie/config.d.ts +5 -4
- package/dist/types/widgets/pie/index.d.ts +2 -2
- package/dist/types/widgets/pie/types.d.ts +6 -12
- package/dist/types/widgets/range/config.d.ts +6 -2
- package/dist/types/widgets/range/index.d.ts +2 -1
- package/dist/types/widgets/range/types.d.ts +6 -17
- package/dist/types/widgets/root/index.d.ts +2 -1
- package/dist/types/widgets/root/root.d.ts +1 -1
- package/dist/types/widgets/root/types.d.ts +6 -12
- package/dist/types/widgets/root/utils.d.ts +1 -0
- package/dist/types/widgets/scatterplot/config.d.ts +5 -4
- package/dist/types/widgets/scatterplot/index.d.ts +2 -2
- package/dist/types/widgets/scatterplot/types.d.ts +6 -12
- package/dist/types/widgets/selection-summary/index.d.ts +2 -0
- package/dist/types/widgets/selection-summary/selection-summary.d.ts +2 -0
- package/dist/types/widgets/selection-summary/style.d.ts +9 -0
- package/dist/types/widgets/selection-summary/types.d.ts +13 -0
- package/dist/types/widgets/spread/config.d.ts +10 -2
- package/dist/types/widgets/spread/index.d.ts +2 -1
- package/dist/types/widgets/spread/types.d.ts +6 -18
- package/dist/types/widgets/stores/index.d.ts +2 -0
- package/dist/types/widgets/stores/types.d.ts +179 -12
- package/dist/types/widgets/stores/widget-store.d.ts +2 -27
- package/dist/types/widgets/subheader/index.d.ts +2 -0
- package/dist/types/widgets/subheader/style.d.ts +19 -0
- package/dist/types/widgets/subheader/subheader.d.ts +2 -0
- package/dist/types/widgets/subheader/types.d.ts +10 -0
- package/dist/types/widgets/table/components/cell-header.d.ts +5 -0
- package/dist/types/widgets/table/components/cell.d.ts +16 -0
- package/dist/types/widgets/table/components/index.d.ts +4 -0
- package/dist/types/widgets/table/components/pagination-actions.d.ts +5 -0
- package/dist/types/widgets/table/components/pagination.d.ts +5 -0
- package/dist/types/widgets/table/components/row.d.ts +5 -0
- package/dist/types/widgets/table/config.d.ts +11 -0
- package/dist/types/widgets/table/helpers.d.ts +38 -0
- package/dist/types/widgets/table/helpers.test.d.ts +1 -0
- package/dist/types/widgets/table/hooks/index.d.ts +6 -0
- package/dist/types/widgets/table/hooks/use-pagination.d.ts +45 -0
- package/dist/types/widgets/table/hooks/use-pagination.test.d.ts +1 -0
- package/dist/types/widgets/table/hooks/use-selection.d.ts +32 -0
- package/dist/types/widgets/table/hooks/use-selection.test.d.ts +1 -0
- package/dist/types/widgets/table/hooks/use-sort.d.ts +29 -0
- package/dist/types/widgets/table/hooks/use-sort.test.d.ts +1 -0
- package/dist/types/widgets/table/index.d.ts +13 -0
- package/dist/types/widgets/table/serializer.d.ts +16 -0
- package/dist/types/widgets/table/skeleton.d.ts +10 -0
- package/dist/types/widgets/table/style.d.ts +33 -0
- package/dist/types/widgets/table/table-ui.d.ts +32 -0
- package/dist/types/widgets/table/types.d.ts +201 -0
- package/dist/types/widgets/timeseries/config.d.ts +5 -4
- package/dist/types/widgets/timeseries/index.d.ts +2 -2
- package/dist/types/widgets/timeseries/types.d.ts +6 -12
- package/dist/types/widgets/toolbar-actions/index.d.ts +2 -0
- package/dist/types/widgets/toolbar-actions/styles.d.ts +37 -0
- package/dist/types/widgets/toolbar-actions/toolbar-actions.d.ts +8 -0
- package/dist/types/widgets/toolbar-actions/types.d.ts +45 -0
- package/dist/types/widgets/wrapper/index.d.ts +2 -2
- package/dist/types/widgets/wrapper/styles.d.ts +6 -0
- package/dist/types/widgets/wrapper/types.d.ts +7 -5
- package/dist/types/widgets/wrapper/wrapper-ui.d.ts +1 -1
- package/dist/types/widgets/wrapper/wrapper.d.ts +1 -1
- package/dist/utils-Dv5Z47UQ.js +144 -0
- package/dist/utils-Dv5Z47UQ.js.map +1 -0
- package/dist/widget-store-DNyVElxd.js +190 -0
- package/dist/widget-store-DNyVElxd.js.map +1 -0
- package/dist/widgets/actions.js +826 -6
- package/dist/widgets/actions.js.map +1 -1
- package/dist/widgets/bar.js +189 -4
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/category.js +460 -0
- package/dist/widgets/category.js.map +1 -0
- package/dist/widgets/echart.js +120 -8
- package/dist/widgets/echart.js.map +1 -1
- package/dist/widgets/error.js +5 -0
- package/dist/widgets/error.js.map +1 -0
- package/dist/widgets/formula.js +117 -20
- package/dist/widgets/formula.js.map +1 -1
- package/dist/widgets/histogram.js +172 -4
- package/dist/widgets/histogram.js.map +1 -1
- package/dist/widgets/markdown.js +127 -0
- package/dist/widgets/markdown.js.map +1 -0
- package/dist/widgets/no-data.js +5 -0
- package/dist/widgets/no-data.js.map +1 -0
- package/dist/widgets/note.js +121 -2
- package/dist/widgets/note.js.map +1 -1
- package/dist/widgets/pie.js +213 -4
- package/dist/widgets/pie.js.map +1 -1
- package/dist/widgets/range.js +210 -12
- package/dist/widgets/range.js.map +1 -1
- package/dist/widgets/root.js +65 -2
- package/dist/widgets/root.js.map +1 -1
- package/dist/widgets/scatterplot.js +219 -4
- package/dist/widgets/scatterplot.js.map +1 -1
- package/dist/widgets/selection-summary.js +40 -0
- package/dist/widgets/selection-summary.js.map +1 -0
- package/dist/widgets/skeleton-loader.js +21 -2
- package/dist/widgets/skeleton-loader.js.map +1 -1
- package/dist/widgets/spread.js +162 -17
- package/dist/widgets/spread.js.map +1 -1
- package/dist/widgets/stores.js +5 -0
- package/dist/widgets/stores.js.map +1 -0
- package/dist/widgets/subheader.js +52 -0
- package/dist/widgets/subheader.js.map +1 -0
- package/dist/widgets/table.js +691 -0
- package/dist/widgets/table.js.map +1 -0
- package/dist/widgets/timeseries.js +171 -4
- package/dist/widgets/timeseries.js.map +1 -1
- package/dist/widgets/toolbar-actions.js +6106 -0
- package/dist/widgets/toolbar-actions.js.map +1 -0
- package/dist/widgets/wrapper.js +292 -6
- package/dist/widgets/wrapper.js.map +1 -1
- package/dist/widgets.js +6 -83
- package/dist/widgets.js.map +1 -1
- package/package.json +46 -6
- package/dist/const-BLV7Tvte.js +0 -758
- package/dist/const-BLV7Tvte.js.map +0 -1
- package/dist/download-KroQ0SWg.js +0 -195
- package/dist/download-KroQ0SWg.js.map +0 -1
- package/dist/echart-CqfROFu3.js +0 -214
- package/dist/echart-CqfROFu3.js.map +0 -1
- package/dist/formula-ui-ChzvMEOG.js +0 -52
- package/dist/formula-ui-ChzvMEOG.js.map +0 -1
- package/dist/lasso-tool-BC-rsMMW.js.map +0 -1
- package/dist/markdown-n_tOtoiT.js +0 -27
- package/dist/markdown-n_tOtoiT.js.map +0 -1
- package/dist/markdown-ui-BBrzzd7Y.js +0 -62
- package/dist/markdown-ui-BBrzzd7Y.js.map +0 -1
- package/dist/note-DF-n70TX.js +0 -101
- package/dist/note-DF-n70TX.js.map +0 -1
- package/dist/range-ui-CtUX11Xm.js +0 -146
- package/dist/range-ui-CtUX11Xm.js.map +0 -1
- package/dist/root-L_WZnJY5.js +0 -46
- package/dist/root-L_WZnJY5.js.map +0 -1
- package/dist/row-DQaSxmDV.js +0 -18
- package/dist/row-DQaSxmDV.js.map +0 -1
- package/dist/series-CsyEPq-X.js +0 -83
- package/dist/series-CsyEPq-X.js.map +0 -1
- package/dist/skeleton-BSPcEvfq.js +0 -27
- package/dist/skeleton-BSPcEvfq.js.map +0 -1
- package/dist/skeleton-C4rOYTy-.js +0 -78
- package/dist/skeleton-C4rOYTy-.js.map +0 -1
- package/dist/skeleton-C9Jqc241.js +0 -82
- package/dist/skeleton-C9Jqc241.js.map +0 -1
- package/dist/skeleton-D-zHBBIw.js +0 -64
- package/dist/skeleton-D-zHBBIw.js.map +0 -1
- package/dist/skeleton-DMP-IwaJ.js +0 -109
- package/dist/skeleton-DMP-IwaJ.js.map +0 -1
- package/dist/skeleton-DRorqowB.js +0 -22
- package/dist/skeleton-DRorqowB.js.map +0 -1
- package/dist/skeleton-DsZhv-AH.js +0 -89
- package/dist/skeleton-DsZhv-AH.js.map +0 -1
- package/dist/skeleton-Dx3FCer0.js +0 -13
- package/dist/skeleton-Dx3FCer0.js.map +0 -1
- package/dist/skeleton-QVDdb1c2.js +0 -21
- package/dist/skeleton-QVDdb1c2.js.map +0 -1
- package/dist/skeleton-loader-DWC1-EAx.js +0 -23
- package/dist/skeleton-loader-DWC1-EAx.js.map +0 -1
- package/dist/spread-ui-BjzH190y.js +0 -82
- package/dist/spread-ui-BjzH190y.js.map +0 -1
- package/dist/style-BGeCtQkP.js +0 -19
- package/dist/style-BGeCtQkP.js.map +0 -1
- package/dist/style-C7v1iwqD.js +0 -34
- package/dist/style-C7v1iwqD.js.map +0 -1
- package/dist/styles-cohnxh9F.js +0 -23
- package/dist/styles-cohnxh9F.js.map +0 -1
- package/dist/types/widgets/config-loader/index.d.ts +0 -2
- package/dist/types/widgets/config-loader/types.d.ts +0 -12
- package/dist/types/widgets/config-loader/use-config.d.ts +0 -5
- package/dist/types/widgets/widget/const.d.ts +0 -2
- package/dist/types/widgets/widget/types.d.ts +0 -47
- package/dist/types/widgets/widget/widget.d.ts +0 -2
- package/dist/use-config-BYEOiIcu.js +0 -43
- package/dist/use-config-BYEOiIcu.js.map +0 -1
- package/dist/widget-store-yDO2ul8g.js +0 -44
- package/dist/widget-store-yDO2ul8g.js.map +0 -1
- package/dist/widgets/config-loader.js +0 -5
- package/dist/widgets/config-loader.js.map +0 -1
- package/dist/wrapper-57csMybC.js +0 -265
- package/dist/wrapper-57csMybC.js.map +0 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
import { TableProps as MuiTableProps } from '@mui/material';
|
|
3
|
+
import { BaseWidgetState, WidgetsStoreProps } from '../stores/types';
|
|
4
|
+
import { WrapperState } from '../wrapper/types';
|
|
5
|
+
import { DownloadItem } from '../actions/download/types';
|
|
6
|
+
/**
|
|
7
|
+
* Table UI component props
|
|
8
|
+
*/
|
|
9
|
+
export interface TableUIProps {
|
|
10
|
+
id: WidgetsStoreProps['id'];
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Table column definition
|
|
15
|
+
*/
|
|
16
|
+
export interface TableColumn {
|
|
17
|
+
/** Unique column identifier, matches key in row data */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Column header label */
|
|
20
|
+
label: string | ReactNode;
|
|
21
|
+
/** Text alignment */
|
|
22
|
+
align?: 'left' | 'center' | 'right';
|
|
23
|
+
/** Column width (number for px, string for CSS value) */
|
|
24
|
+
width?: number | string;
|
|
25
|
+
/** Enable sorting for this column */
|
|
26
|
+
sortable?: boolean;
|
|
27
|
+
/** Custom cell value formatter */
|
|
28
|
+
formatter?: (value: unknown) => ReactNode;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Table row data - extends Record for flexible data
|
|
32
|
+
*/
|
|
33
|
+
export interface TableRow extends Record<string, unknown> {
|
|
34
|
+
/** Unique row identifier */
|
|
35
|
+
id: string | number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Table widget data type - array of row records
|
|
39
|
+
*/
|
|
40
|
+
export type TableWidgetData = TableRow[];
|
|
41
|
+
/**
|
|
42
|
+
* Pagination state
|
|
43
|
+
*/
|
|
44
|
+
export interface TablePaginationState {
|
|
45
|
+
/** Current page (0-indexed) */
|
|
46
|
+
page: number;
|
|
47
|
+
/** Rows per page */
|
|
48
|
+
rowsPerPage: number;
|
|
49
|
+
/** Total number of rows (for remote pagination) */
|
|
50
|
+
total: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Sort direction
|
|
54
|
+
*/
|
|
55
|
+
export type SortDirection = 'asc' | 'desc';
|
|
56
|
+
/**
|
|
57
|
+
* Sort state for single-column sorting
|
|
58
|
+
*/
|
|
59
|
+
export interface SortState {
|
|
60
|
+
/** Column ID being sorted */
|
|
61
|
+
columnId: string | null;
|
|
62
|
+
/** Sort direction */
|
|
63
|
+
direction: SortDirection;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Pagination mode
|
|
67
|
+
*/
|
|
68
|
+
export type PaginationMode = 'local' | 'remote';
|
|
69
|
+
/**
|
|
70
|
+
* Sort mode
|
|
71
|
+
*/
|
|
72
|
+
export type SortMode = 'local' | 'remote';
|
|
73
|
+
/**
|
|
74
|
+
* Table widget configuration
|
|
75
|
+
*/
|
|
76
|
+
export interface TableWidgetConfig {
|
|
77
|
+
/** Column definitions */
|
|
78
|
+
columns?: TableColumn[];
|
|
79
|
+
/** Enable row selection with checkboxes */
|
|
80
|
+
selectable?: boolean;
|
|
81
|
+
/** Pagination configuration */
|
|
82
|
+
pagination?: {
|
|
83
|
+
/** Pagination mode: local (client-side) or remote (server-side) */
|
|
84
|
+
mode: PaginationMode;
|
|
85
|
+
/** Available rows per page options */
|
|
86
|
+
rowsPerPageOptions?: number[];
|
|
87
|
+
/** Default rows per page */
|
|
88
|
+
defaultRowsPerPage?: number;
|
|
89
|
+
/** Total rows for remote pagination */
|
|
90
|
+
total?: number;
|
|
91
|
+
};
|
|
92
|
+
/** Sort configuration */
|
|
93
|
+
sort?: {
|
|
94
|
+
/** Sort mode: local (client-side) or remote (server-side) */
|
|
95
|
+
mode: SortMode;
|
|
96
|
+
/** Default sort column */
|
|
97
|
+
defaultColumnId?: string;
|
|
98
|
+
/** Default sort direction */
|
|
99
|
+
defaultDirection?: SortDirection;
|
|
100
|
+
};
|
|
101
|
+
/** Callback when a row is clicked */
|
|
102
|
+
onRowClick?: (row: TableRow) => void;
|
|
103
|
+
/** Callback when hovering over a row (null when leaving table) */
|
|
104
|
+
onRowHover?: (row: TableRow | null) => void;
|
|
105
|
+
/** Callback when selection changes */
|
|
106
|
+
onSelectionChange?: (selectedIds: Set<string | number>) => void;
|
|
107
|
+
/** Callback when page changes (for remote pagination) */
|
|
108
|
+
onPageChange?: (page: number, rowsPerPage: number) => void;
|
|
109
|
+
/** Callback when sort changes (for remote sorting) */
|
|
110
|
+
onSortChange?: (columnId: string, direction: SortDirection) => void;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Table widget state
|
|
114
|
+
*/
|
|
115
|
+
export type TableWidgetState = BaseWidgetState<WrapperState<TableWidgetConfig> & {
|
|
116
|
+
data: TableWidgetData;
|
|
117
|
+
paginationState?: TablePaginationState;
|
|
118
|
+
sortState?: SortState;
|
|
119
|
+
selectedIds?: Set<string | number>;
|
|
120
|
+
}>;
|
|
121
|
+
/**
|
|
122
|
+
* Table download configuration
|
|
123
|
+
*/
|
|
124
|
+
export type TableDownloadConfig = DownloadItem<TableWidgetData>[];
|
|
125
|
+
/**
|
|
126
|
+
* Props for the base Table component
|
|
127
|
+
*/
|
|
128
|
+
export interface TableProps extends MuiTableProps {
|
|
129
|
+
/** Table element ref */
|
|
130
|
+
ref?: Ref<HTMLTableElement>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Props for CellHeader component
|
|
134
|
+
*/
|
|
135
|
+
export interface CellHeaderProps {
|
|
136
|
+
/** Column definition */
|
|
137
|
+
column: TableColumn;
|
|
138
|
+
/** Current sort state */
|
|
139
|
+
sortState?: SortState;
|
|
140
|
+
/** Callback when sort is triggered */
|
|
141
|
+
onSort?: (columnId: string) => void;
|
|
142
|
+
/** Whether this is a select-all checkbox header */
|
|
143
|
+
isSelectAll?: boolean;
|
|
144
|
+
/** Whether all rows are selected */
|
|
145
|
+
isAllSelected?: boolean;
|
|
146
|
+
/** Whether some rows are selected (indeterminate state) */
|
|
147
|
+
isIndeterminate?: boolean;
|
|
148
|
+
/** Callback for select-all toggle */
|
|
149
|
+
onSelectAll?: () => void;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Props for Row component
|
|
153
|
+
*/
|
|
154
|
+
export interface RowProps {
|
|
155
|
+
/** Row data */
|
|
156
|
+
row: TableRow;
|
|
157
|
+
/** Column definitions */
|
|
158
|
+
columns: TableColumn[];
|
|
159
|
+
/** Whether row is selected */
|
|
160
|
+
isSelected?: boolean;
|
|
161
|
+
/** Whether selection is enabled */
|
|
162
|
+
selectable?: boolean;
|
|
163
|
+
/** Callback when row is clicked */
|
|
164
|
+
onClick?: (row: TableRow) => void;
|
|
165
|
+
/** Callback when row selection is toggled */
|
|
166
|
+
onSelect?: (row: TableRow) => void;
|
|
167
|
+
/** Callback when mouse enters row */
|
|
168
|
+
onMouseEnter?: (row: TableRow) => void;
|
|
169
|
+
/** Callback when mouse leaves row */
|
|
170
|
+
onMouseLeave?: () => void;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Props for Pagination component
|
|
174
|
+
*/
|
|
175
|
+
export interface PaginationProps {
|
|
176
|
+
/** Current page (0-indexed) */
|
|
177
|
+
page: number;
|
|
178
|
+
/** Rows per page */
|
|
179
|
+
rowsPerPage: number;
|
|
180
|
+
/** Total row count */
|
|
181
|
+
total: number;
|
|
182
|
+
/** Available rows per page options */
|
|
183
|
+
rowsPerPageOptions?: number[];
|
|
184
|
+
/** Callback when page changes */
|
|
185
|
+
onPageChange: (page: number) => void;
|
|
186
|
+
/** Callback when rows per page changes */
|
|
187
|
+
onRowsPerPageChange: (rowsPerPage: number) => void;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Props for PaginationActions component
|
|
191
|
+
*/
|
|
192
|
+
export interface PaginationActionsProps {
|
|
193
|
+
/** Current page (0-indexed) */
|
|
194
|
+
page: number;
|
|
195
|
+
/** Total row count */
|
|
196
|
+
count: number;
|
|
197
|
+
/** Rows per page */
|
|
198
|
+
rowsPerPage: number;
|
|
199
|
+
/** Callback when page changes */
|
|
200
|
+
onPageChange: (event: React.MouseEvent<HTMLButtonElement> | null, newPage: number) => void;
|
|
201
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { TimeseriesConfig } from './types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { TimeseriesConfig, TimeseriesWidgetConfig, TimeseriesWidgetData } from './types';
|
|
2
|
+
import { DownloadItem } from '../actions';
|
|
3
|
+
import { ConfigProps } from '../root/types';
|
|
4
|
+
export declare function timeseriesDownloadConfig({ refUI, }: ConfigProps): DownloadItem<TimeseriesWidgetData>[];
|
|
5
|
+
export declare function timeseriesConfig(props: TimeseriesConfig): TimeseriesWidgetConfig;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export { timeseriesConfig } from './config';
|
|
1
|
+
export type { TimeseriesWidgetData, TimeseriesWidgetState, TimeseriesWidgetConfig, TimeseriesConfig, } from './types';
|
|
2
|
+
export { timeseriesConfig, timeseriesDownloadConfig } from './config';
|
|
3
3
|
export { TimeseriesSkeleton } from './skeleton';
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export interface TimeseriesProps extends Omit<BaseWidgetProps<TimeseriesWidgetConfig>, 'data'> {
|
|
5
|
-
type: 'timeseries';
|
|
6
|
-
data: TimeseriesWidgetData | undefined;
|
|
7
|
-
}
|
|
1
|
+
import { EchartWidgetData, EchartWidgetState } from '../echart';
|
|
2
|
+
import { EchartWidgetOptionProps, EchartWidgetProps } from '../echart/types';
|
|
3
|
+
import { ConfigProps } from '../root';
|
|
8
4
|
export type TimeseriesWidgetData = EchartWidgetData;
|
|
9
5
|
export type TimeseriesWidgetState = EchartWidgetState;
|
|
10
|
-
export type TimeseriesWidgetConfig =
|
|
11
|
-
type:
|
|
6
|
+
export type TimeseriesWidgetConfig = EchartWidgetProps & {
|
|
7
|
+
type: 'timeseries';
|
|
12
8
|
};
|
|
13
|
-
export
|
|
14
|
-
data?: TimeseriesWidgetData;
|
|
15
|
-
}
|
|
9
|
+
export type TimeseriesConfig = ConfigProps & EchartWidgetOptionProps<TimeseriesWidgetData>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
export declare const styles: {
|
|
3
|
+
root: {
|
|
4
|
+
display: "flex";
|
|
5
|
+
alignItems: "center";
|
|
6
|
+
width: string;
|
|
7
|
+
overflow: "hidden";
|
|
8
|
+
borderRadius: ({ spacing }: Theme) => string;
|
|
9
|
+
gap: ({ spacing }: Theme) => string;
|
|
10
|
+
};
|
|
11
|
+
preview: {
|
|
12
|
+
display: "flex";
|
|
13
|
+
alignItems: "center";
|
|
14
|
+
gap: ({ spacing }: Theme) => string;
|
|
15
|
+
};
|
|
16
|
+
actionsContainer: {
|
|
17
|
+
position: "absolute";
|
|
18
|
+
display: "flex";
|
|
19
|
+
alignItems: "center";
|
|
20
|
+
backgroundColor: ({ palette }: Theme) => string;
|
|
21
|
+
padding: ({ spacing }: Theme) => string;
|
|
22
|
+
gap: ({ spacing }: Theme) => string;
|
|
23
|
+
};
|
|
24
|
+
iconButton: {
|
|
25
|
+
width: ({ spacing }: Theme) => string;
|
|
26
|
+
height: ({ spacing }: Theme) => string;
|
|
27
|
+
borderRadius: number;
|
|
28
|
+
'.MuiTouchRipple-ripple .MuiTouchRipple-child': {
|
|
29
|
+
borderRadius: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
triggerButton: {
|
|
33
|
+
'&[data-active="true"]': {
|
|
34
|
+
backgroundColor: ({ palette }: Theme) => string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { ToolbarActionsProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A floating toolbar component that displays action buttons.
|
|
5
|
+
* Shows a trigger button when there are 3+ actions, which expands
|
|
6
|
+
* to reveal all actions with a close button.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ToolbarActions({ children: _children, full, direction, labels, sx, IconButtonProps, TooltipProps, }: ToolbarActionsProps): JSX.Element | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IconButtonProps, SxProps, Theme, TooltipProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a single action in the toolbar
|
|
5
|
+
*/
|
|
6
|
+
export interface ToolbarAction {
|
|
7
|
+
/** Unique identifier for the action */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Icon to display for the action */
|
|
10
|
+
icon: ReactNode;
|
|
11
|
+
/** Label displayed in tooltip */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Callback when action is clicked */
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
/** Whether the action is disabled */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Labels for toolbar UI elements
|
|
20
|
+
*/
|
|
21
|
+
export interface ToolbarActionsLabels {
|
|
22
|
+
/** Tooltip for the trigger button */
|
|
23
|
+
trigger?: string;
|
|
24
|
+
/** Tooltip for the close button */
|
|
25
|
+
close?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Props for the ToolbarActions component
|
|
29
|
+
*/
|
|
30
|
+
export interface ToolbarActionsProps {
|
|
31
|
+
/** Array of React elements (typically IconButtons) to display in the toolbar */
|
|
32
|
+
children: ReactNode[] | ReactNode;
|
|
33
|
+
/** Direction in which the toolbar expands */
|
|
34
|
+
direction?: 'left' | 'right';
|
|
35
|
+
/** Whether the toolbar is in full mode */
|
|
36
|
+
full?: boolean;
|
|
37
|
+
/** Custom labels for UI elements */
|
|
38
|
+
labels?: ToolbarActionsLabels;
|
|
39
|
+
/** Custom styles for the root container */
|
|
40
|
+
sx?: SxProps<Theme>;
|
|
41
|
+
/** Props passed to action IconButtons */
|
|
42
|
+
IconButtonProps?: Omit<IconButtonProps, 'onClick' | 'disabled'>;
|
|
43
|
+
/** Props passed to Tooltips */
|
|
44
|
+
TooltipProps?: Omit<TooltipProps, 'title' | 'children'>;
|
|
45
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Actions } from './components/actions';
|
|
2
2
|
export { Options } from './components/options';
|
|
3
3
|
export { Title } from './components/title';
|
|
4
|
-
export {
|
|
4
|
+
export { WidgetWrapper } from './wrapper';
|
|
5
5
|
export { WrapperUI } from './wrapper-ui';
|
|
6
|
-
export type { WrapperProps, WrapperUIProps,
|
|
6
|
+
export type { WrapperActionsProps, WrapperOption, WrapperOptionsProps, WrapperProps, WrapperState, WrapperUIProps, } from './types';
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { ReactNode, SyntheticEvent } from 'react';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material';
|
|
3
3
|
import { BaseWidgetState } from '../stores/types';
|
|
4
|
-
export interface WrapperProps extends Pick<WrapperUIProps, 'sx' | 'actions' | 'options' | 'labels' | 'children' | 'onChangeCollapsed'> {
|
|
4
|
+
export interface WrapperProps extends Pick<WrapperUIProps, 'sx' | 'actions' | 'options' | 'labels' | 'children' | 'onChangeCollapsed'>, Pick<WrapperState, 'disabled' | 'title'> {
|
|
5
5
|
id: WrapperState['id'];
|
|
6
|
-
|
|
6
|
+
defaultCollapsed?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export type WrapperState<T = unknown> = BaseWidgetState<T &
|
|
9
|
-
export interface WrapperUIProps extends WrapperActionsProps, Omit<WrapperOptionsProps, 'labels' | ''> {
|
|
10
|
-
children: ReactNode;
|
|
8
|
+
export type WrapperState<T = unknown> = BaseWidgetState<T & {
|
|
11
9
|
title: string;
|
|
12
10
|
disabled?: boolean;
|
|
13
11
|
collapsed?: boolean;
|
|
14
12
|
isLoading?: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
export interface WrapperUIProps extends WrapperActionsProps, Omit<WrapperOptionsProps, 'labels' | ''> {
|
|
15
|
+
id: WrapperState['id'];
|
|
16
|
+
children: ReactNode;
|
|
15
17
|
sx?: SxProps<Theme>;
|
|
16
18
|
labels?: {
|
|
17
19
|
options?: WrapperOptionsProps['labels'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { WrapperUIProps } from './types';
|
|
2
|
-
export declare function WrapperUI({ children,
|
|
2
|
+
export declare function WrapperUI({ children, id, actions, sx, labels, options, onChangeCollapsed, }: WrapperUIProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { WrapperProps } from './types';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function WidgetWrapper({ id, title, defaultCollapsed, disabled, sx, actions, options, labels, children, onChangeCollapsed, }: WrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { d as n } from "./cjs-D9ro6BXv.js";
|
|
2
|
+
const s = "stacked";
|
|
3
|
+
function S(...e) {
|
|
4
|
+
return n(e[0] ?? {}, e[1] ?? {}, {
|
|
5
|
+
customMerge: (i) => {
|
|
6
|
+
if (i === "color")
|
|
7
|
+
return (I, a) => a;
|
|
8
|
+
if (i === "series")
|
|
9
|
+
return (I, a) => I.length ? a?.map((t, r) => {
|
|
10
|
+
const l = I?.[r] ?? {};
|
|
11
|
+
return n(l, t);
|
|
12
|
+
}) : I;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function h(e, {
|
|
17
|
+
start: i,
|
|
18
|
+
end: I
|
|
19
|
+
} = {
|
|
20
|
+
start: 0,
|
|
21
|
+
end: 100
|
|
22
|
+
}, {
|
|
23
|
+
inside: a = !0,
|
|
24
|
+
xSlider: g = !0,
|
|
25
|
+
ySlider: t = !1,
|
|
26
|
+
showSliders: r = !0,
|
|
27
|
+
xAxisLabelFormatter: l
|
|
28
|
+
} = {}, o) {
|
|
29
|
+
const d = o ? y(o) : {};
|
|
30
|
+
return {
|
|
31
|
+
dataZoom: [a && {
|
|
32
|
+
throttle: 0,
|
|
33
|
+
type: "inside",
|
|
34
|
+
xAxisIndex: g ? [0] : [],
|
|
35
|
+
yAxisIndex: t ? [0] : [],
|
|
36
|
+
show: e,
|
|
37
|
+
zoomLock: !e,
|
|
38
|
+
start: i,
|
|
39
|
+
end: I
|
|
40
|
+
}, a && t && {
|
|
41
|
+
throttle: 0,
|
|
42
|
+
type: "inside",
|
|
43
|
+
show: e,
|
|
44
|
+
zoomLock: !e,
|
|
45
|
+
start: i,
|
|
46
|
+
end: I,
|
|
47
|
+
orientation: "vertical"
|
|
48
|
+
}, g && {
|
|
49
|
+
throttle: 0,
|
|
50
|
+
type: "slider",
|
|
51
|
+
xAxisIndex: [0],
|
|
52
|
+
bottom: 0,
|
|
53
|
+
height: parseInt(o?.spacing?.(4) ?? "32"),
|
|
54
|
+
show: e && r,
|
|
55
|
+
zoomLock: !e,
|
|
56
|
+
start: i,
|
|
57
|
+
end: I,
|
|
58
|
+
labelFormatter: l,
|
|
59
|
+
showDetail: !1,
|
|
60
|
+
...d,
|
|
61
|
+
brushSelect: !1,
|
|
62
|
+
moveHandleSize: 8,
|
|
63
|
+
handleSize: "100%",
|
|
64
|
+
handleIcon: "image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOSIgaGVpZ2h0PSIzNiIgdmlld0JveD0iMCAwIDkgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iLTAuNSIgd2lkdGg9IjgiIGhlaWdodD0iMTgiIHJ4PSI0IiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDI3KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMyAyMykiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDMgMTkpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAzIDE1KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4="
|
|
65
|
+
}, t && {
|
|
66
|
+
throttle: 0,
|
|
67
|
+
type: "slider",
|
|
68
|
+
left: parseInt(o?.spacing?.(6) ?? "48"),
|
|
69
|
+
width: parseInt(o?.spacing?.(4) ?? "32"),
|
|
70
|
+
yAxisIndex: [0],
|
|
71
|
+
show: e && r,
|
|
72
|
+
zoomLock: !e,
|
|
73
|
+
start: i,
|
|
74
|
+
end: I,
|
|
75
|
+
...d,
|
|
76
|
+
brushSelect: !1,
|
|
77
|
+
moveHandleSize: 8,
|
|
78
|
+
handleSize: "100%",
|
|
79
|
+
handleIcon: "image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDM2IDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iMC41IiB3aWR0aD0iOCIgaGVpZ2h0PSIxOCIgcng9IjQiIHRyYW5zZm9ybT0icm90YXRlKC05MCAwLjUgMC41KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDEzIDYpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTcgNikiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0icm90YXRlKC05MCAyMSA2KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4="
|
|
80
|
+
}].filter((c) => !!c)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function y(e) {
|
|
84
|
+
return {
|
|
85
|
+
fillerColor: "rgba(53, 139, 231, 0.25)",
|
|
86
|
+
borderColor: "rgba(53, 139, 231, 0.3)",
|
|
87
|
+
borderWidth: 0.5,
|
|
88
|
+
backgroundColor: "transparent",
|
|
89
|
+
borderRadius: 4,
|
|
90
|
+
dataBackground: {
|
|
91
|
+
lineStyle: {
|
|
92
|
+
opacity: 0
|
|
93
|
+
},
|
|
94
|
+
areaStyle: {
|
|
95
|
+
opacity: 1,
|
|
96
|
+
color: e.palette.secondary.main
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
selectedDataBackground: {
|
|
100
|
+
lineStyle: {
|
|
101
|
+
opacity: 0
|
|
102
|
+
},
|
|
103
|
+
areaStyle: {
|
|
104
|
+
opacity: 1,
|
|
105
|
+
color: e.palette.secondary.main
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
handleStyle: {
|
|
109
|
+
color: e.palette.common.white,
|
|
110
|
+
borderColor: "rgba(3, 111, 226, 0.08)",
|
|
111
|
+
borderWidth: 1,
|
|
112
|
+
shadowBlur: 3,
|
|
113
|
+
shadowColor: "rgba(0, 0, 0, 0.1)",
|
|
114
|
+
shadowOffsetX: 0,
|
|
115
|
+
shadowOffsetY: 1
|
|
116
|
+
},
|
|
117
|
+
textStyle: {
|
|
118
|
+
color: e.palette.black[60],
|
|
119
|
+
fontSize: parseInt(e.typography.overlineDelicate.fontSize),
|
|
120
|
+
fontFamily: e.typography.overlineDelicate.fontFamily
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function p(e) {
|
|
125
|
+
return e ? {
|
|
126
|
+
brush: {
|
|
127
|
+
brushType: "rect",
|
|
128
|
+
brushMode: "single"
|
|
129
|
+
}
|
|
130
|
+
} : {};
|
|
131
|
+
}
|
|
132
|
+
function b(e, i = s) {
|
|
133
|
+
return {
|
|
134
|
+
stack: e ? i : void 0
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
s as D,
|
|
139
|
+
b as a,
|
|
140
|
+
h as b,
|
|
141
|
+
p as g,
|
|
142
|
+
S as m
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=utils-Dv5Z47UQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-Dv5Z47UQ.js","sources":["../src/widgets/echart/const.ts","../src/widgets/echart/utils.ts"],"sourcesContent":["export const DEFAULT_STACK_GROUP = 'stacked'\n","import deepmerge from 'deepmerge'\nimport type { EchartOptionsProps } from './types'\nimport type { Theme } from '@mui/material'\nimport { DEFAULT_STACK_GROUP } from './const'\n\nexport function mergeEchartWidgetConfig<T extends EchartOptionsProps>(\n ...options: [T | undefined, T | undefined]\n): T {\n return deepmerge(options[0] ?? {}, options[1] ?? {}, {\n customMerge: (key) => {\n if (key === 'color') {\n return (_, b: T['color']) => b\n }\n if (key === 'series') {\n return (a: T['series'][], b: T['series'][]) => {\n if (!a.length) return a // If there is no series in a, return a as is\n\n const mergedSeries = b?.map((bItem, index) => {\n const aItem = a?.[index] ?? {}\n return deepmerge(aItem, bItem as object)\n })\n return mergedSeries\n }\n }\n },\n }) as T\n}\n\nexport function getEChartZoomConfig(\n zoom: boolean,\n { start, end }: { start: number; end: number } = { start: 0, end: 100 },\n {\n inside = true,\n xSlider = true,\n ySlider = false,\n showSliders = true,\n xAxisLabelFormatter,\n } = {} as {\n inside?: boolean\n xSlider?: boolean\n ySlider?: boolean\n showSliders?: boolean\n xAxisLabelFormatter?: (value: number) => string\n },\n theme?: Theme,\n) {\n const sliderStyles = theme ? getEChartZoomSliderStyles(theme) : {}\n\n return {\n dataZoom: [\n inside && {\n throttle: 0,\n type: 'inside',\n xAxisIndex: xSlider ? [0] : [],\n yAxisIndex: ySlider ? [0] : [],\n show: zoom,\n zoomLock: !zoom,\n start,\n end,\n },\n inside &&\n ySlider && {\n throttle: 0,\n type: 'inside',\n show: zoom,\n zoomLock: !zoom,\n start,\n end,\n orientation: 'vertical',\n },\n xSlider && {\n throttle: 0,\n type: 'slider',\n xAxisIndex: [0],\n bottom: 0,\n height: parseInt(theme?.spacing?.(4) ?? '32'),\n show: zoom && showSliders,\n zoomLock: !zoom,\n start,\n end,\n labelFormatter: xAxisLabelFormatter,\n showDetail: false,\n ...sliderStyles,\n brushSelect: false,\n moveHandleSize: 8,\n handleSize: '100%',\n handleIcon:\n 'image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOSIgaGVpZ2h0PSIzNiIgdmlld0JveD0iMCAwIDkgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iLTAuNSIgd2lkdGg9IjgiIGhlaWdodD0iMTgiIHJ4PSI0IiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDI3KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMyAyMykiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDMgMTkpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAzIDE1KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4=',\n },\n ySlider && {\n throttle: 0,\n type: 'slider',\n left: parseInt(theme?.spacing?.(6) ?? '48'),\n width: parseInt(theme?.spacing?.(4) ?? '32'),\n yAxisIndex: [0],\n show: zoom && showSliders,\n zoomLock: !zoom,\n start,\n end,\n ...sliderStyles,\n brushSelect: false,\n moveHandleSize: 8,\n handleSize: '100%',\n handleIcon:\n 'image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDM2IDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iMC41IiB3aWR0aD0iOCIgaGVpZ2h0PSIxOCIgcng9IjQiIHRyYW5zZm9ybT0icm90YXRlKC05MCAwLjUgMC41KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDEzIDYpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTcgNikiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0icm90YXRlKC05MCAyMSA2KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4=',\n },\n ].filter((d) => !!d),\n }\n}\n\nfunction getEChartZoomSliderStyles(theme: Theme) {\n return {\n fillerColor: 'rgba(53, 139, 231, 0.25)',\n borderColor: 'rgba(53, 139, 231, 0.3)',\n borderWidth: 0.5,\n backgroundColor: 'transparent',\n borderRadius: 4,\n dataBackground: {\n lineStyle: {\n opacity: 0,\n },\n areaStyle: {\n opacity: 1,\n color: theme.palette.secondary.main,\n },\n },\n selectedDataBackground: {\n lineStyle: {\n opacity: 0,\n },\n areaStyle: {\n opacity: 1,\n color: theme.palette.secondary.main,\n },\n },\n handleStyle: {\n color: theme.palette.common.white,\n borderColor: 'rgba(3, 111, 226, 0.08)',\n borderWidth: 1,\n shadowBlur: 3,\n shadowColor: 'rgba(0, 0, 0, 0.1)',\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n },\n textStyle: {\n color: theme.palette.black[60],\n fontSize: parseInt(theme.typography.overlineDelicate.fontSize as string),\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n },\n } as const\n}\n\nexport function getEChartBrushConfig(brush: boolean) {\n return brush\n ? {\n brush: {\n brushType: 'rect',\n brushMode: 'single',\n },\n }\n : {}\n}\n\nexport function getEChartStackConfig(\n stack: boolean,\n stackGroup: string = DEFAULT_STACK_GROUP,\n) {\n return { stack: stack ? stackGroup : undefined }\n}\n"],"names":["DEFAULT_STACK_GROUP","mergeEchartWidgetConfig","options","deepmerge","customMerge","key","_","b","a","length","map","bItem","index","aItem","getEChartZoomConfig","zoom","start","end","inside","xSlider","ySlider","showSliders","xAxisLabelFormatter","theme","sliderStyles","getEChartZoomSliderStyles","dataZoom","throttle","type","xAxisIndex","yAxisIndex","show","zoomLock","orientation","bottom","height","parseInt","spacing","labelFormatter","showDetail","brushSelect","moveHandleSize","handleSize","handleIcon","left","width","filter","d","fillerColor","borderColor","borderWidth","backgroundColor","borderRadius","dataBackground","lineStyle","opacity","areaStyle","color","palette","secondary","main","selectedDataBackground","handleStyle","common","white","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","textStyle","black","fontSize","typography","overlineDelicate","fontFamily","getEChartBrushConfig","brush","brushType","brushMode","getEChartStackConfig","stack","stackGroup","undefined"],"mappings":"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"}
|