@sisense/sdk-ui 2.1.0 → 2.2.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 (49) hide show
  1. package/dist/ai.cjs +9 -9
  2. package/dist/ai.js +525 -636
  3. package/dist/analytics-composer.cjs +1 -1
  4. package/dist/analytics-composer.js +70 -70
  5. package/dist/{derive-chart-family-DjbiaKLQ.cjs → derive-chart-family-BsbFdcgd.cjs} +129 -129
  6. package/dist/{derive-chart-family-BNMFblR9.js → derive-chart-family-C9IDI6UV.js} +11273 -11244
  7. package/dist/{dimensions-DeTiL-EZ.js → dimensions-HgrcPa-Q.js} +1 -1
  8. package/dist/{dimensions-DcsEnPSY.cjs → dimensions-mYUylB-h.cjs} +1 -1
  9. package/dist/index.cjs +25 -21
  10. package/dist/index.js +13422 -10141
  11. package/dist/packages/sdk-ui/src/api/rest-api.d.ts +1 -0
  12. package/dist/packages/sdk-ui/src/api/types/dashboard-dto.d.ts +7 -0
  13. package/dist/packages/sdk-ui/src/common/hooks/use-state-with-history.d.ts +64 -0
  14. package/dist/packages/sdk-ui/src/dashboard/components/content-panel.d.ts +1 -1
  15. package/dist/packages/sdk-ui/src/dashboard/components/dashboard-header.d.ts +1 -1
  16. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/cell-drop-overlay.d.ts +34 -0
  17. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/draggable-line.d.ts +24 -0
  18. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/draggable-widget-wrapper.d.ts +28 -0
  19. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/droppable-zone.d.ts +23 -0
  20. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/resizable-columns.d.ts +31 -0
  21. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/resizable-row.d.ts +39 -0
  22. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/row-drop-overlay.d.ts +30 -0
  23. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/const.d.ts +11 -0
  24. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/editable-layout.d.ts +28 -0
  25. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/helpers.d.ts +42 -0
  26. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/types.d.ts +78 -0
  27. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/utils.d.ts +5 -0
  28. package/dist/packages/sdk-ui/src/dashboard/constants.d.ts +0 -2
  29. package/dist/packages/sdk-ui/src/dashboard/dashboard.d.ts +7 -1
  30. package/dist/packages/sdk-ui/src/dashboard/hooks/use-dashboard-header-toolbar.d.ts +17 -0
  31. package/dist/packages/sdk-ui/src/dashboard/hooks/use-edit-mode-toolbar.d.ts +52 -0
  32. package/dist/packages/sdk-ui/src/dashboard/types.d.ts +9 -1
  33. package/dist/packages/sdk-ui/src/dashboard/use-dashboard-theme.d.ts +4 -0
  34. package/dist/packages/sdk-ui/src/error-boundary/error-boundary.d.ts +6 -2
  35. package/dist/packages/sdk-ui/src/index.d.ts +1 -1
  36. package/dist/packages/sdk-ui/src/models/dashboard/dashboard-model.d.ts +7 -0
  37. package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-dto-utils.d.ts +3 -1
  38. package/dist/packages/sdk-ui/src/models/dashboard/types.d.ts +30 -18
  39. package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dashboard-model-reducer.d.ts +14 -5
  40. package/dist/packages/sdk-ui/src/props.d.ts +4 -1
  41. package/dist/packages/sdk-ui/src/theme-provider/default-theme-settings.d.ts +3 -0
  42. package/dist/packages/sdk-ui/src/translation/resources/en.d.ts +9 -0
  43. package/dist/packages/sdk-ui/src/translation/resources/index.d.ts +18 -0
  44. package/dist/packages/sdk-ui/src/types.d.ts +14 -0
  45. package/dist/{use-common-filters-DcFu4qRs.cjs → use-common-filters-BKYG6WGA.cjs} +47 -47
  46. package/dist/{use-common-filters-CJNwlbbh.js → use-common-filters-DkwU7HJ3.js} +3685 -3550
  47. package/dist/{widget-composer-BEVCXjFv.js → widget-composer-CACtfvw6.js} +98 -95
  48. package/dist/{widget-composer-fYnr8SDo.cjs → widget-composer-JVl8mNCt.cjs} +1 -1
  49. package/package.json +10 -7
@@ -8,11 +8,14 @@ interface ErrorBoundaryProps {
8
8
  error?: AbstractTranslatableError | Error | string;
9
9
  children: ReactNode;
10
10
  resetKeys?: any[];
11
- onError?: (error: Error) => void;
11
+ onError?: (error: Error) => void | ReactNode;
12
12
  isContainerComponent?: boolean;
13
+ /** If set to true, children will be rendered when an error is provided via props, but not when caught during rendering */
14
+ shouldRenderChildrenWithProvidedError?: boolean;
13
15
  }
14
16
  type ErrorBoundaryState = {
15
17
  error: AbstractTranslatableError | Error | string | null;
18
+ customErrorUI: ReactNode | null;
16
19
  };
17
20
  /**
18
21
  * This component is used to catch errors thrown by the UI component and display an error message
@@ -24,11 +27,12 @@ type ErrorBoundaryState = {
24
27
  */
25
28
  export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
26
29
  showErrorBox: boolean;
27
- onError?: (error: Error) => void;
30
+ onError?: (error: Error) => void | ReactNode;
28
31
  isContainerComponent: boolean;
29
32
  constructor(props: ErrorBoundaryProps);
30
33
  static getDerivedStateFromError(error: Error): {
31
34
  error: Error;
35
+ customErrorUI: null;
32
36
  };
33
37
  componentDidCatch(error: Error): void;
34
38
  componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState): void;
@@ -44,7 +44,7 @@ export { usePlugins } from './plugins-provider/plugins-provider';
44
44
  export { extractDimensionsAndMeasures, useExecutePluginQuery, } from './plugins-provider/use-execute-plugin-query';
45
45
  export { getThemeSettingsByOid } from './themes/theme-loader';
46
46
  export { getDefaultThemeSettings } from './theme-provider/default-theme-settings';
47
- export { useGetDashboardModel, useGetDashboardModels, useDashboardModel, getDashboardModel, getDashboardModels, useGetWidgetModel, getWidgetModel, translateToDashboardResponse, translateToDashboardsResponse, useGetHierarchyModels, getHierarchyModels, translateFiltersAndRelationsToDto, type DashboardModel, type GetDashboardModelParams, type GetDashboardModelsParams, type DashboardModelState, type DashboardModelLoadingState, type DashboardModelSuccessState, type DashboardModelErrorState, type DashboardModelsState, type DashboardModelsLoadingState, type DashboardModelsSuccessState, type DashboardModelsErrorState, type WidgetModel, type WidgetDataOptions, type WidgetModelState, type WidgetModelLoadingState, type WidgetModelErrorState, type WidgetModelSuccessState, type GetWidgetModelParams, type GetDashboardModelOptions, type GetDashboardModelsOptions, type WidgetsPanelColumnLayout, type WidgetsPanelLayout, type WidgetId, type WidgetsOptions, type CommonFiltersOptions, type CommonFiltersApplyMode, type FiltersIgnoringRules, type HierarchyModel, type Hierarchy, type HierarchyId, type GetHierarchyModelsParams, type HierarchyModelsState, type HierarchyModelsLoadingState, type HierarchyModelsErrorState, type HierarchyModelsSuccessState, UseDashboardModelActionType, } from './models';
47
+ export { useGetDashboardModel, useGetDashboardModels, useDashboardModel, getDashboardModel, getDashboardModels, useGetWidgetModel, getWidgetModel, translateToDashboardResponse, translateToDashboardsResponse, useGetHierarchyModels, getHierarchyModels, translateFiltersAndRelationsToDto, type DashboardModel, type GetDashboardModelParams, type GetDashboardModelsParams, type DashboardModelState, type DashboardModelLoadingState, type DashboardModelSuccessState, type DashboardModelErrorState, type DashboardModelsState, type DashboardModelsLoadingState, type DashboardModelsSuccessState, type DashboardModelsErrorState, type WidgetModel, type WidgetDataOptions, type WidgetModelState, type WidgetModelLoadingState, type WidgetModelErrorState, type WidgetModelSuccessState, type GetWidgetModelParams, type GetDashboardModelOptions, type GetDashboardModelsOptions, type WidgetsPanelColumnLayout, type WidgetsPanelLayout, type WidgetsPanelColumn, type WidgetsPanelRow, type WidgetsPanelCell, type WidgetId, type WidgetsOptions, type CommonFiltersOptions, type CommonFiltersApplyMode, type FiltersIgnoringRules, type HierarchyModel, type Hierarchy, type HierarchyId, type GetHierarchyModelsParams, type HierarchyModelsState, type HierarchyModelsLoadingState, type HierarchyModelsErrorState, type HierarchyModelsSuccessState, UseDashboardModelActionType, } from './models';
48
48
  /**
49
49
  * Utility functions to translate a Fusion widget model from and to other widget data structures
50
50
  *
@@ -2,6 +2,7 @@ import { DataSource, Filter, FilterRelations } from '@sisense/sdk-data';
2
2
  import { DashboardStyleOptions, TabbersOptions, WidgetModel } from '../../models';
3
3
  import { type WidgetsOptions } from './types';
4
4
  import { DashboardLayoutOptions } from '../../dashboard';
5
+ import { DashboardSettings } from '../../api/types/dashboard-dto';
5
6
  /**
6
7
  * Model of Sisense Fusion dashboard defined in the abstractions of Compose SDK.
7
8
  *
@@ -55,4 +56,10 @@ export interface DashboardModel {
55
56
  * @internal
56
57
  */
57
58
  tabbersOptions?: TabbersOptions;
59
+ /**
60
+ * Dashboard settings.
61
+ *
62
+ * @internal
63
+ */
64
+ settings?: DashboardSettings;
58
65
  }
@@ -1,5 +1,6 @@
1
1
  import { Filter } from '@sisense/sdk-data';
2
- import { CascadingFilterDto, FilterDto } from '../../api/types/dashboard-dto';
2
+ import { CascadingFilterDto, FilterDto, LayoutDto } from '../../api/types/dashboard-dto';
3
+ import { WidgetsPanelLayout } from '../../dashboard/types';
3
4
  /**
4
5
  * Translates a {@link Filter} to a {@link FilterDto}.
5
6
  *
@@ -8,3 +9,4 @@ import { CascadingFilterDto, FilterDto } from '../../api/types/dashboard-dto';
8
9
  * @internal
9
10
  */
10
11
  export declare function filterToFilterDto(filter: Filter): FilterDto | CascadingFilterDto;
12
+ export declare function layoutToLayoutDto(layout: WidgetsPanelLayout): LayoutDto;
@@ -2,25 +2,37 @@ import { CommonFiltersOptions } from '../../common-filters/types';
2
2
  import { ColorPaletteTheme, TabberConfig } from '../../types';
3
3
  export type { CommonFiltersOptions, CommonFiltersApplyMode, FiltersIgnoringRules, } from '../../common-filters/types';
4
4
  /**
5
- * Column layout of dashboard widgets
5
+ * Part of Dashboard layout, which describes how widgets are arranged in a cell
6
+ */
7
+ export interface WidgetsPanelCell {
8
+ widthPercentage: number;
9
+ /**
10
+ * @privateRemarks
11
+ * This value appears to be overwritten by the widget's height property.
12
+ * Marking as optional and internal for now.
13
+ * @internal
14
+ */
15
+ height?: number | string;
16
+ widgetId: string;
17
+ }
18
+ /**
19
+ * Part of Dashboard layout, which describes how widgets are arranged in a row
20
+ */
21
+ export interface WidgetsPanelRow {
22
+ cells: WidgetsPanelCell[];
23
+ }
24
+ /**
25
+ * Part of Dashboard layout, which describes how widgets are arranged in a column
26
+ */
27
+ export interface WidgetsPanelColumn {
28
+ widthPercentage: number;
29
+ rows: WidgetsPanelRow[];
30
+ }
31
+ /**
32
+ * Dashboard layout, which describes how widgets are arranged in the dashboard
6
33
  */
7
34
  export interface WidgetsPanelColumnLayout {
8
- columns: {
9
- widthPercentage: number;
10
- rows: {
11
- cells: {
12
- widthPercentage: number;
13
- /**
14
- * @privateRemarks
15
- * This value appears to be overwritten by the widget's height property.
16
- * Marking as optional and internal for now.
17
- * @internal
18
- */
19
- height?: number | string;
20
- widgetId: string;
21
- }[];
22
- }[];
23
- }[];
35
+ columns: WidgetsPanelColumn[];
24
36
  }
25
37
  /**
26
38
  * Layout of dashboard widgets panel, which is a union of different layout algorithms
@@ -39,7 +51,7 @@ export type WidgetsOptions = Record<WidgetId, {
39
51
  filtersOptions?: CommonFiltersOptions;
40
52
  }>;
41
53
  /**
42
- * Options for TabberWidetss in a dashboard
54
+ * Options for TabberWidets in a dashboard
43
55
  *
44
56
  * This property actually moves responsibility on the layout management from the tabber widgets to the dashboard,
45
57
  * storing all the tabbers configs in the single place
@@ -1,4 +1,4 @@
1
- import { DashboardModel, WidgetModel } from '../../../models';
1
+ import { DashboardModel, WidgetModel, WidgetsPanelLayout } from '../../../models';
2
2
  import { Filter, FilterRelations } from '@sisense/sdk-data';
3
3
  import { RestApi } from '../../../api/rest-api';
4
4
  export type UseDashboardModelState = DashboardModel | null;
@@ -8,8 +8,7 @@ export type UseDashboardModelState = DashboardModel | null;
8
8
  * @internal
9
9
  */
10
10
  export declare enum UseDashboardModelActionTypeInternal {
11
- DASHBOARD_INIT = "DASHBOARD.INIT",
12
- DASHBOARD_UPDATE_LAYOUT = "DASHBOARD.UPDATE_LAYOUT"
11
+ DASHBOARD_INIT = "DASHBOARD.INIT"
13
12
  }
14
13
  /**
15
14
  * Action types for the dashboard model state used in {@link useDashboardModel}.
@@ -18,7 +17,8 @@ export declare enum UseDashboardModelActionTypeInternal {
18
17
  */
19
18
  export declare enum UseDashboardModelActionType {
20
19
  FILTERS_UPDATE = "FILTERS.UPDATE",
21
- ADD_WIDGET = "WIDGETS.ADD"
20
+ ADD_WIDGET = "WIDGETS.ADD",
21
+ WIDGETS_PANEL_LAYOUT_UPDATE = "WIDGETS_PANEL_LAYOUT.UPDATE"
22
22
  }
23
23
  /**
24
24
  * Internal actions for the dashboard model state used in {@link useDashboardModel}.
@@ -34,7 +34,7 @@ export type UseDashboardModelInternalAction = UseDashboardModelAction | {
34
34
  *
35
35
  * @internal
36
36
  */
37
- export type UseDashboardModelAction = UseDashboardModelFilterUpdateAction | UseDashboardModelAddWidgetAction;
37
+ export type UseDashboardModelAction = UseDashboardModelFilterUpdateAction | UseDashboardModelAddWidgetAction | UseDashboardModelLayoutUpdateAction;
38
38
  /**
39
39
  * Filter update actions for the dashboard model state used in {@link useDashboardModel}.
40
40
  *
@@ -53,6 +53,15 @@ export type UseDashboardModelAddWidgetAction = {
53
53
  type: UseDashboardModelActionType.ADD_WIDGET;
54
54
  payload: WidgetModel;
55
55
  };
56
+ /**
57
+ * Layout update action for the dashboard model state used in {@link useDashboardModel}.
58
+ *
59
+ * @internal
60
+ */
61
+ export type UseDashboardModelLayoutUpdateAction = {
62
+ type: UseDashboardModelActionType.WIDGETS_PANEL_LAYOUT_UPDATE;
63
+ payload: WidgetsPanelLayout;
64
+ };
56
65
  /**
57
66
  * Reducer for the dashboard model state used in {@link useDashboardModel}.
58
67
  *
@@ -86,6 +86,9 @@ export interface SisenseContextProviderProps {
86
86
  /**
87
87
  * Callback function that is triggered when an error occurs within the Sisense context.
88
88
  *
89
+ * Return React node to render a custom error UI.
90
+ * Return `undefined` to use the default error UI.
91
+ *
89
92
  * This callback is useful for handling errors that happen during the initialization or runtime of the Sisense context,
90
93
  * such as incorrect configuration, invalid authentication, or network-related issues.
91
94
  *
@@ -100,7 +103,7 @@ export interface SisenseContextProviderProps {
100
103
  componentName: string;
101
104
  /** The props of the component that caused the error. */
102
105
  componentProps: unknown;
103
- }) => void;
106
+ }) => void | ReactNode;
104
107
  /**
105
108
  * Boolean flag to enable sending silent pre-authentication requests to the Sisense instance.
106
109
  * Used to check if user is already authenticated, check is performed in an ivisible iframe.
@@ -1,6 +1,9 @@
1
1
  import { CompleteThemeSettings } from '../types';
2
2
  export declare const DEFAULT_DIVIDER_COLOR = "#F2F2F2";
3
3
  export declare const DEFAULT_DIVIDER_WIDTH = 4;
4
+ export declare const DEFAULT_DASHBOARD_BORDER_COLOR = "#D5D5D5";
5
+ export declare const DEFAULT_DASHBOARD_BORDER_WIDTH = 1;
6
+ export declare const DEFAULT_FILTER_PANEL_BORDER_COLOR = "#DADADA";
4
7
  export declare const DEFAULT_TITLE_FONT_SIZE = 15;
5
8
  /**
6
9
  * Returns default theme settings, which can be used as base for custom theme options.
@@ -352,6 +352,15 @@ export declare const translation: {
352
352
  grandTotal: string;
353
353
  subTotal: string;
354
354
  };
355
+ dashboard: {
356
+ toolbar: {
357
+ undo: string;
358
+ redo: string;
359
+ cancel: string;
360
+ apply: string;
361
+ editLayout: string;
362
+ };
363
+ };
355
364
  };
356
365
  /**
357
366
  * A reference type containing all currently used translation keys.
@@ -362,6 +362,15 @@ export declare const resources: {
362
362
  grandTotal: string;
363
363
  subTotal: string;
364
364
  };
365
+ dashboard: {
366
+ toolbar: {
367
+ undo: string;
368
+ redo: string;
369
+ cancel: string;
370
+ apply: string;
371
+ editLayout: string;
372
+ };
373
+ };
365
374
  };
366
375
  uk: {
367
376
  errors: {
@@ -717,5 +726,14 @@ export declare const resources: {
717
726
  grandTotal: string;
718
727
  subTotal: string;
719
728
  };
729
+ dashboard: {
730
+ toolbar: {
731
+ undo: string;
732
+ redo: string;
733
+ cancel: string;
734
+ apply: string;
735
+ editLayout: string;
736
+ };
737
+ };
720
738
  };
721
739
  };
@@ -944,6 +944,8 @@ export type DashboardThemeSettings = {
944
944
  backgroundColor?: string;
945
945
  dividerLineWidth?: number;
946
946
  dividerLineColor?: string;
947
+ borderWidth?: number;
948
+ borderColor?: string;
947
949
  };
948
950
  /**
949
951
  * Filter theme settings
@@ -954,6 +956,18 @@ export type FilterThemeSettings = {
954
956
  titleColor?: string;
955
957
  /** Background color */
956
958
  backgroundColor?: string;
959
+ /**
960
+ * Border color
961
+ *
962
+ * @internal
963
+ * */
964
+ borderColor?: string;
965
+ /**
966
+ * Border width
967
+ *
968
+ * @internal
969
+ * */
970
+ borderWidth?: number;
957
971
  };
958
972
  };
959
973
  /**