@sisense/sdk-ui 1.0.0 → 1.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 (62) hide show
  1. package/dist/ai/api/chat-rest-api.d.ts +2 -2
  2. package/dist/ai/api/hooks.d.ts +2 -2
  3. package/dist/ai/api/types.d.ts +21 -21
  4. package/dist/ai/messages/get-widget-options.d.ts +3 -3
  5. package/dist/ai.js +690 -683
  6. package/dist/api/rest-api.d.ts +9 -0
  7. package/dist/app/client-application.d.ts +5 -0
  8. package/dist/app/settings/settings.d.ts +2 -1
  9. package/dist/areamap-chart.d.ts +25 -0
  10. package/dist/boxplot-chart.d.ts +0 -2
  11. package/dist/chart-data/areamap-data.d.ts +4 -0
  12. package/dist/chart-data/data-coloring/geo-data-coloring-function.d.ts +2 -0
  13. package/dist/chart-data/types.d.ts +32 -3
  14. package/dist/chart-data-options/get-translated-data-options.d.ts +2 -2
  15. package/dist/chart-data-options/translate-scattermap-data-options.d.ts +1 -1
  16. package/dist/chart-data-options/types.d.ts +25 -5
  17. package/dist/chart-options-processor/boxplot-chart-options.d.ts +2 -1
  18. package/dist/chart-options-processor/chart-options-service.d.ts +3 -1
  19. package/dist/chart-options-processor/style-to-design-options-translator/translate-to-areamap-options.d.ts +3 -0
  20. package/dist/chart-options-processor/subtype-to-design-options.d.ts +4 -1
  21. package/dist/chart-options-processor/translations/boxplot/boxplot-tooltip.d.ts +2 -1
  22. package/dist/chart-options-processor/translations/design-options.d.ts +7 -1
  23. package/dist/chart-options-processor/translations/types.d.ts +7 -3
  24. package/dist/charts/map-charts/areamap/alternative-country-names-dictionary.d.ts +9 -0
  25. package/dist/charts/map-charts/areamap/areamap-map.d.ts +16 -0
  26. package/dist/charts/map-charts/areamap/areamap.d.ts +16 -0
  27. package/dist/charts/map-charts/areamap/feature-styles-dictionary.d.ts +16 -0
  28. package/dist/charts/map-charts/areamap/use-geo-json.d.ts +9 -0
  29. package/dist/charts/map-charts/scattermap/hooks/use-locations.d.ts +3 -0
  30. package/dist/charts/{scattermap → map-charts/scattermap}/hooks/use-tooltip-handler.d.ts +2 -2
  31. package/dist/charts/{scattermap → map-charts/scattermap}/scattermap.d.ts +3 -3
  32. package/dist/charts/map-charts/scattermap/utils/color.d.ts +3 -0
  33. package/dist/charts/{scattermap → map-charts/scattermap}/utils/location.d.ts +1 -1
  34. package/dist/charts/{scattermap → map-charts/scattermap}/utils/markers.d.ts +1 -1
  35. package/dist/charts/{scattermap → map-charts/scattermap}/utils/size.d.ts +1 -1
  36. package/dist/charts/{scattermap → map-charts/scattermap}/utils/tooltip.d.ts +2 -2
  37. package/dist/dashboard-widget/types.d.ts +5 -3
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.js +13318 -7328
  40. package/dist/props.d.ts +19 -2
  41. package/dist/query/execute-query.d.ts +17 -2
  42. package/dist/query-execution/index.d.ts +2 -1
  43. package/dist/query-execution/pivot-query-state-reducer.d.ts +2 -0
  44. package/dist/query-execution/types.d.ts +134 -1
  45. package/dist/query-execution/use-execute-pivot-query.d.ts +54 -0
  46. package/dist/scattermap-chart.d.ts +0 -2
  47. package/dist/table-widget-65f3e04e.js +77762 -0
  48. package/dist/translation/resources/en.d.ts +10 -0
  49. package/dist/translation/resources/index.d.ts +20 -0
  50. package/dist/types.d.ts +17 -5
  51. package/dist/utils/filters-comparator.d.ts +13 -1
  52. package/dist/widgets/common/custom-drilldown.d.ts +3 -0
  53. package/dist/widgets/common/drilldown-breadcrumbs/styled-buttons.d.ts +2 -2
  54. package/package.json +10 -6
  55. package/dist/charts/scattermap/hooks/use-locations.d.ts +0 -3
  56. package/dist/charts/scattermap/utils/color.d.ts +0 -3
  57. package/dist/table-widget-7936746a.js +0 -72481
  58. /package/dist/charts/{scattermap → map-charts/scattermap}/hooks/use-settings.d.ts +0 -0
  59. /package/dist/charts/{scattermap → map-charts/scattermap}/types.d.ts +0 -0
  60. /package/dist/charts/{scattermap → map-charts/scattermap}/utils/copyright.d.ts +0 -0
  61. /package/dist/charts/{scattermap → map-charts/scattermap}/utils/map.d.ts +0 -0
  62. /package/dist/charts/{scattermap → map-charts/scattermap}/utils/values.d.ts +0 -0
package/dist/props.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Attribute, Filter, Measure, DataSource, Data, QueryResultData, FilterRelation } from '@sisense/sdk-data';
2
- import { ChartDataOptions, CartesianChartDataOptions, CategoricalChartDataOptions, ThemeSettings, PolarStyleOptions, PieStyleOptions, StackableStyleOptions, LineStyleOptions, AreaStyleOptions, FunnelStyleOptions, ScatterStyleOptions, ChartStyleOptions, ChartType, IndicatorStyleOptions, DrilldownOptions, TableStyleOptions, ThemeOid, TreemapStyleOptions, CustomDrilldownResult, MenuPosition, MenuItemSection, SunburstStyleOptions, ChartWidgetStyleOptions, TableWidgetStyleOptions, DashboardWidgetStyleOptions, BoxplotStyleOptions, ScattermapStyleOptions } from './types';
2
+ import { ChartDataOptions, CartesianChartDataOptions, CategoricalChartDataOptions, ThemeSettings, PolarStyleOptions, PieStyleOptions, StackableStyleOptions, LineStyleOptions, AreaStyleOptions, FunnelStyleOptions, ScatterStyleOptions, ChartStyleOptions, ChartType, IndicatorStyleOptions, DrilldownOptions, TableStyleOptions, ThemeOid, TreemapStyleOptions, CustomDrilldownResult, MenuPosition, MenuItemSection, SunburstStyleOptions, ChartWidgetStyleOptions, TableWidgetStyleOptions, DashboardWidgetStyleOptions, BoxplotStyleOptions, ScattermapStyleOptions, AreamapStyleOptions } from './types';
3
3
  import { HighchartsOptions } from './chart-options-processor/chart-options-service';
4
4
  import { ComponentType, PropsWithChildren, ReactNode } from 'react';
5
- import { IndicatorChartDataOptions, BoxplotChartCustomDataOptions, BoxplotChartDataOptions, ScatterChartDataOptions, TableDataOptions, ScattermapChartDataOptions } from './chart-data-options/types';
5
+ import { IndicatorChartDataOptions, BoxplotChartCustomDataOptions, BoxplotChartDataOptions, ScatterChartDataOptions, TableDataOptions, ScattermapChartDataOptions, AreamapChartDataOptions } from './chart-data-options/types';
6
6
  import { DataPointEventHandler, DataPointsEventHandler, ScatterDataPointEventHandler, ScatterDataPointsEventHandler } from './chart-options-processor/apply-event-handlers';
7
7
  import { AppConfig } from './app/client-application';
8
8
  import { ExecuteQueryParams, QueryByWidgetIdState, QueryState } from './query-execution';
@@ -823,6 +823,23 @@ export interface ScattermapChartProps extends BaseChartProps, ChartEventProps {
823
823
  */
824
824
  styleOptions?: ScattermapStyleOptions;
825
825
  }
826
+ /**
827
+ * Props of the {@link AreamapChart} component.
828
+ */
829
+ export interface AreamapChartProps extends BaseChartProps, ChartEventProps {
830
+ /**
831
+ * Configurations for how to interpret and present the data passed to the chart
832
+ *
833
+ * @category Chart
834
+ */
835
+ dataOptions: AreamapChartDataOptions;
836
+ /**
837
+ * Configuration that defines functional style of the various chart elements
838
+ *
839
+ * @category Chart
840
+ */
841
+ styleOptions?: AreamapStyleOptions;
842
+ }
826
843
  /**
827
844
  * Props for {@link ContextMenu} component.
828
845
  */
@@ -1,5 +1,5 @@
1
- import { Attribute, QueryResultData } from '@sisense/sdk-data';
2
- import type { QueryDescription as InternalQueryDescription, QueryExecutionConfig } from '@sisense/sdk-query-client';
1
+ import { Attribute, Measure, PivotAttribute, PivotMeasure, PivotQueryResultData, QueryResultData } from '@sisense/sdk-data';
2
+ import type { QueryDescription as InternalQueryDescription, PivotQueryDescription as InternalPivotQueryDescription, QueryExecutionConfig } from '@sisense/sdk-query-client';
3
3
  import { ClientApplication } from '../app/client-application';
4
4
  /**
5
5
  * All the properties that fully describe a query you want to send.
@@ -11,6 +11,19 @@ import { ClientApplication } from '../app/client-application';
11
11
  export type QueryDescription = Partial<Omit<InternalQueryDescription, 'attributes'>> & {
12
12
  dimensions?: Attribute[];
13
13
  };
14
+ /**
15
+ * All the properties that fully describe a pivot query you want to send.
16
+ *
17
+ * We use "dimensions" in public interface because the term is closer to the query and charting
18
+ * as used in the industry (Sisense included).
19
+ * internally, "dimensions" are represented by attributes as the latter is closer to the data model.
20
+ *
21
+ */
22
+ export type PivotQueryDescription = Partial<Omit<InternalPivotQueryDescription, 'rowsAttributes' | 'columnsAttributes' | 'measures'>> & {
23
+ rows?: (Attribute | PivotAttribute)[];
24
+ columns?: (Attribute | PivotAttribute)[];
25
+ values?: (Measure | PivotMeasure)[];
26
+ };
14
27
  /** @internal */
15
28
  export declare const QUERY_DEFAULT_LIMIT = 20000;
16
29
  /** @internal */
@@ -19,3 +32,5 @@ export declare const QUERY_DEFAULT_OFFSET = 0;
19
32
  export declare const executeQuery: (queryDescription: QueryDescription, app: ClientApplication, executionConfig?: QueryExecutionConfig) => Promise<QueryResultData>;
20
33
  /** @internal */
21
34
  export declare const executeCsvQuery: (queryDescription: QueryDescription, app: ClientApplication, executionConfig?: QueryExecutionConfig) => Promise<Blob>;
35
+ /** @internal */
36
+ export declare const executePivotQuery: (queryDescription: PivotQueryDescription, app: ClientApplication, executionConfig?: QueryExecutionConfig) => Promise<PivotQueryResultData>;
@@ -3,4 +3,5 @@ export { useExecuteQuery } from './use-execute-query';
3
3
  export { useExecuteCsvQuery } from './use-execute-csv-query';
4
4
  export { ExecuteQueryByWidgetId } from './execute-query-by-widget-id';
5
5
  export { useExecuteQueryByWidgetId, executeQueryByWidgetId, } from './use-execute-query-by-widget-id';
6
- export type { QueryState, QueryLoadingState, QuerySuccessState, QueryErrorState, CsvQueryState, CsvQueryLoadingState, CsvQuerySuccessState, CsvQueryErrorState, ExecuteQueryParams, ExecuteCsvQueryParams, ExecuteCSVQueryConfig, ExecuteQueryByWidgetIdParams, QueryByWidgetIdState, } from './types';
6
+ export { useExecutePivotQuery } from './use-execute-pivot-query';
7
+ export type { QueryState, QueryLoadingState, QuerySuccessState, QueryErrorState, CsvQueryState, CsvQueryLoadingState, CsvQuerySuccessState, CsvQueryErrorState, PivotQueryState, PivotQueryLoadingState, PivotQuerySuccessState, PivotQueryErrorState, ExecuteQueryParams, ExecuteCsvQueryParams, ExecuteCSVQueryConfig, ExecuteQueryByWidgetIdParams, QueryByWidgetIdState, ExecutePivotQueryParams, } from './types';
@@ -0,0 +1,2 @@
1
+ import { PivotQueryAction, PivotQueryState } from './types.js';
2
+ export declare function pivotQueryStateReducer(state: PivotQueryState, action: PivotQueryAction): PivotQueryState;
@@ -1,4 +1,4 @@
1
- import { Attribute, DataSource, Filter, FilterRelation, Measure, QueryResultData } from '@sisense/sdk-data';
1
+ import { Attribute, DataSource, Filter, FilterRelation, Measure, PivotAttribute, PivotGrandTotals, PivotMeasure, PivotQueryResultData, QueryResultData } from '@sisense/sdk-data';
2
2
  import { DataLoadAction } from '../common/hooks/data-load-state-reducer';
3
3
  import { FiltersMergeStrategy } from '../dashboard-widget/types';
4
4
  /**
@@ -190,3 +190,136 @@ export type ExecuteCSVQueryConfig = {
190
190
  export interface ExecuteCsvQueryParams extends ExecuteQueryParams {
191
191
  config?: ExecuteCSVQueryConfig;
192
192
  }
193
+ /**
194
+ * State of a pivot query execution.
195
+ */
196
+ export type PivotQueryState = PivotQueryLoadingState | PivotQueryErrorState | PivotQuerySuccessState;
197
+ /**
198
+ * State of a query execution that is loading.
199
+ */
200
+ export type PivotQueryLoadingState = {
201
+ /** Whether the query is loading */
202
+ isLoading: true;
203
+ /** Whether the query has failed */
204
+ isError: false;
205
+ /** Whether the query has succeeded */
206
+ isSuccess: false;
207
+ /** The error if any occurred */
208
+ error: undefined;
209
+ /** The result data if the query has succeeded */
210
+ data: PivotQueryResultData | undefined;
211
+ /** The status of the query execution */
212
+ status: 'loading';
213
+ };
214
+ /**
215
+ * State of a query execution that has failed.
216
+ */
217
+ export type PivotQueryErrorState = {
218
+ /** Whether the query is loading */
219
+ isLoading: false;
220
+ /** Whether the query has failed */
221
+ isError: true;
222
+ /** Whether the query has succeeded */
223
+ isSuccess: false;
224
+ /** The error if any occurred */
225
+ error: Error;
226
+ /** The result data if the query has succeeded */
227
+ data: undefined;
228
+ /** The status of the query execution */
229
+ status: 'error';
230
+ };
231
+ /**
232
+ * State of a query execution that has succeeded.
233
+ */
234
+ export type PivotQuerySuccessState = {
235
+ /** Whether the query is loading */
236
+ isLoading: false;
237
+ /** Whether the query has failed */
238
+ isError: false;
239
+ /** Whether the query has succeeded */
240
+ isSuccess: true;
241
+ /** The error if any occurred */
242
+ error: undefined;
243
+ /** The result data if the query has succeeded */
244
+ data: PivotQueryResultData;
245
+ /** The status of the query execution */
246
+ status: 'success';
247
+ };
248
+ export type PivotQueryAction = DataLoadAction<PivotQueryResultData>;
249
+ /**
250
+ * Parameters for {@link useExecutePivotQuery} hook.
251
+ */
252
+ export interface ExecutePivotQueryParams {
253
+ /**
254
+ * Data source the query is run against - e.g. `Sample ECommerce`
255
+ *
256
+ * If not specified, the query will use the `defaultDataSource` specified in the parent Sisense Context.
257
+ *
258
+ * @category Data Options
259
+ */
260
+ dataSource?: DataSource;
261
+ /**
262
+ * Dimensions for the rows of the pivot table
263
+ *
264
+ * @category Data Options
265
+ */
266
+ rows?: (Attribute | PivotAttribute)[];
267
+ /**
268
+ * Dimensions for the columns of the pivot table
269
+ *
270
+ * @category Data Options
271
+ */
272
+ columns?: (Attribute | PivotAttribute)[];
273
+ /**
274
+ * Measures for the values of the pivot table
275
+ *
276
+ * @category Data Options
277
+ */
278
+ values?: (Measure | PivotMeasure)[];
279
+ /**
280
+ * Options for grand totals
281
+ *
282
+ * @category Data Options
283
+ */
284
+ grandTotals?: PivotGrandTotals;
285
+ /**
286
+ * Filters that will slice query results
287
+ *
288
+ * @category Filtering
289
+ */
290
+ filters?: Filter[] | FilterRelation;
291
+ /**
292
+ * Highlight filters that will highlight results that pass filter criteria
293
+ *
294
+ * @category Filtering
295
+ */
296
+ highlights?: Filter[];
297
+ /**
298
+ * {@inheritDoc ExecuteQueryProps.count}
299
+ *
300
+ * @category Pagination
301
+ *
302
+ * [To be reviewed for pivot table]
303
+ * @internal
304
+ */
305
+ count?: number;
306
+ /**
307
+ * {@inheritDoc ExecuteQueryProps.offset}
308
+ *
309
+ * @category Pagination
310
+ *
311
+ * [To be reviewed for pivot table]
312
+ * @internal
313
+ */
314
+ offset?: number;
315
+ /**
316
+ * Boolean flag to control if query is executed
317
+ *
318
+ * If not specified, the default value is `true`
319
+ *
320
+ * @category Control
321
+ */
322
+ enabled?: boolean;
323
+ /** {@inheritDoc ExecuteQueryProps.onBeforeQuery} */
324
+ onBeforeQuery?: (jaql: any) => any | Promise<any>;
325
+ }
@@ -0,0 +1,54 @@
1
+ import { ExecutePivotQueryParams, PivotQueryState } from './types';
2
+ /**
3
+ * React hook that executes a data query for a pivot table.
4
+ * This approach is similar to React Query's `useQuery` hook.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * const { data, isLoading, isError } = useExecutePivotQuery({
9
+ * dataSource: DM.DataSource,
10
+ * rows: [
11
+ * { attribute: DM.Category.Category, includeSubTotals: true },
12
+ * { attribute: DM.Brand.Brand, includeSubTotals: true },
13
+ * DM.Commerce.Condition,
14
+ * ],
15
+ * columns: [DM.Commerce.Gender],
16
+ * values: [
17
+ * { measure: measures.sum(DM.Commerce.Revenue, 'Total Revenue'), totalsCalculation: 'sum' },
18
+ * { measure: measures.sum(DM.Commerce.Quantity, 'Total Quantity'), totalsCalculation: 'min' },
19
+ * ],
20
+ * grandTotals: {title: 'Grand Totals', rows: true, columns: true},
21
+ * filters: [filters.members(DM.Commerce.Gender, ['Female', 'Male'])],
22
+ * });
23
+ * if (isLoading) {
24
+ * return <div>Loading...</div>;
25
+ * }
26
+ * if (isError) {
27
+ * return <div>Error</div>;
28
+ * }
29
+ * if (data) {
30
+ * return <div>[Render pivot table with returned data]</div>;
31
+ * }
32
+ * return null;
33
+ * ```
34
+ * See also hook {@link useExecuteQuery}, which execute a generic data query.
35
+ * @param params - Parameters of the query
36
+ * @returns Query state that contains the status of the query execution, the result data, or the error if any occurred
37
+ * @alpha
38
+ */
39
+ export declare const useExecutePivotQuery: (params: ExecutePivotQueryParams) => PivotQueryState;
40
+ /**
41
+ * {@link useExecutePivotQuery} without tracking to be used inside other hooks or components in Compose SDK.
42
+ *
43
+ * @internal
44
+ */
45
+ export declare function useExecutePivotQueryInternal(params: ExecutePivotQueryParams): PivotQueryState;
46
+ /**
47
+ * Checks if the query parameters have changed by deep comparison.
48
+ *
49
+ * TODO refactor to reuse isQueryParamsChanged
50
+ *
51
+ * @param prevParams - Previous query parameters
52
+ * @param newParams - New query parameters
53
+ */
54
+ export declare function isPivotQueryParamsChanged(prevParams: ExecutePivotQueryParams | undefined, newParams: ExecutePivotQueryParams): boolean;
@@ -4,8 +4,6 @@ import { ScattermapChartProps } from './props';
4
4
  * A React component that allows to visualize geographical data as data points on a map.
5
5
  * See [Scattermap Chart](https://docs.sisense.com/main/SisenseLinux/scatter-map.htm) for more information.
6
6
  *
7
- * This component is still in beta.
8
- *
9
7
  * @example
10
8
  * An example of using the component to visualize the `Sample ECommerce` data source:
11
9
  * ```tsx