@carto/ps-react-ui 4.17.2 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/category-Ct2BzADB.js +753 -0
  2. package/dist/category-Ct2BzADB.js.map +1 -0
  3. package/dist/change-column-Bhcxmp-r.js +1148 -0
  4. package/dist/change-column-Bhcxmp-r.js.map +1 -0
  5. package/dist/echart-B10dhEaM.js +262 -0
  6. package/dist/echart-B10dhEaM.js.map +1 -0
  7. package/dist/legend/stores.js +1 -1
  8. package/dist/{legend-store-registry-Bo8U_qWM.js → legend-store-registry-p1tSwJXH.js} +151 -147
  9. package/dist/legend-store-registry-p1tSwJXH.js.map +1 -0
  10. package/dist/legend.js +473 -415
  11. package/dist/legend.js.map +1 -1
  12. package/dist/types/legend/components/legend-actions/legend-actions.d.ts +2 -2
  13. package/dist/types/legend/components/legend-group/styles.d.ts +31 -20
  14. package/dist/types/legend/components/legend-row/styles.d.ts +24 -4
  15. package/dist/types/legend/components/legend-sortable/styles.d.ts +4 -3
  16. package/dist/types/widgets-v2/actions/lock-selection/lock-selection.d.ts +15 -5
  17. package/dist/types/widgets-v2/category/components/category-legend.d.ts +18 -2
  18. package/dist/types/widgets-v2/category/components/category-row-stacked.d.ts +6 -1
  19. package/dist/types/widgets-v2/category/style.d.ts +8 -0
  20. package/dist/types/widgets-v2/echart/use-chart-selection.d.ts +10 -4
  21. package/dist/types/widgets-v2/histogram/index.d.ts +1 -1
  22. package/dist/types/widgets-v2/histogram/transforms.d.ts +11 -0
  23. package/dist/types/widgets-v2/histogram/types.d.ts +9 -0
  24. package/dist/types/widgets-v2/scatterplot/index.d.ts +1 -1
  25. package/dist/types/widgets-v2/scatterplot/transforms.d.ts +9 -0
  26. package/dist/types/widgets-v2/table/index.d.ts +1 -0
  27. package/dist/types/widgets-v2/table/transforms.d.ts +13 -0
  28. package/dist/types/widgets-v2/table/transforms.test.d.ts +1 -0
  29. package/dist/types/widgets-v2/timeseries/index.d.ts +1 -0
  30. package/dist/types/widgets-v2/timeseries/transforms.d.ts +10 -0
  31. package/dist/types/widgets-v2/timeseries/transforms.test.d.ts +1 -0
  32. package/dist/widgets-v2/actions.js +1 -1
  33. package/dist/widgets-v2/category.js +1 -1
  34. package/dist/widgets-v2/echart.js +1 -1
  35. package/dist/widgets-v2/echart.js.map +1 -1
  36. package/dist/widgets-v2/histogram.js +181 -158
  37. package/dist/widgets-v2/histogram.js.map +1 -1
  38. package/dist/widgets-v2/pie.js +155 -116
  39. package/dist/widgets-v2/pie.js.map +1 -1
  40. package/dist/widgets-v2/scatterplot.js +91 -85
  41. package/dist/widgets-v2/scatterplot.js.map +1 -1
  42. package/dist/widgets-v2/table.js +55 -45
  43. package/dist/widgets-v2/table.js.map +1 -1
  44. package/dist/widgets-v2/timeseries.js +96 -85
  45. package/dist/widgets-v2/timeseries.js.map +1 -1
  46. package/dist/widgets-v2.js +4 -4
  47. package/package.json +3 -3
  48. package/src/legend/components/legend-actions/legend-actions.tsx +2 -2
  49. package/src/legend/components/legend-group/styles.ts +59 -36
  50. package/src/legend/components/legend-row/legend-row.tsx +10 -7
  51. package/src/legend/components/legend-row/styles.ts +41 -10
  52. package/src/legend/components/legend-sortable/styles.ts +13 -4
  53. package/src/legend/stores/legend-store-registry.ts +28 -4
  54. package/src/legend/stores/legend-store.test.ts +23 -0
  55. package/src/widgets-v2/actions/lock-selection/lock-selection.test.tsx +62 -0
  56. package/src/widgets-v2/actions/lock-selection/lock-selection.tsx +45 -13
  57. package/src/widgets-v2/category/category-ui.test.tsx +55 -0
  58. package/src/widgets-v2/category/category-ui.tsx +65 -6
  59. package/src/widgets-v2/category/components/category-legend.test.tsx +53 -2
  60. package/src/widgets-v2/category/components/category-legend.tsx +55 -12
  61. package/src/widgets-v2/category/components/category-row-stacked.test.tsx +7 -3
  62. package/src/widgets-v2/category/components/category-row-stacked.tsx +8 -3
  63. package/src/widgets-v2/category/style.ts +10 -2
  64. package/src/widgets-v2/echart/echart-ui.test.tsx +25 -0
  65. package/src/widgets-v2/echart/echart-ui.tsx +20 -0
  66. package/src/widgets-v2/echart/use-chart-selection.test.tsx +3 -1
  67. package/src/widgets-v2/echart/use-chart-selection.ts +10 -4
  68. package/src/widgets-v2/histogram/index.ts +4 -1
  69. package/src/widgets-v2/histogram/options.test.ts +86 -0
  70. package/src/widgets-v2/histogram/options.ts +50 -0
  71. package/src/widgets-v2/histogram/transforms.test.ts +36 -1
  72. package/src/widgets-v2/histogram/transforms.ts +23 -0
  73. package/src/widgets-v2/histogram/types.ts +9 -0
  74. package/src/widgets-v2/pie/options.test.ts +262 -0
  75. package/src/widgets-v2/pie/options.ts +80 -5
  76. package/src/widgets-v2/scatterplot/index.ts +4 -1
  77. package/src/widgets-v2/scatterplot/transforms.test.ts +38 -1
  78. package/src/widgets-v2/scatterplot/transforms.ts +23 -0
  79. package/src/widgets-v2/table/index.ts +1 -0
  80. package/src/widgets-v2/table/transforms.test.ts +40 -0
  81. package/src/widgets-v2/table/transforms.ts +26 -0
  82. package/src/widgets-v2/timeseries/index.ts +1 -0
  83. package/src/widgets-v2/timeseries/transforms.test.ts +49 -0
  84. package/src/widgets-v2/timeseries/transforms.ts +31 -0
  85. package/dist/category-CGS_eHr4.js +0 -719
  86. package/dist/category-CGS_eHr4.js.map +0 -1
  87. package/dist/change-column-CiVAjOUB.js +0 -1143
  88. package/dist/change-column-CiVAjOUB.js.map +0 -1
  89. package/dist/echart-Bdvbfx9s.js +0 -250
  90. package/dist/echart-Bdvbfx9s.js.map +0 -1
  91. package/dist/legend-store-registry-Bo8U_qWM.js.map +0 -1
@@ -7,8 +7,8 @@ export interface LegendActionsProps {
7
7
  * parity): the wrapper partitions its children by component identity and
8
8
  * renders this slot inside the header, wrapped in the hover-fade group
9
9
  * (`PsLegend-rowFade` in rows, `PsLegend-groupFade` in group headers —
10
- * resolved from the nearest context). Compose the menu last so it sits
11
- * rightmost, per design.
10
+ * resolved from the nearest context). Compose the visibility toggle last so
11
+ * it sits rightmost, per design.
12
12
  *
13
13
  * @experimental This API is new and may change in a future release.
14
14
  */
@@ -13,6 +13,22 @@ export declare const styles: {
13
13
  borderTop: string;
14
14
  borderColor: "divider";
15
15
  };
16
+ };
17
+ groupDragging: {
18
+ opacity: number;
19
+ };
20
+ header: {
21
+ display: "flex";
22
+ alignItems: "center";
23
+ gap: number;
24
+ padding: ({ spacing }: Theme) => string;
25
+ minHeight: number;
26
+ borderBottom: string;
27
+ borderColor: "divider";
28
+ position: "sticky";
29
+ top: number;
30
+ zIndex: number;
31
+ backgroundColor: "background.default";
16
32
  '& .PsLegend-groupFade > *': {
17
33
  opacity: number;
18
34
  transition: ({ transitions }: Theme) => string;
@@ -23,10 +39,14 @@ export declare const styles: {
23
39
  opacity: number;
24
40
  };
25
41
  };
26
- '&:hover .PsLegend-groupFade > *, &:focus-within .PsLegend-groupFade > *': {
27
- opacity: number;
28
- };
29
42
  '@media (hover: hover)': {
43
+ '& .PsLegend-groupFade > *:not(.active)': {
44
+ width: number;
45
+ minWidth: number;
46
+ padding: number;
47
+ overflow: "hidden";
48
+ pointerEvents: "none";
49
+ };
30
50
  '& .PsLegend-groupActions:not(:has(.active))': {
31
51
  width: number;
32
52
  minWidth: number;
@@ -35,6 +55,14 @@ export declare const styles: {
35
55
  pointerEvents: "none";
36
56
  };
37
57
  };
58
+ '&:hover .PsLegend-groupFade > *, &:focus-within .PsLegend-groupFade > *': {
59
+ opacity: number;
60
+ width: string;
61
+ minWidth: number;
62
+ padding: string;
63
+ overflow: "visible";
64
+ pointerEvents: "auto";
65
+ };
38
66
  '&:hover .PsLegend-groupActions, &:focus-within .PsLegend-groupActions': {
39
67
  width: string;
40
68
  minWidth: number;
@@ -53,22 +81,6 @@ export declare const styles: {
53
81
  opacity: number;
54
82
  };
55
83
  };
56
- groupDragging: {
57
- opacity: number;
58
- };
59
- header: {
60
- display: "flex";
61
- alignItems: "center";
62
- gap: number;
63
- padding: ({ spacing }: Theme) => string;
64
- minHeight: number;
65
- borderBottom: string;
66
- borderColor: "divider";
67
- position: "sticky";
68
- top: number;
69
- zIndex: number;
70
- backgroundColor: "background.default";
71
- };
72
84
  titleArea: {
73
85
  flex: number;
74
86
  minWidth: number;
@@ -88,7 +100,6 @@ export declare const styles: {
88
100
  color: "text.secondary";
89
101
  };
90
102
  label: {
91
- flex: number;
92
103
  minWidth: number;
93
104
  overflow: "hidden";
94
105
  textOverflow: "ellipsis";
@@ -18,10 +18,14 @@ export declare const styles: {
18
18
  opacity: number;
19
19
  };
20
20
  };
21
- '&:hover .PsLegend-rowFade > *, &:focus-within .PsLegend-rowFade > *': {
22
- opacity: number;
23
- };
24
21
  '@media (hover: hover)': {
22
+ '& .PsLegend-rowFade > *:not(.active)': {
23
+ width: number;
24
+ minWidth: number;
25
+ padding: number;
26
+ overflow: "hidden";
27
+ pointerEvents: "none";
28
+ };
25
29
  '& .PsLegend-rowActions:not(:has(.active))': {
26
30
  width: number;
27
31
  minWidth: number;
@@ -30,6 +34,14 @@ export declare const styles: {
30
34
  pointerEvents: "none";
31
35
  };
32
36
  };
37
+ '&:hover .PsLegend-rowFade > *, &:focus-within .PsLegend-rowFade > *': {
38
+ opacity: number;
39
+ width: string;
40
+ minWidth: number;
41
+ padding: string;
42
+ overflow: "visible";
43
+ pointerEvents: "auto";
44
+ };
33
45
  '&:hover .PsLegend-rowActions, &:focus-within .PsLegend-rowActions': {
34
46
  width: string;
35
47
  minWidth: number;
@@ -64,6 +76,9 @@ export declare const styles: {
64
76
  zIndex: number;
65
77
  backgroundColor: "background.paper";
66
78
  };
79
+ headerGrouped: {
80
+ paddingLeft: number;
81
+ };
67
82
  titleBox: {
68
83
  flex: number;
69
84
  minWidth: number;
@@ -86,7 +101,6 @@ export declare const styles: {
86
101
  gap: number;
87
102
  };
88
103
  title: {
89
- flex: number;
90
104
  minWidth: number;
91
105
  overflow: "hidden";
92
106
  textOverflow: "ellipsis";
@@ -120,9 +134,15 @@ export declare const styles: {
120
134
  gap: number;
121
135
  padding: ({ spacing }: Theme) => string;
122
136
  };
137
+ contentGrouped: {
138
+ paddingLeft: number;
139
+ };
123
140
  footer: {
124
141
  padding: ({ spacing }: Theme) => string;
125
142
  };
143
+ footerGrouped: {
144
+ paddingLeft: number;
145
+ };
126
146
  dimmed: {
127
147
  opacity: number;
128
148
  };
@@ -6,13 +6,14 @@ export declare const styles: {
6
6
  display: "flex";
7
7
  alignItems: "center";
8
8
  justifyContent: "center";
9
- height: number;
9
+ left: number;
10
+ top: number;
10
11
  };
11
12
  handleSlotLayer: {
12
- right: number;
13
+ height: number;
13
14
  };
14
15
  handleSlotGroup: {
15
- right: number;
16
+ height: number;
16
17
  };
17
18
  handle: {
18
19
  padding: string;
@@ -2,28 +2,38 @@ import { ComponentType } from 'react';
2
2
  import { SvgIconProps } from '@mui/material';
3
3
  import { LockSelectionLabels } from './labels';
4
4
  export type LockSelectionKey = string | number;
5
- export interface LockSelectionProps {
5
+ export interface LockSelectionProps<K extends LockSelectionKey = LockSelectionKey> {
6
6
  /**
7
7
  * Currently-selected items (destination-owned). On lock, this set is
8
8
  * snapshotted into `lockedItems` via `onLockChange`.
9
9
  */
10
- selection: readonly LockSelectionKey[];
10
+ selection: readonly K[];
11
11
  /**
12
12
  * Currently-locked items (destination-owned). When non-empty, the widget's
13
13
  * data is filtered to these items via the registered transform.
14
14
  */
15
- lockedItems: readonly LockSelectionKey[];
15
+ lockedItems: readonly K[];
16
16
  /**
17
17
  * Fires when the user toggles the lock. The destination is responsible for
18
18
  * persisting the new locked set (and re-feeding it via `lockedItems`).
19
19
  */
20
- onLockChange: (next: readonly LockSelectionKey[]) => void;
20
+ onLockChange: (next: readonly K[]) => void;
21
21
  labels?: Partial<LockSelectionLabels>;
22
22
  /** Lock icon (default: `LockIcon`). */
23
23
  lockIcon?: ComponentType<SvgIconProps>;
24
24
  /** Unlock icon (default: `LockOpenIcon`). */
25
25
  unlockIcon?: ComponentType<SvgIconProps>;
26
26
  iconProps?: SvgIconProps;
27
+ /**
28
+ * Data transform applied while locked. Defaults to {@link filterByLockedItems}
29
+ * (keeps only `{name, ...}` items whose `name` is in `lockedItems`, across a
30
+ * `X[][]` series shape — matches Bar/Pie/Category/Timeseries data). Widgets
31
+ * whose data shape or selection identity differs (bin index, composite
32
+ * point key, flat rows) pass their own — e.g. Histogram's
33
+ * `filterHistogramByLockedBins`, Scatterplot's
34
+ * `filterScatterplotByLockedPoints`, Table's `filterTableByLockedRows`.
35
+ */
36
+ filterFn?: (data: unknown, lockedItems: readonly K[]) => unknown;
27
37
  }
28
38
  /**
29
39
  * Action that pins the current selection so the widget's data filters down
@@ -33,4 +43,4 @@ export interface LockSelectionProps {
33
43
  *
34
44
  * The trigger is disabled when there is nothing to lock and nothing locked.
35
45
  */
36
- export declare function LockSelection({ selection, lockedItems, onLockChange, labels, lockIcon: LockSvg, unlockIcon: UnlockSvg, iconProps, }: LockSelectionProps): import("react/jsx-runtime").JSX.Element;
46
+ export declare function LockSelection<K extends LockSelectionKey = LockSelectionKey>({ selection, lockedItems, onLockChange, labels, lockIcon: LockSvg, unlockIcon: UnlockSvg, iconProps, filterFn, }: LockSelectionProps<K>): import("react/jsx-runtime").JSX.Element;
@@ -10,9 +10,25 @@ export interface CategoryLegendProps {
10
10
  * same source).
11
11
  */
12
12
  colorAt: (index: number) => string | undefined;
13
+ /**
14
+ * Series indices currently hidden from the chart. Renders dimmed.
15
+ * Optional — defaults to none hidden. Added after this component's first
16
+ * release; kept optional (not required) so it stays a non-breaking
17
+ * addition for any direct consumer of `CategoryLegend` (a public
18
+ * subpath export) that predates the hide feature.
19
+ */
20
+ hiddenSeries?: ReadonlySet<number>;
21
+ /**
22
+ * Fires with the series index when its legend item is clicked. Optional
23
+ * — omitting it renders a legend with no hide affordance (same
24
+ * reasoning as `hiddenSeries`).
25
+ */
26
+ onToggle?: (index: number) => void;
13
27
  }
14
28
  /**
15
29
  * Sticky color legend rendered below a multi-series Category list.
16
- * Per-series `color` overrides the matching `colorAt(i)` result.
30
+ * Per-series `color` overrides the matching `colorAt(i)` result. Clicking an
31
+ * item toggles that series' visibility in the rows above (mirrors ECharts'
32
+ * native legend click-to-hide).
17
33
  */
18
- export declare function CategoryLegend({ series, colorAt }: CategoryLegendProps): import("react/jsx-runtime").JSX.Element | null;
34
+ export declare function CategoryLegend({ series, colorAt, hiddenSeries, onToggle, }: CategoryLegendProps): import("react/jsx-runtime").JSX.Element | null;
@@ -8,7 +8,12 @@ export interface CategoryRowStackedProps {
8
8
  values: readonly number[];
9
9
  /** One color per series (palette + per-series overrides resolved upstream). */
10
10
  colors: readonly string[];
11
- /** Series names for the breakdown row. Missing entries fall back to `Series N`. */
11
+ /**
12
+ * Series names for the breakdown row, one per visible series, already
13
+ * resolved by the caller (unnamed series fall back to `Series N` using
14
+ * their ORIGINAL series index — this component has no notion of which
15
+ * series were hidden, so it must not recompute a positional fallback).
16
+ */
12
17
  seriesNames: readonly string[];
13
18
  formatter: (n: number) => string;
14
19
  selected: boolean;
@@ -140,6 +140,14 @@ export declare const styles: {
140
140
  display: string;
141
141
  alignItems: string;
142
142
  gap: number;
143
+ cursor: string;
144
+ };
145
+ legendItemHidden: {
146
+ display: string;
147
+ alignItems: string;
148
+ gap: number;
149
+ cursor: string;
150
+ opacity: number;
143
151
  };
144
152
  legendDot: {
145
153
  width: number;
@@ -2,7 +2,13 @@ import { CallbackDataParams } from 'echarts/types/dist/shared';
2
2
  import { EchartsEventHandler } from './echart-ui';
3
3
  export type SelectionKey = string | number;
4
4
  export interface UseChartSelectionOptions<K extends SelectionKey> {
5
- /** Controlled selection. `undefined` is treated the same as `[]`. */
5
+ /**
6
+ * Controlled selection. `undefined`/`null`/an explicit `[]` all mean "no
7
+ * selection interaction" — every current merger already treats an empty
8
+ * selection as "nothing excluded," so this hook collapses all three to
9
+ * `null` rather than promising per-merger `[]` semantics it doesn't
10
+ * implement.
11
+ */
6
12
  selection?: readonly K[];
7
13
  /** Receives the next selection. When omitted the wiring is a no-op. */
8
14
  onSelectionChange?: (next: readonly K[]) => void;
@@ -29,9 +35,9 @@ export interface ChartSelectionWiring<K extends SelectionKey> {
29
35
  */
30
36
  onEvents: Record<string, EchartsEventHandler>;
31
37
  /**
32
- * The current selection — `null` when the consumer didn't pass one or it's
33
- * empty. Mergers should treat `null` as "no dimming" and a non-null array
34
- * as "render only these as fully opaque, dim the rest".
38
+ * The current selection — `null` for "no selection interaction"
39
+ * (`undefined`/`null`/an explicit `[]`), or a non-empty array meaning
40
+ * "render only these as fully opaque, dim the rest".
35
41
  */
36
42
  selection: readonly K[] | null;
37
43
  }
@@ -1,5 +1,5 @@
1
1
  export { histogramOptions, createHistogramOptionFactory } from './options';
2
2
  export { HistogramSkeleton, type HistogramSkeletonProps } from './skeleton';
3
3
  export { createHistogramDownloadConfig } from './download';
4
- export { toRelativeHistogramData } from './transforms';
4
+ export { toRelativeHistogramData, filterHistogramByLockedBins, } from './transforms';
5
5
  export type { HistogramWidgetData, HistogramOptionsInput, HistogramOptionFactoryInput, HistogramEChartsOption, } from './types';
@@ -15,3 +15,14 @@
15
15
  * shape-check pattern as the default transform).
16
16
  */
17
17
  export declare const toRelativeHistogramData: (input: unknown) => unknown;
18
+ /**
19
+ * `LockSelection` filter for Histogram. Data is `number[][]` — a flat list
20
+ * of bin counts per series, positionally paired with `ticks` (bin `i` covers
21
+ * `[ticks[i], ticks[i+1])`). Unlike name-keyed widgets, locked-out bins can't
22
+ * be REMOVED — that would shift every later bin's index and desync it from
23
+ * its `ticks` range. Zeroing them out instead preserves array length/position,
24
+ * so locked bins just render as empty (height 0) rather than disappearing.
25
+ *
26
+ * `lockedItems` holds bin indices (numbers, from Histogram's `selection`).
27
+ */
28
+ export declare function filterHistogramByLockedBins(input: unknown, lockedItems: readonly (string | number)[]): unknown;
@@ -41,6 +41,15 @@ export interface HistogramOptionFactoryInput {
41
41
  * (`itemStyle.opacity: 0.15`). `null`/empty means no selection.
42
42
  */
43
43
  selection?: readonly number[] | null;
44
+ /**
45
+ * Locked bin indices (from `LockSelection`). The x-axis crops its visible
46
+ * window to `[min(lockedItems), max(lockedItems)]` so the chart actually
47
+ * zooms into the locked range instead of showing every bin label with
48
+ * zeroed-out bars outside it. `null`/empty means no crop. Histogram's
49
+ * selection is always a contiguous run (`use-widget-filters`'s BETWEEN
50
+ * envelope round-trip fills any gaps), so min/max fully describes it.
51
+ */
52
+ lockedItems?: readonly number[] | null;
44
53
  /**
45
54
  * Consumer-supplied partial option merged into the structural option at
46
55
  * structural-build time. Lets stories override pieces of the theme-aware
@@ -1,5 +1,5 @@
1
1
  export { scatterplotOptions, createScatterplotOptionFactory } from './options';
2
2
  export { ScatterplotSkeleton, type ScatterplotSkeletonProps } from './skeleton';
3
3
  export { createScatterplotDownloadConfig } from './download';
4
- export { toRelativeScatterplotData } from './transforms';
4
+ export { toRelativeScatterplotData, filterScatterplotByLockedPoints, } from './transforms';
5
5
  export type { ScatterplotDatum, ScatterplotWidgetData, ScatterplotOptionsInput, ScatterplotOptionFactoryInput, ScatterplotEChartsOption, } from './types';
@@ -15,3 +15,12 @@
15
15
  * untouched.
16
16
  */
17
17
  export declare const toRelativeScatterplotData: (input: unknown) => unknown;
18
+ /**
19
+ * `LockSelection` filter for Scatterplot. Data is `[number, number][][]` —
20
+ * points have no `name`, so selection (and locking) is keyed on a synthetic
21
+ * `${seriesIndex}:${dataIndex}` string (same format `useChartSelection`'s
22
+ * `keyFromClick`/`keysFromBrush` produce for this widget). Unlike Histogram,
23
+ * a point's position carries no external meaning (no `ticks` to desync from),
24
+ * so non-locked points are removed outright rather than zeroed.
25
+ */
26
+ export declare function filterScatterplotByLockedPoints(input: unknown, lockedItems: readonly (string | number)[]): unknown;
@@ -2,6 +2,7 @@ export { Table, type TableProps } from './table';
2
2
  export { TableUI, type TableUIProps } from './table-ui';
3
3
  export { TableSkeleton, type TableSkeletonProps } from './skeleton';
4
4
  export { createTableDownloadConfig } from './download';
5
+ export { filterTableByLockedRows } from './transforms';
5
6
  export { compareValues, sortRows, paginateRows, resolveColumns, deriveVisibleRows, tableDataToCsv, } from './helpers';
6
7
  export { DEFAULT_TABLE_LABELS, type TableLabels } from './labels';
7
8
  export { DEFAULT_TABLE_PAGE_SIZE, DEFAULT_TABLE_PAGE_SIZE_OPTIONS, type TableColumn, type TableRow, type TableWidgetData, type TableWidgetState, type TableSortDirection, type TableSortState, } from './types';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `LockSelection` filter for Table. Data is a FLAT `TableRow[]` (unlike every
3
+ * other widget's `X[][]` series shape) and row identity comes from
4
+ * `row[keyColumn]` (default `'id'`), not `name` — so `filterByLockedItems`
5
+ * doesn't apply here (its outer `.map` treats each row as a "series", and a
6
+ * plain row object isn't an array, so it would silently pass everything
7
+ * through unfiltered). Falls back to the row's index when the identity
8
+ * column is nullish, mirroring `TableUI`'s own `resolveRowId`.
9
+ *
10
+ * `keyColumn` isn't part of `LockSelection`'s generic `filterFn` signature —
11
+ * close over it: `filterFn={(data, locked) => filterTableByLockedRows(data, locked, keyColumn)}`.
12
+ */
13
+ export declare function filterTableByLockedRows(input: unknown, lockedItems: readonly (string | number)[], keyColumn?: string): unknown;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  export { timeseriesOptions, createTimeseriesOptionFactory } from './options';
2
2
  export { TimeseriesSkeleton } from './skeleton';
3
3
  export { createTimeseriesDownloadConfig } from './download';
4
+ export { filterTimeseriesByLockedItems } from './transforms';
4
5
  export type { TimeseriesDatum, TimeseriesWidgetData, TimeseriesOptionsInput, TimeseriesOptionFactoryInput, TimeseriesEChartsOption, } from './types';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * `LockSelection` filter for Timeseries. Data is `{name, value}[][]` like
3
+ * Bar/Pie/Category, but `name` may arrive as `Date | number | string` (the
4
+ * time axis stores a `Date`). `lockedItems` is snapshotted from `selection`,
5
+ * whose keys are already normalized to `Date → ms` (see `options.ts`'s
6
+ * `normalizeName`) — so a raw `Date` name must be normalized the same way
7
+ * before the membership check, or every point would compare a `Date` object
8
+ * against a `number` and silently fail to match, filtering everything out.
9
+ */
10
+ export declare function filterTimeseriesByLockedItems(input: unknown, lockedItems: readonly (string | number)[]): unknown;
@@ -1,4 +1,4 @@
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-CiVAjOUB.js";
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-Bhcxmp-r.js";
2
2
  import { Z as u, a as x, c as M } from "../transforms-Cdx4fkU5.js";
3
3
  import { d as b, a as p, t as v, b as H } from "../exports-Cx-f6m6U.js";
4
4
  import { C as W, D as V, M as y, P as K, b as j } from "../png-item-9dNbB37T.js";
@@ -1,4 +1,4 @@
1
- import { C as N, a as P, b as $, c as z, d as G, e as L, f as M } from "../category-CGS_eHr4.js";
1
+ import { C as N, a as P, b as $, c as z, d as G, e as L, f as M } from "../category-Ct2BzADB.js";
2
2
  import { jsx as m, jsxs as g } from "react/jsx-runtime";
3
3
  import { c as d } from "react/compiler-runtime";
4
4
  import { Box as c, Skeleton as p } from "@mui/material";
@@ -1,4 +1,4 @@
1
- import { D as T, E as z, a as D, _ as U, o as w } from "../echart-Bdvbfx9s.js";
1
+ import { D as T, E as z, a as D, _ as U, o as w } from "../echart-B10dhEaM.js";
2
2
  import { c as C } from "react/compiler-runtime";
3
3
  import { useRef as R } from "react";
4
4
  function F(x) {
@@ -1 +1 @@
1
- {"version":3,"file":"echart.js","sources":["../../src/widgets-v2/echart/use-chart-selection.ts"],"sourcesContent":["import { useCallback, useMemo, useRef } from 'react'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport type { EchartsEventHandler } from './echart-ui'\n\nexport type SelectionKey = string | number\n\nexport interface UseChartSelectionOptions<K extends SelectionKey> {\n /** Controlled selection. `undefined` is treated the same as `[]`. */\n selection?: readonly K[]\n /** Receives the next selection. When omitted the wiring is a no-op. */\n onSelectionChange?: (next: readonly K[]) => void\n /**\n * Pull a selection key out of an ECharts `click` event. Return `null` to\n * skip (e.g. a click on empty plot area). For Bar/Pie/Timeseries this is\n * usually `(p) => p.name`; for Histogram/Scatterplot it's the dataIndex.\n */\n keyFromClick: (params: CallbackDataParams) => K | null\n /**\n * Map a `brushSelected` payload's `selected[*]` entries (each carrying a\n * `seriesIndex` + `dataIndex[]`) into the full set of selection keys for\n * the brushed area. Called once per brush event.\n */\n keysFromBrush: (\n selected: readonly { seriesIndex: number; dataIndex: number[] }[],\n ) => K[]\n}\n\nexport interface ChartSelectionWiring<K extends SelectionKey> {\n /**\n * Pass straight to `<Widget.Echart onEvents={…}>`. Wires `click` and\n * `brushSelected` so the user's interactions reach `onSelectionChange`.\n */\n onEvents: Record<string, EchartsEventHandler>\n /**\n * The current selection — `null` when the consumer didn't pass one or it's\n * empty. Mergers should treat `null` as \"no dimming\" and a non-null array\n * as \"render only these as fully opaque, dim the rest\".\n */\n selection: readonly K[] | null\n}\n\n/**\n * Translate ECharts' click + brush events into a consumer-owned selection\n * with the expected dashboard semantics:\n *\n * - **Click toggles** — clicking an item adds it to the selection if\n * absent, removes it if present.\n * - **Brush replaces** — finishing a brush stroke overwrites the selection\n * with whatever the brush covered (drag-to-empty clears).\n *\n * Wire the returned `onEvents` into `<Widget.Echart>` and feed\n * `wiring.selection` to the widget's option factory so the merger can dim\n * non-selected rows at fusion time.\n */\nexport function useChartSelection<K extends SelectionKey>({\n selection,\n onSelectionChange,\n keyFromClick,\n keysFromBrush,\n}: UseChartSelectionOptions<K>): ChartSelectionWiring<K> {\n const handleClick = useCallback(\n (event: unknown) => {\n if (!onSelectionChange) return\n const params = event as CallbackDataParams\n const key = keyFromClick(params)\n if (key == null) return\n const current = selection ?? []\n const idx = current.indexOf(key)\n const next =\n idx === -1\n ? [...current, key]\n : [...current.slice(0, idx), ...current.slice(idx + 1)]\n onSelectionChange(next)\n },\n [selection, onSelectionChange, keyFromClick],\n )\n\n // ECharts fires `brushSelected` on every pointer-move while the user is\n // drawing a brush, but we only want to push to `onSelectionChange` once\n // the gesture ends. Cache the latest `brushSelected` payload here, then\n // commit on `brushEnd`.\n const latestBrushedRef = useRef<\n readonly { seriesIndex: number; dataIndex: number[] }[]\n >([])\n\n const handleBrushSelected = useCallback((event: unknown) => {\n const params = event as {\n batch?: {\n selected?: { seriesIndex: number; dataIndex: number[] }[]\n }[]\n }\n latestBrushedRef.current = params.batch?.[0]?.selected ?? []\n }, [])\n\n const handleBrushEnd = useCallback(() => {\n if (!onSelectionChange) return\n onSelectionChange(keysFromBrush(latestBrushedRef.current))\n }, [onSelectionChange, keysFromBrush])\n\n const onEvents = useMemo<Record<string, EchartsEventHandler>>(\n () => ({\n click: handleClick,\n brushSelected: handleBrushSelected,\n brushEnd: handleBrushEnd,\n }),\n [handleClick, handleBrushSelected, handleBrushEnd],\n )\n\n const wiringSelection = useMemo(\n () => (selection && selection.length > 0 ? selection : null),\n [selection],\n )\n\n return { onEvents, selection: wiringSelection }\n}\n"],"names":["useChartSelection","t0","$","_c","selection","onSelectionChange","keyFromClick","keysFromBrush","t1","event","key","current","idx","indexOf","next","slice","handleClick","t2","Symbol","for","latestBrushedRef","useRef","t3","event_0","params_0","params","batch","selected","handleBrushSelected","t4","handleBrushEnd","t5","click","brushSelected","brushEnd","onEvents","wiringSelection","length","t6"],"mappings":";;;AAsDO,SAAAA,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAAmD;AAAA,IAAAC,WAAAA;AAAAA,IAAAC,mBAAAA;AAAAA,IAAAC,cAAAA;AAAAA,IAAAC,eAAAA;AAAAA,EAAAA,IAAAN;AAK5B,MAAAO;AAAA,EAAAN,EAAA,CAAA,MAAAI,KAAAJ,SA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,KAAA5B,UAAAc,KAG7Be,IAAA;AAAA,IAAAC,OACEhB;AAAAA,IAAWiB,eACHL;AAAAA,IAAmBM,UACxBJ;AAAAA,EAAAA,GACX5B,OAAA4B,GAAA5B,QAAAc,GAAAd,QAAA6B,KAAAA,IAAA7B,EAAA,EAAA;AALH,QAAAiC,IACSJ,GAQTK,IACShC,KAAaA,EAASiC,SAAU,IAAhCjC,IAAA;AAER,MAAAkC;AAAA,SAAApC,EAAA,EAAA,MAAAiC,KAAAjC,UAAAkC,KAEME,IAAA;AAAA,IAAAH,UAAAA;AAAAA,IAAA/B,WAAuBgC;AAAAA,EAAAA,GAAiBlC,QAAAiC,GAAAjC,QAAAkC,GAAAlC,QAAAoC,KAAAA,IAAApC,EAAA,EAAA,GAAxCoC;AAAwC;"}
1
+ {"version":3,"file":"echart.js","sources":["../../src/widgets-v2/echart/use-chart-selection.ts"],"sourcesContent":["import { useCallback, useMemo, useRef } from 'react'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport type { EchartsEventHandler } from './echart-ui'\n\nexport type SelectionKey = string | number\n\nexport interface UseChartSelectionOptions<K extends SelectionKey> {\n /**\n * Controlled selection. `undefined`/`null`/an explicit `[]` all mean \"no\n * selection interaction\" — every current merger already treats an empty\n * selection as \"nothing excluded,\" so this hook collapses all three to\n * `null` rather than promising per-merger `[]` semantics it doesn't\n * implement.\n */\n selection?: readonly K[]\n /** Receives the next selection. When omitted the wiring is a no-op. */\n onSelectionChange?: (next: readonly K[]) => void\n /**\n * Pull a selection key out of an ECharts `click` event. Return `null` to\n * skip (e.g. a click on empty plot area). For Bar/Pie/Timeseries this is\n * usually `(p) => p.name`; for Histogram/Scatterplot it's the dataIndex.\n */\n keyFromClick: (params: CallbackDataParams) => K | null\n /**\n * Map a `brushSelected` payload's `selected[*]` entries (each carrying a\n * `seriesIndex` + `dataIndex[]`) into the full set of selection keys for\n * the brushed area. Called once per brush event.\n */\n keysFromBrush: (\n selected: readonly { seriesIndex: number; dataIndex: number[] }[],\n ) => K[]\n}\n\nexport interface ChartSelectionWiring<K extends SelectionKey> {\n /**\n * Pass straight to `<Widget.Echart onEvents={…}>`. Wires `click` and\n * `brushSelected` so the user's interactions reach `onSelectionChange`.\n */\n onEvents: Record<string, EchartsEventHandler>\n /**\n * The current selection — `null` for \"no selection interaction\"\n * (`undefined`/`null`/an explicit `[]`), or a non-empty array meaning\n * \"render only these as fully opaque, dim the rest\".\n */\n selection: readonly K[] | null\n}\n\n/**\n * Translate ECharts' click + brush events into a consumer-owned selection\n * with the expected dashboard semantics:\n *\n * - **Click toggles** — clicking an item adds it to the selection if\n * absent, removes it if present.\n * - **Brush replaces** — finishing a brush stroke overwrites the selection\n * with whatever the brush covered (drag-to-empty clears).\n *\n * Wire the returned `onEvents` into `<Widget.Echart>` and feed\n * `wiring.selection` to the widget's option factory so the merger can dim\n * non-selected rows at fusion time.\n */\nexport function useChartSelection<K extends SelectionKey>({\n selection,\n onSelectionChange,\n keyFromClick,\n keysFromBrush,\n}: UseChartSelectionOptions<K>): ChartSelectionWiring<K> {\n const handleClick = useCallback(\n (event: unknown) => {\n if (!onSelectionChange) return\n const params = event as CallbackDataParams\n const key = keyFromClick(params)\n if (key == null) return\n const current = selection ?? []\n const idx = current.indexOf(key)\n const next =\n idx === -1\n ? [...current, key]\n : [...current.slice(0, idx), ...current.slice(idx + 1)]\n onSelectionChange(next)\n },\n [selection, onSelectionChange, keyFromClick],\n )\n\n // ECharts fires `brushSelected` on every pointer-move while the user is\n // drawing a brush, but we only want to push to `onSelectionChange` once\n // the gesture ends. Cache the latest `brushSelected` payload here, then\n // commit on `brushEnd`.\n const latestBrushedRef = useRef<\n readonly { seriesIndex: number; dataIndex: number[] }[]\n >([])\n\n const handleBrushSelected = useCallback((event: unknown) => {\n const params = event as {\n batch?: {\n selected?: { seriesIndex: number; dataIndex: number[] }[]\n }[]\n }\n latestBrushedRef.current = params.batch?.[0]?.selected ?? []\n }, [])\n\n const handleBrushEnd = useCallback(() => {\n if (!onSelectionChange) return\n onSelectionChange(keysFromBrush(latestBrushedRef.current))\n }, [onSelectionChange, keysFromBrush])\n\n const onEvents = useMemo<Record<string, EchartsEventHandler>>(\n () => ({\n click: handleClick,\n brushSelected: handleBrushSelected,\n brushEnd: handleBrushEnd,\n }),\n [handleClick, handleBrushSelected, handleBrushEnd],\n )\n\n const wiringSelection = useMemo(\n () => (selection && selection.length > 0 ? selection : null),\n [selection],\n )\n\n return { onEvents, selection: wiringSelection }\n}\n"],"names":["useChartSelection","t0","$","_c","selection","onSelectionChange","keyFromClick","keysFromBrush","t1","event","key","current","idx","indexOf","next","slice","handleClick","t2","Symbol","for","latestBrushedRef","useRef","t3","event_0","params_0","params","batch","selected","handleBrushSelected","t4","handleBrushEnd","t5","click","brushSelected","brushEnd","onEvents","wiringSelection","length","t6"],"mappings":";;;AA4DO,SAAAA,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAAmD;AAAA,IAAAC,WAAAA;AAAAA,IAAAC,mBAAAA;AAAAA,IAAAC,cAAAA;AAAAA,IAAAC,eAAAA;AAAAA,EAAAA,IAAAN;AAK5B,MAAAO;AAAA,EAAAN,EAAA,CAAA,MAAAI,KAAAJ,SAAAG,KAAAH,EAAA,CAAA,MAAAE,KAE1BI,IAAAC,CAAAA,MAAA;AACE,QAAI,CAACJ;AAAiB;AAEtB,UAAAK,IAAYJ,EADGG,CACgB;AAC/B,QAAIC,KAAO;AAAI;AACf,UAAAC,IAAgBP,KAAA,CAAA,GAChBQ,IAAYD,EAAOE,QAASH,CAAG,GAC/BI,IACEF,MAAQ,KAAR,CAAA,GACQD,GAASD,CAAG,IADpB,IAEQC,EAAOI,MAAO,GAAGH,CAAG,GAAC,GAAKD,EAAOI,MAAOH,IAAM,CAAC,CAAC;AAC1DP,IAAAA,EAAkBS,CAAI;AAAA,EAAC,GACxBZ,OAAAI,GAAAJ,OAAAG,GAAAH,OAAAE,GAAAF,OAAAM,KAAAA,IAAAN,EAAA,CAAA;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