@sisense/sdk-ui 1.34.0 → 2.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.
Files changed (75) hide show
  1. package/dist/ai.cjs +9 -9
  2. package/dist/ai.js +553 -578
  3. package/dist/analytics-composer.cjs +120 -119
  4. package/dist/analytics-composer.js +3235 -2506
  5. package/dist/{derive-chart-family-5CbFzbpu.js → derive-chart-family-BLaI9-3r.js} +23488 -23351
  6. package/dist/{derive-chart-family-C3FH49ux.cjs → derive-chart-family-CxqjTyNt.cjs} +196 -196
  7. package/dist/dimensions-C-VKss5V.cjs +1 -0
  8. package/dist/dimensions-Cfq9FexH.js +200 -0
  9. package/dist/index.cjs +24 -20
  10. package/dist/index.js +5909 -6105
  11. package/dist/packages/sdk-ui/src/ai/ai-context-provider.d.ts +13 -6
  12. package/dist/packages/sdk-ui/src/ai/chat-config.d.ts +4 -2
  13. package/dist/packages/sdk-ui/src/ai/chatbot.d.ts +17 -7
  14. package/dist/packages/sdk-ui/src/ai/get-nlg-insights.d.ts +0 -21
  15. package/dist/packages/sdk-ui/src/ai/index.d.ts +4 -3
  16. package/dist/packages/sdk-ui/src/ai/use-get-nlg-insights.d.ts +0 -12
  17. package/dist/packages/sdk-ui/src/ai/use-get-nlq-result.d.ts +0 -4
  18. package/dist/packages/sdk-ui/src/ai/use-get-query-recommendations.d.ts +0 -4
  19. package/dist/packages/sdk-ui/src/analytics-composer/{common → code}/stringify-props.d.ts +10 -2
  20. package/dist/packages/sdk-ui/src/analytics-composer/common/custom-superjson.d.ts +16 -0
  21. package/dist/packages/sdk-ui/src/analytics-composer/dashboard/dashboard-composer.d.ts +8 -0
  22. package/dist/packages/sdk-ui/src/analytics-composer/dashboard/stringify-widgets.d.ts +3 -0
  23. package/dist/packages/sdk-ui/src/analytics-composer/dashboard/to-dashboard-code.d.ts +3 -0
  24. package/dist/packages/sdk-ui/src/analytics-composer/index.d.ts +1 -0
  25. package/dist/packages/sdk-ui/src/analytics-composer/query/index.d.ts +1 -0
  26. package/dist/packages/sdk-ui/src/analytics-composer/query/query-translator.d.ts +1 -0
  27. package/dist/packages/sdk-ui/src/analytics-composer/query/simplify-metadata-item.d.ts +9 -0
  28. package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +78 -4
  29. package/dist/packages/sdk-ui/src/analytics-composer/widget/chart-options/get-widget-options.d.ts +1 -1
  30. package/dist/packages/sdk-ui/src/analytics-composer/widget/to-widget-code.d.ts +3 -1
  31. package/dist/packages/sdk-ui/src/app/client-application.d.ts +3 -55
  32. package/dist/packages/sdk-ui/src/area-range-chart.d.ts +0 -1
  33. package/dist/packages/sdk-ui/src/common/components/menu/types.d.ts +1 -0
  34. package/dist/packages/sdk-ui/src/dashboard/dashboard-helpers.d.ts +0 -11
  35. package/dist/packages/sdk-ui/src/dashboard/index.d.ts +1 -1
  36. package/dist/packages/sdk-ui/src/dashboard/types.d.ts +7 -3
  37. package/dist/packages/sdk-ui/src/dashboard/use-composed-dashboard.d.ts +1 -4
  38. package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/index.d.ts +0 -1
  39. package/dist/packages/sdk-ui/src/filters/components/filter-tile.d.ts +0 -1
  40. package/dist/packages/sdk-ui/src/index-typedoc.d.ts +4 -1
  41. package/dist/packages/sdk-ui/src/index.d.ts +4 -3
  42. package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dashboard-model-reducer.d.ts +15 -1
  43. package/dist/packages/sdk-ui/src/models/widget/types.d.ts +1 -1
  44. package/dist/packages/sdk-ui/src/models/widget/widget-model-translator.d.ts +2 -12
  45. package/dist/packages/sdk-ui/src/models/widget/widget-model.d.ts +1 -125
  46. package/dist/packages/sdk-ui/src/props.d.ts +25 -45
  47. package/dist/packages/sdk-ui/src/query-execution/types.d.ts +1 -3
  48. package/dist/packages/sdk-ui/src/translation/resources/en.d.ts +2 -1
  49. package/dist/packages/sdk-ui/src/translation/resources/index.d.ts +4 -2
  50. package/dist/packages/sdk-ui/src/types.d.ts +48 -41
  51. package/dist/packages/sdk-ui/src/utils/{utility-types.d.ts → utility-types/basic-utility-types.d.ts} +0 -34
  52. package/dist/packages/sdk-ui/src/utils/utility-types/distributive-omit.d.ts +24 -0
  53. package/dist/packages/sdk-ui/src/utils/utility-types/index.d.ts +4 -0
  54. package/dist/packages/sdk-ui/src/utils/utility-types/rest-api-hook-state.d.ts +35 -0
  55. package/dist/packages/sdk-ui/src/utils/utility-types/soft-union.d.ts +35 -0
  56. package/dist/packages/sdk-ui/src/widget-by-id/translate-dashboard-filters.d.ts +0 -7
  57. package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-data-options.d.ts +2 -2
  58. package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-drilldown-options.d.ts +2 -2
  59. package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-style-options.d.ts +2 -2
  60. package/dist/packages/sdk-ui/src/widget-by-id/types.d.ts +2 -2
  61. package/dist/packages/sdk-ui/src/widget-by-id/utils.d.ts +23 -16
  62. package/dist/packages/sdk-ui/src/widgets/widget.d.ts +0 -1
  63. package/dist/{use-common-filters-CqGo6jp3.cjs → use-common-filters-BGGGgJJ5.cjs} +13 -13
  64. package/dist/{use-common-filters-Bw15BNGn.js → use-common-filters-Cmyb86sc.js} +4618 -4637
  65. package/dist/widget-composer-BJURHrVD.cjs +428 -0
  66. package/dist/widget-composer-C4rwNt4P.js +959 -0
  67. package/package.json +12 -9
  68. package/dist/packages/sdk-ui/src/ai/common/beta-label.d.ts +0 -1
  69. package/dist/packages/sdk-ui/src/analytics-composer/widget/stringify-props.d.ts +0 -8
  70. package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/types.d.ts +0 -8
  71. package/dist/packages/sdk-ui/src/utils/check-and-notify-about-deprecated-prop.d.ts +0 -1
  72. package/dist/packages/sdk-ui/src/widget-by-id/dashboard-widget.d.ts +0 -27
  73. package/dist/widget-composer-C5_iIuZN.js +0 -742
  74. package/dist/widget-composer-D5_iKTui.cjs +0 -316
  75. /package/dist/packages/sdk-ui/src/analytics-composer/{widget → code}/stringify-filters.d.ts +0 -0
@@ -0,0 +1,35 @@
1
+ import { AnyArray, AnyObject } from './basic-utility-types';
2
+ /**
3
+ * Universal generic state for hooks that fetch data from the REST API.
4
+ */
5
+ export type RestApiHookState<DataKey extends string, SuccessDataType extends AnyObject | AnyArray> = RestApiHookSuccessState<DataKey, SuccessDataType> | RestApiHookErrorState<DataKey> | RestApiHookLoadingState<DataKey>;
6
+ /** Success state of the REST API hook */
7
+ export type RestApiHookSuccessState<DataKey extends string, SuccessDataType extends AnyObject | AnyArray> = {
8
+ isLoading: false;
9
+ isError: false;
10
+ isSuccess: true;
11
+ error: undefined;
12
+ status: 'success';
13
+ } & {
14
+ [key in DataKey]: SuccessDataType;
15
+ };
16
+ /** Error state of the REST API hook */
17
+ export type RestApiHookErrorState<DataKey extends string> = {
18
+ isLoading: false;
19
+ isError: true;
20
+ isSuccess: false;
21
+ error: Error;
22
+ status: 'error';
23
+ } & {
24
+ [key in DataKey]: undefined;
25
+ };
26
+ /** Loading state of the REST API hook */
27
+ export type RestApiHookLoadingState<DataKey extends string> = {
28
+ isLoading: true;
29
+ isError: false;
30
+ isSuccess: false;
31
+ error: undefined;
32
+ status: 'loading';
33
+ } & {
34
+ [key in DataKey]: undefined;
35
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Gets all unique keys from a union of object types.
3
+ *
4
+ * @template T - The union of object types.
5
+ * @returns A union of all keys present in the types in `T`.
6
+ *
7
+ * @example
8
+ * type Type1 = { a: number; b: string };
9
+ * type Type2 = { b: string; c?: boolean };
10
+ * type AllKeys = KeysOfUnion<Type1 | Type2>; // Evaluates to "a" | "b" | "c"
11
+ */
12
+ type KeysOfUnion<T> = T extends unknown ? keyof T : never;
13
+ /**
14
+ * Creates a "soft union" type from a union of object types. A soft union
15
+ * combines the properties of all types in the union, making properties
16
+ * optional with `undefined` if they are not present in a specific type
17
+ * within the union.
18
+ *
19
+ * @template T - The union of object types.
20
+ * @returns A type that represents the soft union of the types in `T`.
21
+ * Each constituent type in the union `T` is augmented with the missing
22
+ * properties from other types in `T`, typed as optional `undefined`.
23
+ *
24
+ * @example
25
+ * type Type1 = { bar: string };
26
+ * type Type2 = { agg: number };
27
+ * type SoftUnionType = SoftUnion<Type1 | Type2>;
28
+ * // Evaluates to:
29
+ * // | { bar: string; agg?: undefined }
30
+ * // | { bar?: undefined; agg: number; }
31
+ *
32
+ * @internal
33
+ */
34
+ export type SoftUnion<T, K extends PropertyKey = KeysOfUnion<T>> = T extends unknown ? T & Partial<Record<Exclude<K, keyof T>, undefined>> : never;
35
+ export {};
@@ -4785,13 +4785,6 @@ export declare function getDashboardFilters(dashboardFilters: Array<FilterDto |
4785
4785
  sort?: "desc" | "asc" | undefined;
4786
4786
  in?: {
4787
4787
  selected?: {
4788
- /**
4789
- * Checks if a highlight filter is applicable to a widget.
4790
- *
4791
- * @param {FilterDto} filter - The filter to be checked.
4792
- * @param {WidgetDto} widget - The widget that filters are applied to.
4793
- * @returns {boolean} `true` if the filter is applicable; otherwise, `false`.
4794
- */
4795
4788
  jaql: import("@sisense/sdk-data").FilterJaql;
4796
4789
  } | undefined;
4797
4790
  } | undefined;
@@ -1,6 +1,6 @@
1
1
  import { JaqlDataSource } from '@sisense/sdk-data';
2
2
  import { StyledMeasureColumn, StyledColumn, Color } from '../types.js';
3
- import { Panel, PanelItem, WidgetType, WidgetStyle, BoxplotWidgetStyle } from './types.js';
3
+ import { Panel, PanelItem, FusionWidgetType, WidgetStyle, BoxplotWidgetStyle } from './types.js';
4
4
  import { WidgetDataOptions } from '../models/index.js';
5
5
  /** @internal */
6
6
  export declare function applyStatisticalModels(dataOption: StyledMeasureColumn, statisticalModels?: {
@@ -38,4 +38,4 @@ export declare function extractBoxplotBoxType(style: BoxplotWidgetStyle): "iqr"
38
38
  * This is to support multi-source dashboards.
39
39
  */
40
40
  export declare function attachDataSourceToPanels(panels: Panel[], dataSource: JaqlDataSource): Panel[];
41
- export declare function extractDataOptions(widgetType: WidgetType, panels: Panel[], style: WidgetStyle, customPaletteColors?: Color[]): WidgetDataOptions;
41
+ export declare function extractDataOptions(fusionWidgetType: FusionWidgetType, panels: Panel[], style: WidgetStyle, customPaletteColors?: Color[]): WidgetDataOptions;
@@ -1,3 +1,3 @@
1
- import { Panel, PanelItem, WidgetType } from './types.js';
1
+ import { Panel, PanelItem, FusionWidgetType } from './types.js';
2
2
  import { DrilldownOptions } from '../types.js';
3
- export declare const extractDrilldownOptions: (widgetType: WidgetType, panels: Panel[], drillHistory?: PanelItem[], enableDrillToAnywhere?: boolean) => DrilldownOptions;
3
+ export declare const extractDrilldownOptions: (widgetType: FusionWidgetType, panels: Panel[], drillHistory?: PanelItem[], enableDrillToAnywhere?: boolean) => DrilldownOptions;
@@ -1,9 +1,9 @@
1
1
  import { ChartStyleOptions, TableStyleOptions, NumericBarIndicatorStyleOptions, NumericSimpleIndicatorStyleOptions, GaugeIndicatorStyleOptions, PivotTableStyleOptions, SpaceSizes, RadiusSizes, ShadowsTypes, AlignmentTypes, WidgetStyleOptions, TextWidgetStyleOptions } from '../types';
2
- import { WidgetSubtype, WidgetType, TableWidgetStyle, IndicatorWidgetStyle, PivotWidgetStyle, WidgetDesign, WidgetDto } from './types';
2
+ import { WidgetSubtype, FusionWidgetType, TableWidgetStyle, IndicatorWidgetStyle, PivotWidgetStyle, WidgetDesign, WidgetDto } from './types';
3
3
  export declare function extractTableChartStyleOptions(widgetStyle: TableWidgetStyle): TableStyleOptions;
4
4
  export declare const getIndicatorTypeSpecificOptions: (widgetSubtype: WidgetSubtype, widgetStyle: IndicatorWidgetStyle) => NumericSimpleIndicatorStyleOptions | NumericBarIndicatorStyleOptions | GaugeIndicatorStyleOptions;
5
5
  export declare function extractPivotTableStyleOptions(widgetStyle: PivotWidgetStyle): PivotTableStyleOptions;
6
- export declare function extractStyleOptions<WType extends WidgetType>(widgetType: WType, widget: WidgetDto): ChartStyleOptions | TableStyleOptions | TextWidgetStyleOptions;
6
+ export declare function extractStyleOptions<WType extends FusionWidgetType>(widgetType: WType, widget: WidgetDto): ChartStyleOptions | TableStyleOptions | TextWidgetStyleOptions;
7
7
  export declare const getFlattenWidgetDesign: (widgetDesign: WidgetDesign) => {
8
8
  backgroundColor: string;
9
9
  spaceAround: SpaceSizes;
@@ -21,7 +21,7 @@ export type TextWidgetType = 'richtexteditor';
21
21
  /**
22
22
  * The type of a widget on a dashboard.
23
23
  */
24
- export type WidgetType = CartesianWidgetType | CategoricalWidgetType | 'chart/scatter' | 'indicator' | TabularWidgetType | 'chart/boxplot' | 'map/scatter' | 'map/area' | TextWidgetType | 'plugin';
24
+ export type FusionWidgetType = CartesianWidgetType | CategoricalWidgetType | 'chart/scatter' | 'indicator' | TabularWidgetType | 'chart/boxplot' | 'map/scatter' | 'map/area' | TextWidgetType | 'plugin';
25
25
  export type WidgetSubtype = 'area/basic' | 'area/stacked' | 'area/stacked100' | 'area/spline' | 'area/stackedspline' | 'area/stackedspline100' | 'bar/classic' | 'bar/stacked' | 'bar/stacked100' | 'column/classic' | 'column/stackedcolumn' | 'column/stackedcolumn100' | 'line/basic' | 'line/spline' | 'pie/classic' | 'pie/donut' | 'pie/ring' | 'column/polar' | 'area/polar' | 'line/polar' | 'indicator/numeric' | 'indicator/gauge' | 'bubble/scatter' | 'treemap' | 'sunburst' | 'boxplot/full' | 'boxplot/hollow' | 'map/scatter' | 'areamap/world' | 'areamap/usa' | 'richtexteditor';
26
26
  export declare enum WidgetDashboardFilterMode {
27
27
  FILTER = "filter",
@@ -37,7 +37,7 @@ export declare enum WidgetDashboardFilterMode {
37
37
  */
38
38
  export interface WidgetDto {
39
39
  oid: string;
40
- type: WidgetType | string;
40
+ type: FusionWidgetType;
41
41
  subtype: WidgetSubtype | string;
42
42
  datasource: JaqlDataSource;
43
43
  metadata: {
@@ -1,25 +1,32 @@
1
1
  import { ChartSubtype } from '../chart-options-processor/subtype-to-design-options.js';
2
- import { ChartType } from '../types.js';
3
- import { Panel, PanelItem, TextWidgetDtoStyle, WidgetStyle, WidgetSubtype, WidgetType } from './types.js';
4
- import { ChartProps, ChartWidgetProps, PivotTableWidgetProps, PluginWidgetProps, RenderToolbarHandler, TextWidgetProps, CommonWidgetProps, WithWidgetType, WidgetProps } from '../index.js';
2
+ import { ChartType, RenderToolbarHandler } from '../types.js';
3
+ import { Panel, PanelItem, TextWidgetDtoStyle, WidgetStyle, WidgetSubtype, FusionWidgetType } from './types.js';
4
+ import { ChartProps, ChartWidgetProps, PivotTableWidgetProps, PluginWidgetProps, TextWidgetProps, CommonWidgetProps, WithCommonWidgetProps, WidgetProps, WidgetType } from '../props';
5
5
  import { WidgetTypeInternal } from '../models/widget/types';
6
+ import { WidgetModel } from '../models';
6
7
  export { mergeFilters, getFilterRelationsFromJaql, convertFilterRelationsModelToJaql, getFilterCompareId, } from '@sisense/sdk-data';
7
8
  /**
8
9
  * Returns the corresponding chart type for a given widget type
9
10
  *
10
11
  * @internal
11
12
  */
12
- export declare function getChartType(widgetType: WidgetType): ChartType;
13
- export declare function getWidgetTypeFromChartType(chartType: ChartType): WidgetType;
13
+ export declare function getChartType(fusionWidgetType: FusionWidgetType): ChartType;
14
+ export declare function getFusionWidgetTypeFromChartType(chartType: ChartType): FusionWidgetType;
15
+ export declare function getFusionWidgetType(widgetType: WidgetType, chartType?: ChartType): FusionWidgetType;
16
+ export declare function getWidgetType(fusionWidgetType: FusionWidgetType): WidgetType;
14
17
  export declare function getChartSubtype(widgetSubtype: WidgetSubtype): ChartSubtype | undefined;
15
- type WidgetTypeOrString = string | WidgetType;
16
- export declare function isSupportedWidgetType(widgetType: WidgetTypeOrString): widgetType is WidgetType;
17
- export declare function isTableWidget(widgetType: WidgetTypeOrString): boolean;
18
- export declare function isPivotTableWidget(widgetType: WidgetTypeOrString): boolean;
19
- export declare function isTextWidget(widgetType: WidgetTypeOrString): boolean;
18
+ export declare function isSupportedWidgetType(fusionWidgetType: FusionWidgetType): fusionWidgetType is FusionWidgetType;
19
+ export declare function isTableFusionWidget(fusionWidgetType: FusionWidgetType): boolean;
20
+ export declare function isTableWidgetModel(widgetModel: WidgetModel): boolean;
21
+ export declare function isPivotTableFusionWidget(fusionWidgetType: FusionWidgetType): boolean;
22
+ export declare function isPivotWidget(widgetType: WidgetType): boolean;
23
+ export declare function isTextFusionWidget(fusionWidgetType: FusionWidgetType): boolean;
24
+ export declare function isTextWidget(widgetType: WidgetType): boolean;
20
25
  export declare function isTextWidgetDtoStyle(widgetStyle: WidgetStyle): widgetStyle is TextWidgetDtoStyle;
21
- export declare function isPluginWidget(widgetType: WidgetTypeOrString): boolean;
22
- export declare function isChartWidget(widgetType: WidgetTypeOrString): boolean;
26
+ export declare function isPluginFusionWidget(fusionWidgetType: FusionWidgetType): boolean;
27
+ export declare function isPluginWidget(widgetType: WidgetType): boolean;
28
+ export declare function isChartFusionWidget(fusionWidgetType: FusionWidgetType): boolean;
29
+ export declare function isChartWidget(widgetType: WidgetType): boolean;
23
30
  /**
24
31
  * Type guard for checking if the widget props is for a text widget.
25
32
  *
@@ -27,7 +34,7 @@ export declare function isChartWidget(widgetType: WidgetTypeOrString): boolean;
27
34
  * @returns whether the widget props is for a text widget
28
35
  * @internal
29
36
  */
30
- export declare function isTextWidgetProps(widgetProps: CommonWidgetProps): widgetProps is WithWidgetType<TextWidgetProps, 'text'>;
37
+ export declare function isTextWidgetProps(widgetProps: CommonWidgetProps): widgetProps is WithCommonWidgetProps<TextWidgetProps, 'text'>;
31
38
  /**
32
39
  * Type guard for checking if the widget props is for a pivot table widget.
33
40
  *
@@ -35,7 +42,7 @@ export declare function isTextWidgetProps(widgetProps: CommonWidgetProps): widge
35
42
  * @returns whether the widget props is for a pivot table widget
36
43
  * @internal
37
44
  */
38
- export declare function isPivotTableWidgetProps(widgetProps: CommonWidgetProps): widgetProps is WithWidgetType<PivotTableWidgetProps, 'pivot'>;
45
+ export declare function isPivotTableWidgetProps(widgetProps: CommonWidgetProps): widgetProps is WithCommonWidgetProps<PivotTableWidgetProps, 'pivot'>;
39
46
  /**
40
47
  * Type guard for checking if the widget props is for a plugin widget
41
48
  *
@@ -43,7 +50,7 @@ export declare function isPivotTableWidgetProps(widgetProps: CommonWidgetProps):
43
50
  * @returns whether the widget props is for a plugin widget
44
51
  * @internal
45
52
  */
46
- export declare function isPluginWidgetProps(widgetProps: CommonWidgetProps): widgetProps is WithWidgetType<PluginWidgetProps, 'plugin'>;
53
+ export declare function isPluginWidgetProps(widgetProps: CommonWidgetProps): widgetProps is WithCommonWidgetProps<PluginWidgetProps, 'plugin'>;
47
54
  /**
48
55
  * Type guard for checking if the widget props is for a chart widget
49
56
  *
@@ -51,7 +58,7 @@ export declare function isPluginWidgetProps(widgetProps: CommonWidgetProps): wid
51
58
  * @returns whether the widget props is for a chart widget
52
59
  * @internal
53
60
  */
54
- export declare function isChartWidgetProps(widgetProps: CommonWidgetProps): widgetProps is WithWidgetType<ChartWidgetProps, 'chart'>;
61
+ export declare function isChartWidgetProps(widgetProps: CommonWidgetProps): widgetProps is WithCommonWidgetProps<ChartWidgetProps, 'chart'>;
55
62
  export declare function getInternalWidgetType(widgetProps: CommonWidgetProps): WidgetTypeInternal;
56
63
  /**
57
64
  * Registers new "onDataPointClick" handler for the Widget component
@@ -4,6 +4,5 @@ import { WidgetProps } from '..';
4
4
  * Facade component that renders a widget within a dashboard based on the widget type.
5
5
  *
6
6
  * @group Dashboards
7
- * @alpha
8
7
  */
9
8
  export declare const Widget: React.FC<WidgetProps>;