@sisense/sdk-data 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.
@@ -355,3 +355,44 @@ export interface FilterRelation {
355
355
  export declare type FilterRelationJaqlNode = {
356
356
  instanceid: string;
357
357
  };
358
+ /**
359
+ * Wrapped attribute with additional options for pivot table
360
+ */
361
+ export interface PivotAttribute {
362
+ attribute: Attribute;
363
+ includeSubTotals?: boolean;
364
+ }
365
+ /**
366
+ * Runs type guard check for PivotAttribute.
367
+ *
368
+ * @param arg - object to check
369
+ * @internal
370
+ */
371
+ export declare function isPivotAttribute(arg: Attribute | PivotAttribute): arg is PivotAttribute;
372
+ export declare type TotalsCalculation = 'sum' | 'max' | 'min' | 'avg' | 'median';
373
+ /**
374
+ * Wrapped measure with additional options for pivot table
375
+ */
376
+ export interface PivotMeasure {
377
+ measure: Measure;
378
+ totalsCalculation: TotalsCalculation;
379
+ }
380
+ /**
381
+ * Runs type guard check for PivotMeasure.
382
+ *
383
+ * @param arg - object to check
384
+ * @internal
385
+ */
386
+ export declare function isPivotMeasure(arg: Measure | PivotMeasure): arg is PivotMeasure;
387
+ /**
388
+ * Data options for grand totals of a pivot table
389
+ */
390
+ export declare type PivotGrandTotals = {
391
+ title?: string;
392
+ rows?: boolean;
393
+ columns?: boolean;
394
+ };
395
+ /**
396
+ * @internal
397
+ */
398
+ export declare const DEFAULT_PIVOT_GRAND_TOTALS: PivotGrandTotals;
@@ -1 +1,26 @@
1
- export {};
1
+ /**
2
+ * Runs type guard check for PivotAttribute.
3
+ *
4
+ * @param arg - object to check
5
+ * @internal
6
+ */
7
+ export function isPivotAttribute(arg) {
8
+ return 'attribute' in arg;
9
+ }
10
+ /**
11
+ * Runs type guard check for PivotMeasure.
12
+ *
13
+ * @param arg - object to check
14
+ * @internal
15
+ */
16
+ export function isPivotMeasure(arg) {
17
+ return 'measure' in arg;
18
+ }
19
+ /**
20
+ * @internal
21
+ */
22
+ export const DEFAULT_PIVOT_GRAND_TOTALS = {
23
+ title: 'Grand Total',
24
+ rows: false,
25
+ columns: false,
26
+ };
package/dist/index.d.ts CHANGED
@@ -12,13 +12,13 @@ export * from './dimensional-model/dimensions.js';
12
12
  export * from './dimensional-model/factory.js';
13
13
  export * from './dimensional-model/filters/filters.js';
14
14
  /**
15
- * Functions to create date, text, or numeric filters on certain data columns
15
+ * Functions to create date, text, or numeric filters on specified data.
16
16
  *
17
- * They are similar to [Dashboard and Widget Filters](https://docs.sisense.com/main/SisenseLinux/build-formulas.htm) in Sisense.
17
+ * Filters created with these functions can be used to:
18
18
  *
19
- * Filters created with these functions can be used in the data options of UI components such as
20
- * {@link @sisense/sdk-ui!ChartProps | Chart}, {@link @sisense/sdk-ui!ChartWidgetProps | ChartWidget},
21
- * and {@link @sisense/sdk-ui!ExecuteQueryProps | ExecuteQuery}.
19
+ * + Filter explicit queries by query components or query functions
20
+ * + Filter or highlight queries used by UI components, such as charts
21
+ * + Set the filters of filter components
22
22
  *
23
23
  * @example
24
24
  * Example of using React hook `useExecuteQuery` to query the `Sample ECommerce` data source.
package/dist/index.js CHANGED
@@ -12,13 +12,13 @@ export * from './dimensional-model/dimensions.js';
12
12
  export * from './dimensional-model/factory.js';
13
13
  export * from './dimensional-model/filters/filters.js';
14
14
  /**
15
- * Functions to create date, text, or numeric filters on certain data columns
15
+ * Functions to create date, text, or numeric filters on specified data.
16
16
  *
17
- * They are similar to [Dashboard and Widget Filters](https://docs.sisense.com/main/SisenseLinux/build-formulas.htm) in Sisense.
17
+ * Filters created with these functions can be used to:
18
18
  *
19
- * Filters created with these functions can be used in the data options of UI components such as
20
- * {@link @sisense/sdk-ui!ChartProps | Chart}, {@link @sisense/sdk-ui!ChartWidgetProps | ChartWidget},
21
- * and {@link @sisense/sdk-ui!ExecuteQueryProps | ExecuteQuery}.
19
+ * + Filter explicit queries by query components or query functions
20
+ * + Filter or highlight queries used by UI components, such as charts
21
+ * + Set the filters of filter components
22
22
  *
23
23
  * @example
24
24
  * Example of using React hook `useExecuteQuery` to query the `Sample ECommerce` data source.
@@ -148,6 +148,133 @@ export interface QueryResultData {
148
148
  /** Two-dimensional array of data {@link Cell | cells} */
149
149
  rows: Cell[][];
150
150
  }
151
+ /**
152
+ * Tree node representing data in a pivot table
153
+ */
154
+ export declare type TreeNode = {
155
+ /**
156
+ * Raw data
157
+ */
158
+ value?: string;
159
+ /**
160
+ * Raw data
161
+ *
162
+ * @internal
163
+ */
164
+ content?: string;
165
+ /**
166
+ * Matched index for condition formatting
167
+ *
168
+ * @internal
169
+ */
170
+ cf?: number;
171
+ /**
172
+ * List of children of this node
173
+ */
174
+ children?: Array<TreeNode>;
175
+ /**
176
+ * Data list for rows nodes
177
+ */
178
+ data?: Array<any>;
179
+ /**
180
+ * Index in data list for columns nodes
181
+ */
182
+ index?: number;
183
+ /**
184
+ * Current node's index divergence
185
+ *
186
+ * @internal
187
+ */
188
+ indexDivergence?: number;
189
+ /**
190
+ * Initial child count in raw data from server
191
+ *
192
+ * @internal
193
+ */
194
+ size?: number;
195
+ /**
196
+ * Boolean flag if node is some part of real node
197
+ *
198
+ * @internal
199
+ */
200
+ isPart?: boolean;
201
+ /**
202
+ * Max number of children (measures) nodes to insert
203
+ *
204
+ * @internal
205
+ */
206
+ maxChilds?: number;
207
+ /**
208
+ * Node deep level
209
+ *
210
+ * @internal
211
+ */
212
+ level?: number;
213
+ /**
214
+ * Node min deep level, for columns nodes with values at the and
215
+ *
216
+ * @internal
217
+ */
218
+ minLevel?: number;
219
+ /**
220
+ * Internal cache, to make sure that node was already mapped
221
+ *
222
+ * @internal
223
+ */
224
+ isMapped?: boolean;
225
+ /**
226
+ * Internal cache, for child count
227
+ *
228
+ * @internal
229
+ */
230
+ childCount?: number;
231
+ /**
232
+ * Internal cache, for child deep
233
+ *
234
+ * @internal
235
+ */
236
+ childDeep?: number;
237
+ /**
238
+ * Internal data store
239
+ *
240
+ * @internal
241
+ */
242
+ store?: {
243
+ [key: string]: any;
244
+ };
245
+ };
246
+ /**
247
+ * Grid of tree nodes
248
+ */
249
+ export declare type PivotGrid = Array<Array<TreeNode | string>>;
250
+ /**
251
+ * Pivot query result data set, which includes both a flat table of {@link QueryResultData} and grids of tree structures.
252
+ */
253
+ export interface PivotQueryResultData {
254
+ /**
255
+ * Flat table structure
256
+ *
257
+ * @category Table
258
+ */
259
+ table: QueryResultData;
260
+ /**
261
+ * Grids of tree structures
262
+ *
263
+ * @category Tree Structures
264
+ */
265
+ grids?: {
266
+ corner: PivotGrid;
267
+ rows: PivotGrid;
268
+ columns: PivotGrid;
269
+ values: PivotGrid;
270
+ };
271
+ }
272
+ /**
273
+ * Empty pivot query result data set
274
+ *
275
+ * @internal
276
+ */
277
+ export declare const EMPTY_PIVOT_QUERY_RESULT_DATA: PivotQueryResultData;
151
278
  /**
152
279
  * Runs type guard check for DataSource.
153
280
  *
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Empty pivot query result data set
3
+ *
4
+ * @internal
5
+ */
6
+ export const EMPTY_PIVOT_QUERY_RESULT_DATA = {
7
+ table: { columns: [], rows: [] },
8
+ };
1
9
  /**
2
10
  * Runs type guard check for DataSource.
3
11
  *
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "Sisense",
12
12
  "Compose SDK"
13
13
  ],
14
- "version": "1.0.0",
14
+ "version": "1.2.0",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -23,8 +23,8 @@
23
23
  "author": "Sisense ",
24
24
  "license": "SEE LICENSE IN LICENSE.md",
25
25
  "dependencies": {
26
- "@sisense/sdk-common": "^1.0.0",
27
- "@sisense/sdk-rest-client": "^1.0.0",
26
+ "@sisense/sdk-common": "^1.2.0",
27
+ "@sisense/sdk-rest-client": "^1.2.0",
28
28
  "guid-typescript": "^1.0.9",
29
29
  "lodash": "^4.17.21",
30
30
  "numeral": "^2.0.6",