@object-ui/plugin-charts 6.2.2 → 7.0.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/CHANGELOG.md +139 -0
- package/dist/{packages/plugin-charts/src/AdvancedChartImpl.d.ts → AdvancedChartImpl.d.ts} +10 -2
- package/dist/{packages/plugin-charts/src/ChartContainerImpl.d.ts → ChartContainerImpl.d.ts} +4 -4
- package/dist/{packages/plugin-charts/src/ChartImpl.d.ts → ChartImpl.d.ts} +1 -1
- package/dist/{packages/plugin-charts/src/ChartRenderer.d.ts → ChartRenderer.d.ts} +1 -1
- package/dist/{packages/plugin-charts/src/ObjectChart.d.ts → ObjectChart.d.ts} +3 -2
- package/dist/chartDrillEvents.d.ts +38 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +452 -259
- package/dist/index.umd.cjs +2 -2
- package/dist/{packages/plugin-charts/src/types.d.ts → types.d.ts} +1 -1
- package/package.json +10 -10
- package/dist/packages/plugin-charts/src/ObjectChart.stories.d.ts +0 -24
- package/dist/packages/plugin-charts/src/index.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,144 @@
|
|
|
1
1
|
# @object-ui/plugin-charts
|
|
2
2
|
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c5a7d6f: Bar-chart X-axis labels no longer overlap on narrow widgets. When a chart has
|
|
8
|
+
many categories (>4) or any long label (>8 chars), the tick labels are angled
|
|
9
|
+
(-32°) and truncated with a hover `title`; few short labels stay horizontal.
|
|
10
|
+
- cb2fdb1: feat(dashboard): expand drill-in — table/list row→record + scatter/treemap/sankey drill-through
|
|
11
|
+
|
|
12
|
+
Drill-in now covers the widgets that were missing it, and formalizes the two
|
|
13
|
+
interaction semantics mainstream BI/low-code platforms separate. `DrillDownConfig`
|
|
14
|
+
gains a `mode` discriminator: `'filter'` (drill-through: aggregate bucket → filtered
|
|
15
|
+
record list) and `'record'` (drill-to-record: a table/list row → that record's detail).
|
|
16
|
+
|
|
17
|
+
- Scatter, treemap and sankey charts now wire click → the existing filtered-record
|
|
18
|
+
drill drawer (radar excluded — no single clickable category point). The
|
|
19
|
+
Recharts-payload → drill-event mapping is extracted to pure, tested functions.
|
|
20
|
+
- Object-backed table/list widgets drill to the clicked record in a read-only detail
|
|
21
|
+
drawer (Sheet/Dialog), on by default (`drillDown:{enabled:false}` opts out). Field
|
|
22
|
+
labels and value formatting (incl. tenant-default currency) are shared with the
|
|
23
|
+
table cells so a value reads identically in both. An author-supplied `onRowClick`
|
|
24
|
+
still wins.
|
|
25
|
+
- The chart/KPI drill-through record lists now drill into a record too, completing the
|
|
26
|
+
segment → list → record chain.
|
|
27
|
+
|
|
28
|
+
- c3749eb: feat(dashboard): dataset chart widgets drill through to records
|
|
29
|
+
|
|
30
|
+
Dataset-bound **chart** widgets (bar/line/pie/area/donut/funnel/…) are now
|
|
31
|
+
click-drillable, matching table/pivot. Clicking a segment maps it back to its
|
|
32
|
+
dataset row and opens the same governed drill drawer (raw group keys preserved),
|
|
33
|
+
so a chart-only dashboard is no longer an exploration dead-end. This closes the
|
|
34
|
+
"object-backed chart drills but dataset chart doesn't" inconsistency and aligns
|
|
35
|
+
with mainstream BI (click a chart → see records).
|
|
36
|
+
|
|
37
|
+
- `@object-ui/core`: `findChartSeriesRow` — inverse of `buildChartSeries`,
|
|
38
|
+
maps a clicked `{category, series}` back to the source dataset row index
|
|
39
|
+
(matches both dims when a 2nd dimension is pivoted into series).
|
|
40
|
+
- `ObjectChart`: optional `onSegmentClick` lets a host own the chart click
|
|
41
|
+
(and suppress the widget's own object-drill).
|
|
42
|
+
- `DatasetWidget`: lifts the drill machinery to cover both table/pivot and
|
|
43
|
+
chart, and wires the chart's segment click to the precise dataset drill.
|
|
44
|
+
|
|
45
|
+
- 6cfa330: feat(dashboard): drill "Open in list" escape hatch + unify report drill
|
|
46
|
+
|
|
47
|
+
Adopts the mainstream BI peek-then-escalate drill model. Drill-through opens an
|
|
48
|
+
in-place drawer (keep context) and offers an "Open in list →" affordance to
|
|
49
|
+
escalate to the object's full list page (sort / bulk-select / export / shareable
|
|
50
|
+
URL) — the Looker / Power BI "see records → open in page" pattern.
|
|
51
|
+
|
|
52
|
+
- New `DrillNavigationContext` (`@object-ui/react`): the app shell provides
|
|
53
|
+
`openRecordList`; the renderer stays decoupled from console routing.
|
|
54
|
+
- The drill drawers (pivot / dataset / chart / KPI) render the escape hatch when
|
|
55
|
+
a host navigation handler is present, and hide it otherwise (self-contained
|
|
56
|
+
peek). `DashboardView` provides the handler via `useOpenRecordList`.
|
|
57
|
+
- `DrillDownConfig.target` gains `'navigate'` — skip the drawer and open the
|
|
58
|
+
list directly; degrades to `'drawer'` when no host handler is available.
|
|
59
|
+
- `ReportView` drill-through now opens the same in-place drawer (peek records →
|
|
60
|
+
click a row to open a record) instead of navigating away; the escape hatch
|
|
61
|
+
preserves the previous navigate-to-list behavior. Dashboard and report drill
|
|
62
|
+
are now unified.
|
|
63
|
+
- i18n: `dashboard.openInList` (en / zh).
|
|
64
|
+
|
|
65
|
+
- e270c7d: fix(chart): consume ADR-0021 `dataset` binding in list/object chart views
|
|
66
|
+
|
|
67
|
+
Chart views authored to the current spec (ADR-0021: `dataset` + `dimensions` +
|
|
68
|
+
`values`) previously rendered nothing — the renderers only read the **removed**
|
|
69
|
+
legacy inline `xAxisField` / `yAxisFields` / `aggregation` shape, so a
|
|
70
|
+
spec-compliant chart view showed an empty canvas. `ObjectChart` now runs the
|
|
71
|
+
governed `queryDataset` path when a chart binds to a dataset (the same path the
|
|
72
|
+
dashboard `DatasetWidget` uses, so numbers stay consistent), and `ListView` /
|
|
73
|
+
`ObjectView` emit the dataset shape. The legacy inline aggregate is kept as a
|
|
74
|
+
deprecated fallback so pre-ADR-0021 metadata keeps rendering.
|
|
75
|
+
|
|
76
|
+
Refs objectstack-ai/framework#1890
|
|
77
|
+
|
|
78
|
+
- ab168e4: Dashboard charts no longer render blank on first paint. Recharts'
|
|
79
|
+
`ResponsiveContainer` was a child of a `flex … justify-center` box, so it
|
|
80
|
+
collapsed to content width (0) on first paint inside react-grid-layout,
|
|
81
|
+
measured `width(-1)` and skipped drawing until a later resize fired its
|
|
82
|
+
ResizeObserver. The chart wrapper is now a definite-width block in both the
|
|
83
|
+
dashboard chart container (`plugin-charts/ChartContainerImpl`) and the shadcn
|
|
84
|
+
base (`components/ui/chart`). Follow-up changeset for #1634.
|
|
85
|
+
- Updated dependencies [5976ba3]
|
|
86
|
+
- Updated dependencies [a00e16d]
|
|
87
|
+
- Updated dependencies [eaccefd]
|
|
88
|
+
- Updated dependencies [f7f325d]
|
|
89
|
+
- Updated dependencies [c12986e]
|
|
90
|
+
- Updated dependencies [71d7ce0]
|
|
91
|
+
- Updated dependencies [053c948]
|
|
92
|
+
- Updated dependencies [89e113c]
|
|
93
|
+
- Updated dependencies [ddbe4a2]
|
|
94
|
+
- Updated dependencies [2d47e94]
|
|
95
|
+
- Updated dependencies [9049bbe]
|
|
96
|
+
- Updated dependencies [77cc6bb]
|
|
97
|
+
- Updated dependencies [6c0c92c]
|
|
98
|
+
- Updated dependencies [97c6831]
|
|
99
|
+
- Updated dependencies [cb2fdb1]
|
|
100
|
+
- Updated dependencies [c3749eb]
|
|
101
|
+
- Updated dependencies [c09f44e]
|
|
102
|
+
- Updated dependencies [6cfa330]
|
|
103
|
+
- Updated dependencies [ad8ade6]
|
|
104
|
+
- Updated dependencies [d54346c]
|
|
105
|
+
- Updated dependencies [3870c20]
|
|
106
|
+
- Updated dependencies [2eb3096]
|
|
107
|
+
- Updated dependencies [b88c560]
|
|
108
|
+
- Updated dependencies [0ad72a6]
|
|
109
|
+
- Updated dependencies [3fa23a7]
|
|
110
|
+
- Updated dependencies [18d0339]
|
|
111
|
+
- Updated dependencies [59b6bbb]
|
|
112
|
+
- Updated dependencies [d16566f]
|
|
113
|
+
- Updated dependencies [90acb7f]
|
|
114
|
+
- Updated dependencies [7913390]
|
|
115
|
+
- Updated dependencies [1394e34]
|
|
116
|
+
- Updated dependencies [e95cc25]
|
|
117
|
+
- Updated dependencies [abe8ebc]
|
|
118
|
+
- Updated dependencies [300d755]
|
|
119
|
+
- Updated dependencies [bd8b054]
|
|
120
|
+
- Updated dependencies [4eb9cb6]
|
|
121
|
+
- Updated dependencies [7c239fd]
|
|
122
|
+
- Updated dependencies [858ad94]
|
|
123
|
+
- Updated dependencies [2270239]
|
|
124
|
+
- Updated dependencies [2f31406]
|
|
125
|
+
- Updated dependencies [8d1195d]
|
|
126
|
+
- @object-ui/core@7.0.0
|
|
127
|
+
- @object-ui/components@7.0.0
|
|
128
|
+
- @object-ui/react@7.0.0
|
|
129
|
+
- @object-ui/i18n@7.0.0
|
|
130
|
+
- @object-ui/types@7.0.0
|
|
131
|
+
|
|
132
|
+
## 6.2.3
|
|
133
|
+
|
|
134
|
+
### Patch Changes
|
|
135
|
+
|
|
136
|
+
- @object-ui/types@6.2.3
|
|
137
|
+
- @object-ui/core@6.2.3
|
|
138
|
+
- @object-ui/i18n@6.2.3
|
|
139
|
+
- @object-ui/react@6.2.3
|
|
140
|
+
- @object-ui/components@6.2.3
|
|
141
|
+
|
|
3
142
|
## 6.2.2
|
|
4
143
|
|
|
5
144
|
### Patch Changes
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { ChartConfig } from './ChartContainerImpl';
|
|
2
|
+
/**
|
|
3
|
+
* ObjectUI
|
|
4
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from "react";
|
|
2
10
|
export interface AdvancedChartImplProps {
|
|
3
|
-
chartType?: 'bar' | 'column' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'scatter' | 'funnel' | 'combo';
|
|
11
|
+
chartType?: 'bar' | 'column' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'scatter' | 'funnel' | 'combo' | 'treemap' | 'sankey';
|
|
4
12
|
data?: Array<Record<string, any>>;
|
|
5
13
|
config?: ChartConfig;
|
|
6
14
|
xAxisKey?: string;
|
|
@@ -28,4 +36,4 @@ export interface AdvancedChartImplProps {
|
|
|
28
36
|
* AdvancedChartImpl - The heavy implementation that imports Recharts with full features
|
|
29
37
|
* This component is lazy-loaded to avoid including Recharts in the initial bundle
|
|
30
38
|
*/
|
|
31
|
-
export default function AdvancedChartImpl({ chartType: rawChartType, data: rawData, config, xAxisKey, series, className, onChartClick, }: AdvancedChartImplProps):
|
|
39
|
+
export default function AdvancedChartImpl({ chartType: rawChartType, data: rawData, config, xAxisKey, series, className, onChartClick, }: AdvancedChartImplProps): React.JSX.Element;
|
|
@@ -26,13 +26,13 @@ export type ChartConfig = {
|
|
|
26
26
|
declare function ChartContainer({ id, className, children, config, ...props }: React.ComponentProps<"div"> & {
|
|
27
27
|
config: ChartConfig;
|
|
28
28
|
children: React.ComponentProps<typeof ResponsiveContainer>["children"];
|
|
29
|
-
}):
|
|
29
|
+
}): React.JSX.Element;
|
|
30
30
|
declare const ChartStyle: ({ id, config }: {
|
|
31
31
|
id: string;
|
|
32
32
|
config: ChartConfig;
|
|
33
|
-
}) =>
|
|
33
|
+
}) => React.JSX.Element | null;
|
|
34
34
|
declare const ChartTooltip: typeof Tooltip;
|
|
35
|
-
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: any):
|
|
35
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: any): React.JSX.Element | null;
|
|
36
36
|
declare const ChartLegend: React.MemoExoticComponent<(outsideProps: import('recharts').LegendProps) => React.ReactPortal | null>;
|
|
37
|
-
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: any):
|
|
37
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: any): React.JSX.Element | null;
|
|
38
38
|
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
|
|
@@ -17,4 +17,4 @@ export interface ChartImplProps {
|
|
|
17
17
|
* ChartImpl - The heavy implementation that imports Recharts
|
|
18
18
|
* This component is lazy-loaded to avoid including Recharts in the initial bundle
|
|
19
19
|
*/
|
|
20
|
-
export default function ChartImpl({ data, dataKey, xAxisKey, height, className, color, }: ChartImplProps): import("react
|
|
20
|
+
export default function ChartImpl({ data, dataKey, xAxisKey, height, className, color, }: ChartImplProps): import("react").JSX.Element;
|
|
@@ -20,7 +20,7 @@ export interface ChartRendererProps {
|
|
|
20
20
|
type: string;
|
|
21
21
|
id?: string;
|
|
22
22
|
className?: string;
|
|
23
|
-
chartType?: 'bar' | 'column' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'scatter' | 'funnel' | 'combo';
|
|
23
|
+
chartType?: 'bar' | 'column' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'scatter' | 'funnel' | 'combo' | 'treemap' | 'sankey';
|
|
24
24
|
data?: Array<Record<string, any>>;
|
|
25
25
|
config?: Record<string, any>;
|
|
26
26
|
xAxisKey?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
/**
|
|
2
3
|
* Humanize a snake_case or kebab-case string into Title Case.
|
|
3
4
|
* Local implementation to avoid a dependency on @object-ui/fields.
|
|
@@ -27,5 +28,5 @@ export declare function aggregateRecords(records: any[], aggregate: {
|
|
|
27
28
|
* to perform any value→label conversion.
|
|
28
29
|
*/
|
|
29
30
|
export declare function resolveGroupByLabels(data: any[], groupByField: string, objectSchema: any, dataSource?: any, translateOption?: (value: string, fallbackLabel: string) => string): Promise<any[]>;
|
|
30
|
-
export { extractRecords } from '
|
|
31
|
-
export declare const ObjectChart: (props: any) =>
|
|
31
|
+
export { extractRecords } from '@object-ui/core';
|
|
32
|
+
export declare const ObjectChart: (props: any) => React.JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* Pure mappers from a Recharts element-click payload to the shared
|
|
9
|
+
* `{ category, series, value }` drill event consumed by ObjectChart's drill
|
|
10
|
+
* drawer. Kept separate from AdvancedChartImpl so the (Recharts-shape-sensitive)
|
|
11
|
+
* payload extraction can be unit-tested without rendering a chart.
|
|
12
|
+
*/
|
|
13
|
+
export interface ChartDrillEvent {
|
|
14
|
+
category?: string;
|
|
15
|
+
series?: string;
|
|
16
|
+
value?: number;
|
|
17
|
+
}
|
|
18
|
+
interface SeriesLike {
|
|
19
|
+
dataKey?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Scatter point click. Recharts spreads the data row onto the node and also
|
|
23
|
+
* exposes it under `.payload`; we read the category (xAxisKey) and the
|
|
24
|
+
* y-measure from whichever is present. Returns `null` when there's no category.
|
|
25
|
+
*/
|
|
26
|
+
export declare function mapScatterClick(node: any, xAxisKey: string, series: SeriesLike[] | undefined): ChartDrillEvent | null;
|
|
27
|
+
/**
|
|
28
|
+
* Treemap tile click. The node carries the category label as `name` and the
|
|
29
|
+
* measure as `value`/`size`. Returns `null` when there's no name.
|
|
30
|
+
*/
|
|
31
|
+
export declare function mapTreemapClick(node: any, series: SeriesLike[] | undefined): ChartDrillEvent | null;
|
|
32
|
+
/**
|
|
33
|
+
* Sankey click. Drill only on flow *nodes* (categories): links carry
|
|
34
|
+
* source/target indices but no `name`, and the synthetic root node (depth 0)
|
|
35
|
+
* aggregates everything. Returns `null` for those so they don't drill.
|
|
36
|
+
*/
|
|
37
|
+
export declare function mapSankeyClick(payload: any, series: SeriesLike[] | undefined): ChartDrillEvent | null;
|
|
38
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export {}
|
|
1
|
+
import { ChartBarRenderer, ChartRenderer } from './ChartRenderer';
|
|
2
|
+
export type { BarChartSchema } from './types';
|
|
3
|
+
export { ChartBarRenderer, ChartRenderer };
|
|
4
|
+
export { ObjectChart } from './ObjectChart';
|
|
5
|
+
export declare const chartComponents: {
|
|
6
|
+
'bar-chart': import('react').FC<import('./ChartRenderer').ChartBarRendererProps>;
|
|
7
|
+
chart: import('react').FC<import('./ChartRenderer').ChartRendererProps>;
|
|
8
|
+
};
|