@sisense/sdk-ui 0.15.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/ai/messages/get-widget-options.d.ts +3 -3
  2. package/dist/ai.js +334 -308
  3. package/dist/api/types/dashboard-dto.d.ts +3 -2
  4. package/dist/area-chart.d.ts +2 -2
  5. package/dist/bar-chart.d.ts +2 -2
  6. package/dist/boxplot-chart.d.ts +38 -0
  7. package/dist/boxplot-utils.d.ts +30 -0
  8. package/dist/chart-data/boxplot-data.d.ts +11 -0
  9. package/dist/chart-data/cartesian-data.d.ts +6 -3
  10. package/dist/chart-data/data-coloring/create-data-coloring-function.d.ts +7 -0
  11. package/dist/chart-data/data-coloring/index.d.ts +3 -0
  12. package/dist/chart-data/{series-data-color-service → data-coloring}/legend-color.d.ts +1 -1
  13. package/dist/chart-data/data-coloring/series-data-coloring-function.d.ts +11 -0
  14. package/dist/chart-data/indicator-data.d.ts +2 -2
  15. package/dist/chart-data/scatter-data.d.ts +2 -2
  16. package/dist/chart-data/scattermap-data.d.ts +4 -0
  17. package/dist/chart-data/types.d.ts +46 -1
  18. package/dist/chart-data-options/coloring/consts.d.ts +3 -0
  19. package/dist/chart-data-options/coloring/utils.d.ts +6 -0
  20. package/dist/chart-data-options/get-translated-data-options.d.ts +6 -0
  21. package/dist/chart-data-options/translate-boxplot-data-options.d.ts +7 -0
  22. package/dist/chart-data-options/translate-scattermap-data-options.d.ts +3 -0
  23. package/dist/chart-data-options/types.d.ts +122 -10
  24. package/dist/chart-data-options/utils.d.ts +6 -1
  25. package/dist/chart-options-processor/boxplot-chart-options.d.ts +10 -0
  26. package/dist/chart-options-processor/chart-options-service.d.ts +21 -77
  27. package/dist/chart-options-processor/style-to-design-options-translator/translate-style-to-design-options.d.ts +2 -2
  28. package/dist/chart-options-processor/style-to-design-options-translator/translate-to-highcharts-options.d.ts +4 -2
  29. package/dist/chart-options-processor/subtype-to-design-options.d.ts +5 -2
  30. package/dist/chart-options-processor/theme-option-service.d.ts +0 -1
  31. package/dist/chart-options-processor/translations/axis-section.d.ts +4 -3
  32. package/dist/chart-options-processor/translations/boxplot/boxplot-axis.d.ts +10 -0
  33. package/dist/chart-options-processor/translations/boxplot/boxplot-plot-options.d.ts +3 -0
  34. package/dist/chart-options-processor/translations/boxplot/boxplot-series.d.ts +5 -0
  35. package/dist/chart-options-processor/translations/boxplot/boxplot-tooltip.d.ts +3 -0
  36. package/dist/chart-options-processor/translations/design-options.d.ts +9 -2
  37. package/dist/chart-options-processor/translations/funnel-series.d.ts +1 -2
  38. package/dist/chart-options-processor/translations/legend-section.d.ts +6 -4
  39. package/dist/chart-options-processor/translations/pie-series.d.ts +1 -2
  40. package/dist/chart-options-processor/translations/tooltip-utils.d.ts +5 -0
  41. package/dist/chart-options-processor/translations/translations-to-highcharts.d.ts +11 -3
  42. package/dist/chart-options-processor/translations/types.d.ts +10 -2
  43. package/dist/chart-options-processor/translations/value-label-section.d.ts +2 -1
  44. package/dist/chart.d.ts +2 -2
  45. package/dist/charts/indicator/indicator-legacy-chart-data-options.d.ts +2 -2
  46. package/dist/charts/indicator/indicator-legacy-chart-options/indicator-legacy-chart-options.d.ts +2 -2
  47. package/dist/charts/indicator/indicator-legacy-chart-options/override-with-value-color.d.ts +2 -2
  48. package/dist/charts/scattermap/hooks/use-locations.d.ts +3 -0
  49. package/dist/charts/scattermap/hooks/use-settings.d.ts +5 -0
  50. package/dist/charts/scattermap/hooks/use-tooltip-handler.d.ts +14 -0
  51. package/dist/charts/scattermap/scattermap.d.ts +13 -0
  52. package/dist/charts/scattermap/types.d.ts +16 -0
  53. package/dist/charts/scattermap/utils/color.d.ts +3 -0
  54. package/dist/charts/scattermap/utils/copyright.d.ts +2 -0
  55. package/dist/charts/scattermap/utils/location.d.ts +5 -0
  56. package/dist/charts/scattermap/utils/map.d.ts +2 -0
  57. package/dist/charts/scattermap/utils/markers.d.ts +28 -0
  58. package/dist/charts/scattermap/utils/size.d.ts +2 -0
  59. package/dist/charts/scattermap/utils/tooltip.d.ts +8 -0
  60. package/dist/charts/scattermap/utils/values.d.ts +4 -0
  61. package/dist/charts/table/types.d.ts +1 -1
  62. package/dist/column-chart.d.ts +2 -2
  63. package/dist/common/components/loading-dots.d.ts +4 -0
  64. package/dist/dashboard-widget/translate-dashboard-filters.d.ts +1 -1
  65. package/dist/dashboard-widget/translate-panel-color-format.d.ts +3 -3
  66. package/dist/dashboard-widget/translate-widget-data-options.d.ts +6 -5
  67. package/dist/dashboard-widget/translate-widget-style-options.d.ts +2 -2
  68. package/dist/dashboard-widget/types.d.ts +45 -19
  69. package/dist/dashboard-widget/use-fetch-widget-dto-model.d.ts +9 -5
  70. package/dist/dashboard-widget/utils.d.ts +1 -1
  71. package/dist/decorators/component-decorators/as-sisense-component.d.ts +1 -0
  72. package/dist/filters/components/common/basic-input.d.ts +1 -1
  73. package/dist/filters/components/common/date-range-field-button.d.ts +3 -2
  74. package/dist/filters/components/common/dropdown.d.ts +9 -0
  75. package/dist/filters/components/common/filter-utils.d.ts +13 -0
  76. package/dist/filters/components/common/index.d.ts +3 -1
  77. package/dist/filters/components/common/radio.d.ts +7 -0
  78. package/dist/filters/components/criteria-filter-tile/criteria-filter-display.d.ts +2 -2
  79. package/dist/filters/components/criteria-filter-tile/criteria-filter-menu.d.ts +6 -3
  80. package/dist/filters/components/criteria-filter-tile/criteria-filter-operations.d.ts +13 -8
  81. package/dist/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +21 -4
  82. package/dist/filters/components/criteria-filter-tile/index.d.ts +0 -1
  83. package/dist/filters/components/date-filter/date-filter/calendar-date-selector.d.ts +10 -8
  84. package/dist/filters/components/date-filter/date-filter/quick-date-selection-buttons.d.ts +4 -4
  85. package/dist/filters/components/date-filter/date-range-filter-tile/date-range-filter-tile.d.ts +1 -1
  86. package/dist/filters/components/date-filter/index.d.ts +1 -0
  87. package/dist/filters/components/date-filter/relative-date-filter-tile/index.d.ts +1 -0
  88. package/dist/filters/components/date-filter/relative-date-filter-tile/relative-date-filter-display.d.ts +14 -0
  89. package/dist/filters/components/date-filter/relative-date-filter-tile/relative-date-filter-tile.d.ts +36 -0
  90. package/dist/filters/components/date-filter/relative-date-filter-tile/relative-date-filter.d.ts +26 -0
  91. package/dist/filters/components/filter-tile.d.ts +1 -1
  92. package/dist/filters/components/member-filter-tile/basic-member-filter-tile.d.ts +2 -0
  93. package/dist/filters/components/member-filter-tile/members-reducer.d.ts +9 -1
  94. package/dist/filters/components/member-filter-tile/pill-section.d.ts +0 -1
  95. package/dist/filters/index.d.ts +1 -0
  96. package/dist/highcharts-memorized.d.ts +4 -3
  97. package/dist/index.d.ts +5 -2
  98. package/dist/index.js +5585 -4933
  99. package/dist/indicator-canvas.d.ts +3 -3
  100. package/dist/indicator-chart.d.ts +4 -4
  101. package/dist/line-chart.d.ts +2 -2
  102. package/dist/models/dashboard/types.d.ts +1 -1
  103. package/dist/models/dashboard/use-get-dashboard-model.d.ts +1 -0
  104. package/dist/models/dashboard/use-get-dashboard-models.d.ts +2 -1
  105. package/dist/models/widget/get-widget-model.d.ts +4 -0
  106. package/dist/models/widget/index.d.ts +3 -1
  107. package/dist/models/widget/translate-widget.d.ts +1 -1
  108. package/dist/models/widget/use-get-widget-model.d.ts +103 -0
  109. package/dist/models/widget/widget-model.d.ts +123 -0
  110. package/dist/pie-chart.d.ts +2 -2
  111. package/dist/polar-chart.d.ts +2 -2
  112. package/dist/props.d.ts +67 -62
  113. package/dist/query/execute-query.d.ts +3 -1
  114. package/dist/query-execution/csv-query-state-reducer.d.ts +2 -0
  115. package/dist/query-execution/execute-query-by-widget-id.d.ts +10 -2
  116. package/dist/query-execution/execute-query.d.ts +11 -4
  117. package/dist/query-execution/index.d.ts +4 -3
  118. package/dist/query-execution/query-state-reducer.d.ts +1 -58
  119. package/dist/query-execution/types.d.ts +192 -0
  120. package/dist/query-execution/use-execute-csv-query.d.ts +80 -0
  121. package/dist/query-execution/use-execute-query-by-widget-id.d.ts +6 -37
  122. package/dist/query-execution/use-execute-query.d.ts +10 -35
  123. package/dist/scatter-chart.d.ts +4 -4
  124. package/dist/scattermap-chart.d.ts +36 -0
  125. package/dist/sunburst-chart.d.ts +1 -1
  126. package/dist/table/hooks/use-table-data.d.ts +7 -2
  127. package/dist/table/table.d.ts +5 -2
  128. package/dist/table-widget-7936746a.js +72481 -0
  129. package/dist/themes/theme-loader.d.ts +0 -1
  130. package/dist/translation/resources/en.d.ts +21 -0
  131. package/dist/translation/resources/index.d.ts +42 -0
  132. package/dist/treemap-chart.d.ts +2 -2
  133. package/dist/types.d.ts +76 -7
  134. package/dist/utils/utility-types.d.ts +4 -0
  135. package/dist/widgets/chart-widget-deprecated.d.ts +1 -1
  136. package/dist/widgets/chart-widget.d.ts +1 -1
  137. package/dist/widgets/common/drilldown-breadcrumbs/drilldown-breadcrumbs-navigation.d.ts +8 -0
  138. package/dist/widgets/common/drilldown-breadcrumbs/styled-buttons.d.ts +11 -0
  139. package/dist/widgets/common/drilldown.d.ts +12 -2
  140. package/dist/widgets/drilldown-widget.d.ts +2 -2
  141. package/package.json +28 -6
  142. package/dist/chart-data/series-data-color-service/index.d.ts +0 -3
  143. package/dist/chart-data/series-data-color-service/series-data-color-service.d.ts +0 -4
  144. package/dist/models/widget/types.d.ts +0 -6
  145. package/dist/table-widget-7b20ecf7.js +0 -64167
  146. /package/dist/chart-data/{series-data-color-service → data-coloring}/types.d.ts +0 -0
@@ -2,7 +2,7 @@ import { type FunctionComponent } from 'react';
2
2
  import { ExecuteQueryByWidgetIdProps } from '../props';
3
3
  /**
4
4
  * Executes a query over the existing widget and renders a function as child component.
5
- * The child component is passed the results of the query.
5
+ * The child component is passed the state of the query as defined in {@link QueryByWidgetIdState}.
6
6
  *
7
7
  * This component takes the Children Prop Pattern and
8
8
  * offers an alternative approach to the {@link useExecuteQueryByWidgetId} hook.
@@ -15,10 +15,18 @@ import { ExecuteQueryByWidgetIdProps } from '../props';
15
15
  * dashboardOid={'6441e728dac1920034bce737'}
16
16
  * >
17
17
  * {
18
- * (data, query) => {
18
+ * ({data, isLoading, isError}) => {
19
+ * if (isLoading) {
20
+ * return <div>Loading...</div>;
21
+ * }
22
+ * if (isError) {
23
+ * return <div>Error</div>;
24
+ * }
19
25
  * if (data) {
26
+ * console.log(data);
20
27
  * return <div>{`Total Rows: ${data.rows.length}`}</div>;
21
28
  * }
29
+ * return null;
22
30
  * }
23
31
  * }
24
32
  * </ExecuteQueryByWidgetId>
@@ -2,7 +2,7 @@ import { type FunctionComponent } from 'react';
2
2
  import { ExecuteQueryProps } from '../props';
3
3
  /**
4
4
  * Executes a query and renders a function as child component. The child
5
- * component is passed the results of the query.
5
+ * component is passed the state of the query as defined in {@link QueryState}.
6
6
  *
7
7
  * This component takes the Children Prop Pattern and
8
8
  * offers an alternative approach to the {@link useExecuteQuery} hook.
@@ -13,15 +13,22 @@ import { ExecuteQueryProps } from '../props';
13
13
  * <ExecuteQuery
14
14
  * dataSource={DM.DataSource}
15
15
  * dimensions={[DM.Commerce.AgeRange]}
16
- * measures={[measures.sum(DM.Commerce.Revenue)]}
17
- * filters={[filters.greaterThan(DM.Commerce.Revenue, 1000)]}
16
+ * measures={[measureFactory.sum(DM.Commerce.Revenue)]}
17
+ * filters={[filterFactory.greaterThan(DM.Commerce.Revenue, 1000)]}
18
18
  * >
19
19
  * {
20
- * (data) => {
20
+ * ({data, isLoading, isError}) => {
21
+ * if (isLoading) {
22
+ * return <div>Loading...</div>;
23
+ * }
24
+ * if (isError) {
25
+ * return <div>Error</div>;
26
+ * }
21
27
  * if (data) {
22
28
  * console.log(data);
23
29
  * return <div>{`Total Rows: ${data.rows.length}`}</div>;
24
30
  * }
31
+ * return null;
25
32
  * }
26
33
  * }
27
34
  * </ExecuteQuery>
@@ -1,5 +1,6 @@
1
1
  export { ExecuteQuery } from './execute-query';
2
- export { useExecuteQuery, type ExecuteQueryParams } from './use-execute-query';
2
+ export { useExecuteQuery } from './use-execute-query';
3
+ export { useExecuteCsvQuery } from './use-execute-csv-query';
3
4
  export { ExecuteQueryByWidgetId } from './execute-query-by-widget-id';
4
- export { useExecuteQueryByWidgetId, type ExecuteQueryByWidgetIdParams, type QueryByWidgetIdState, executeQueryByWidgetId, } from './use-execute-query-by-widget-id';
5
- export type { QueryState, QueryLoadingState, QuerySuccessState, QueryErrorState, } from './query-state-reducer';
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';
@@ -1,59 +1,2 @@
1
- import { QueryResultData } from '@sisense/sdk-data';
2
- import { DataLoadAction } from '../common/hooks/data-load-state-reducer';
3
- /**
4
- * State of a query execution.
5
- */
6
- export type QueryState = QueryLoadingState | QueryErrorState | QuerySuccessState;
7
- /**
8
- * State of a query execution that is loading.
9
- */
10
- export type QueryLoadingState = {
11
- /** Whether the query is loading */
12
- isLoading: true;
13
- /** Whether the query has failed */
14
- isError: false;
15
- /** Whether the query has succeeded */
16
- isSuccess: false;
17
- /** The error if any occurred */
18
- error: undefined;
19
- /** The result data if the query has succeeded */
20
- data: QueryResultData | undefined;
21
- /** The status of the query execution */
22
- status: 'loading';
23
- };
24
- /**
25
- * State of a query execution that has failed.
26
- */
27
- export type QueryErrorState = {
28
- /** Whether the query is loading */
29
- isLoading: false;
30
- /** Whether the query has failed */
31
- isError: true;
32
- /** Whether the query has succeeded */
33
- isSuccess: false;
34
- /** The error if any occurred */
35
- error: Error;
36
- /** The result data if the query has succeeded */
37
- data: undefined;
38
- /** The status of the query execution */
39
- status: 'error';
40
- };
41
- /**
42
- * State of a query execution that has succeeded.
43
- */
44
- export type QuerySuccessState = {
45
- /** Whether the query is loading */
46
- isLoading: false;
47
- /** Whether the query has failed */
48
- isError: false;
49
- /** Whether the query has succeeded */
50
- isSuccess: true;
51
- /** The error if any occurred */
52
- error: undefined;
53
- /** The result data if the query has succeeded */
54
- data: QueryResultData;
55
- /** The status of the query execution */
56
- status: 'success';
57
- };
58
- export type QueryAction = DataLoadAction<QueryResultData>;
1
+ import { QueryAction, QueryState } from './types';
59
2
  export declare function queryStateReducer(state: QueryState, action: QueryAction): QueryState;
@@ -0,0 +1,192 @@
1
+ import { Attribute, DataSource, Filter, FilterRelation, Measure, QueryResultData } from '@sisense/sdk-data';
2
+ import { DataLoadAction } from '../common/hooks/data-load-state-reducer';
3
+ import { FiltersMergeStrategy } from '../dashboard-widget/types';
4
+ /**
5
+ * State of a query execution.
6
+ */
7
+ export type CsvQueryState = CsvQueryLoadingState | CsvQueryErrorState | CsvQuerySuccessState;
8
+ /**
9
+ * State of a query execution that is loading.
10
+ */
11
+ export type CsvQueryLoadingState = {
12
+ /** Whether the query is loading */
13
+ isLoading: true;
14
+ /** Whether the query has failed */
15
+ isError: false;
16
+ /** Whether the query has succeeded */
17
+ isSuccess: false;
18
+ /** The error if any occurred */
19
+ error: undefined;
20
+ /** The result data if the query has succeeded */
21
+ data: Blob | string | undefined;
22
+ /** The status of the query execution */
23
+ status: 'loading';
24
+ };
25
+ /**
26
+ * State of a query execution that has failed.
27
+ */
28
+ export type CsvQueryErrorState = {
29
+ /** Whether the query is loading */
30
+ isLoading: false;
31
+ /** Whether the query has failed */
32
+ isError: true;
33
+ /** Whether the query has succeeded */
34
+ isSuccess: false;
35
+ /** The error if any occurred */
36
+ error: Error;
37
+ /** The result data if the query has succeeded */
38
+ data: undefined;
39
+ /** The status of the query execution */
40
+ status: 'error';
41
+ };
42
+ /**
43
+ * State of a query execution that has succeeded.
44
+ */
45
+ export type CsvQuerySuccessState = {
46
+ /** Whether the query is loading */
47
+ isLoading: false;
48
+ /** Whether the query has failed */
49
+ isError: false;
50
+ /** Whether the query has succeeded */
51
+ isSuccess: true;
52
+ /** The error if any occurred */
53
+ error: undefined;
54
+ /** The result data if the query has succeeded */
55
+ data: Blob | string;
56
+ /** The status of the query execution */
57
+ status: 'success';
58
+ };
59
+ export type CsvQueryAction = DataLoadAction<Blob | string>;
60
+ /**
61
+ * State of a query execution.
62
+ */
63
+ export type QueryState = QueryLoadingState | QueryErrorState | QuerySuccessState;
64
+ /**
65
+ * State of a query execution that is loading.
66
+ */
67
+ export type QueryLoadingState = {
68
+ /** Whether the query is loading */
69
+ isLoading: true;
70
+ /** Whether the query has failed */
71
+ isError: false;
72
+ /** Whether the query has succeeded */
73
+ isSuccess: false;
74
+ /** The error if any occurred */
75
+ error: undefined;
76
+ /** The result data if the query has succeeded */
77
+ data: QueryResultData | undefined;
78
+ /** The status of the query execution */
79
+ status: 'loading';
80
+ };
81
+ /**
82
+ * State of a query execution that has failed.
83
+ */
84
+ export type QueryErrorState = {
85
+ /** Whether the query is loading */
86
+ isLoading: false;
87
+ /** Whether the query has failed */
88
+ isError: true;
89
+ /** Whether the query has succeeded */
90
+ isSuccess: false;
91
+ /** The error if any occurred */
92
+ error: Error;
93
+ /** The result data if the query has succeeded */
94
+ data: undefined;
95
+ /** The status of the query execution */
96
+ status: 'error';
97
+ };
98
+ /**
99
+ * State of a query execution that has succeeded.
100
+ */
101
+ export type QuerySuccessState = {
102
+ /** Whether the query is loading */
103
+ isLoading: false;
104
+ /** Whether the query has failed */
105
+ isError: false;
106
+ /** Whether the query has succeeded */
107
+ isSuccess: true;
108
+ /** The error if any occurred */
109
+ error: undefined;
110
+ /** The result data if the query has succeeded */
111
+ data: QueryResultData;
112
+ /** The status of the query execution */
113
+ status: 'success';
114
+ };
115
+ export type QueryAction = DataLoadAction<QueryResultData>;
116
+ /**
117
+ * Parameters for {@link useExecuteQueryByWidgetId} hook.
118
+ */
119
+ export interface ExecuteQueryByWidgetIdParams {
120
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.widgetOid} */
121
+ widgetOid: string;
122
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.dashboardOid} */
123
+ dashboardOid: string;
124
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.filters} */
125
+ filters?: Filter[];
126
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.highlights} */
127
+ highlights?: Filter[];
128
+ /** {@inheritDoc ExecuteQueryProps.count} */
129
+ count?: number;
130
+ /** {@inheritDoc ExecuteQueryProps.offset} */
131
+ offset?: number;
132
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.filtersMergeStrategy} */
133
+ filtersMergeStrategy?: FiltersMergeStrategy;
134
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.includeDashboardFilters} */
135
+ includeDashboardFilters?: boolean;
136
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.onBeforeQuery} */
137
+ onBeforeQuery?: (jaql: any) => any | Promise<any>;
138
+ /**
139
+ * Boolean flag to control if query is executed
140
+ *
141
+ * If not specified, the default value is `true`
142
+ */
143
+ enabled?: boolean;
144
+ }
145
+ export type QueryByWidgetIdState = QueryState & {
146
+ /** Query parameters constructed over the widget */
147
+ query: ExecuteQueryParams | undefined;
148
+ };
149
+ /**
150
+ * Parameters for {@link useExecuteQuery} hook.
151
+ */
152
+ export interface ExecuteQueryParams {
153
+ /**
154
+ * Data source the query is run against - e.g. `Sample ECommerce`
155
+ *
156
+ * If not specified, the query will use the `defaultDataSource` specified in the parent Sisense Context.
157
+ */
158
+ dataSource?: DataSource;
159
+ /** Dimensions of the query */
160
+ dimensions?: Attribute[];
161
+ /** Measures of the query */
162
+ measures?: Measure[];
163
+ /** Filters that will slice query results */
164
+ filters?: Filter[] | FilterRelation;
165
+ /** Highlight filters that will highlight results that pass filter criteria */
166
+ highlights?: Filter[];
167
+ /** {@inheritDoc ExecuteQueryProps.count} */
168
+ count?: number;
169
+ /** {@inheritDoc ExecuteQueryProps.offset} */
170
+ offset?: number;
171
+ /**
172
+ * Boolean flag to control if query is executed
173
+ *
174
+ * If not specified, the default value is `true`
175
+ */
176
+ enabled?: boolean;
177
+ /** {@inheritDoc ExecuteQueryProps.onBeforeQuery} */
178
+ onBeforeQuery?: (jaql: any) => any | Promise<any>;
179
+ }
180
+ /** Configuration for {@link useExecuteCsvQuery} hook. */
181
+ export type ExecuteCSVQueryConfig = {
182
+ /**
183
+ * If set to true, the data will be returned as a Blob.
184
+ */
185
+ asDataStream?: boolean;
186
+ };
187
+ /**
188
+ * Parameters for {@link useExecuteCsvQuery} hook.
189
+ */
190
+ export interface ExecuteCsvQueryParams extends ExecuteQueryParams {
191
+ config?: ExecuteCSVQueryConfig;
192
+ }
@@ -0,0 +1,80 @@
1
+ import { CsvQueryState, ExecuteCsvQueryParams } from './types.js';
2
+ /**
3
+ * React hook that executes a CSV data query.
4
+ * Similar to {@link useExecuteQuery}, but returns the data in CSV format as text or as a stream.
5
+ *
6
+ * @example
7
+ * An example of using the hook to obtain data in a CSV string:
8
+ ```tsx
9
+ const { data, isLoading, isError } = useExecuteCsvQuery({
10
+ dataSource: DM.DataSource,
11
+ dimensions: [DM.Commerce.AgeRange],
12
+ measures: [measureFactory.sum(DM.Commerce.Revenue)],
13
+ filters: [filterFactory.greaterThan(DM.Commerce.Revenue, 1000)],
14
+ });
15
+ if (isLoading) {
16
+ return <div>Loading...</div>;
17
+ }
18
+ if (isError) {
19
+ return <div>Error</div>;
20
+ }
21
+ if (data) {
22
+ return <div>{`CSV as string: ${data}`}</div>;
23
+ }
24
+ return null;
25
+ ```
26
+ * An example of using the hook to obtain data in CSV format as a stream, translating headers, and triggering file download:
27
+ ```tsx
28
+ const { data, isLoading, isError } = useExecuteCsvQuery({
29
+ dataSource: DM.DataSource,
30
+ dimensions: [DM.Commerce.AgeRange],
31
+ measures: [measureFactory.sum(DM.Commerce.Revenue)],
32
+ filters: [filterFactory.greaterThan(DM.Commerce.Revenue, 1000)],
33
+ config: { asDataStream: true },
34
+ });
35
+ if (isLoading) {
36
+ return <div>Loading...</div>;
37
+ }
38
+ if (isError) {
39
+ return <div>Error</div>;
40
+ }
41
+ if (data) {
42
+ const reader = new FileReader();
43
+ reader.onload = () => {
44
+ if (reader.result) {
45
+ const text = reader.result as string;
46
+ const lines = text.split('\n');
47
+ // Update headers
48
+ if (lines.length > 0) {
49
+ lines[0] = translateHeaders(lines[0]); // replace with own implementation
50
+ }
51
+ // Join modified lines back to a text
52
+ const modifiedCsv = lines.join('\n');
53
+ // Create a new Blob with modified content
54
+ const modifiedBlob = new Blob([modifiedCsv], { type: 'text/csv' });
55
+ // Trigger file download
56
+ const blobURL = window.URL.createObjectURL(modifiedBlob);
57
+ const a = document.createElement('a');
58
+ a.href = blobURL;
59
+ const fileName = 'data_translated_headers'
60
+ a.download = fileName;
61
+ document.body.appendChild(a);
62
+ a.click();
63
+ window.URL.revokeObjectURL(blobURL);
64
+ document.body.removeChild(a);
65
+ }
66
+ };
67
+ reader.readAsText(data as Blob);
68
+ }
69
+ return null;
70
+ ```
71
+ * @param params - Parameters of the query
72
+ * @returns Query state that contains the status of the query execution, the result data, or the error if any occurred
73
+ */
74
+ export declare const useExecuteCsvQuery: (params: ExecuteCsvQueryParams) => CsvQueryState;
75
+ /**
76
+ * {@link useExecuteQuery} without tracking to be used inside other hooks or components in Compose SDK.
77
+ *
78
+ * @internal
79
+ */
80
+ export declare function useExecuteCsvQueryInternal(params: ExecuteCsvQueryParams): CsvQueryState;
@@ -1,41 +1,7 @@
1
- import { type Filter } from '@sisense/sdk-data';
2
1
  import { ExecuteQueryParams } from './';
3
- import { QueryState } from './query-state-reducer';
4
- import { FiltersMergeStrategy } from '../dashboard-widget/types';
5
2
  import { ClientApplication } from '../app/client-application';
6
- /**
7
- * Parameters for {@link useExecuteQueryByWidgetId} hook.
8
- */
9
- export interface ExecuteQueryByWidgetIdParams {
10
- /** {@inheritDoc ExecuteQueryByWidgetIdProps.widgetOid} */
11
- widgetOid: string;
12
- /** {@inheritDoc ExecuteQueryByWidgetIdProps.dashboardOid} */
13
- dashboardOid: string;
14
- /** {@inheritDoc ExecuteQueryByWidgetIdProps.filters} */
15
- filters?: Filter[];
16
- /** {@inheritDoc ExecuteQueryByWidgetIdProps.highlights} */
17
- highlights?: Filter[];
18
- /** {@inheritDoc ExecuteQueryProps.count} */
19
- count?: number;
20
- /** {@inheritDoc ExecuteQueryProps.offset} */
21
- offset?: number;
22
- /** {@inheritDoc ExecuteQueryByWidgetIdProps.filtersMergeStrategy} */
23
- filtersMergeStrategy?: FiltersMergeStrategy;
24
- /** {@inheritDoc ExecuteQueryByWidgetIdProps.includeDashboardFilters} */
25
- includeDashboardFilters?: boolean;
26
- /** {@inheritDoc ExecuteQueryByWidgetIdProps.onBeforeQuery} */
27
- onBeforeQuery?: (jaql: any) => any | Promise<any>;
28
- /**
29
- * Boolean flag to control if query is executed
30
- *
31
- * If not specified, the default value is `true`
32
- */
33
- enabled?: boolean;
34
- }
35
- export type QueryByWidgetIdState = QueryState & {
36
- /** Query parameters constructed over the widget */
37
- query: ExecuteQueryParams | undefined;
38
- };
3
+ import { ExecuteQueryByWidgetIdParams, QueryByWidgetIdState } from './types';
4
+ import { Filter } from '@sisense/sdk-data';
39
5
  /**
40
6
  * React hook that executes a data query extracted from an existing widget in the Sisense instance.
41
7
  *
@@ -67,6 +33,7 @@ export type QueryByWidgetIdState = QueryState & {
67
33
  export declare const useExecuteQueryByWidgetId: (params: ExecuteQueryByWidgetIdParams) => QueryByWidgetIdState;
68
34
  /**
69
35
  * {@link useExecuteQueryByWidgetId} without tracking to be used inside other hooks or components in Compose SDK.
36
+ *
70
37
  * @internal
71
38
  */
72
39
  export declare function useExecuteQueryByWidgetIdInternal(params: ExecuteQueryByWidgetIdParams): QueryByWidgetIdState;
@@ -82,5 +49,7 @@ export declare function executeQueryByWidgetId({ widgetOid, dashboardOid, filter
82
49
  app: ClientApplication;
83
50
  }): Promise<{
84
51
  data: import("@sisense/sdk-data").QueryResultData;
85
- query: ExecuteQueryParams;
52
+ query: Omit<ExecuteQueryParams, "filters"> & {
53
+ filters?: Filter[] | undefined;
54
+ };
86
55
  }>;
@@ -1,36 +1,4 @@
1
- import { Attribute, DataSource, Filter, Measure } from '@sisense/sdk-data';
2
- import { QueryState } from './query-state-reducer';
3
- /**
4
- * Parameters for {@link useExecuteQuery} hook.
5
- */
6
- export interface ExecuteQueryParams {
7
- /**
8
- * Data source the query is run against - e.g. `Sample ECommerce`
9
- *
10
- * If not specified, the query will use the `defaultDataSource` specified in the parent Sisense Context.
11
- */
12
- dataSource?: DataSource;
13
- /** Dimensions of the query */
14
- dimensions?: Attribute[];
15
- /** Measures of the query */
16
- measures?: Measure[];
17
- /** Filters that will slice query results */
18
- filters?: Filter[];
19
- /** Highlight filters that will highlight results that pass filter criteria */
20
- highlights?: Filter[];
21
- /** {@inheritDoc ExecuteQueryProps.count} */
22
- count?: number;
23
- /** {@inheritDoc ExecuteQueryProps.offset} */
24
- offset?: number;
25
- /**
26
- * Boolean flag to control if query is executed
27
- *
28
- * If not specified, the default value is `true`
29
- */
30
- enabled?: boolean;
31
- /** {@inheritDoc ExecuteQueryProps.onBeforeQuery} */
32
- onBeforeQuery?: (jaql: any) => any | Promise<any>;
33
- }
1
+ import { ExecuteQueryParams, QueryState } from './types';
34
2
  /**
35
3
  * React hook that executes a data query.
36
4
  * This approach, which offers an alternative to {@link ExecuteQuery} component, is similar to React Query's `useQuery` hook.
@@ -40,8 +8,8 @@ export interface ExecuteQueryParams {
40
8
  const { data, isLoading, isError } = useExecuteQuery({
41
9
  dataSource: DM.DataSource,
42
10
  dimensions: [DM.Commerce.AgeRange],
43
- measures: [measures.sum(DM.Commerce.Revenue)],
44
- filters: [filters.greaterThan(DM.Commerce.Revenue, 1000)],
11
+ measures: [measureFactory.sum(DM.Commerce.Revenue)],
12
+ filters: [filterFactory.greaterThan(DM.Commerce.Revenue, 1000)],
45
13
  });
46
14
  if (isLoading) {
47
15
  return <div>Loading...</div>;
@@ -69,3 +37,10 @@ export declare const useExecuteQuery: (params: ExecuteQueryParams) => QueryState
69
37
  * @internal
70
38
  */
71
39
  export declare function useExecuteQueryInternal(params: ExecuteQueryParams): QueryState;
40
+ /**
41
+ * Checks if the query parameters have changed by deep comparison.
42
+ *
43
+ * @param prevParams - Previous query parameters
44
+ * @param newParams - New query parameters
45
+ */
46
+ export declare function isQueryParamsChanged(prevParams: ExecuteQueryParams | undefined, newParams: ExecuteQueryParams): boolean;
@@ -19,13 +19,13 @@ import { ScatterChartProps } from './props';
19
19
  * ```tsx
20
20
  * <ScatterChart
21
21
  * dataSet={DM.DataSource}
22
- * filters={[filters.greaterThan(DM.Commerce.Revenue, 10)]}
22
+ * filters={[filterFactory.greaterThan(DM.Commerce.Revenue, 10)]}
23
23
  * dataOptions={{
24
- * x: measures.sum(DM.Commerce.Revenue),
25
- * y: measures.sum(DM.Commerce.Quantity),
24
+ * x: measureFactory.sum(DM.Commerce.Revenue),
25
+ * y: measureFactory.sum(DM.Commerce.Quantity),
26
26
  * breakByPoint: DM.Category.Category,
27
27
  * breakByColor: DM.Commerce.Gender,
28
- * size: measures.sum(DM.Commerce.Cost),
28
+ * size: measureFactory.sum(DM.Commerce.Cost),
29
29
  * }}
30
30
  * styleOptions={{
31
31
  * xAxis: {
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import { ScattermapChartProps } from './props';
3
+ /**
4
+ * A React component that allows to visualize geographical data as data points on a map.
5
+ * See [Scattermap Chart](https://docs.sisense.com/main/SisenseLinux/scatter-map.htm) for more information.
6
+ *
7
+ * This component is still in beta.
8
+ *
9
+ * @example
10
+ * An example of using the component to visualize the `Sample ECommerce` data source:
11
+ * ```tsx
12
+ * <ScattermapChart
13
+ * dataSet={DM.DataSource}
14
+ * dataOptions={{
15
+ * locations: [DM.Country.Country],
16
+ * size: measureFactory.sum(DM.Commerce.Cost, 'Size by Cost'),
17
+ * colorBy: {
18
+ * column: measureFactory.sum(DM.Commerce.Revenue, 'Color by Revenue'),
19
+ * color: 'green'
20
+ * },
21
+ * details: DM.Category.Category,
22
+ * }}
23
+ * styleOptions={{
24
+ * markers: {
25
+ * fill: 'hollow-bold'
26
+ * }
27
+ * }}
28
+ * />
29
+ * ```
30
+ *
31
+ * <img src="media://scattermap-chart-example-1.png" width="600px" />
32
+ * @param props - Scattermap chart properties
33
+ * @returns Scattermap Chart component
34
+ * @beta
35
+ */
36
+ export declare const ScattermapChart: import("react").FunctionComponent<ScattermapChartProps>;
@@ -15,7 +15,7 @@ import { SunburstChartProps } from './props';
15
15
  * DM.Commerce.Сondition,
16
16
  * DM.Commerce.Date.Years
17
17
  * ],
18
- * value: [measures.sum(DM.Commerce.Quantity)],
18
+ * value: [measureFactory.sum(DM.Commerce.Quantity)],
19
19
  * }}
20
20
  * />
21
21
  * ```
@@ -1,11 +1,16 @@
1
- import { Data, DataSource, Filter } from '@sisense/sdk-data';
1
+ import { Attribute, Data, DataSource, Filter, FilterRelation, Measure } from '@sisense/sdk-data';
2
2
  import { TableDataOptionsInternal } from '../../chart-data-options/types';
3
3
  type UseDataProps = {
4
4
  dataSet: Data | DataSource | undefined;
5
5
  dataOptions: TableDataOptionsInternal | null;
6
6
  filters: Filter[] | undefined;
7
+ filterRelations: FilterRelation | undefined;
7
8
  count: number;
8
9
  offset: number;
9
10
  };
10
- export declare const useTableData: ({ dataSet, dataOptions, filters, count, offset, }: UseDataProps) => Data | null;
11
+ export declare const getTableAttributesAndMeasures: (dataOptions: TableDataOptionsInternal) => {
12
+ attributes: Attribute[];
13
+ measures: Measure[];
14
+ };
15
+ export declare const useTableData: ({ dataSet, dataOptions, filters, filterRelations, count, offset, }: UseDataProps) => Data | null;
11
16
  export {};
@@ -31,8 +31,8 @@ import { TableProps } from '../props';
31
31
  * dataOptions={{
32
32
  * columns: [
33
33
  * DM.Commerce.AgeRange,
34
- * measures.sum(DM.Commerce.Revenue, 'Total Revenue'),
35
- * measures.sum(DM.Commerce.Cost, 'Total Cost'),
34
+ * measureFactory.sum(DM.Commerce.Revenue, 'Total Revenue'),
35
+ * measureFactory.sum(DM.Commerce.Cost, 'Total Cost'),
36
36
  * ],
37
37
  * }}
38
38
  * styleOptions={{
@@ -48,3 +48,6 @@ import { TableProps } from '../props';
48
48
  * @returns Table component
49
49
  */
50
50
  export declare const Table: React.FunctionComponent<TableProps>;
51
+ export declare const DEFAULT_TABLE_ROWS_PER_PAGE: 25;
52
+ /** How many pages of data will be loaded in one query */
53
+ export declare const PAGES_BATCH_SIZE = 10;