@sisense/sdk-ui 2.28.0 → 2.29.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 +1 -1
- package/dist/ai.js +5 -5
- package/dist/analytics-composer/node.cjs +1 -1
- package/dist/analytics-composer/node.js +1256 -1203
- package/dist/analytics-composer.cjs +7 -7
- package/dist/analytics-composer.js +19 -18
- package/dist/apply-styled-options-to-query-CaP4IMrQ.js +6379 -0
- package/dist/apply-styled-options-to-query-D5D8pRl2.cjs +1 -0
- package/dist/index.cjs +398 -398
- package/dist/index.js +22490 -21772
- package/dist/index.umd.js +700 -700
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/get-dashboard-model.d.ts +7 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/translate-dashboard-utils.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/persist-dashboard-model-middleware.d.ts +10 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/types.d.ts +29 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-widget-updates-persistence.d.ts +27 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/deep-merge.d.ts +17 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/types.d.ts +15 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/update-types.d.ts +51 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/data.d.ts +0 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data/filter-and-aggregate-chart-data.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/types.d.ts +27 -23
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/utils.d.ts +4 -4
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/filter-to-readable-label.d.ts +14 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-definition.d.ts +5 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill.d.ts +5 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/truncate-pill-label.d.ts +10 -0
- package/dist/packages/sdk-ui/src/domains/widgets/change-events.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/custom-widget/types.d.ts +11 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/pivot-table-widget.d.ts +15 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/to-widget-dto-style.d.ts +41 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/types.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/widgets/hooks/use-track-widget-init.d.ts +44 -0
- package/dist/packages/sdk-ui/src/domains/widgets/hooks/widget-entity-id.d.ts +30 -0
- package/dist/packages/sdk-ui/src/domains/widgets/hooks/widget-tracking-adapters.d.ts +41 -0
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-style-utils.d.ts +29 -0
- package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/to-widget-dto-panels.d.ts +29 -1
- package/dist/packages/sdk-ui/src/infra/api/rest-api.d.ts +2 -1
- package/dist/packages/sdk-ui/src/infra/app/settings/settings.d.ts +1 -7
- package/dist/packages/sdk-ui/src/infra/app/settings/types/features.d.ts +1 -9
- package/dist/packages/sdk-ui/src/infra/app/types.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/contexts/sisense-context/sisense-context-provider.d.ts +1 -1
- package/dist/packages/sdk-ui/src/infra/formatting/format-data-set.d.ts +21 -0
- package/dist/packages/sdk-ui/src/infra/formatting/format-date.d.ts +67 -0
- package/dist/packages/sdk-ui/src/infra/formatting/format-number.d.ts +24 -0
- package/dist/packages/sdk-ui/src/infra/formatting/index.d.ts +5 -0
- package/dist/packages/sdk-ui/src/infra/modules/build-module-graph.d.ts +31 -0
- package/dist/packages/sdk-ui/src/infra/modules/build-module-registry.d.ts +31 -0
- package/dist/packages/sdk-ui/src/infra/modules/core-module-providers-tree.d.ts +11 -0
- package/dist/packages/sdk-ui/src/infra/modules/core-module.d.ts +26 -0
- package/dist/packages/sdk-ui/src/infra/modules/index.d.ts +3 -0
- package/dist/packages/sdk-ui/src/infra/modules/module-provider.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/modules/modules-context.d.ts +20 -0
- package/dist/packages/sdk-ui/src/infra/modules/types.d.ts +79 -0
- package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/types.d.ts +52 -2
- package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/widget-plugin-registry.d.ts +3 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/dimensions/get-dimension-name.d.ts +9 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/dimensions/translate-dimensions-to-json.d.ts +4 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/filters/get-filter-name.d.ts +10 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/filters/translate-filters-to-json.d.ts +3 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/get-query-element-summary.d.ts +23 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/measures/get-measure-name.d.ts +10 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/measures/translate-measures-to-json.d.ts +4 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/index.d.ts +3 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/query/translate-query-from-json.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/query/translate-query-to-json.d.ts +4 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/data-options/adapters.d.ts +3 -2
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/data-options/index.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/types.d.ts +70 -9
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/widget/helpers/to-widget-props.d.ts +3 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/widget/helpers/translate-envelope-widget-from-json.d.ts +2 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/types.d.ts +1 -18
- package/dist/packages/sdk-ui/src/props.d.ts +9 -0
- package/dist/packages/sdk-ui/src/public-api/alpha.d.ts +3 -0
- package/dist/packages/sdk-ui/src/public-api/public.d.ts +3 -1
- package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +1 -1
- package/dist/packages/sdk-ui/src/shared/components/loading-overlay.d.ts +1 -0
- package/dist/packages/sdk-ui/src/shared/hooks/use-element-height.d.ts +19 -0
- package/dist/packages/sdk-ui/src/shared/hooks/use-synced-state.d.ts +23 -2
- package/dist/packages/sdk-ui/src/shared/utils/filter-relations.d.ts +8 -0
- package/dist/packages/sdk-ui/src/shared/utils/gradient.d.ts +5 -0
- package/dist/types-7YG0uOzO.js +74 -0
- package/dist/{types-CzgBH2kL.cjs → types-DlYJ_DZ0.cjs} +1 -1
- package/dist/{use-hover-CaSOzp0i.cjs → use-hover-CANskYrn.cjs} +127 -127
- package/dist/{use-hover-B6VmMb06.js → use-hover-Dju4Dcv3.js} +11021 -10942
- package/dist/{utils-CsV-iYtb.js → utils-BKRpWUGm.js} +1061 -1058
- package/dist/{utils-BwGnDoB0.cjs → utils-C4PIba42.cjs} +10 -10
- package/dist/{widget-composer-C72Io-3c.cjs → widget-composer-BXEyx308.cjs} +1 -1
- package/dist/{widget-composer-Bv_OVu1o.js → widget-composer-DRDw1oBF.js} +3 -3
- package/package.json +9 -8
- package/dist/apply-styled-options-to-query-23D9br-S.cjs +0 -1
- package/dist/apply-styled-options-to-query-BagjzMqm.js +0 -5992
- package/dist/dimensions-Bn1EaWiP.js +0 -204
- package/dist/dimensions-D8r34WRI.cjs +0 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-widget-scroll-persistence.d.ts +0 -16
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/with-navigator-scroll-save.d.ts +0 -10
- package/dist/types-D3fPN43o.js +0 -74
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { PivotGrandTotals } from '@sisense/sdk-data';
|
|
2
|
+
import type { BoxWhiskerType } from '../../../../../domains/visualizations/core/chart-data-options/types.js';
|
|
2
3
|
import { AppSettings } from '../../../../../infra/app/settings/settings.js';
|
|
3
|
-
import type { AreamapType, AreaStyleOptions, AxisLabel, CompleteThemeSettingsInternal, DataLimits, FunnelStyleOptions, IndicatorStyleOptions, LegendOptions, LineStyleOptions, LineWidth, Markers, Navigator, PieStyleOptions, PivotTableWidgetStyleOptions, PolarStyleOptions, ScattermapStyleOptions, ScatterStyleOptions, SeriesLabels, StackableStyleOptions, SunburstStyleOptions, TableStyleOptions, TreemapStyleOptions, WidgetStyleOptions } from '../../../../../types.js';
|
|
4
|
-
import type { AxisStyle, CartesianWidgetStyle, FunnelWidgetStyle, PivotWidgetStyle, PolarWidgetStyle, ScattermapWidgetStyle, ScatterWidgetStyle, SunburstWidgetStyle, TableWidgetStyle, TreemapWidgetStyle, WidgetDesign, WidgetStyle, WidgetSubtype } from '../types.js';
|
|
4
|
+
import type { AreamapType, AreaStyleOptions, AxisLabel, BoxplotStyleOptions, CalendarHeatmapStyleOptions, CompleteThemeSettingsInternal, DataLimits, FunnelStyleOptions, IndicatorStyleOptions, LegendOptions, LineStyleOptions, LineWidth, Markers, Navigator, PieStyleOptions, PivotTableWidgetStyleOptions, PolarStyleOptions, ScattermapStyleOptions, ScatterStyleOptions, SeriesLabels, StackableStyleOptions, SunburstStyleOptions, TableStyleOptions, TreemapStyleOptions, WidgetStyleOptions } from '../../../../../types.js';
|
|
5
|
+
import type { AxisStyle, BoxplotWidgetStyle, CalendarHeatmapWidgetStyle, CartesianWidgetStyle, FunnelWidgetStyle, PivotWidgetStyle, PolarWidgetStyle, ScattermapWidgetStyle, ScatterWidgetStyle, SunburstWidgetStyle, TableWidgetStyle, TreemapWidgetStyle, WidgetDesign, WidgetStyle, WidgetSubtype } from '../types.js';
|
|
5
6
|
/**
|
|
6
7
|
* Maps SDK legend options to Fusion DTO legend style.
|
|
7
8
|
*
|
|
@@ -211,6 +212,44 @@ export declare function toScattermapWidgetStyle(styleOptions: ScattermapStyleOpt
|
|
|
211
212
|
* @internal
|
|
212
213
|
*/
|
|
213
214
|
export declare function toAreamapSubtype(mapType?: AreamapType): 'areamap/world' | 'areamap/usa';
|
|
215
|
+
/**
|
|
216
|
+
* Converts boxplot style options to Fusion BoxplotWidgetStyle DTO.
|
|
217
|
+
* Inverse of `extractBoxplotChartStyleOptions`.
|
|
218
|
+
*
|
|
219
|
+
* The whisker algorithm (`boxType`) and `outliersEnabled` flag live on
|
|
220
|
+
* {@link BoxplotChartDataOptions} in the WidgetModel rather than on `styleOptions`,
|
|
221
|
+
* so they are passed in separately. `boxType` defaults to `'iqr'` — the same default
|
|
222
|
+
* the boxplot translator falls back to when no whisker flag is selected.
|
|
223
|
+
*
|
|
224
|
+
* @param styleOptions - Boxplot style options from WidgetModel.styleOptions
|
|
225
|
+
* @param boxType - Whisker algorithm from WidgetModel.dataOptions.boxType
|
|
226
|
+
* @param outliersEnabled - Whether to render boxplot outliers
|
|
227
|
+
* @returns Fusion BoxplotWidgetStyle for the widget DTO
|
|
228
|
+
* @internal
|
|
229
|
+
*/
|
|
230
|
+
export declare function toBoxplotWidgetStyle(styleOptions: BoxplotStyleOptions, boxType?: BoxWhiskerType, outliersEnabled?: boolean): BoxplotWidgetStyle;
|
|
231
|
+
/**
|
|
232
|
+
* Converts calendar-heatmap style options to Fusion CalendarHeatmapWidgetStyle DTO.
|
|
233
|
+
* Inverse of {@link extractCalendarHeatmapChartStyleOptions}.
|
|
234
|
+
*
|
|
235
|
+
* Only the fields the inverse extractor reads are round-trippable. Cosmetic fields
|
|
236
|
+
* that the extractor synthesizes from {@link CALENDAR_HEATMAP_DEFAULTS}
|
|
237
|
+
* (`monthLabels.enabled`, `weekends.cellColor`, `weekends.hideValues`,
|
|
238
|
+
* `pagination.enabled`) are not written back because the Fusion DTO has no fields
|
|
239
|
+
* for them.
|
|
240
|
+
*
|
|
241
|
+
* The CSDK `subtype` (`'calendar-heatmap/split' | 'calendar-heatmap/continuous'`)
|
|
242
|
+
* is NOT the DTO `subtype` — the DTO uses `'heatmap'` and encodes view as the
|
|
243
|
+
* `'view/weekly'` / `'view/monthly'` style flags.
|
|
244
|
+
*
|
|
245
|
+
* `pagination.startMonth` is emitted as `{year, month}` because Fusion's startMonth
|
|
246
|
+
* object form is the canonical write shape; the string form is read-only legacy input.
|
|
247
|
+
*
|
|
248
|
+
* @param styleOptions - Calendar heatmap style options from WidgetModel.styleOptions
|
|
249
|
+
* @returns Fusion CalendarHeatmapWidgetStyle for the widget DTO
|
|
250
|
+
* @internal
|
|
251
|
+
*/
|
|
252
|
+
export declare function toCalendarHeatmapWidgetStyle(styleOptions: CalendarHeatmapStyleOptions): CalendarHeatmapWidgetStyle;
|
|
214
253
|
/**
|
|
215
254
|
* Converts table style options to Fusion TableWidgetStyle DTO.
|
|
216
255
|
* Used when serializing a table widget back to WidgetDto.
|
|
@@ -77,6 +77,12 @@ export interface WidgetDto {
|
|
|
77
77
|
supportsHierarchies?: boolean;
|
|
78
78
|
imageColumns?: number[];
|
|
79
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Custom-widget-specific runtime options bag, persisted across reloads for
|
|
82
|
+
* custom (plugin) widgets. Round-trips opaquely between the Fusion DTO and the
|
|
83
|
+
* CSDK widget model's `customOptions`.
|
|
84
|
+
*/
|
|
85
|
+
customOptions?: Record<string, unknown>;
|
|
80
86
|
source?: any;
|
|
81
87
|
owner?: string;
|
|
82
88
|
userId?: string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { WidgetType } from '../components/widget/types';
|
|
2
|
+
/**
|
|
3
|
+
* Fully resolved options for {@link useTrackWidgetInit}. The caller (a leaf widget) is
|
|
4
|
+
* responsible for deriving each field from its own props so the hook stays free of
|
|
5
|
+
* widget-shape concerns and runtime type casts.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export type UseTrackWidgetInitOptions = {
|
|
10
|
+
/** Widget type (chart / pivot / text / custom). */
|
|
11
|
+
widgetType: WidgetType;
|
|
12
|
+
/** Resolved widget kind — chart subtype, plugin name, or fixed string for pivot/text. */
|
|
13
|
+
widgetName: string;
|
|
14
|
+
/** Widget title entered by the designer, or `null` if absent. */
|
|
15
|
+
widgetTitle: string | null;
|
|
16
|
+
/** Stable unique widget identifier — the widget id/OID when available, otherwise a content hash. */
|
|
17
|
+
entityId: string;
|
|
18
|
+
/**
|
|
19
|
+
* When `false`, the event is suppressed. Pass the caller's render preconditions here
|
|
20
|
+
* (e.g. `!!(chartType && dataOptions)` for `ChartWidget`) so we do not count mounts
|
|
21
|
+
* whose render body early-returns `null`. The event fires once when this flips to `true`.
|
|
22
|
+
*
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Fires the `sdkWidgetInit` tracking event exactly once per widget mount.
|
|
29
|
+
*
|
|
30
|
+
* Behavioral note: unlike `useTrackComponentInit`, this hook intentionally
|
|
31
|
+
* IGNORES `TrackingContextProvider`'s skip-nested signal. Widgets rendered inside
|
|
32
|
+
* a tracked parent (e.g. a `<Dashboard>`) must still emit `sdkWidgetInit`, since
|
|
33
|
+
* the event must count every widget render regardless of nesting.
|
|
34
|
+
*
|
|
35
|
+
* The payload includes envelope overrides (`eventType: 'action'`,
|
|
36
|
+
* `featureName: 'composesdk'`, `entityType: 'widget'`) that override the defaults
|
|
37
|
+
* set by `trackProductEvent`, as required by the data-tracking spec.
|
|
38
|
+
*
|
|
39
|
+
* `widgetTitle` is emitted as `null` rather than `undefined` when absent, matching the
|
|
40
|
+
* spec's "null or [empty]" wire convention.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export declare const useTrackWidgetInit: (options: UseTrackWidgetInitOptions) => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type DataSource } from '@sisense/sdk-data';
|
|
2
|
+
import type { ChartDataOptions, PivotTableDataOptions } from '../../../domains/visualizations/core/chart-data-options/types';
|
|
3
|
+
import type { GenericDataOptions } from '../../../types';
|
|
4
|
+
import type { WidgetType } from '../components/widget/types';
|
|
5
|
+
/** Union of every widget's `dataOptions` shape (chart, pivot, custom). */
|
|
6
|
+
type WidgetDataOptions = ChartDataOptions | PivotTableDataOptions | GenericDataOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Resolves a stable, unique `entityId` for a widget tracking event.
|
|
9
|
+
*
|
|
10
|
+
* Prefers the widget's own `id` (the Fusion widget OID when loaded via `WidgetById` /
|
|
11
|
+
* `DashboardById`, or the user-supplied id when composed). When no id is available — e.g. a
|
|
12
|
+
* standalone `<ChartWidget>` — it falls back to a deterministic hash of the widget's identity:
|
|
13
|
+
* its type, name, title, the column names of its `dataOptions`, and its data source. Two
|
|
14
|
+
* structurally identical standalone widgets therefore resolve to the same id, which is the
|
|
15
|
+
* desired behavior for adoption tracking. The fallback is prefixed with `hash:` so downstream
|
|
16
|
+
* consumers can tell a generated identifier apart from a real widget id/OID.
|
|
17
|
+
*
|
|
18
|
+
* Typed with a generic + intersection so callers pass their concrete widget prop type while the
|
|
19
|
+
* optional `id` / `dataOptions` / `dataSource` are read uniformly (e.g. `TextWidgetProps` declares
|
|
20
|
+
* none of them).
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare const getWidgetEntityId: <P extends object>(props: P & {
|
|
25
|
+
id?: string | undefined;
|
|
26
|
+
title?: string | undefined;
|
|
27
|
+
dataOptions?: WidgetDataOptions | undefined;
|
|
28
|
+
dataSource?: DataSource | undefined;
|
|
29
|
+
}, widgetType: WidgetType, widgetName: string) => string;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ChartWidgetProps } from '../../../domains/widgets/components/chart-widget/types';
|
|
2
|
+
import type { CustomWidgetProps } from '../../../domains/widgets/components/custom-widget/types';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the `widgetName` tracking field for a chart widget — the visualization subtype
|
|
5
|
+
* (e.g. `'line'`, `'column'`, `'pie'`, `'streamgraph'`).
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const getChartWidgetName: (props: Pick<ChartWidgetProps, 'chartType'>) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Resolves the `widgetName` tracking field for a pivot table widget.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const getPivotWidgetName: () => string;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the `widgetName` tracking field for a text widget.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare const getTextWidgetName: () => string;
|
|
22
|
+
/**
|
|
23
|
+
* Resolves the `widgetName` tracking field for a custom widget — the registered plugin name
|
|
24
|
+
* (e.g. `'my-org-bullet-chart'`).
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare const getCustomWidgetName: (props: Pick<CustomWidgetProps, 'customWidgetType'>) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Reads the widget's user-facing title from props if present, otherwise `null`.
|
|
31
|
+
*
|
|
32
|
+
* Typed with a generic + intersection so callers preserve their concrete widget prop type
|
|
33
|
+
* (`ChartWidgetProps`, `PivotTableWidgetProps`, …) while making the contract — "I read an
|
|
34
|
+
* optional `title`" — explicit. The intersection sidesteps the weak-type heuristic that
|
|
35
|
+
* would otherwise reject `TextWidgetProps`, which declares no `title`.
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare const getWidgetTitle: <P extends object>(props: P & {
|
|
40
|
+
title?: string | undefined;
|
|
41
|
+
}) => string | null;
|
|
@@ -12,3 +12,32 @@ export declare enum WidgetSpaceAround {
|
|
|
12
12
|
'Small' = "5px"
|
|
13
13
|
}
|
|
14
14
|
export declare const getShadowValue: (styleOptions: WidgetContainerStyleOptions | undefined, themeSettings: CompleteThemeSettingsInternal) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the effective "space around" value, in pixels, that the widget container applies
|
|
17
|
+
* as padding on each side. Reads from the widget's style options first, then falls back to
|
|
18
|
+
* the theme's widget settings.
|
|
19
|
+
*
|
|
20
|
+
* @param styleOptions - The widget container style options.
|
|
21
|
+
* @param themeSettings - The complete theme settings.
|
|
22
|
+
* @returns The space around value in pixels (0 when unset or "None").
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare const getSpaceAroundPx: (styleOptions: WidgetContainerStyleOptions | undefined, themeSettings: CompleteThemeSettingsInternal) => number;
|
|
26
|
+
/**
|
|
27
|
+
* Calculates the total non-content vertical space, in pixels, that the widget container reserves —
|
|
28
|
+
* the header (when visible) plus the top and bottom "space around" padding.
|
|
29
|
+
*
|
|
30
|
+
* Auto-sized widget content must add this overhead to its measured content height so that the
|
|
31
|
+
* visible content area (after the container subtracts its padding and header) matches the
|
|
32
|
+
* content's intended height. Without it, the bottom of the content is clipped by the container's
|
|
33
|
+
* `overflow: hidden`.
|
|
34
|
+
*
|
|
35
|
+
* @param options - The overhead height options.
|
|
36
|
+
* @returns The total overhead height in pixels.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare const getWidgetOverheadHeight: ({ styleOptions, themeSettings, hasHeader, }: {
|
|
40
|
+
styleOptions: WidgetContainerStyleOptions | undefined;
|
|
41
|
+
themeSettings: CompleteThemeSettingsInternal;
|
|
42
|
+
hasHeader: boolean;
|
|
43
|
+
}) => number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AreamapChartDataOptions, CartesianChartDataOptions, CategoricalChartDataOptions, IndicatorChartDataOptions, PivotTableDataOptions, ScatterChartDataOptions, ScattermapChartDataOptions, TableDataOptionsInternal } from '../../../../domains/visualizations/core/chart-data-options/types.js';
|
|
1
|
+
import { AreamapChartDataOptions, BoxplotChartDataOptions, CalendarHeatmapChartDataOptions, CartesianChartDataOptions, CategoricalChartDataOptions, IndicatorChartDataOptions, PivotTableDataOptions, ScatterChartDataOptions, ScattermapChartDataOptions, TableDataOptionsInternal } from '../../../../domains/visualizations/core/chart-data-options/types.js';
|
|
2
2
|
import { Panel } from '../../../../domains/widgets/components/widget-by-id/types.js';
|
|
3
3
|
import type { GenericDataOptions } from '../../../../types.js';
|
|
4
4
|
import { ScattermapStyleOptions } from '../../../../types.js';
|
|
@@ -169,6 +169,34 @@ export declare function toScattermapPanels(dataOptions: ScattermapChartDataOptio
|
|
|
169
169
|
* @internal
|
|
170
170
|
*/
|
|
171
171
|
export declare function toAreamapPanels(dataOptions: AreamapChartDataOptions): Panel[];
|
|
172
|
+
/**
|
|
173
|
+
* Builds DTO panels for a boxplot chart widget. Emits `category` (0 or 1 attribute)
|
|
174
|
+
* and `value` (the single target numeric attribute, treated as an attribute — not a
|
|
175
|
+
* measure — to match the inverse read in `extractBoxplotChartDataOptions`). The
|
|
176
|
+
* derived box/whisker measures live on `style.whisker` rather than on panels, so
|
|
177
|
+
* they are written by {@link toBoxplotWidgetStyle} instead.
|
|
178
|
+
*
|
|
179
|
+
* @param dataOptions - Boxplot chart data options from the WidgetModel
|
|
180
|
+
* @returns Fusion panels in fixed order: category, value
|
|
181
|
+
* @internal
|
|
182
|
+
*/
|
|
183
|
+
export declare function toBoxplotPanels(dataOptions: BoxplotChartDataOptions): Panel[];
|
|
184
|
+
/**
|
|
185
|
+
* Builds DTO panels for a calendar-heatmap widget. The Fusion `heatmap` manifest declares
|
|
186
|
+
* `date` (single attribute) and `color` (single measure) panels — both are always emitted,
|
|
187
|
+
* matching the inverse read in {@link extractCaledarHeatmapChartDataOptions}: an empty
|
|
188
|
+
* `items: []` array is written when a slot has no column so Fusion's renderer can locate
|
|
189
|
+
* each declared panel by name.
|
|
190
|
+
*
|
|
191
|
+
* Note: the DTO panel name for the measure slot is `color`, not `value` — the SDK's
|
|
192
|
+
* {@link CalendarHeatmapChartDataOptions.value} is read from / written to the panel named
|
|
193
|
+
* `color`.
|
|
194
|
+
*
|
|
195
|
+
* @param dataOptions - Calendar heatmap chart data options from the WidgetModel
|
|
196
|
+
* @returns Fusion panels: date, color
|
|
197
|
+
* @internal
|
|
198
|
+
*/
|
|
199
|
+
export declare function toCalendarHeatmapPanels(dataOptions: CalendarHeatmapChartDataOptions): Panel[];
|
|
172
200
|
/**
|
|
173
201
|
* Builds DTO panels for a plugin / custom widget. Each key in {@link GenericDataOptions}
|
|
174
202
|
* becomes one panel; every Column is normalised then converted to a JAQL panel item via
|
|
@@ -25,6 +25,7 @@ type GetDashboardsOptions = {
|
|
|
25
25
|
type GetDashboardOptions = {
|
|
26
26
|
fields?: string[];
|
|
27
27
|
sharedMode?: boolean;
|
|
28
|
+
adminAccess?: boolean;
|
|
28
29
|
};
|
|
29
30
|
export declare class RestApi {
|
|
30
31
|
private httpClient;
|
|
@@ -55,7 +56,7 @@ export declare class RestApi {
|
|
|
55
56
|
/**
|
|
56
57
|
* Get a specific dashboard using the legacy API version
|
|
57
58
|
*/
|
|
58
|
-
getDashboardLegacy: (dashboardOid: string) => Promise<DashboardDto | undefined>;
|
|
59
|
+
getDashboardLegacy: (dashboardOid: string, options?: GetDashboardOptions) => Promise<DashboardDto | undefined>;
|
|
59
60
|
/**
|
|
60
61
|
* Get all widgets of a specific dashboard
|
|
61
62
|
*/
|
|
@@ -8,9 +8,7 @@ import { FeatureMap } from './types/features.js';
|
|
|
8
8
|
* it still surfaces via the index signature on {@link AiFeatureFlags}.
|
|
9
9
|
*/
|
|
10
10
|
type KnownAiFeatureFlags = {
|
|
11
|
-
completionV2: boolean;
|
|
12
11
|
naturalResponseEnabled: boolean;
|
|
13
|
-
nlqV3Enabled: boolean;
|
|
14
12
|
queryDefinition: boolean;
|
|
15
13
|
};
|
|
16
14
|
/**
|
|
@@ -27,7 +25,7 @@ export type AiFeatureFlags = KnownAiFeatureFlags & {
|
|
|
27
25
|
/**
|
|
28
26
|
* AI-related slice derived from globals (`serverFeatures` + deployment props),
|
|
29
27
|
* aligned with admin UI paths such as `ai.featureFlags.*`, `ai.featureModelType`,
|
|
30
|
-
*
|
|
28
|
+
* and `ai.quotaNotification`.
|
|
31
29
|
*/
|
|
32
30
|
type AiSettingsSlice = {
|
|
33
31
|
featureFlags: AiFeatureFlags;
|
|
@@ -38,10 +36,6 @@ type AiSettingsSlice = {
|
|
|
38
36
|
*/
|
|
39
37
|
featureModelType?: string;
|
|
40
38
|
quotaNotification: boolean;
|
|
41
|
-
aiStudio: {
|
|
42
|
-
realtime: boolean;
|
|
43
|
-
usageDisplay: boolean;
|
|
44
|
-
};
|
|
45
39
|
};
|
|
46
40
|
/**
|
|
47
41
|
* Application settings
|
|
@@ -122,22 +122,14 @@ type CloudCDNFeature = Feature<'cloudCDN'>;
|
|
|
122
122
|
type OnboardingFeature = Feature<'onboarding'>;
|
|
123
123
|
type AiAssistantFeature = Feature<'aiAssistant', {
|
|
124
124
|
unified?: boolean;
|
|
125
|
-
nlqV3Enabled?: boolean;
|
|
126
|
-
isNlqV3Enabled?: boolean;
|
|
127
125
|
naturalResponseEnabled?: boolean;
|
|
128
126
|
queryDefinition?: boolean;
|
|
129
|
-
completionV2?: boolean;
|
|
130
127
|
sharedFormulasEnabled?: boolean;
|
|
131
128
|
aiAccessControl?: string;
|
|
132
129
|
quotaNotification?: boolean;
|
|
133
130
|
featureModelType?: string;
|
|
134
131
|
}>;
|
|
135
|
-
type AiStudioFeature = Feature<'aiStudio'
|
|
136
|
-
realtime?: boolean;
|
|
137
|
-
usageDisplay?: boolean;
|
|
138
|
-
isRealtimeEnabled?: boolean;
|
|
139
|
-
isUsageDisplayEnabled?: boolean;
|
|
140
|
-
}>;
|
|
132
|
+
type AiStudioFeature = Feature<'aiStudio'>;
|
|
141
133
|
type NewNavigationBetaFeature = Feature<'newNavigationBeta'>;
|
|
142
134
|
type ApiTelemetryFeature = Feature<'apiTelemetry'>;
|
|
143
135
|
export type Features = (AlertingFeature | LiveQueryFeature | NlqFeature | PivotFeature | CustomCodeFeature | CustomCodeTransformationFeature | BuildDestinationFeature | VersionHistoryFeature | EmbedCodeFeature | LiveCustomColumnFeature | ExportingEngineV2Feature | ExportingXlsxV2Feature | ExportingCsvFeature | ConnectionManagementFeature | SisenseLightFeature | WizardSqlEditorFeature | MultiTenancyFeature | BloxFeature | FunnelFeature | Cloud360Feature | BreakByToggleFeature | GitIntegrationFeature | InfusionFeature | InfusionWebClientFeature | NotebooksFeature | AdminWebClientFeature | DateTimeFiltersFeature | TextFiltersFeature | NumericFiltersFeature | FilterRelationsEnabledFeature | TimeLevelSupportEnabledFeature | SyncDashboardEventsFeature | UserProfileFeature | ScatterFeature | CustomFontsFeature | PreferWidgetImageServerExportFeature | NewAdminUIFeature | SharedFormulasFeature | SideBarFeature | InfusionTokenEndpointFeature | ExplanationsForIndicatorWidgetsFeature | ExplanationsForCategoricalWidgetsFeature | WidgetDesignStyleFeature | FiscalOnFeature | ReactAnalyticsWidgetEditorFeature | DynamicSQLFeature | NewCustomConnectorFeature | CrossTenantPerspectivesFeature | EnableDatamodelPerspectiveFeature | AlwaysDirectRelationsFeature | ModelStatisticsFeature | ExportingCsvFormattedFeature | FlexibleTooltipsFeature | DimensionalModelingFeature | CloudCDNFeature | OnboardingFeature | AiAssistantFeature | AiStudioFeature | NewNavigationBetaFeature | ApiTelemetryFeature)[];
|
|
@@ -3,6 +3,7 @@ import { PivotQueryClient } from '@sisense/sdk-pivot-query-client';
|
|
|
3
3
|
import { QueryClient } from '@sisense/sdk-query-client';
|
|
4
4
|
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
5
5
|
import { TrackingEventDetails } from '@sisense/sdk-tracking';
|
|
6
|
+
import type { Locale } from 'date-fns';
|
|
6
7
|
import { DateConfig, LoadingIndicatorConfig, TranslationConfig } from '../../types';
|
|
7
8
|
import { AppSettings } from './settings/settings';
|
|
8
9
|
/**
|
|
@@ -190,6 +191,19 @@ export type AppConfig = {
|
|
|
190
191
|
*/
|
|
191
192
|
alwaysShowResultsPerPage?: boolean;
|
|
192
193
|
};
|
|
194
|
+
/**
|
|
195
|
+
* Configuration of the default number formatting for visualizations.
|
|
196
|
+
*
|
|
197
|
+
* @sisenseInternal
|
|
198
|
+
*/
|
|
199
|
+
defaultNumberFormatting?: {
|
|
200
|
+
/**
|
|
201
|
+
* If `false`, raw values are displayed without applying the default number formatting configuration.
|
|
202
|
+
*
|
|
203
|
+
* @default true
|
|
204
|
+
*/
|
|
205
|
+
enabled?: boolean;
|
|
206
|
+
};
|
|
193
207
|
};
|
|
194
208
|
};
|
|
195
209
|
/**
|
package/dist/packages/sdk-ui/src/infra/contexts/sisense-context/sisense-context-provider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FunctionComponent, PropsWithChildren } from 'react';
|
|
1
|
+
import { type FunctionComponent, type PropsWithChildren } from 'react';
|
|
2
2
|
import { SisenseContextProviderProps } from '../../../props';
|
|
3
3
|
/**
|
|
4
4
|
* Sisense Context Provider Component allowing you to connect to
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Data, QueryResultData } from '@sisense/sdk-data';
|
|
2
|
+
import { CommonDataOptions } from '../../domains/visualizations/core/chart-data-options/types';
|
|
3
|
+
import { FormatDateOptions } from './format-date';
|
|
4
|
+
/**
|
|
5
|
+
* Options for {@link formatDataSet}.
|
|
6
|
+
*/
|
|
7
|
+
export type FormatDataSetOptions = FormatDateOptions;
|
|
8
|
+
/**
|
|
9
|
+
* Formats a data set by applying the number and date formatting declared in `dataOptions` to a data set.
|
|
10
|
+
* Writes the formatted result into each affected cell's `text` property.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const formattedData = formatDataSet(data, dataOptions);
|
|
14
|
+
*
|
|
15
|
+
* @param data - Query result or user-provided data set.
|
|
16
|
+
* @param dataOptions - Any chart, pivot, or custom-widget data options.
|
|
17
|
+
* @param options - Formatting options.
|
|
18
|
+
* @returns A new data set with formatted `text` values on affected cells.
|
|
19
|
+
* @group Formatting
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatDataSet<DataSet extends QueryResultData | Data>(data: DataSet, dataOptions: CommonDataOptions, options?: FormatDataSetOptions): DataSet;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Locale } from 'date-fns';
|
|
2
|
+
import type { DateConfig } from '../../domains/query-execution/core/date-formats';
|
|
3
|
+
/**
|
|
4
|
+
* Options for {@link formatDate}.
|
|
5
|
+
*/
|
|
6
|
+
export type FormatDateOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* A [date-fns Locale](https://date-fns.org/v2.30.0/docs/Locale) for language-specific formatting.
|
|
9
|
+
* Defaults to 'en-US'.
|
|
10
|
+
*/
|
|
11
|
+
locale?: Locale;
|
|
12
|
+
/**
|
|
13
|
+
* Fiscal year, timezone, and date-level configuration.
|
|
14
|
+
*/
|
|
15
|
+
dateConfig?: DateConfig;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Formats a single date value (Date instance or ISO 8601 string) using the
|
|
19
|
+
* provided format mask.
|
|
20
|
+
*
|
|
21
|
+
* Accepts standard [date-fns format tokens](https://date-fns.org/v2.30.0/docs/format)
|
|
22
|
+
* plus the SDK's extended Angular-style masks (locale-aware; examples use en-US):
|
|
23
|
+
*
|
|
24
|
+
* ```
|
|
25
|
+
* shortDate → '3/15/26' (M/d/yy)
|
|
26
|
+
* mediumDate → 'Mar 15, 2026' (MMM d, y)
|
|
27
|
+
* longDate → 'March 15, 2026' (MMMM d, y)
|
|
28
|
+
* fullDate → 'Sunday, March 15, 2026' (EEEE, MMMM d, y)
|
|
29
|
+
* shortTime → '1:45 PM' (h:mm a)
|
|
30
|
+
* mediumTime → '1:45:00 PM' (h:mm:ss a)
|
|
31
|
+
* short → '3/15/26 1:45 PM' (M/d/yy h:mm a)
|
|
32
|
+
* medium → 'Mar 15, 2026 1:45:00 PM' (MMM d, y h:mm:ss a)
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* Returns the input unchanged if it matches the reserved "not available" value (`'N\A'`).
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* formatDate(new Date('2026-03-15'), 'MM/yyyy');
|
|
39
|
+
* // returns '03/2026'
|
|
40
|
+
*
|
|
41
|
+
* formatDate('2026-03-15T13:45:00Z', 'shortDate');
|
|
42
|
+
* // returns '3/15/26' (en-US locale)
|
|
43
|
+
*
|
|
44
|
+
* formatDate('2026-03-15T13:45:00Z', 'mediumDate');
|
|
45
|
+
* // returns 'Mar 15, 2026'
|
|
46
|
+
*
|
|
47
|
+
* @param value - Date value to format.
|
|
48
|
+
* @param format - Format mask string (date-fns tokens or SDK extended masks).
|
|
49
|
+
* @param options - Optional locale and date configuration.
|
|
50
|
+
* @returns Formatted date string.
|
|
51
|
+
* @group Formatting
|
|
52
|
+
*/
|
|
53
|
+
export declare function formatDate(value: Date | string, format: string, options?: FormatDateOptions): string;
|
|
54
|
+
/**
|
|
55
|
+
* Returns a default date-format mask for a given granularity level from {@link @sisense/sdk-data!DateLevels | `DateLevels`}
|
|
56
|
+
*
|
|
57
|
+
* Falls back to default `'fullDate'` for unknown or absent granularities.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* getDefaultDateFormat('months'); // 'MM/yyyy'
|
|
61
|
+
* getDefaultDateFormat('years'); // 'yyyy'
|
|
62
|
+
* getDefaultDateFormat('days'); // 'shortDate'
|
|
63
|
+
* @param granularity - Optional granularity string.
|
|
64
|
+
* @returns A date-format mask string.
|
|
65
|
+
* @group Formatting
|
|
66
|
+
*/
|
|
67
|
+
export declare function getDefaultDateFormat(granularity?: string): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NumberFormatConfig } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Formats a single numeric value using the provided {@link NumberFormatConfig}.
|
|
4
|
+
*
|
|
5
|
+
* Missing config falls back to defaults:
|
|
6
|
+
* Numbers type, auto decimal scale, thousand separator enabled, all abbreviations (K/M/B/T) enabled.
|
|
7
|
+
*
|
|
8
|
+
* Returns an empty string when `value` is `NaN`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* formatNumber(1234567);
|
|
12
|
+
* // returns '1.23M'
|
|
13
|
+
*
|
|
14
|
+
* formatNumber(0.42, { name: 'Percent', decimalScale: 1 });
|
|
15
|
+
* // returns '42.0%'
|
|
16
|
+
*
|
|
17
|
+
* formatNumber(1500, { name: 'Currency', symbol: '€', prefix: true });
|
|
18
|
+
* // returns '€1.5K'
|
|
19
|
+
* @param value - The numeric value to format.
|
|
20
|
+
* @param config - Formatting configuration.
|
|
21
|
+
* @returns Formatted string representation of the value.
|
|
22
|
+
* @group Formatting
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatNumber(value: number, config?: NumberFormatConfig): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { formatNumber } from './format-number';
|
|
2
|
+
export { formatDate, getDefaultDateFormat } from './format-date';
|
|
3
|
+
export { formatDataSet } from './format-data-set';
|
|
4
|
+
export type { FormatDateOptions } from './format-date';
|
|
5
|
+
export type { FormatDataSetOptions } from './format-data-set';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Module } from './types.js';
|
|
2
|
+
/** Normalised view of a `ModuleRequirement`. */
|
|
3
|
+
interface NormalizedRequirement {
|
|
4
|
+
name: string;
|
|
5
|
+
optional: boolean;
|
|
6
|
+
requiredVersion?: string;
|
|
7
|
+
}
|
|
8
|
+
/** A module after graph resolution, with its normalised requirements attached. */
|
|
9
|
+
export interface ResolvedModule {
|
|
10
|
+
module: Module;
|
|
11
|
+
requirements: NormalizedRequirement[];
|
|
12
|
+
/**
|
|
13
|
+
* Names of soft requirements that were absent or version-incompatible at boot.
|
|
14
|
+
* Integrations targeting these names are silently dropped.
|
|
15
|
+
*/
|
|
16
|
+
missingOptionalTargets: Set<string>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Builds the validated, topologically-ordered module graph from the given roots.
|
|
20
|
+
*
|
|
21
|
+
* - Recursively expands `includes` and dedupes by `name` (versions must match).
|
|
22
|
+
* - Validates every hard `requires` target is present and its version satisfies
|
|
23
|
+
* any declared `requiredVersion`.
|
|
24
|
+
* - Drops contributions to soft requirements (`optional: true`) that are missing
|
|
25
|
+
* or version-incompatible.
|
|
26
|
+
* - Validates each integration targets a declared requirement and a known field
|
|
27
|
+
* on the target's `api`.
|
|
28
|
+
* - Returns modules sorted so each appears after its requirements.
|
|
29
|
+
*/
|
|
30
|
+
export declare const buildModuleGraph: (modules: ReadonlyArray<Module>) => ResolvedModule[];
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Module } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Modules API registry.
|
|
4
|
+
*
|
|
5
|
+
* Each registry is an opaque value produced by the owning module's
|
|
6
|
+
* `ApiField.createRegistry` and written to by every contributor's
|
|
7
|
+
* `ApiField.register`. Keyed by `(moduleName, fieldName)` to keep field names
|
|
8
|
+
* scoped to their owning module.
|
|
9
|
+
*/
|
|
10
|
+
export interface ModulesApiRegistry {
|
|
11
|
+
/** Returns the registry for a module's API field, or `undefined` if absent. */
|
|
12
|
+
get(moduleName: string, fieldName: string): unknown;
|
|
13
|
+
/** Whether the given module's API field has a registry in this store. */
|
|
14
|
+
has(moduleName: string, fieldName: string): boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Result of building a module registry from a set of user-provided modules. */
|
|
17
|
+
export interface ModulesRegistry {
|
|
18
|
+
/** Registered modules array (in topological order) */
|
|
19
|
+
modules: Module[];
|
|
20
|
+
/** Modules api registry. */
|
|
21
|
+
apiRegistry: ModulesApiRegistry;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Builds a per-`ModuleProvider` registry from the given user-provided modules.
|
|
25
|
+
*
|
|
26
|
+
* - Always includes `CoreModule`.
|
|
27
|
+
* - Builds and validates the module graph (`buildModuleGraph`).
|
|
28
|
+
* - Creates a fresh registry per API field via `ApiField.createRegistry`.
|
|
29
|
+
* - Applies every contribution in topological order via `ApiField.register`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const buildModuleRegistry: (modules?: ReadonlyArray<Module>) => ModulesRegistry;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FunctionComponent, type PropsWithChildren } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Registers providers passed via the `core.providers` API.
|
|
4
|
+
*
|
|
5
|
+
* The registry is read from the enclosing `ModuleProvider`, so each
|
|
6
|
+
* `SisenseContextProvider` instance mounts only the providers contributed by
|
|
7
|
+
* the modules it registered. Providers are mounted in registration
|
|
8
|
+
* (topological) order — the first entry is the outermost wrapper.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare const CoreModuleProvidersTree: FunctionComponent<PropsWithChildren>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { ApiContract, ApiField, Module } from './types.js';
|
|
3
|
+
type ProviderComponent = ComponentType<{
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* API declaration for the `core` module.
|
|
8
|
+
*/
|
|
9
|
+
export interface CoreModuleApiDefinition {
|
|
10
|
+
/** Root-level React providers mounted by `SisenseContextProvider`. */
|
|
11
|
+
providers: ApiField<ProviderComponent[], ProviderComponent[]>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* API contract for contributing to the `core` module.
|
|
15
|
+
*/
|
|
16
|
+
export type CoreModuleApi = ApiContract<CoreModuleApiDefinition>;
|
|
17
|
+
export declare const CORE_MODULE_NAME = "core";
|
|
18
|
+
/**
|
|
19
|
+
* The `core` module.
|
|
20
|
+
* Always registered automatically by `ModuleProvider`; consumers do not need to list it in the `modules` prop.
|
|
21
|
+
*
|
|
22
|
+
* Owns the `providers` registry — other modules contribute root-level React
|
|
23
|
+
* providers there, which `CoreModuleProvidersTree` mounts inside `SisenseContextProvider`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CoreModule: Module<CoreModuleApiDefinition>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FunctionComponent, type PropsWithChildren } from 'react';
|
|
2
|
+
import type { Module } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Props for `ModuleProvider`.
|
|
5
|
+
*/
|
|
6
|
+
export interface ModuleProviderProps {
|
|
7
|
+
/**
|
|
8
|
+
* Modules to register.
|
|
9
|
+
*
|
|
10
|
+
* `CoreModule` is registered automatically; consumers do not need to list it.
|
|
11
|
+
*/
|
|
12
|
+
modules?: ReadonlyArray<Module>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Registers the given modules and makes the API registry available to the children.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ModuleProvider: FunctionComponent<PropsWithChildren<ModuleProviderProps>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ModulesApiRegistry } from './build-module-registry.js';
|
|
3
|
+
import type { Module, RegistryOf } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Modules API registry context.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ModulesContext: import("react").Context<ModulesApiRegistry | null>;
|
|
8
|
+
/**
|
|
9
|
+
* Gives access to the API registry for a given module and field.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const chartBuilders = useModuleApiRegistry(VisualizationsModule, 'chartBuilders');
|
|
14
|
+
* ```
|
|
15
|
+
* @throws if used outside a `ModuleProvider`.
|
|
16
|
+
* @throws if `module` was not registered in the enclosing provider.
|
|
17
|
+
*
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
export declare const useModuleApiRegistry: <TSchema, K extends keyof TSchema & string>(module: Module<TSchema>, field: K) => RegistryOf<TSchema, K>;
|