@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.
- package/dist/ai.cjs +9 -9
- package/dist/ai.js +553 -578
- package/dist/analytics-composer.cjs +120 -119
- package/dist/analytics-composer.js +3235 -2506
- package/dist/{derive-chart-family-5CbFzbpu.js → derive-chart-family-BLaI9-3r.js} +23488 -23351
- package/dist/{derive-chart-family-C3FH49ux.cjs → derive-chart-family-CxqjTyNt.cjs} +196 -196
- package/dist/dimensions-C-VKss5V.cjs +1 -0
- package/dist/dimensions-Cfq9FexH.js +200 -0
- package/dist/index.cjs +24 -20
- package/dist/index.js +5909 -6105
- package/dist/packages/sdk-ui/src/ai/ai-context-provider.d.ts +13 -6
- package/dist/packages/sdk-ui/src/ai/chat-config.d.ts +4 -2
- package/dist/packages/sdk-ui/src/ai/chatbot.d.ts +17 -7
- package/dist/packages/sdk-ui/src/ai/get-nlg-insights.d.ts +0 -21
- package/dist/packages/sdk-ui/src/ai/index.d.ts +4 -3
- package/dist/packages/sdk-ui/src/ai/use-get-nlg-insights.d.ts +0 -12
- package/dist/packages/sdk-ui/src/ai/use-get-nlq-result.d.ts +0 -4
- package/dist/packages/sdk-ui/src/ai/use-get-query-recommendations.d.ts +0 -4
- package/dist/packages/sdk-ui/src/analytics-composer/{common → code}/stringify-props.d.ts +10 -2
- package/dist/packages/sdk-ui/src/analytics-composer/common/custom-superjson.d.ts +16 -0
- package/dist/packages/sdk-ui/src/analytics-composer/dashboard/dashboard-composer.d.ts +8 -0
- package/dist/packages/sdk-ui/src/analytics-composer/dashboard/stringify-widgets.d.ts +3 -0
- package/dist/packages/sdk-ui/src/analytics-composer/dashboard/to-dashboard-code.d.ts +3 -0
- package/dist/packages/sdk-ui/src/analytics-composer/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/analytics-composer/query/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/analytics-composer/query/query-translator.d.ts +1 -0
- package/dist/packages/sdk-ui/src/analytics-composer/query/simplify-metadata-item.d.ts +9 -0
- package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +78 -4
- package/dist/packages/sdk-ui/src/analytics-composer/widget/chart-options/get-widget-options.d.ts +1 -1
- package/dist/packages/sdk-ui/src/analytics-composer/widget/to-widget-code.d.ts +3 -1
- package/dist/packages/sdk-ui/src/app/client-application.d.ts +3 -55
- package/dist/packages/sdk-ui/src/area-range-chart.d.ts +0 -1
- package/dist/packages/sdk-ui/src/common/components/menu/types.d.ts +1 -0
- package/dist/packages/sdk-ui/src/dashboard/dashboard-helpers.d.ts +0 -11
- package/dist/packages/sdk-ui/src/dashboard/index.d.ts +1 -1
- package/dist/packages/sdk-ui/src/dashboard/types.d.ts +7 -3
- package/dist/packages/sdk-ui/src/dashboard/use-composed-dashboard.d.ts +1 -4
- package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/index.d.ts +0 -1
- package/dist/packages/sdk-ui/src/filters/components/filter-tile.d.ts +0 -1
- package/dist/packages/sdk-ui/src/index-typedoc.d.ts +4 -1
- package/dist/packages/sdk-ui/src/index.d.ts +4 -3
- package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dashboard-model-reducer.d.ts +15 -1
- package/dist/packages/sdk-ui/src/models/widget/types.d.ts +1 -1
- package/dist/packages/sdk-ui/src/models/widget/widget-model-translator.d.ts +2 -12
- package/dist/packages/sdk-ui/src/models/widget/widget-model.d.ts +1 -125
- package/dist/packages/sdk-ui/src/props.d.ts +25 -45
- package/dist/packages/sdk-ui/src/query-execution/types.d.ts +1 -3
- package/dist/packages/sdk-ui/src/translation/resources/en.d.ts +2 -1
- package/dist/packages/sdk-ui/src/translation/resources/index.d.ts +4 -2
- package/dist/packages/sdk-ui/src/types.d.ts +48 -41
- package/dist/packages/sdk-ui/src/utils/{utility-types.d.ts → utility-types/basic-utility-types.d.ts} +0 -34
- package/dist/packages/sdk-ui/src/utils/utility-types/distributive-omit.d.ts +24 -0
- package/dist/packages/sdk-ui/src/utils/utility-types/index.d.ts +4 -0
- package/dist/packages/sdk-ui/src/utils/utility-types/rest-api-hook-state.d.ts +35 -0
- package/dist/packages/sdk-ui/src/utils/utility-types/soft-union.d.ts +35 -0
- package/dist/packages/sdk-ui/src/widget-by-id/translate-dashboard-filters.d.ts +0 -7
- package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-data-options.d.ts +2 -2
- package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-drilldown-options.d.ts +2 -2
- package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-style-options.d.ts +2 -2
- package/dist/packages/sdk-ui/src/widget-by-id/types.d.ts +2 -2
- package/dist/packages/sdk-ui/src/widget-by-id/utils.d.ts +23 -16
- package/dist/packages/sdk-ui/src/widgets/widget.d.ts +0 -1
- package/dist/{use-common-filters-CqGo6jp3.cjs → use-common-filters-BGGGgJJ5.cjs} +13 -13
- package/dist/{use-common-filters-Bw15BNGn.js → use-common-filters-Cmyb86sc.js} +4618 -4637
- package/dist/widget-composer-BJURHrVD.cjs +428 -0
- package/dist/widget-composer-C4rwNt4P.js +959 -0
- package/package.json +12 -9
- package/dist/packages/sdk-ui/src/ai/common/beta-label.d.ts +0 -1
- package/dist/packages/sdk-ui/src/analytics-composer/widget/stringify-props.d.ts +0 -8
- package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/types.d.ts +0 -8
- package/dist/packages/sdk-ui/src/utils/check-and-notify-about-deprecated-prop.d.ts +0 -1
- package/dist/packages/sdk-ui/src/widget-by-id/dashboard-widget.d.ts +0 -27
- package/dist/widget-composer-C5_iIuZN.js +0 -742
- package/dist/widget-composer-D5_iKTui.cjs +0 -316
- /package/dist/packages/sdk-ui/src/analytics-composer/{widget → code}/stringify-filters.d.ts +0 -0
|
@@ -3,10 +3,9 @@ export * from './chart-data-options/types';
|
|
|
3
3
|
export { Chart } from './chart';
|
|
4
4
|
export { ThemeProvider } from './theme-provider';
|
|
5
5
|
export * from './dashboard';
|
|
6
|
-
export { DashboardWidget } from './widget-by-id/dashboard-widget';
|
|
7
6
|
export { WidgetById } from './widget-by-id/widget-by-id';
|
|
8
7
|
export { isChartWidgetProps, isPivotTableWidgetProps, isTextWidgetProps, isPluginWidgetProps, } from './widget-by-id/utils';
|
|
9
|
-
export { type
|
|
8
|
+
export { type CartesianWidgetType, type CategoricalWidgetType, type TabularWidgetType, type TextWidgetType, } from './widget-by-id/types';
|
|
10
9
|
export { getChartType } from './widget-by-id/utils';
|
|
11
10
|
export * from './query-execution';
|
|
12
11
|
export { executeQuery, executePivotQuery } from './query/execute-query';
|
|
@@ -45,7 +44,7 @@ export { usePlugins } from './plugins-provider/plugins-provider';
|
|
|
45
44
|
export { extractDimensionsAndMeasures, useExecutePluginQuery, } from './plugins-provider/use-execute-plugin-query';
|
|
46
45
|
export { getThemeSettingsByOid } from './themes/theme-loader';
|
|
47
46
|
export { getDefaultThemeSettings } from './theme-provider/default-theme-settings';
|
|
48
|
-
export { useGetDashboardModel, useGetDashboardModels, useDashboardModel, getDashboardModel, getDashboardModels, useGetWidgetModel, getWidgetModel, translateToDashboardResponse, translateToDashboardsResponse, useGetHierarchyModels, getHierarchyModels, 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 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';
|
|
49
48
|
/**
|
|
50
49
|
* Utility functions to translate a Fusion widget model from and to other widget data structures
|
|
51
50
|
*
|
|
@@ -74,6 +73,8 @@ export { boxWhiskerProcessResult } from './boxplot-utils';
|
|
|
74
73
|
export { queryStateReducer } from './query-execution/query-state-reducer';
|
|
75
74
|
export * from './props';
|
|
76
75
|
export * from './types';
|
|
76
|
+
export type { SoftUnion } from './utils/utility-types';
|
|
77
|
+
export type { BeforeMenuOpenHandler } from './common/components/menu/types';
|
|
77
78
|
export * from './filters';
|
|
78
79
|
export * from './formulas';
|
|
79
80
|
export { trackHook } from './decorators/hook-decorators';
|
|
@@ -61,6 +61,20 @@ export type UseDashboardModelAddWidgetAction = {
|
|
|
61
61
|
* @internal
|
|
62
62
|
*/
|
|
63
63
|
export declare function dashboardReducer(state: UseDashboardModelState, action: UseDashboardModelInternalAction): UseDashboardModelState;
|
|
64
|
+
/**
|
|
65
|
+
* Translates filters and relations to DTOs.
|
|
66
|
+
*
|
|
67
|
+
* @param filtersOrFilterRelations - The filters or filter relations to translate
|
|
68
|
+
* @returns The translated filters and relations DTOs for Fusion
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export declare function translateFiltersAndRelationsToDto(filtersOrFilterRelations: Filter[] | FilterRelations): {
|
|
72
|
+
filters: (import("../../../api/types/dashboard-dto").FilterDto | import("../../../api/types/dashboard-dto").CascadingFilterDto)[];
|
|
73
|
+
filterRelations: {
|
|
74
|
+
datasource: string;
|
|
75
|
+
filterRelations: import("@sisense/sdk-data").FilterRelationsModelNode;
|
|
76
|
+
}[] | undefined;
|
|
77
|
+
};
|
|
64
78
|
/**
|
|
65
79
|
* Middleware that persists the dashboard model changes to the Sisense server.
|
|
66
80
|
*
|
|
@@ -68,4 +82,4 @@ export declare function dashboardReducer(state: UseDashboardModelState, action:
|
|
|
68
82
|
* @param reducer - The dashboard model reducer
|
|
69
83
|
* @internal
|
|
70
84
|
*/
|
|
71
|
-
export declare function persistDashboardModelMiddleware(
|
|
85
|
+
export declare function persistDashboardModelMiddleware(dashboardOid: string | undefined, action: UseDashboardModelInternalAction, restApi: RestApi): Promise<UseDashboardModelInternalAction>;
|
|
@@ -2,7 +2,7 @@ import { ChartType } from '../../index';
|
|
|
2
2
|
/**
|
|
3
3
|
* Widget type
|
|
4
4
|
*
|
|
5
|
-
* todo: as a future refactoring need to replace
|
|
5
|
+
* todo: as a future refactoring need to replace this type by combination of WidgetType and ChartType
|
|
6
6
|
*
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExecutePivotQueryParams, ExecuteQueryParams } from '../../query-execution';
|
|
2
2
|
import { WidgetModel } from './widget-model.js';
|
|
3
3
|
import { ChartProps, ChartWidgetProps, WidgetProps, PivotTableProps, PivotTableWidgetProps, PluginWidgetProps, TableProps, TableWidgetProps, TextWidgetProps, CommonWidgetProps } from '../../props';
|
|
4
|
-
import {
|
|
4
|
+
import { JaqlDataSourceForDto } from '@sisense/sdk-data';
|
|
5
5
|
import { CompleteThemeSettings } from '../../types.js';
|
|
6
6
|
import { WidgetDto } from '../../widget-by-id/types.js';
|
|
7
7
|
import { AppSettings } from '../../app/settings/settings.js';
|
|
@@ -160,16 +160,6 @@ export declare function fromChartWidgetProps(chartWidgetProps: ChartWidgetProps)
|
|
|
160
160
|
* @internal
|
|
161
161
|
*/
|
|
162
162
|
export declare function fromWidgetProps(widgetProps: WidgetProps): WidgetModel;
|
|
163
|
-
/**
|
|
164
|
-
* Data source as specified in the jaql
|
|
165
|
-
* but with required filelds
|
|
166
|
-
*
|
|
167
|
-
* @internal
|
|
168
|
-
*/
|
|
169
|
-
export type JaqlDataSourceForWidgetDto = JaqlDataSource & {
|
|
170
|
-
id: string;
|
|
171
|
-
address?: string;
|
|
172
|
-
};
|
|
173
163
|
/**
|
|
174
164
|
* Translates a {@link WidgetModel} to {@link WidgetDto}.
|
|
175
165
|
*
|
|
@@ -178,4 +168,4 @@ export type JaqlDataSourceForWidgetDto = JaqlDataSource & {
|
|
|
178
168
|
* @returns WidgetDto
|
|
179
169
|
* @internal
|
|
180
170
|
*/
|
|
181
|
-
export declare function toWidgetDto(widgetModel: WidgetModel, dataSource?:
|
|
171
|
+
export declare function toWidgetDto(widgetModel: WidgetModel, dataSource?: JaqlDataSourceForDto): WidgetDto;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { DataSource, Filter } from '@sisense/sdk-data';
|
|
2
2
|
import { ChartDataOptions, PivotTableDataOptions } from '../../chart-data-options/types';
|
|
3
|
-
import { WidgetType } from '../../
|
|
4
|
-
import { ChartProps, ChartWidgetProps, PivotTableProps, TableProps, TableWidgetProps, PivotTableWidgetProps, TextWidgetProps } from '../../props';
|
|
5
|
-
import { ExecutePivotQueryParams, ExecuteQueryParams } from '../../query-execution';
|
|
3
|
+
import type { WidgetType } from '../../props';
|
|
6
4
|
import { ChartType, DrilldownOptions, WidgetStyleOptions } from '../../types';
|
|
7
5
|
import { EmptyObject } from '@sisense/sdk-query-client/src/helpers/utility-types';
|
|
8
6
|
/**
|
|
@@ -34,8 +32,6 @@ export interface WidgetModel {
|
|
|
34
32
|
dataSource: DataSource;
|
|
35
33
|
/**
|
|
36
34
|
* Widget type.
|
|
37
|
-
*
|
|
38
|
-
* @deprecated Use {@link widgetModelTranslator} methods instead
|
|
39
35
|
*/
|
|
40
36
|
widgetType: WidgetType;
|
|
41
37
|
/**
|
|
@@ -68,125 +64,5 @@ export interface WidgetModel {
|
|
|
68
64
|
* Widget drilldown options.
|
|
69
65
|
*/
|
|
70
66
|
drilldownOptions: DrilldownOptions;
|
|
71
|
-
/**
|
|
72
|
-
* Returns the parameters to be used for executing a query for the widget.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```tsx
|
|
76
|
-
* const {data, isLoading, isError} = useExecuteQuery(widget.getExecuteQueryParams());
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* Note: this method is not supported for getting pivot query.
|
|
80
|
-
* Use {@link getExecutePivotQueryParams} instead for getting query parameters for the pivot widget.
|
|
81
|
-
* @deprecated Use {@link widgetModelTranslator.toExecuteQueryParams} instead
|
|
82
|
-
*/
|
|
83
|
-
getExecuteQueryParams(): ExecuteQueryParams;
|
|
84
|
-
/**
|
|
85
|
-
* Returns the parameters to be used for executing a query for the pivot widget.
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```tsx
|
|
89
|
-
* const {data, isLoading, isError} = useExecutePivotQuery(widget.getExecutePivotQueryParams());
|
|
90
|
-
* ```
|
|
91
|
-
*
|
|
92
|
-
* Note: this method is supported only for getting pivot query.
|
|
93
|
-
* Use {@link getExecuteQueryParams} instead for getting query parameters for non-pivot widgets.
|
|
94
|
-
* @deprecated Use {@link widgetModelTranslator.toExecutePivotQueryParams} instead
|
|
95
|
-
*/
|
|
96
|
-
getExecutePivotQueryParams(): ExecutePivotQueryParams;
|
|
97
|
-
/**
|
|
98
|
-
* Returns the props to be used for rendering a chart.
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```tsx
|
|
102
|
-
* <Chart {...widget.getChartProps()} />
|
|
103
|
-
* ```
|
|
104
|
-
*
|
|
105
|
-
* Note: this method is not supported for pivot table widgets.
|
|
106
|
-
* Use {@link getPivotTableProps} instead for getting props for the <PivotTable> component.
|
|
107
|
-
* @deprecated Use {@link widgetModelTranslator.toChartProps} instead
|
|
108
|
-
*/
|
|
109
|
-
getChartProps(): ChartProps;
|
|
110
|
-
/**
|
|
111
|
-
* Returns the props to be used for rendering a table.
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* ```tsx
|
|
115
|
-
* <Table {...widget.getTableProps()} />
|
|
116
|
-
* ```
|
|
117
|
-
*
|
|
118
|
-
* Note: this method is not supported for chart and pivot widgets.
|
|
119
|
-
* Use {@link getChartProps} instead for getting props for the <Chart> component.
|
|
120
|
-
* Use {@link getPivotTableProps} instead for getting props for the <PivotTable> component.
|
|
121
|
-
* @deprecated Use {@link widgetModelTranslator.toTableProps} instead
|
|
122
|
-
*/
|
|
123
|
-
getTableProps(): TableProps;
|
|
124
|
-
/**
|
|
125
|
-
* Returns the props to be used for rendering a pivot table.
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```tsx
|
|
129
|
-
* <PivotTable {...widget.getPivotTableProps()} />
|
|
130
|
-
* ```
|
|
131
|
-
*
|
|
132
|
-
* Note: this method is not supported for chart or table widgets.
|
|
133
|
-
* Use {@link getChartProps} instead for getting props for the <Chart> component.
|
|
134
|
-
* Use {@link getTableProps} instead for getting props for the <Table> component.
|
|
135
|
-
* @deprecated Use {@link widgetModelTranslator.toPivotTableProps} instead
|
|
136
|
-
*/
|
|
137
|
-
getPivotTableProps(): PivotTableProps;
|
|
138
|
-
/**
|
|
139
|
-
* Returns the props to be used for rendering a chart widget.
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* ```tsx
|
|
143
|
-
* <ChartWidget {...widget.getChartWidgetProps()} />
|
|
144
|
-
* ```
|
|
145
|
-
*
|
|
146
|
-
* Note: this method is not supported for pivot widgets.
|
|
147
|
-
* @deprecated Use {@link widgetModelTranslator.toChartWidgetProps} instead
|
|
148
|
-
*/
|
|
149
|
-
getChartWidgetProps(): ChartWidgetProps;
|
|
150
|
-
/**
|
|
151
|
-
* Returns the props to be used for rendering a table widget.
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
* ```tsx
|
|
155
|
-
* <TableWidget {...widget.getTableWidgetProps()} />
|
|
156
|
-
* ```
|
|
157
|
-
*
|
|
158
|
-
* Note: this method is not supported for chart widgets.
|
|
159
|
-
* Use {@link getChartWidgetProps} instead for getting props for the <ChartWidget> component.
|
|
160
|
-
* @deprecated Use {@link widgetModelTranslator.toTableWidgetProps} instead
|
|
161
|
-
* @internal
|
|
162
|
-
*/
|
|
163
|
-
getTableWidgetProps(): TableWidgetProps;
|
|
164
|
-
/**
|
|
165
|
-
* Returns the props to be used for rendering a pivot table widget.
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* ```tsx
|
|
169
|
-
* <PivotTableWidget {...widget.getPivotTableWidgetProps()} />
|
|
170
|
-
* ```
|
|
171
|
-
|
|
172
|
-
* Note: this method is not supported for chart or table widgets.
|
|
173
|
-
* Use {@link getChartWidgetProps} instead for getting props for the <ChartWidget> component.
|
|
174
|
-
* @deprecated Use {@link widgetModelTranslator.toPivotTableWidgetProps} instead
|
|
175
|
-
*/
|
|
176
|
-
getPivotTableWidgetProps(): PivotTableWidgetProps;
|
|
177
|
-
/**
|
|
178
|
-
* Returns the props to be used for rendering a text widget.
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* ```tsx
|
|
182
|
-
* <TextWidget {...widget.getTextWidgetProps()} />
|
|
183
|
-
* ```
|
|
184
|
-
*
|
|
185
|
-
* Note: this method is not supported for chart or pivot widgets.
|
|
186
|
-
* Use {@link getChartWidgetProps} instead for getting props for the <ChartWidget> component.
|
|
187
|
-
* Use {@link getPivotTableWidgetProps} instead for getting props for the <PivotTableWidget> component.
|
|
188
|
-
* @deprecated Use {@link widgetModelTranslator.toTextWidgetProps} instead
|
|
189
|
-
*/
|
|
190
|
-
getTextWidgetProps(): TextWidgetProps;
|
|
191
67
|
}
|
|
192
68
|
export declare const isWidgetModel: (widget: any) => widget is WidgetModel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Attribute, Filter, Measure, DataSource, Data, QueryResultData, FilterRelations } from '@sisense/sdk-data';
|
|
2
|
-
import { ChartDataOptions, CartesianChartDataOptions, CategoricalChartDataOptions, ThemeSettings, PolarStyleOptions, PieStyleOptions, StackableStyleOptions, LineStyleOptions, AreaStyleOptions, FunnelStyleOptions, ScatterStyleOptions, ChartStyleOptions, ChartType, IndicatorStyleOptions, DrilldownOptions, ThemeOid, TreemapStyleOptions, CustomDrilldownResult, MenuPosition, MenuItemSection, SunburstStyleOptions, ChartWidgetStyleOptions, TableWidgetStyleOptions, WidgetByIdStyleOptions, BoxplotStyleOptions, ScattermapStyleOptions, AreamapStyleOptions, DataPoint, ScatterDataPoint, AreamapDataPoint, BoxplotDataPoint, ChartDataPoints, ScattermapDataPoint, PivotTableStyleOptions, PivotTableWidgetStyleOptions, RegularChartType, RegularChartStyleOptions, TabularChartStyleOptions, TableStyleOptions, AreaRangeStyleOptions, DrilldownSelection, TextWidgetStyleOptions, GenericDataOptions,
|
|
2
|
+
import { ChartDataOptions, CartesianChartDataOptions, CategoricalChartDataOptions, ThemeSettings, PolarStyleOptions, PieStyleOptions, StackableStyleOptions, LineStyleOptions, AreaStyleOptions, FunnelStyleOptions, ScatterStyleOptions, ChartStyleOptions, ChartType, IndicatorStyleOptions, DrilldownOptions, ThemeOid, TreemapStyleOptions, CustomDrilldownResult, MenuPosition, MenuItemSection, SunburstStyleOptions, ChartWidgetStyleOptions, TableWidgetStyleOptions, WidgetByIdStyleOptions, BoxplotStyleOptions, ScattermapStyleOptions, AreamapStyleOptions, DataPoint, ScatterDataPoint, AreamapDataPoint, BoxplotDataPoint, ChartDataPoints, ScattermapDataPoint, PivotTableStyleOptions, PivotTableWidgetStyleOptions, RegularChartType, RegularChartStyleOptions, TabularChartStyleOptions, TableStyleOptions, AreaRangeStyleOptions, DrilldownSelection, TextWidgetStyleOptions, GenericDataOptions, IndicatorRenderOptions, TabberStyleProps } from './types';
|
|
3
3
|
import { HighchartsOptions } from './chart-options-processor/chart-options-service';
|
|
4
4
|
import { ComponentType, PropsWithChildren, ReactNode } from 'react';
|
|
5
5
|
import { IndicatorChartDataOptions, BoxplotChartCustomDataOptions, BoxplotChartDataOptions, ScatterChartDataOptions, TableDataOptions, ScattermapChartDataOptions, AreamapChartDataOptions, PivotTableDataOptions, RegularChartDataOptions, TabularChartDataOptions, RangeChartDataOptions } from './chart-data-options/types';
|
|
@@ -10,6 +10,7 @@ import { HookEnableParam } from './common/hooks/types';
|
|
|
10
10
|
import { ExecuteQueryResult } from './query-execution/types';
|
|
11
11
|
import { Hierarchy } from './models';
|
|
12
12
|
import { BeforeMenuOpenHandler } from './common/components/menu/types';
|
|
13
|
+
import { DistributiveOmit } from './utils/utility-types/distributive-omit';
|
|
13
14
|
export type { MenuItemSection, HighchartsOptions };
|
|
14
15
|
/**
|
|
15
16
|
* Configurations and authentication for Sisense Context.
|
|
@@ -106,7 +107,8 @@ export interface SisenseContextProviderProps {
|
|
|
106
107
|
* Used only with SSO authentication.
|
|
107
108
|
* If not specified, the default value is `false`.
|
|
108
109
|
*
|
|
109
|
-
* @
|
|
110
|
+
* @category Sisense Authentication
|
|
111
|
+
*
|
|
110
112
|
*/
|
|
111
113
|
enableSilentPreAuth?: boolean;
|
|
112
114
|
}
|
|
@@ -133,11 +135,7 @@ export interface ExecuteQueryProps {
|
|
|
133
135
|
count?: number;
|
|
134
136
|
/** {@inheritDoc ExecuteQueryParams.offset} */
|
|
135
137
|
offset?: number;
|
|
136
|
-
/**
|
|
137
|
-
* {@inheritDoc ExecuteQueryParams.ungroup}
|
|
138
|
-
*
|
|
139
|
-
* @internal
|
|
140
|
-
*/
|
|
138
|
+
/** {@inheritDoc ExecuteQueryParams.ungroup} */
|
|
141
139
|
ungroup?: boolean;
|
|
142
140
|
/** Function as child component that is called to render the query results */
|
|
143
141
|
children?: (queryResult: ExecuteQueryResult) => ReactNode;
|
|
@@ -299,7 +297,6 @@ interface BaseChartEventProps {
|
|
|
299
297
|
* Can be used to inject modification of queried data.
|
|
300
298
|
*
|
|
301
299
|
* @category Callbacks
|
|
302
|
-
* @internal
|
|
303
300
|
*/
|
|
304
301
|
onDataReady?: (data: Data) => Data;
|
|
305
302
|
}
|
|
@@ -920,19 +917,6 @@ export interface WidgetByIdProps extends Omit<ChartWidgetProps, 'dataSource' | '
|
|
|
920
917
|
*/
|
|
921
918
|
drilldownOptions?: DrilldownOptions;
|
|
922
919
|
}
|
|
923
|
-
/**
|
|
924
|
-
* Props for the {@link DashboardWidget} component
|
|
925
|
-
*
|
|
926
|
-
* @deprecated Use {@link WidgetById} and {@link WidgetByIdProps} instead
|
|
927
|
-
*/
|
|
928
|
-
export interface DashboardWidgetProps extends WidgetByIdProps {
|
|
929
|
-
/**
|
|
930
|
-
* Style options for the widget including the widget container and the chart or table inside.
|
|
931
|
-
*
|
|
932
|
-
* @category Widget
|
|
933
|
-
*/
|
|
934
|
-
styleOptions?: DashboardWidgetStyleOptions;
|
|
935
|
-
}
|
|
936
920
|
/**
|
|
937
921
|
* Props for the {@link ChartWidget} component
|
|
938
922
|
*
|
|
@@ -1222,20 +1206,19 @@ export interface PluginWidgetProps {
|
|
|
1222
1206
|
description?: string;
|
|
1223
1207
|
}
|
|
1224
1208
|
/**
|
|
1225
|
-
* A utility type that combines widget-specific properties (`
|
|
1226
|
-
*
|
|
1227
|
-
* This is used to extend the props of a widget with its respective widget type.
|
|
1209
|
+
* A utility type that combines widget-specific properties (`BaseWidget`)
|
|
1210
|
+
* with a common widget props including corresponding widget type (`Type`).
|
|
1228
1211
|
*/
|
|
1229
|
-
export type
|
|
1212
|
+
export type WithCommonWidgetProps<BaseWidget, Type extends WidgetType> = BaseWidget & {
|
|
1213
|
+
/**
|
|
1214
|
+
* Unique identifier of the widget within the container component (dashboard)
|
|
1215
|
+
*
|
|
1216
|
+
*/
|
|
1217
|
+
readonly id: string;
|
|
1230
1218
|
/**
|
|
1231
1219
|
* Widget type
|
|
1232
1220
|
*/
|
|
1233
|
-
widgetType:
|
|
1234
|
-
};
|
|
1235
|
-
/**
|
|
1236
|
-
* Props for the facade widget component.
|
|
1237
|
-
*/
|
|
1238
|
-
export type CommonWidgetProps = (WithWidgetType<ChartWidgetProps, 'chart'> | WithWidgetType<PivotTableWidgetProps, 'pivot'> | WithWidgetType<TextWidgetProps, 'text'> | WithWidgetType<PluginWidgetProps, 'plugin'>) & {
|
|
1221
|
+
widgetType: Type;
|
|
1239
1222
|
/**
|
|
1240
1223
|
* Optional handler function to process menu options before opening the context menu.
|
|
1241
1224
|
*
|
|
@@ -1243,16 +1226,20 @@ export type CommonWidgetProps = (WithWidgetType<ChartWidgetProps, 'chart'> | Wit
|
|
|
1243
1226
|
*/
|
|
1244
1227
|
onBeforeMenuOpen?: BeforeMenuOpenHandler;
|
|
1245
1228
|
};
|
|
1229
|
+
/**
|
|
1230
|
+
* Type of the widget component.
|
|
1231
|
+
*/
|
|
1232
|
+
export type WidgetType = 'chart' | 'pivot' | 'text' | 'plugin';
|
|
1246
1233
|
/**
|
|
1247
1234
|
* Props for the widget component within a container component like dashboard.
|
|
1248
1235
|
*/
|
|
1249
|
-
export type WidgetProps =
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1236
|
+
export type WidgetProps = WithCommonWidgetProps<ChartWidgetProps, 'chart'> | WithCommonWidgetProps<PivotTableWidgetProps, 'pivot'> | WithCommonWidgetProps<TextWidgetProps, 'text'> | WithCommonWidgetProps<PluginWidgetProps, 'plugin'>;
|
|
1237
|
+
/**
|
|
1238
|
+
* Props for the facade widget component.
|
|
1239
|
+
*
|
|
1240
|
+
* @internal
|
|
1241
|
+
*/
|
|
1242
|
+
export type CommonWidgetProps = DistributiveOmit<WidgetProps, 'id'>;
|
|
1256
1243
|
/**
|
|
1257
1244
|
* Props for {@link ExecuteQueryByWidgetId} component.
|
|
1258
1245
|
*
|
|
@@ -1476,13 +1463,6 @@ export type DrilldownWidgetConfig = {
|
|
|
1476
1463
|
* Props for the {@link DrilldownWidget} component
|
|
1477
1464
|
*/
|
|
1478
1465
|
export interface DrilldownWidgetProps {
|
|
1479
|
-
/**
|
|
1480
|
-
* List of dimensions to allow drilldowns on
|
|
1481
|
-
*
|
|
1482
|
-
* @category Widget
|
|
1483
|
-
* @deprecated Use {@link DrilldownWidgetProps.drilldownPaths} instead
|
|
1484
|
-
*/
|
|
1485
|
-
drilldownDimensions?: Attribute[];
|
|
1486
1466
|
/**
|
|
1487
1467
|
* Dimensions and hierarchies available for drilldown on.
|
|
1488
1468
|
*
|
|
@@ -209,11 +209,9 @@ export interface ExecuteQueryParams {
|
|
|
209
209
|
/**
|
|
210
210
|
* Boolean flag whether to include `ungroup: true` in non-aggregated JAQL queries.
|
|
211
211
|
*
|
|
212
|
-
* This improves computation and performance of querying
|
|
212
|
+
* This improves computation and performance of querying tables when no aggregation is needed
|
|
213
213
|
*
|
|
214
214
|
* If not specified, the default value is `false`
|
|
215
|
-
*
|
|
216
|
-
* @internal
|
|
217
215
|
*/
|
|
218
216
|
ungroup?: boolean;
|
|
219
217
|
/**
|
|
@@ -41,6 +41,8 @@ export declare const translation: {
|
|
|
41
41
|
onlyPivotWidgetSupported: string;
|
|
42
42
|
onlyTextWidgetSupported: string;
|
|
43
43
|
onlyPluginWidgetSupported: string;
|
|
44
|
+
unsupportedWidgetType: string;
|
|
45
|
+
unsupportedFusionWidgetType: string;
|
|
44
46
|
};
|
|
45
47
|
unknownFilterInFilterRelations: string;
|
|
46
48
|
filterRelationsNotSupported: string;
|
|
@@ -226,7 +228,6 @@ export declare const translation: {
|
|
|
226
228
|
dataTopics: string;
|
|
227
229
|
chatbotDescription: string;
|
|
228
230
|
topicSelectPrompt: string;
|
|
229
|
-
betaLabel: string;
|
|
230
231
|
preview: string;
|
|
231
232
|
clearHistoryPrompt: string;
|
|
232
233
|
config: {
|
|
@@ -51,6 +51,8 @@ export declare const resources: {
|
|
|
51
51
|
onlyPivotWidgetSupported: string;
|
|
52
52
|
onlyTextWidgetSupported: string;
|
|
53
53
|
onlyPluginWidgetSupported: string;
|
|
54
|
+
unsupportedWidgetType: string;
|
|
55
|
+
unsupportedFusionWidgetType: string;
|
|
54
56
|
};
|
|
55
57
|
unknownFilterInFilterRelations: string;
|
|
56
58
|
filterRelationsNotSupported: string;
|
|
@@ -236,7 +238,6 @@ export declare const resources: {
|
|
|
236
238
|
dataTopics: string;
|
|
237
239
|
chatbotDescription: string;
|
|
238
240
|
topicSelectPrompt: string;
|
|
239
|
-
betaLabel: string;
|
|
240
241
|
preview: string;
|
|
241
242
|
clearHistoryPrompt: string;
|
|
242
243
|
config: {
|
|
@@ -405,6 +406,8 @@ export declare const resources: {
|
|
|
405
406
|
onlyPivotWidgetSupported: string;
|
|
406
407
|
onlyTextWidgetSupported: string;
|
|
407
408
|
onlyPluginWidgetSupported: string;
|
|
409
|
+
unsupportedWidgetType: string;
|
|
410
|
+
unsupportedFusionWidgetType: string;
|
|
408
411
|
};
|
|
409
412
|
unknownFilterInFilterRelations: string;
|
|
410
413
|
filterRelationsNotSupported: string;
|
|
@@ -590,7 +593,6 @@ export declare const resources: {
|
|
|
590
593
|
dataTopics: string;
|
|
591
594
|
chatbotDescription: string;
|
|
592
595
|
topicSelectPrompt: string;
|
|
593
|
-
betaLabel: string;
|
|
594
596
|
preview: string;
|
|
595
597
|
clearHistoryPrompt: string;
|
|
596
598
|
config: {
|
|
@@ -13,6 +13,7 @@ import { HighchartsOptionsInternal } from './chart-options-processor/chart-optio
|
|
|
13
13
|
import { CSSProperties } from 'react';
|
|
14
14
|
import { GeoDataElement, RawGeoDataElement } from './chart/restructured-charts/areamap-chart/types';
|
|
15
15
|
import { TabCornerRadius, TabInterval, TabSize } from './widgets/tabber-widget';
|
|
16
|
+
import { SoftUnion } from './utils/utility-types';
|
|
16
17
|
export type { SortDirection, PivotRowsSort } from '@sisense/sdk-data';
|
|
17
18
|
export type { AppConfig } from './app/client-application';
|
|
18
19
|
export type { DateConfig } from './query/date-formats';
|
|
@@ -320,24 +321,6 @@ export type IndicatorStyleOptions = (NumericSimpleIndicatorStyleOptions | Numeri
|
|
|
320
321
|
};
|
|
321
322
|
/** Configuration options that define functional style of the various elements of the Table Component */
|
|
322
323
|
export interface TableStyleOptions {
|
|
323
|
-
/**
|
|
324
|
-
* Boolean flag whether to fill header cells with background color
|
|
325
|
-
*
|
|
326
|
-
* @deprecated Use {@link TableStyleOptions#header | TableStyleOptions.header.color} instead.
|
|
327
|
-
*/
|
|
328
|
-
headersColor?: boolean;
|
|
329
|
-
/**
|
|
330
|
-
* Boolean flag whether to apply background color to alternate rows.
|
|
331
|
-
*
|
|
332
|
-
* @deprecated Use {@link TableStyleOptions#rows | TableStyleOptions.rows.alternatingColor} instead.
|
|
333
|
-
*/
|
|
334
|
-
alternatingRowsColor?: boolean;
|
|
335
|
-
/**
|
|
336
|
-
* Boolean flag whether to apply background color to alternate columns
|
|
337
|
-
*
|
|
338
|
-
* @deprecated Use {@link TableStyleOptions#columns | TableStyleOptions.columns.alternatingColor} instead.
|
|
339
|
-
*/
|
|
340
|
-
alternatingColumnsColor?: boolean;
|
|
341
324
|
/**
|
|
342
325
|
* Vertical padding around whole table
|
|
343
326
|
* Default value is 20px
|
|
@@ -668,12 +651,6 @@ export interface ChartThemeSettings {
|
|
|
668
651
|
secondaryTextColor?: string;
|
|
669
652
|
/** Background color */
|
|
670
653
|
backgroundColor?: string;
|
|
671
|
-
/**
|
|
672
|
-
* Toolbar Background color, can be used as a secondary background color
|
|
673
|
-
*
|
|
674
|
-
* @deprecated
|
|
675
|
-
*/
|
|
676
|
-
panelBackgroundColor?: string;
|
|
677
654
|
/** Animation options */
|
|
678
655
|
animation?: {
|
|
679
656
|
/** Chart initialization animation options */
|
|
@@ -1229,13 +1206,6 @@ export interface WidgetByIdStyleOptions extends WidgetContainerStyleOptions {
|
|
|
1229
1206
|
*/
|
|
1230
1207
|
height?: number;
|
|
1231
1208
|
}
|
|
1232
|
-
/**
|
|
1233
|
-
* Style settings defining the look and feel of DashboardWidget
|
|
1234
|
-
*
|
|
1235
|
-
* @deprecated Use {@link WidgetByIdStyleOptions} instead
|
|
1236
|
-
*/
|
|
1237
|
-
export interface DashboardWidgetStyleOptions extends WidgetByIdStyleOptions {
|
|
1238
|
-
}
|
|
1239
1209
|
/** Style settings defining the look and feel of ChartWidget */
|
|
1240
1210
|
export type ChartWidgetStyleOptions = ChartStyleOptions & WidgetContainerStyleOptions;
|
|
1241
1211
|
/**
|
|
@@ -1272,12 +1242,6 @@ export declare type ColorPaletteTheme = {
|
|
|
1272
1242
|
};
|
|
1273
1243
|
/** Configuration for the drilldown */
|
|
1274
1244
|
export type DrilldownOptions = {
|
|
1275
|
-
/**
|
|
1276
|
-
* Dimensions that can be used for drilldown
|
|
1277
|
-
*
|
|
1278
|
-
* @deprecated Use {@link DrilldownOptions.drilldownPaths} instead
|
|
1279
|
-
*/
|
|
1280
|
-
drilldownDimensions?: Attribute[];
|
|
1281
1245
|
/**
|
|
1282
1246
|
* Dimensions and hierarchies available for drilldown on.
|
|
1283
1247
|
*/
|
|
@@ -1653,6 +1617,51 @@ export type CustomTranslationObject = {
|
|
|
1653
1617
|
*/
|
|
1654
1618
|
namespace?: string;
|
|
1655
1619
|
};
|
|
1620
|
+
/**
|
|
1621
|
+
* Translation Configuration
|
|
1622
|
+
*/
|
|
1623
|
+
export type TranslationConfig = {
|
|
1624
|
+
/**
|
|
1625
|
+
* Language code to be used for translations.
|
|
1626
|
+
*/
|
|
1627
|
+
language?: string;
|
|
1628
|
+
/**
|
|
1629
|
+
* Additional translation resources to be loaded.
|
|
1630
|
+
*
|
|
1631
|
+
* You can find the list of available translation keys in the translation folder of every package.
|
|
1632
|
+
*
|
|
1633
|
+
* Translation keys that are not provided will default to the English translation.
|
|
1634
|
+
* If translation is provided for a package other than sdk-ui, please specify the namespace property.
|
|
1635
|
+
*
|
|
1636
|
+
* Important: Do not translate parts in {{}} - these are placeholders for dynamic values and will be matched using provided variable names.
|
|
1637
|
+
*
|
|
1638
|
+
* @example
|
|
1639
|
+
* ```ts
|
|
1640
|
+
* customTranslations: [
|
|
1641
|
+
* {
|
|
1642
|
+
* language: 'fr',
|
|
1643
|
+
* resources: {
|
|
1644
|
+
* errors: {
|
|
1645
|
+
* invalidFilterType: 'Type de filtre invalide',
|
|
1646
|
+
* },
|
|
1647
|
+
* },
|
|
1648
|
+
* },
|
|
1649
|
+
* {
|
|
1650
|
+
* language: 'es',
|
|
1651
|
+
* namespace: 'sdkData'
|
|
1652
|
+
* resources: {
|
|
1653
|
+
* errors: {
|
|
1654
|
+
* measure: {
|
|
1655
|
+
* unsupportedType: 'Tipo de medida no compatible',
|
|
1656
|
+
* },
|
|
1657
|
+
* },
|
|
1658
|
+
* },
|
|
1659
|
+
* },
|
|
1660
|
+
* ]
|
|
1661
|
+
* ```
|
|
1662
|
+
*/
|
|
1663
|
+
customTranslations?: CustomTranslationObject[];
|
|
1664
|
+
};
|
|
1656
1665
|
/**
|
|
1657
1666
|
* Single Tabber Widget tab object without styling
|
|
1658
1667
|
*
|
|
@@ -1707,10 +1716,8 @@ export type TabberConfig = {
|
|
|
1707
1716
|
activeTab: number;
|
|
1708
1717
|
};
|
|
1709
1718
|
/** @internal */
|
|
1710
|
-
export type CustomContextProviderProps<P> = {
|
|
1719
|
+
export type CustomContextProviderProps<P> = SoftUnion<{
|
|
1711
1720
|
context: P;
|
|
1712
|
-
error?: undefined;
|
|
1713
1721
|
} | {
|
|
1714
|
-
context?: undefined;
|
|
1715
1722
|
error: Error;
|
|
1716
|
-
}
|
|
1723
|
+
}>;
|
package/dist/packages/sdk-ui/src/utils/{utility-types.d.ts → utility-types/basic-utility-types.d.ts}
RENAMED
|
@@ -61,38 +61,4 @@ export type AnyArray = any[];
|
|
|
61
61
|
* type TRequiredB = WithRequiredProp<T, 'b'>; // { a: string; b: number; c?: boolean; }
|
|
62
62
|
*/
|
|
63
63
|
export type WithRequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
64
|
-
/**
|
|
65
|
-
* Universal generic state for hooks that fetch data from the REST API.
|
|
66
|
-
*/
|
|
67
|
-
export type RestApiHookState<DataKey extends string, SuccessDataType extends AnyObject | AnyArray> = RestApiHookSuccessState<DataKey, SuccessDataType> | RestApiHookErrorState<DataKey> | RestApiHookLoadingState<DataKey>;
|
|
68
|
-
/** Success state of the REST API hook */
|
|
69
|
-
export type RestApiHookSuccessState<DataKey extends string, SuccessDataType extends AnyObject | AnyArray> = {
|
|
70
|
-
isLoading: false;
|
|
71
|
-
isError: false;
|
|
72
|
-
isSuccess: true;
|
|
73
|
-
error: undefined;
|
|
74
|
-
status: 'success';
|
|
75
|
-
} & {
|
|
76
|
-
[key in DataKey]: SuccessDataType;
|
|
77
|
-
};
|
|
78
|
-
/** Error state of the REST API hook */
|
|
79
|
-
export type RestApiHookErrorState<DataKey extends string> = {
|
|
80
|
-
isLoading: false;
|
|
81
|
-
isError: true;
|
|
82
|
-
isSuccess: false;
|
|
83
|
-
error: Error;
|
|
84
|
-
status: 'error';
|
|
85
|
-
} & {
|
|
86
|
-
[key in DataKey]: undefined;
|
|
87
|
-
};
|
|
88
|
-
/** Loading state of the REST API hook */
|
|
89
|
-
export type RestApiHookLoadingState<DataKey extends string> = {
|
|
90
|
-
isLoading: true;
|
|
91
|
-
isError: false;
|
|
92
|
-
isSuccess: false;
|
|
93
|
-
error: undefined;
|
|
94
|
-
status: 'loading';
|
|
95
|
-
} & {
|
|
96
|
-
[key in DataKey]: undefined;
|
|
97
|
-
};
|
|
98
64
|
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility type that applies `Omit` distributively over a union of types.
|
|
3
|
+
*
|
|
4
|
+
* In TypeScript, applying `Omit` directly to a union type causes the keys to be removed
|
|
5
|
+
* from the union "as a whole", resulting in unintended behavior. This type fixes that by
|
|
6
|
+
* distributing `Omit` to each member of the union individually.
|
|
7
|
+
*
|
|
8
|
+
* @template T The union of types to apply the omit to.
|
|
9
|
+
* @template K The keys to omit from each type in the union.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* type A = { type: 'a'; foo: string };
|
|
13
|
+
* type B = { type: 'b'; bar: number };
|
|
14
|
+
* type U = A | B;
|
|
15
|
+
*
|
|
16
|
+
* // Without distributive omit:
|
|
17
|
+
* type Broken = Omit<U, 'type'>;
|
|
18
|
+
* // Result: { foo?: string; bar?: number } - not a union anymore
|
|
19
|
+
*
|
|
20
|
+
* // With distributive omit:
|
|
21
|
+
* type Fixed = DistributiveOmit<U, 'type'>;
|
|
22
|
+
* // Result: { foo: string } | { bar: number } - still a union
|
|
23
|
+
*/
|
|
24
|
+
export type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
|