@sisense/sdk-ui 0.11.3 → 0.12.1
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/api/rest-api.d.ts +30 -0
- package/dist/api/types/dashboard-dto.d.ts +13 -0
- package/dist/app/client-application.d.ts +6 -0
- package/dist/app/settings/settings.d.ts +1 -0
- package/dist/chart-data-options/validate-data-options/index.d.ts +1 -0
- package/dist/chart-data-options/validate-data-options/validate-categorical-data-options.d.ts +3 -0
- package/dist/chart-data-options/{validate-data-options.d.ts → validate-data-options/validate-data-options.d.ts} +4 -4
- package/dist/chart-options-processor/chart-options-service.d.ts +1 -1
- package/dist/common/hooks/data-load-state-reducer.d.ts +65 -0
- package/dist/common/hooks/types.d.ts +8 -0
- package/dist/common/hooks/use-previous.d.ts +7 -0
- package/dist/dashboard-widget/types.d.ts +7 -6
- package/dist/dashboard-widget/utils.d.ts +0 -1
- package/dist/decorators/as-sisense-component.d.ts +2 -0
- package/dist/decorators/with-default-translations.d.ts +6 -0
- package/dist/decorators/with-sisense-context-validation.d.ts +1 -1
- package/dist/decorators/with-tracking/error-tracker.d.ts +2 -0
- package/dist/error-boundary/error-boundary-box.d.ts +4 -3
- package/dist/error-boundary/error-boundary.d.ts +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +37090 -34175
- package/dist/models/dashboard/get-dashboard-model.d.ts +11 -0
- package/dist/models/dashboard/get-dashboard-models.d.ts +17 -0
- package/dist/models/dashboard/index.d.ts +6 -0
- package/dist/models/dashboard/translate-dashboard.d.ts +3 -0
- package/dist/models/dashboard/types.d.ts +8 -0
- package/dist/models/dashboard/use-get-dashboard-model.d.ts +99 -0
- package/dist/models/dashboard/use-get-dashboard-models.d.ts +84 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/widget/index.d.ts +2 -0
- package/dist/models/widget/translate-widget.d.ts +3 -0
- package/dist/models/widget/types.d.ts +6 -0
- package/dist/props.d.ts +1 -1
- package/dist/query-execution/query-state-reducer.d.ts +2 -9
- package/dist/query-execution/use-execute-query-by-widget-id.d.ts +1 -1
- package/dist/query-execution/use-execute-query.d.ts +0 -7
- package/dist/translation/i18n-provider.d.ts +7 -0
- package/dist/translation/initialize-i18n.d.ts +2 -0
- package/dist/translation/resources/en.d.ts +28 -0
- package/dist/translation/resources/index.d.ts +59 -0
- package/dist/translation/resources/uk.d.ts +2 -0
- package/dist/translation/translatable-error.d.ts +5 -0
- package/dist/translation/use-initialized-i18n.d.ts +2 -0
- package/package.json +7 -5
- package/dist/dashboard-widget/fetch-widget.d.ts +0 -11
- package/dist/locales/en.d.ts +0 -17
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
2
|
+
import { WidgetDto } from '../dashboard-widget/types';
|
|
3
|
+
import type { DashboardDto } from './types/dashboard-dto';
|
|
4
|
+
type GetDashboardsOptions = {
|
|
5
|
+
searchByTitle?: string;
|
|
6
|
+
fields?: string[];
|
|
7
|
+
expand?: string[];
|
|
8
|
+
};
|
|
9
|
+
type GetDashboardOptions = {
|
|
10
|
+
fields?: string[];
|
|
11
|
+
expand?: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare class RestApi {
|
|
14
|
+
private httpClient;
|
|
15
|
+
constructor(httpClient: HttpClient);
|
|
16
|
+
/**
|
|
17
|
+
* Get all dashboards
|
|
18
|
+
*/
|
|
19
|
+
getDashboards: (options?: GetDashboardsOptions) => Promise<DashboardDto[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a specific dashboard
|
|
22
|
+
*/
|
|
23
|
+
getDashboard: (dashboardOid: string, options?: GetDashboardOptions) => Promise<DashboardDto>;
|
|
24
|
+
/**
|
|
25
|
+
* Get a specific widget from a dashboard
|
|
26
|
+
*/
|
|
27
|
+
getWidget: (widgetOid: string, dashboardOid: string) => Promise<WidgetDto>;
|
|
28
|
+
}
|
|
29
|
+
export declare const useGetApi: () => RestApi;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WidgetDto, Datasource, FilterJaql } from '../../dashboard-widget/types';
|
|
2
|
+
type Filter = {
|
|
3
|
+
jaql: FilterJaql;
|
|
4
|
+
isCascading: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type DashboardDto = {
|
|
7
|
+
oid: string;
|
|
8
|
+
title: string;
|
|
9
|
+
datasource: Datasource;
|
|
10
|
+
widgets?: WidgetDto[];
|
|
11
|
+
filters?: Filter[];
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -12,6 +12,12 @@ export type AppConfig = {
|
|
|
12
12
|
* A [date-fns Locale](https://date-fns.org/v2.30.0/docs/Locale)
|
|
13
13
|
*/
|
|
14
14
|
locale?: Locale;
|
|
15
|
+
/**
|
|
16
|
+
* Language code to be used for translations
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
language?: string;
|
|
15
21
|
/**
|
|
16
22
|
* Date Configurations
|
|
17
23
|
*/
|
|
@@ -10,6 +10,7 @@ export type AppSettings = Required<ConfigurableAppSettings> & ServerSettings;
|
|
|
10
10
|
type ConfigurableAppSettings = AppConfig;
|
|
11
11
|
type ServerSettings = {
|
|
12
12
|
serverThemeSettings: ThemeSettings;
|
|
13
|
+
serverLanguage: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* Gets the application settings
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validate-data-options';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CategoricalChartType } from '../../types';
|
|
2
|
+
import { CategoricalChartDataOptions } from '../types';
|
|
3
|
+
export declare function validateCategoricalChartDataOptions(chartType: CategoricalChartType, dataOptions: CategoricalChartDataOptions): CategoricalChartDataOptions;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ChartDataOptions, ChartDataOptionsInternal, Value } from '
|
|
2
|
-
import { ChartType } from '
|
|
1
|
+
import { ChartDataOptions, ChartDataOptionsInternal, Value } from '../types';
|
|
2
|
+
import { ChartType } from '../../types';
|
|
3
3
|
import { Attribute, Data, Filter, Measure } from '@sisense/sdk-data';
|
|
4
|
-
import { DataTable } from '
|
|
4
|
+
import { DataTable } from '../../chart-data-processor/table-processor';
|
|
5
5
|
export type DataColumnNamesMapping = Record<string, string>;
|
|
6
6
|
/**
|
|
7
7
|
* Generates and applies unique data column names and creates a mapping of new names to original names.
|
|
@@ -18,4 +18,4 @@ export declare const applyDefaultChartDataOptions: (chartDataOptions: ChartDataO
|
|
|
18
18
|
* Validates attributes, measures, filters, and highlights against the columns in data.
|
|
19
19
|
*/
|
|
20
20
|
export declare const validateDataOptionsAgainstData: (data: Data | DataTable, attributes: Attribute[], measures: Measure[], dataColumnNamesMapping: DataColumnNamesMapping, filters?: Filter[], highlights?: Filter[]) => boolean;
|
|
21
|
-
export declare function validateDataOptions(chartType: ChartType, dataOptions: ChartDataOptions):
|
|
21
|
+
export declare function validateDataOptions(chartType: ChartType, dataOptions: ChartDataOptions): ChartDataOptions;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* States of a data load.
|
|
3
|
+
*/
|
|
4
|
+
export type DataState<Data> = DataLoadingState<Data> | DataErrorState | DataSuccessState<Data>;
|
|
5
|
+
/**
|
|
6
|
+
* State of data loading.
|
|
7
|
+
*/
|
|
8
|
+
export type DataLoadingState<Data> = {
|
|
9
|
+
/** Whether the data is loading */
|
|
10
|
+
isLoading: true;
|
|
11
|
+
/** Whether the data load has failed */
|
|
12
|
+
isError: false;
|
|
13
|
+
/** Whether the data load has succeeded */
|
|
14
|
+
isSuccess: false;
|
|
15
|
+
/** The error if any occurred */
|
|
16
|
+
error: undefined;
|
|
17
|
+
/** The result data if the load has succeeded */
|
|
18
|
+
data: Data | undefined;
|
|
19
|
+
/** The status of the data load */
|
|
20
|
+
status: 'loading';
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* State of a data load that has failed.
|
|
24
|
+
*/
|
|
25
|
+
export type DataErrorState = {
|
|
26
|
+
/** Whether the data is loading */
|
|
27
|
+
isLoading: false;
|
|
28
|
+
/** Whether the data load has failed */
|
|
29
|
+
isError: true;
|
|
30
|
+
/** Whether the data load has succeeded */
|
|
31
|
+
isSuccess: false;
|
|
32
|
+
/** The error if any occurred */
|
|
33
|
+
error: Error;
|
|
34
|
+
/** The result data if the load has succeeded */
|
|
35
|
+
data: undefined;
|
|
36
|
+
/** The status of the data load */
|
|
37
|
+
status: 'error';
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* State of a data load that has succeeded.
|
|
41
|
+
*/
|
|
42
|
+
export type DataSuccessState<Data> = {
|
|
43
|
+
/** Whether the data is loading */
|
|
44
|
+
isLoading: false;
|
|
45
|
+
/** Whether the data load has failed */
|
|
46
|
+
isError: false;
|
|
47
|
+
/** Whether the data load has succeeded */
|
|
48
|
+
isSuccess: true;
|
|
49
|
+
/** The error if any occurred */
|
|
50
|
+
error: undefined;
|
|
51
|
+
/** The result data if the load has succeeded */
|
|
52
|
+
data: Data;
|
|
53
|
+
/** The status of the data load */
|
|
54
|
+
status: 'success';
|
|
55
|
+
};
|
|
56
|
+
export type DataLoadAction<Data> = {
|
|
57
|
+
type: 'loading';
|
|
58
|
+
} | {
|
|
59
|
+
type: 'success';
|
|
60
|
+
data: Data;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'error';
|
|
63
|
+
error: Error;
|
|
64
|
+
};
|
|
65
|
+
export declare function dataLoadStateReducer<Data>(state: DataState<Data>, action: DataLoadAction<Data>): DataState<Data>;
|
|
@@ -13,6 +13,12 @@ export declare const enum WidgetType {
|
|
|
13
13
|
TableWithAggregation = "tablewidgetagg"
|
|
14
14
|
}
|
|
15
15
|
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';
|
|
16
|
+
export type Datasource = {
|
|
17
|
+
title: string;
|
|
18
|
+
id: string;
|
|
19
|
+
fullname?: string;
|
|
20
|
+
live: boolean;
|
|
21
|
+
};
|
|
16
22
|
/**
|
|
17
23
|
* The data transfer object (DTO) containing info of a widget on a dashboard.
|
|
18
24
|
*
|
|
@@ -23,12 +29,7 @@ export interface WidgetDto {
|
|
|
23
29
|
oid: string;
|
|
24
30
|
type: WidgetType | string;
|
|
25
31
|
subtype: WidgetSubtype | string;
|
|
26
|
-
datasource:
|
|
27
|
-
title: string;
|
|
28
|
-
id: string;
|
|
29
|
-
fullname: string;
|
|
30
|
-
live: boolean;
|
|
31
|
-
};
|
|
32
|
+
datasource: Datasource;
|
|
32
33
|
metadata: {
|
|
33
34
|
panels: Panel[];
|
|
34
35
|
};
|
|
@@ -25,7 +25,6 @@ export declare function mergeFilters(sourceFilters?: Filter[], targetFilters?: F
|
|
|
25
25
|
* @param {Filter[]} widgetFilters - The filters from the widget.
|
|
26
26
|
* @param {Filter[]} codeFilters - The filters from the code.
|
|
27
27
|
* @param {FiltersMergeStrategy} [mergeStrategy] - The strategy to use for merging filters.
|
|
28
|
-
*
|
|
29
28
|
* @returns {Filter[]} The merged filters based on the selected strategy.
|
|
30
29
|
*/
|
|
31
30
|
export declare function mergeFiltersByStrategy(widgetFilters?: Filter[], codeFilters?: Filter[], mergeStrategy?: FiltersMergeStrategy): Filter[];
|
|
@@ -9,6 +9,8 @@ export type SisenseComponentConfig = {
|
|
|
9
9
|
shouldSkipSisenseContextWaiting?: boolean | ((props: any) => boolean);
|
|
10
10
|
/** If set to true (or function returns true), the component will not be tracked */
|
|
11
11
|
shouldSkipTracking?: boolean | ((props: any) => boolean);
|
|
12
|
+
/** If set, the error message for wrong SisenseContext will be overridden with the provided key */
|
|
13
|
+
customContextErrorMessageKey?: string;
|
|
12
14
|
};
|
|
13
15
|
export type ComponentDecorator<DecoratorConfig> = (decoratorConfig: DecoratorConfig) => <ComponentProps extends Record<string, any>>(Component: FunctionComponent<ComponentProps>) => FunctionComponent<ComponentProps>;
|
|
14
16
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentDecorator, SisenseComponentConfig } from './as-sisense-component';
|
|
2
|
-
type SisenseContextValidationConfig = Pick<SisenseComponentConfig, 'shouldSkipSisenseContextWaiting'>;
|
|
2
|
+
type SisenseContextValidationConfig = Pick<SisenseComponentConfig, 'shouldSkipSisenseContextWaiting' | 'customContextErrorMessageKey'>;
|
|
3
3
|
/**
|
|
4
4
|
* Adds waiting for the Sisense context to be initialized
|
|
5
5
|
*/
|
|
@@ -11,10 +11,12 @@ export declare class ErrorTracker extends Component<ErrorTrackerProps, {
|
|
|
11
11
|
componentName: string;
|
|
12
12
|
context: SisenseContextPayload;
|
|
13
13
|
httpClient?: HttpClient;
|
|
14
|
+
postponedErrors: Error[];
|
|
14
15
|
constructor(props: ErrorTrackerProps);
|
|
15
16
|
static contextType: import("react").Context<SisenseContextPayload>;
|
|
16
17
|
componentDidMount(): void;
|
|
17
18
|
componentDidCatch(error: Error): void;
|
|
19
|
+
private sendErrorTracking;
|
|
18
20
|
render(): ReactNode;
|
|
19
21
|
}
|
|
20
22
|
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { AbstractTranslatableError } from '@sisense/sdk-common';
|
|
2
3
|
/**
|
|
3
4
|
* This component is used to display an error message when a component fails to render.
|
|
4
5
|
* It is used by the ErrorBoundary component.
|
|
5
6
|
*
|
|
6
7
|
* @param props - component properties
|
|
7
|
-
* @param props.
|
|
8
|
+
* @param props.error - The error to translate and display
|
|
8
9
|
* @returns A component which will replace the component when it fails to render
|
|
9
10
|
*/
|
|
10
|
-
declare const ErrorBoundaryBox: ({
|
|
11
|
-
|
|
11
|
+
declare const ErrorBoundaryBox: ({ error, }: {
|
|
12
|
+
error: Error | AbstractTranslatableError | string;
|
|
12
13
|
}) => JSX.Element;
|
|
13
14
|
export default ErrorBoundaryBox;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { Component, ReactNode } from 'react';
|
|
2
2
|
import { SisenseContextPayload } from '../sisense-context/sisense-context';
|
|
3
|
+
import { AbstractTranslatableError } from '@sisense/sdk-common';
|
|
3
4
|
/**
|
|
4
5
|
* @internal
|
|
5
6
|
*/
|
|
6
7
|
interface ErrorBoundaryProps {
|
|
7
8
|
showErrorBox?: boolean;
|
|
8
|
-
error?: Error | string;
|
|
9
|
+
error?: AbstractTranslatableError | Error | string;
|
|
9
10
|
children: ReactNode;
|
|
10
11
|
resetKeys?: any[];
|
|
11
12
|
}
|
|
12
13
|
type ErrorBoundaryState = {
|
|
13
|
-
error: Error | string | null;
|
|
14
|
+
error: AbstractTranslatableError | Error | string | null;
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
17
|
* This component is used to catch errors thrown by the UI component and display an error message
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from './sisense-context/custom-sisense-context-provider';
|
|
|
30
30
|
export * from './theme-provider/custom-theme-provider';
|
|
31
31
|
export { getThemeSettingsByOid } from './themes/theme-loader';
|
|
32
32
|
export { getDefaultThemeSettings } from './chart-options-processor/theme-option-service';
|
|
33
|
+
export { useGetDashboardModel, useGetDashboardModels, getDashboardModel, getDashboardModels, type DashboardModel, type GetDashboardModelParams, type GetDashboardModelsParams, type DashboardModelState, type DashboardModelLoadingState, type DashboardModelSuccessState, type DashboardModelErrorState, type DashboardModelsState, type DashboardModelsLoadingState, type DashboardModelsSuccessState, type DashboardModelsErrorState, type WidgetModel, } from './models';
|
|
33
34
|
export * from './props';
|
|
34
35
|
export * from './types';
|
|
35
36
|
export * from './filters';
|