@sisense/sdk-ui 2.31.1 → 2.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai.cjs +2 -2
- package/dist/ai.js +9 -9
- package/dist/analytics-composer/node.cjs +1 -1
- package/dist/analytics-composer/node.js +5 -5
- package/dist/analytics-composer.cjs +1 -1
- package/dist/analytics-composer.js +6 -6
- package/dist/apply-styled-options-to-query-CE3WQwRs.cjs +1 -0
- package/dist/{apply-styled-options-to-query-lFlufwrB.js → apply-styled-options-to-query-TW3CqofD.js} +209 -207
- package/dist/{flow-DHowZLKN.cjs → const-BLmTd3gM.cjs} +1 -1
- package/dist/{flow-Cs53Uv2Y.js → const-vJfedJf9.js} +15 -15
- package/dist/execute-query-CZOWu-Fh.cjs +1 -0
- package/dist/{execute-query-4_76L7Ax.js → execute-query-D-gXk-LI.js} +908 -906
- package/dist/index-Boixy7N4.cjs +1 -0
- package/dist/{index-C2A2EHoh.cjs → index-C6ytYe3A.cjs} +1 -1
- package/dist/{index-eIOG6LP6.js → index-Ct7mA7YB.js} +1 -1
- package/dist/{index-CyVSfJ-B.js → index-D3DsBxkp.js} +22 -22
- package/dist/{index-DCYw3JUB.js → index-DrI_xqvr.js} +14 -0
- package/dist/{index-DTvxJdqZ.cjs → index-UssOwVVX.cjs} +1 -1
- package/dist/index.cjs +340 -340
- package/dist/index.js +12477 -12340
- package/dist/index.umd.js +805 -690
- package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/utils.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/types.d.ts +22 -6
- package/dist/packages/sdk-ui/src/domains/query-execution/types.d.ts +2 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/components/regular-chart/has-no-results.d.ts +12 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/components/sisense-chart/sisense-chart.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/components/sisense-chart/types.d.ts +8 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/helpers/use-chart-on-ready.d.ts +38 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/helpers/use-chart-renderer-props.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/highchart-based-charts/highcharts-based-chart-renderer/highcharts-based-chart-renderer.d.ts +8 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/highchart-based-charts/sankey-chart/helpers/on-ready-state.d.ts +17 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/highchart-based-charts/sankey-chart/sankey-chart-builder.d.ts +8 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/data/comparison.d.ts +22 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/data/data.d.ts +17 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/data/index.d.ts +4 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/data/load-data.d.ts +64 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/data/value-colors.d.ts +27 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/data-options/data-options.d.ts +30 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/data-options/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/design-options/design-options.d.ts +31 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/design-options/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/kpi-chart-builder.d.ts +9 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/helpers.d.ts +139 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/kpi-card-styles.d.ts +154 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/kpi-card.d.ts +41 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/kpi-chart-renderer.d.ts +46 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/kpi-comparison.d.ts +60 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/kpi-sparkline.d.ts +23 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/kpi-title.d.ts +28 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/kpi-value.d.ts +55 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/on-color.d.ts +70 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/sparkline-options.d.ts +51 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/use-auto-fit-font-size.d.ts +98 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/use-element-size.d.ts +26 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/renderer/use-size-tier.d.ts +19 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/kpi-chart/types.d.ts +62 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/types.d.ts +47 -9
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/types.d.ts +9 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/kpi-chart.d.ts +23 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/apply-on-ready-to-highcharts-options.d.ts +11 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data/types.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/types.d.ts +108 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-options-processor/chart-options-service.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-options-processor/translations/design-options.d.ts +41 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-options-processor/translations/types.d.ts +17 -3
- package/dist/packages/sdk-ui/src/domains/visualizations/core/highcharts-renderer.d.ts +7 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-definition-style-constants.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/types.d.ts +1 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/use-chart-widget-excel-download.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/custom-widget/types.d.ts +1 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/filter-widget/filter-widget-dropdown.d.ts +16 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/filter-widget/types.d.ts +17 -23
- package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/types.d.ts +1 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget/types.d.ts +18 -4
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-dashboard-filters.d.ts +447 -447
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-panel-color-format.d.ts +8 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-filters.d.ts +56 -56
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/categorical-labels-style.d.ts +3 -3
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/series-label-affix-style.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/to-widget-dto-style.d.ts +11 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/types.d.ts +28 -5
- package/dist/packages/sdk-ui/src/domains/widgets/hooks/use-fire-on-ready.d.ts +14 -0
- package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/to-widget-dto-panels.d.ts +11 -1
- package/dist/packages/sdk-ui/src/infra/api/rest-api.d.ts +9 -2
- package/dist/packages/sdk-ui/src/infra/app/helpers.d.ts +23 -2
- package/dist/packages/sdk-ui/src/infra/app/settings/settings.d.ts +6 -3
- package/dist/packages/sdk-ui/src/infra/app/types.d.ts +14 -1
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/de-de.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/en-us.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-ar.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-es.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/fr-fr.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/it-it.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ja-jp.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ko-kr.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/nl-nl.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/pt-br.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ru-ru.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/tr-tr.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/zh-cn.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/en.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/index.d.ts +28 -0
- package/dist/packages/sdk-ui/src/props.d.ts +77 -5
- package/dist/packages/sdk-ui/src/public-api/beta.d.ts +4 -0
- package/dist/packages/sdk-ui/src/types.d.ts +296 -5
- package/dist/query.cjs +1 -1
- package/dist/query.js +3 -3
- package/dist/quota-notification-CdcItYEO.cjs +665 -0
- package/dist/{quota-notification-mCXOSF0U.js → quota-notification-DJPs09UQ.js} +17392 -15866
- package/dist/translations/de-de.cjs +1 -1
- package/dist/translations/de-de.js +15 -1
- package/dist/translations/en-us.cjs +1 -1
- package/dist/translations/en-us.js +1 -1
- package/dist/translations/es-ar.cjs +1 -1
- package/dist/translations/es-ar.js +15 -1
- package/dist/translations/es-es.cjs +1 -1
- package/dist/translations/es-es.js +15 -1
- package/dist/translations/fr-fr.cjs +1 -1
- package/dist/translations/fr-fr.js +17 -3
- package/dist/translations/it-it.cjs +1 -1
- package/dist/translations/it-it.js +15 -1
- package/dist/translations/ja-jp.cjs +1 -1
- package/dist/translations/ja-jp.js +15 -1
- package/dist/translations/ko-kr.cjs +1 -1
- package/dist/translations/ko-kr.js +15 -1
- package/dist/translations/nl-nl.cjs +1 -1
- package/dist/translations/nl-nl.js +15 -1
- package/dist/translations/pt-br.cjs +1 -1
- package/dist/translations/pt-br.js +15 -1
- package/dist/translations/ru-ru.cjs +1 -1
- package/dist/translations/ru-ru.js +15 -1
- package/dist/translations/tr-tr.cjs +1 -1
- package/dist/translations/tr-tr.js +15 -1
- package/dist/translations/zh-cn.cjs +1 -1
- package/dist/translations/zh-cn.js +15 -1
- package/dist/{types-CzQiy3kx.js → types-B60QjE1r.js} +1 -1
- package/dist/{types-pkCiWY_S.cjs → types-BAIldf5u.cjs} +1 -1
- package/dist/{use-execute-csv-query-DnTVUxCj.cjs → use-execute-csv-query-DAJqBzR5.cjs} +2 -2
- package/dist/{use-execute-csv-query-LtQrd2A4.js → use-execute-csv-query-tLJmsnwg.js} +6 -6
- package/dist/{utils-Bqaxp0gq.cjs → utils-BIAAcoFt.cjs} +12 -12
- package/dist/{utils-DHLPgrHF.js → utils-D2c9kOce.js} +1544 -1541
- package/dist/{widget-composer-CSkR-kBh.js → widget-composer-VWvON_Hi.js} +4 -4
- package/dist/{widget-composer-BUq7QhlK.cjs → widget-composer-srdW7lV4.cjs} +1 -1
- package/package.json +8 -8
- package/dist/apply-styled-options-to-query-siyJXPed.cjs +0 -1
- package/dist/execute-query-9rwu12er.cjs +0 -1
- package/dist/index-BGVJyEgp.cjs +0 -1
- package/dist/quota-notification-C49kSTz5.cjs +0 -550
|
@@ -22,5 +22,5 @@ type GetWidgetDataOptionsWithDrilldownParams = {
|
|
|
22
22
|
* @param params.drilldownOptions - The drilldown options of the widget.
|
|
23
23
|
* @returns The widget data options with drilldown applied.
|
|
24
24
|
*/
|
|
25
|
-
export declare function getWidgetDataOptionsWithDrilldown({ widgetType, chartType, dataOptions, drilldownOptions, }: GetWidgetDataOptionsWithDrilldownParams): import('../../../index.js').CategoricalChartDataOptions | import('../../../index.js').ScatterChartDataOptions | import('../../../index.js').IndicatorChartDataOptions | import('../../../index.js').BoxplotChartDataOptions | import('../../../index.js').BoxplotChartCustomDataOptions | import('../../../index.js').AreamapChartDataOptions | import('../../../index.js').ScattermapChartDataOptions | import('../../../index.js').RangeChartDataOptions | import('../../../index.js').CalendarHeatmapChartDataOptions | import('../../../index.js').SankeyChartDataOptions | import('../../../index.js').TableDataOptions | PivotTableDataOptions | GenericDataOptions;
|
|
25
|
+
export declare function getWidgetDataOptionsWithDrilldown({ widgetType, chartType, dataOptions, drilldownOptions, }: GetWidgetDataOptionsWithDrilldownParams): import('../../../index.js').CategoricalChartDataOptions | import('../../../index.js').ScatterChartDataOptions | import('../../../index.js').IndicatorChartDataOptions | import('../../../index.js').BoxplotChartDataOptions | import('../../../index.js').BoxplotChartCustomDataOptions | import('../../../index.js').AreamapChartDataOptions | import('../../../index.js').ScattermapChartDataOptions | import('../../../index.js').RangeChartDataOptions | import('../../../index.js').CalendarHeatmapChartDataOptions | import('../../../index.js').SankeyChartDataOptions | import('../../../index.js').KpiChartDataOptions | import('../../../index.js').TableDataOptions | PivotTableDataOptions | GenericDataOptions;
|
|
26
26
|
export {};
|
|
@@ -67,8 +67,10 @@ export interface DashboardWidgetsDeletedEvent {
|
|
|
67
67
|
payload: string[];
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
70
|
+
* `DashboardWidgetDateLevelChangedEvent` is emitted when a filter widget's date
|
|
71
|
+
* granularity is changed on the dashboard, letting an embedding host sync the widget's
|
|
72
|
+
* stored dimension metadata to the new level. The payload carries the affected widget's
|
|
73
|
+
* `oid` plus a JAQL-level descriptor of the new date granularity.
|
|
72
74
|
*
|
|
73
75
|
* @beta
|
|
74
76
|
*/
|
|
@@ -239,15 +241,29 @@ export interface WidgetsPanelConfig {
|
|
|
239
241
|
enabled?: boolean;
|
|
240
242
|
};
|
|
241
243
|
/**
|
|
242
|
-
* Configuration for
|
|
244
|
+
* Configuration for the "Download as Excel" action on all widgets in the panel,
|
|
245
|
+
* which adds an item to each widget's header menu that exports the widget's
|
|
246
|
+
* underlying data as an Excel (XLSX) file.
|
|
243
247
|
*
|
|
244
|
-
* @
|
|
248
|
+
* @example
|
|
249
|
+
* Enable Excel download for every widget in a dashboard:
|
|
250
|
+
* ```ts
|
|
251
|
+
* const dashboardConfig: DashboardConfig = {
|
|
252
|
+
* widgetsPanel: {
|
|
253
|
+
* actions: {
|
|
254
|
+
* downloadExcel: {
|
|
255
|
+
* enabled: true,
|
|
256
|
+
* },
|
|
257
|
+
* },
|
|
258
|
+
* },
|
|
259
|
+
* };
|
|
260
|
+
* ```
|
|
245
261
|
*/
|
|
246
262
|
downloadExcel?: {
|
|
247
263
|
/**
|
|
248
|
-
*
|
|
264
|
+
* Whether the "Download as Excel" action is enabled for all widgets in the panel.
|
|
249
265
|
*
|
|
250
|
-
*
|
|
266
|
+
* @default false
|
|
251
267
|
*/
|
|
252
268
|
enabled?: boolean;
|
|
253
269
|
};
|
|
@@ -386,6 +386,8 @@ export interface ExecuteCsvQueryParams extends Omit<ExecuteQueryParams, 'include
|
|
|
386
386
|
}
|
|
387
387
|
/**
|
|
388
388
|
* Parameters for {@link useExecuteExcelQueryInternal} (JAQL XLSX export).
|
|
389
|
+
*
|
|
390
|
+
* @internal
|
|
389
391
|
*/
|
|
390
392
|
export interface ExecuteExcelQueryParams extends Omit<ExecuteQueryParams, 'includeRowCount'> {
|
|
391
393
|
/** `false` = repeat rows (Angular default); `true` = merge rows. */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChartData } from '../../../../../../domains/visualizations/core/chart-data/types';
|
|
2
|
+
import { ChartType } from '../../../../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Returns whether prepared chart data has nothing to visualize
|
|
5
|
+
* (triggers the no-results overlay).
|
|
6
|
+
*
|
|
7
|
+
* @param chartType - Chart type used to interpret `chartData`.
|
|
8
|
+
* @param chartData - Prepared chart data for that type.
|
|
9
|
+
* @returns `true` when the chart should show an empty / no-results state.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function hasNoResults(chartType: ChartType, chartData: ChartData): boolean;
|
|
@@ -4,6 +4,6 @@ import { SisenseChartProps, SisenseChartType } from './types.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const SisenseChart: ({ chartType, chartData, dataOptions, designOptions, onDataPointClick, onDataPointContextMenu, onDataPointsSelected, onBeforeRender, size, }: SisenseChartProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export declare const SisenseChart: ({ chartType, chartData, dataOptions, designOptions, onDataPointClick, onDataPointContextMenu, onDataPointsSelected, onBeforeRender, onReady, size, }: SisenseChartProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
8
|
export declare const isSisenseChartType: (chartType: ChartType) => chartType is SisenseChartType;
|
|
9
9
|
export declare const isSisenseChartProps: (props: ChartRendererProps) => props is SisenseChartProps;
|
|
@@ -15,6 +15,14 @@ export interface SisenseChartProps {
|
|
|
15
15
|
onDataPointContextMenu?: SisenseChartDataPointEventHandler;
|
|
16
16
|
onDataPointsSelected?: SisenseChartDataPointsEventHandler;
|
|
17
17
|
onBeforeRender?: BeforeRenderHandler;
|
|
18
|
+
/**
|
|
19
|
+
* Called when Highcharts finishes painting the chart (`chart.events.load` /
|
|
20
|
+
* `render`). Used by RegularChart as the paint signal for the shared chart
|
|
21
|
+
* `onReady` readiness contract (see `BaseChartEventProps.onReady` in props).
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
onReady?: () => void;
|
|
18
26
|
size?: {
|
|
19
27
|
width?: number;
|
|
20
28
|
height?: number;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ChartData } from '../../../../../domains/visualizations/core/chart-data/types';
|
|
2
|
+
import { ChartType } from '../../../../../types';
|
|
3
|
+
type UseChartOnReadyInput = {
|
|
4
|
+
chartType: ChartType;
|
|
5
|
+
/** Whether a query / data sync is in progress. */
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
/** Whether data options have no attributes or measures. */
|
|
8
|
+
hasNoDimensions: boolean;
|
|
9
|
+
/** Prepared chart data, or `null` while unavailable. */
|
|
10
|
+
chartData: ChartData | null;
|
|
11
|
+
/** Consumer `onReady` callback to fire on each rising edge of readiness. */
|
|
12
|
+
onReady?: () => void;
|
|
13
|
+
};
|
|
14
|
+
type UseChartOnReadyResult = {
|
|
15
|
+
/**
|
|
16
|
+
* Paint signal handler to forward to the renderer via
|
|
17
|
+
* `ChartRendererProps.onReady`, or `undefined` when the chart type does not
|
|
18
|
+
* participate in the `onReady` contract.
|
|
19
|
+
*/
|
|
20
|
+
onRendererReady: (() => void) | undefined;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Wires the shared chart `onReady` (Fusion `domready` / PDF) readiness contract.
|
|
24
|
+
*
|
|
25
|
+
* Chart types opt in by declaring `onReady` on their `ChartBuilder`; this
|
|
26
|
+
* hook tracks the renderer paint flag, feeds it into the builder's readiness
|
|
27
|
+
* predicate together with the loading / data signals, and fires the consumer
|
|
28
|
+
* `onReady` callback via {@link useFireOnReady} on each rising edge. Chart types
|
|
29
|
+
* without the contract get a no-op (`onRendererReady` is `undefined`).
|
|
30
|
+
*
|
|
31
|
+
* Readiness lives here rather than inside the renderer because `onReady` must
|
|
32
|
+
* still fire in the empty / no-results case, where RegularChart shows a terminal
|
|
33
|
+
* overlay and the renderer never mounts.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export declare function useChartOnReady({ chartType, isLoading, hasNoDimensions, chartData, onReady, }: UseChartOnReadyInput): UseChartOnReadyResult;
|
|
38
|
+
export {};
|
|
@@ -15,6 +15,7 @@ type UnpreparedInternalChartProps = {
|
|
|
15
15
|
onDataPointContextMenu?: ChartProps['onDataPointContextMenu'];
|
|
16
16
|
onDataPointsSelected?: ChartProps['onDataPointsSelected'];
|
|
17
17
|
onBeforeRender?: ChartProps['onBeforeRender'];
|
|
18
|
+
onReady?: ChartProps['onReady'];
|
|
18
19
|
filters?: ChartProps['filters'];
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
@@ -14,6 +14,14 @@ export type HighchartsBasedChartRendererProps<CT extends HighchartBasedChartType
|
|
|
14
14
|
onDataPointContextMenu?: SisenseChartDataPointEventHandler;
|
|
15
15
|
onDataPointsSelected?: SisenseChartDataPointsEventHandler;
|
|
16
16
|
onBeforeRender?: BeforeRenderHandler;
|
|
17
|
+
/**
|
|
18
|
+
* Called when Highcharts finishes painting the chart (`chart.events.load` /
|
|
19
|
+
* `render`). Used by RegularChart as the paint signal for the shared chart
|
|
20
|
+
* `onReady` readiness contract (see `BaseChartEventProps.onReady` in props).
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
onReady?: () => void;
|
|
17
25
|
};
|
|
18
26
|
/**
|
|
19
27
|
* Creates a specific highcharts based chart renderer component
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChartOnReadyStateInput } from '../../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Rising-edge readiness for Sankey `onReady` (Fusion `domready` / PDF).
|
|
4
|
+
*
|
|
5
|
+
* Implements the `ChartBuilder.onReady` contract for Sankey — other
|
|
6
|
+
* Fusion widgets fire `domready` from their native Prism renderers, not via
|
|
7
|
+
* Compose SDK `Chart`, so they omit the contract.
|
|
8
|
+
*
|
|
9
|
+
* - Ready after Highcharts paint when not loading
|
|
10
|
+
* - Empty / no-dimensions: ready when the terminal overlay is shown **and**
|
|
11
|
+
* loading has finished (so empty→empty refetch still gets a false→true edge)
|
|
12
|
+
*
|
|
13
|
+
* @param state - Current loading, paint, and data signals.
|
|
14
|
+
* @returns `true` when the consumer `onReady` callback should fire for this cycle.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function isSankeyReadyForOnReady({ isLoading, rendererPainted, hasNoDimensions, chartData, }: ChartOnReadyStateInput): boolean;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { ChartBuilder } from '../../types.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Wires together data options, data, design options, and Highcharts renderer
|
|
4
|
+
* for the Sankey chart.
|
|
5
|
+
*
|
|
6
|
+
* `onReady` (Fusion `domready`): Highcharts paint is forwarded via
|
|
7
|
+
* `ChartRendererProps.onReady`; the `onReady` contract below tells RegularChart
|
|
8
|
+
* when to fire the consumer callback (see `helpers/on-ready-state.ts`).
|
|
9
|
+
*/
|
|
3
10
|
export declare const sankeyChartBuilder: ChartBuilder<'sankey'>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes a delta comparison (absolute and percent change) between `value` and `baseline`.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function calcDeltaComparison(value: number, baseline: number): {
|
|
6
|
+
deltaValue: number;
|
|
7
|
+
deltaPercent: number | undefined;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Computes a target comparison (percent of goal and remaining amount) between `value` and `target`.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function calcTargetComparison(value: number, target: number): {
|
|
14
|
+
percentOfTarget: number | undefined;
|
|
15
|
+
toGo: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the `'previous-period'` comparison's translation key for the given `trend` granularity,
|
|
19
|
+
* falling back to a granularity-agnostic key when `granularity` is missing or unrecognized.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function inferPeriodLabelKey(granularity: string | undefined): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { KpiChartDataOptionsInternal } from '../../../../../../../domains/visualizations/core/chart-data-options/types.js';
|
|
2
|
+
import { DataTable } from '../../../../../../../domains/visualizations/core/chart-data-processor/table-processor.js';
|
|
3
|
+
import { KpiChartData } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Converts a data table to KPI chart data.
|
|
6
|
+
*
|
|
7
|
+
* Without `trend`: a single-row query -- the headline is read straight from the first row.
|
|
8
|
+
*
|
|
9
|
+
* With `trend`: one row per time bucket. When the result was produced by the dual-query
|
|
10
|
+
* merge in `load-data.ts` (`valueMode: 'total'` with a `trend`), rows carry a
|
|
11
|
+
* {@link KPI_ROW_TYPE_COLUMN} marker; rows are split into per-bucket rows and the single
|
|
12
|
+
* ungrouped total row by that marker **before** any date-based processing runs, because the
|
|
13
|
+
* merged total row's date cell is a blank placeholder that parses to `NaN` -- letting it
|
|
14
|
+
* anywhere near bucket iteration, sparkline building, or prior-bucket lookups would corrupt
|
|
15
|
+
* them. When the marker column is absent (the single-query path), every row is a bucket.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getKpiChartData(dataOptions: KpiChartDataOptionsInternal, dataTable: DataTable): KpiChartData;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { QueryResultData } from '@sisense/sdk-data';
|
|
2
|
+
import type { TypedLoadDataFunction } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Name of the marker column appended to a KPI query result merged by
|
|
5
|
+
* {@link mergeTotalIntoResult}. Its presence in `columns` is how a consumer
|
|
6
|
+
* distinguishes a dual-query merged result from a plain single-query one --
|
|
7
|
+
* when the column is absent, every row is implicitly a `'bucket'` row.
|
|
8
|
+
*
|
|
9
|
+
* Reserved: this assumes no real dimension/measure is ever named `$kpiRowType`. A collision
|
|
10
|
+
* would misclassify a bucket row as the total row (or vice versa); not hardened against here
|
|
11
|
+
* (tracked separately as a follow-up).
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const KPI_ROW_TYPE_COLUMN = "$kpiRowType";
|
|
15
|
+
/**
|
|
16
|
+
* Marks a row of a KPI dual-query merged result as either a per-bucket data point
|
|
17
|
+
* (`'bucket'`, one per grouped date value) or the single ungrouped total row
|
|
18
|
+
* (`'total'`), appended under the {@link KPI_ROW_TYPE_COLUMN} column.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export type KpiRowType = 'bucket' | 'total';
|
|
22
|
+
/**
|
|
23
|
+
* Options accepted by {@link loadKpiData}, matching `TypedLoadDataFunction<'kpi'>`'s shape
|
|
24
|
+
* (`restructured-charts/types.ts`) -- kept as its own named alias since this module and its
|
|
25
|
+
* tests reference it directly.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export type LoadKpiDataOptions = Parameters<TypedLoadDataFunction<'kpi'>>[0];
|
|
29
|
+
/**
|
|
30
|
+
* Loads the data for a KPI chart.
|
|
31
|
+
*
|
|
32
|
+
* When `valueMode` is `'total'` and a `trend` dimension is configured, the headline
|
|
33
|
+
* value must be the aggregate over the *entire* period, not a combination of the
|
|
34
|
+
* per-bucket (e.g. per-month) values -- summing per-bucket averages, for instance,
|
|
35
|
+
* would be mathematically wrong. Correct SQL semantics require a second, ungrouped
|
|
36
|
+
* query (same measures, no dimensions) run alongside the regular grouped one; the
|
|
37
|
+
* two results are then merged (see {@link mergeTotalIntoResult}).
|
|
38
|
+
*
|
|
39
|
+
* In every other case (`valueMode: 'last'`, or `'total'` without a `trend`), a single
|
|
40
|
+
* regular query is sufficient and its result is returned untouched.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export declare const loadKpiData: (options: LoadKpiDataOptions) => Promise<QueryResultData>;
|
|
44
|
+
/**
|
|
45
|
+
* Merges a bucketed (grouped-by-date) KPI query result with an ungrouped total
|
|
46
|
+
* query result into a single {@link QueryResultData}.
|
|
47
|
+
*
|
|
48
|
+
* The merge appends a `{@link KPI_ROW_TYPE_COLUMN}` column (type `'string'`) to the
|
|
49
|
+
* bucketed columns. Every bucketed row is carried over unchanged with a `'bucket'`
|
|
50
|
+
* marker cell appended; one extra row is appended holding the total query's measure
|
|
51
|
+
* values -- prefixed with an empty cell in place of the (dropped) date bucket -- with
|
|
52
|
+
* a `'total'` marker cell.
|
|
53
|
+
*
|
|
54
|
+
* The total query is expected to carry exactly the bucketed result's measure
|
|
55
|
+
* columns (same measures, no dimensions), so its column count is used to work out
|
|
56
|
+
* how many leading (dimension) columns the bucketed result has and need an empty
|
|
57
|
+
* placeholder cell in the appended total row.
|
|
58
|
+
*
|
|
59
|
+
* An empty `total.rows` (the ungrouped query legitimately returning no row at all) has no
|
|
60
|
+
* measure cells to append -- rather than emit a total row holding only the marker cell (missing
|
|
61
|
+
* every measure value), the total row is omitted entirely and only the bucket rows are returned.
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export declare function mergeTotalIntoResult(bucketed: QueryResultData, total: QueryResultData): QueryResultData;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DataColorOptions, StyledMeasureColumn } from '../../../../../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the display color of a KPI value from the measure's color options
|
|
4
|
+
* (`StyledMeasureColumn.color`) — the same mechanism the indicator chart uses.
|
|
5
|
+
* Static (string/uniform) and conditional options are supported; range coloring
|
|
6
|
+
* needs a comparison population and is not applicable to a single KPI value.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveValueColor(styledMeasureColumn: StyledMeasureColumn, value: number | undefined): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the display color of a KPI comparison metric (`deltaPercent`/`percentOfTarget`)
|
|
11
|
+
* against the given color options, reusing the shared data-coloring evaluator
|
|
12
|
+
* (`getColoringServiceByColorOptions`) so conditional/uniform/range options behave
|
|
13
|
+
* identically to how they're evaluated elsewhere (indicator values, pivot table cells).
|
|
14
|
+
*
|
|
15
|
+
* - `metric === undefined` → `undefined` (renderer falls back to the default text color).
|
|
16
|
+
* - `colorOptions` provided → evaluated against `metric` via the shared evaluator.
|
|
17
|
+
* - No `colorOptions` → sign-based default: positive → green, negative → red, zero → undefined.
|
|
18
|
+
* - `'Relative'` (range) options → `undefined`, same as {@link resolveValueColor}: range coloring
|
|
19
|
+
* is meant to place a value within a population of other values, and a single comparison
|
|
20
|
+
* metric has no such population to place itself within -- even with an explicit
|
|
21
|
+
* `minValue`/`maxValue`, there's no other data point for "relative" to mean anything against.
|
|
22
|
+
* Left unrejected, the previous approach of feeding the interpolator a one-item population
|
|
23
|
+
* compounds this: with the (common) population-derived min/max, the metric always equals both
|
|
24
|
+
* bounds, so the interpolator collapses to its fixed midpoint color regardless of the metric's
|
|
25
|
+
* actual sign or magnitude -- a range-colored comparison that can never visibly vary.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveComparisonColor(colorOptions: DataColorOptions | undefined, metric: number | undefined): string | undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Attribute, Measure } from '@sisense/sdk-data';
|
|
2
|
+
import { ChartDataOptionsInternal, KpiChartDataOptions, KpiChartDataOptionsInternal } from '../../../../../../../domains/visualizations/core/chart-data-options/types.js';
|
|
3
|
+
import { ChartDataOptions } from '../../../../../../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Translates the public KPI data options into their internal, normalized shape.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function translateKpiChartDataOptions(dataOptions: KpiChartDataOptions): KpiChartDataOptionsInternal;
|
|
9
|
+
/**
|
|
10
|
+
* Extracts the attribute(s) a KPI chart's query needs, from its `trend` column when present.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function getKpiAttributes(dataOptions: KpiChartDataOptionsInternal): Attribute[];
|
|
14
|
+
/**
|
|
15
|
+
* Extracts every measure a KPI chart's query needs: the headline `value`, plus whichever
|
|
16
|
+
* comparison measure (`delta`/`target`/`value`) is configured.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function getKpiMeasures(dataOptions: KpiChartDataOptionsInternal): Measure[];
|
|
20
|
+
/**
|
|
21
|
+
* Checks whether the given chart data options are shaped as {@link KpiChartDataOptions}.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function isKpiChartDataOptions(dataOptions: ChartDataOptions): dataOptions is KpiChartDataOptions;
|
|
25
|
+
/**
|
|
26
|
+
* Checks whether the given internal chart data options are shaped as
|
|
27
|
+
* {@link KpiChartDataOptionsInternal}.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare function isKpiChartDataOptionsInternal(dataOptions: ChartDataOptionsInternal): dataOptions is KpiChartDataOptionsInternal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './data-options.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { KpiChartDataOptionsInternal } from '../../../../../../../domains/visualizations/core/chart-data-options/types.js';
|
|
2
|
+
import { KpiChartDesignOptions } from '../../../../../../../domains/visualizations/core/chart-options-processor/translations/design-options.js';
|
|
3
|
+
import { ChartStyleOptions, KpiStyleOptions } from '../../../../../../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Translates KPI style options to design options.
|
|
6
|
+
*
|
|
7
|
+
* @param styleOptions - User-provided KPI style options
|
|
8
|
+
* @param dataOptionsInternal - Translated data options, used to resolve data-dependent defaults
|
|
9
|
+
* @returns Translated design options for internal use
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function translateKpiStyleOptionsToDesignOptions(styleOptions: KpiStyleOptions, dataOptionsInternal: KpiChartDataOptionsInternal): KpiChartDesignOptions;
|
|
13
|
+
/**
|
|
14
|
+
* Checks whether the given style options are valid for KPI charts.
|
|
15
|
+
*
|
|
16
|
+
* @param styleOptions - Style options to validate
|
|
17
|
+
* @returns True if the style options are valid for KPI charts
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function isKpiStyleOptions(styleOptions: ChartStyleOptions): styleOptions is KpiStyleOptions;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the default style options for KPI charts.
|
|
23
|
+
*
|
|
24
|
+
* Data-dependent defaults (like sparkline visibility) are intentionally left unset here so that
|
|
25
|
+
* feeding this result back into {@link translateKpiStyleOptionsToDesignOptions} alongside the
|
|
26
|
+
* actual {@link KpiChartDataOptionsInternal} resolves them the same way as an empty object would.
|
|
27
|
+
*
|
|
28
|
+
* @returns Default KPI style options
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare function getDefaultKpiStyleOptions(): KpiStyleOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './design-options.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChartBuilder } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* KPI chart builder configuration.
|
|
4
|
+
*
|
|
5
|
+
* Provides a complete configuration for building KPI charts,
|
|
6
|
+
* including data processing, styling, and rendering capabilities.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const kpiChartBuilder: ChartBuilder<'kpi'>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { KpiComparisonInfo, KpiDataPoint, KpiIconCondition, KpiRenderOptions, NumberFormatConfig } from '../../../../../../../types.js';
|
|
2
|
+
import { KpiChartData, KpiComparisonData } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Caps the displayed percent difference so a near-zero baseline doesn't blow up the readout.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const MAX_DISPLAY_PERCENT_DIFF = 999.99;
|
|
8
|
+
/**
|
|
9
|
+
* Formats a KPI number through the shared number-format pipeline (plain text, no markup).
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatKpiValue(value: number, config?: NumberFormatConfig): string;
|
|
13
|
+
/**
|
|
14
|
+
* Computes the non-circular height budget for whichever of value/comparison plays the
|
|
15
|
+
* "headline" (auto-fit) role in `BodyArea`: its `flex: 0 0 auto` sibling's own box is
|
|
16
|
+
* content-sized, so subtracting the *sibling's* measured height (plus the gap between them) from
|
|
17
|
+
* `BodyArea`'s own (grid-derived, safe-to-self-measure) height gives the headline element's real
|
|
18
|
+
* available height -- see `use-auto-fit-font-size.ts`'s `maxHeightPxOverride` TSDoc for why this
|
|
19
|
+
* indirection is needed at all. Clamped to 0 so a not-yet-measured (0-height) `BodyArea` -- or a
|
|
20
|
+
* compact sibling briefly taller than `BodyArea` mid-resize -- never yields a negative budget.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function computeHeadlineMaxHeightPx(bodyHeightPx: number, compactSiblingHeightPx: number, gapPx: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Formats a percent difference with an explicit sign, capped at {@link MAX_DISPLAY_PERCENT_DIFF}.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatPercentDiff(percentDiff: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* A percent diff is only worth displaying when it's a finite, non-extreme number.
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare function isMeaningfulPercentDiff(percentDiff: number | undefined): percentDiff is number;
|
|
34
|
+
/**
|
|
35
|
+
* Formats a delta value with an explicit sign, e.g. `+$1.2K` / `-$3.4K`.
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatDeltaValue(deltaValue: number, config?: NumberFormatConfig): string;
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the first icon condition matching `value` (first-match-wins), or `undefined` when
|
|
41
|
+
* nothing matches or an input is missing.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveConditionalIcon(conditions: KpiIconCondition[] | undefined, value: number | undefined): KpiIconCondition | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Builds the readout text for a delta-shaped comparison (`'previous-period'`/`'delta'`),
|
|
47
|
+
* honoring `display`. `deltaValue` is guaranteed on this shape, so every branch always resolves
|
|
48
|
+
* to a string (falling back to the formatted absolute delta when the percent isn't meaningful).
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare function formatDelta(comparison: {
|
|
52
|
+
deltaValue: number;
|
|
53
|
+
deltaPercent?: number;
|
|
54
|
+
}, display: 'percent' | 'value' | 'both', numberFormatConfig?: NumberFormatConfig): string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Picks the metric a comparison's color (and conditional icon) should be evaluated against, per
|
|
57
|
+
* the contract documented on {@link KpiComparisonInfo} / `KpiComparisonStyleOptions.color`:
|
|
58
|
+
* delta-shaped comparisons compare on `deltaPercent`, `'target'` compares on `percentOfTarget`,
|
|
59
|
+
* and `'value'` has no applicable metric here -- it's colored by its own measure instead.
|
|
60
|
+
*
|
|
61
|
+
* A zero baseline leaves `deltaPercent` undefined (division by zero); this deliberately does
|
|
62
|
+
* NOT fall back to `deltaValue` -- an absolute delta isn't the same unit as a user's percent
|
|
63
|
+
* condition (e.g. `> 5` meaning 5%), and sign-based default coloring would misapply too.
|
|
64
|
+
* `undefined` means "no metric to evaluate against", which `resolveComparisonColor` /
|
|
65
|
+
* `resolveConditionalIcon` both already treat as no color / no icon.
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export declare function metricFor(comparison: {
|
|
69
|
+
type: string;
|
|
70
|
+
deltaValue?: number;
|
|
71
|
+
deltaPercent?: number;
|
|
72
|
+
percentOfTarget?: number;
|
|
73
|
+
}): number | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Translates the internal {@link KpiComparisonData} into the public {@link KpiComparisonInfo}
|
|
76
|
+
* shape exposed to `onBeforeRender`/`onDataPointClick` consumers, resolving `'previous-period'`'s
|
|
77
|
+
* `labelKey` to display text via `t()`. Internal-only rendering metadata (`color`,
|
|
78
|
+
* `numberFormatConfig`) is intentionally dropped -- it's not part of the public contract.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export declare function toKpiComparisonInfo(comparison: KpiComparisonData, t: (key: string) => string): KpiComparisonInfo;
|
|
82
|
+
/**
|
|
83
|
+
* Builds the public {@link KpiRenderOptions} passed to `onBeforeRender`, translating the
|
|
84
|
+
* comparison's `labelKey` (when present) to display text up front -- this always runs, whether
|
|
85
|
+
* or not a consumer supplied `onBeforeRender`, so the label is resolved exactly once per render.
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
export declare function toKpiRenderOptions(chartData: KpiChartData, t: (key: string) => string): KpiRenderOptions;
|
|
89
|
+
/**
|
|
90
|
+
* Builds the click/context-menu payload from the (possibly `onBeforeRender`-adjusted) render options.
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
export declare function toKpiDataPoint(renderOptions: KpiRenderOptions): KpiDataPoint;
|
|
94
|
+
/**
|
|
95
|
+
* Comparison data shaped for display: same as {@link KpiComparisonData}, but with
|
|
96
|
+
* `'previous-period'`'s `labelKey` already resolved to `label` (matching `'delta'`'s shape), so
|
|
97
|
+
* `kpi-comparison.tsx` only ever needs to read `label`.
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
export type KpiComparisonDisplay = {
|
|
101
|
+
type: 'previous-period' | 'delta';
|
|
102
|
+
baseline: number;
|
|
103
|
+
deltaValue: number;
|
|
104
|
+
deltaPercent?: number;
|
|
105
|
+
label: string;
|
|
106
|
+
color?: string;
|
|
107
|
+
} | {
|
|
108
|
+
type: 'target';
|
|
109
|
+
target: number;
|
|
110
|
+
percentOfTarget?: number;
|
|
111
|
+
toGo: number;
|
|
112
|
+
label: string;
|
|
113
|
+
color?: string;
|
|
114
|
+
} | {
|
|
115
|
+
type: 'value';
|
|
116
|
+
value: number;
|
|
117
|
+
label: string;
|
|
118
|
+
color?: string;
|
|
119
|
+
numberFormatConfig?: NumberFormatConfig;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Combines the (possibly `onBeforeRender`-modified) public comparison info with the internal-only
|
|
123
|
+
* metadata (`color`, `numberFormatConfig`) that never left `original` in the first place, so the
|
|
124
|
+
* card can display a consumer's numeric/label override without losing its coloring/formatting.
|
|
125
|
+
* The metadata is only carried over when the type is unchanged -- if a consumer's callback swaps
|
|
126
|
+
* the comparison type entirely, there's no matching original metadata to reuse.
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
export declare function toComparisonDisplay(original: KpiComparisonData | undefined, publicInfo: KpiComparisonInfo): KpiComparisonDisplay;
|
|
130
|
+
/**
|
|
131
|
+
* Builds the comparison segment of the card's `aria-label`, e.g. `'+20.00% vs prior month'`.
|
|
132
|
+
*
|
|
133
|
+
* For `'target'` comparisons the summary follows the same `display` semantics as the visible
|
|
134
|
+
* readout (see `kpi-comparison.tsx`), so assistive tech never hears content that isn't shown:
|
|
135
|
+
* `'percent'` reads the percent-of-goal line, `'value'` the amount-to-go line, `'both'` reads
|
|
136
|
+
* both; an unavailable percent falls back to the amount-to-go line.
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
export declare function summarizeComparisonForAria(comparison: KpiComparisonDisplay, numberFormatConfig: NumberFormatConfig | undefined, display?: 'percent' | 'value' | 'both'): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './kpi-chart-renderer.js';
|