@sisense/sdk-ui-angular 1.32.0 → 1.33.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 (44) hide show
  1. package/dist/ai/lib/components/chatbot.component.d.ts +1 -2
  2. package/dist/ai/lib/components/get-nlg-insights.component.d.ts +1 -2
  3. package/dist/esm2020/ai/lib/components/chatbot.component.mjs +2 -3
  4. package/dist/esm2020/ai/lib/components/get-nlg-insights.component.mjs +2 -3
  5. package/dist/esm2020/lib/components/dashboard/dashboard-by-id.component.mjs +4 -4
  6. package/dist/esm2020/lib/components/dashboard/dashboard.component.mjs +1 -1
  7. package/dist/esm2020/lib/components/widgets/index.mjs +2 -1
  8. package/dist/esm2020/lib/components/widgets/pivot-table-widget.component.mjs +127 -0
  9. package/dist/esm2020/lib/sdk-ui-core-exports.mjs +2 -2
  10. package/dist/esm2020/lib/sdk-ui.module.mjs +8 -4
  11. package/dist/esm2020/lib/services/query.service.mjs +31 -5
  12. package/dist/esm2020/lib/types/dashboard-config.mjs +2 -0
  13. package/dist/esm2020/lib/types/index.mjs +2 -1
  14. package/dist/esm2020/lib/utilities/dashboard-helpers.mjs +119 -0
  15. package/dist/esm2020/lib/utilities/dashboard-model-translator.mjs +49 -0
  16. package/dist/esm2020/lib/utilities/index.mjs +7 -0
  17. package/dist/esm2020/lib/utilities/widget-model-translator.mjs +304 -0
  18. package/dist/esm2020/public-api.mjs +2 -1
  19. package/dist/esm2020/version.mjs +2 -2
  20. package/dist/fesm2015/sisense-sdk-ui-angular-ai.mjs +2 -4
  21. package/dist/fesm2015/sisense-sdk-ui-angular-ai.mjs.map +1 -1
  22. package/dist/fesm2015/sisense-sdk-ui-angular.mjs +663 -13
  23. package/dist/fesm2015/sisense-sdk-ui-angular.mjs.map +1 -1
  24. package/dist/fesm2020/sisense-sdk-ui-angular-ai.mjs +2 -4
  25. package/dist/fesm2020/sisense-sdk-ui-angular-ai.mjs.map +1 -1
  26. package/dist/fesm2020/sisense-sdk-ui-angular.mjs +660 -12
  27. package/dist/fesm2020/sisense-sdk-ui-angular.mjs.map +1 -1
  28. package/dist/lib/components/dashboard/dashboard-by-id.component.d.ts +8 -5
  29. package/dist/lib/components/dashboard/dashboard.component.d.ts +5 -2
  30. package/dist/lib/components/widgets/index.d.ts +1 -0
  31. package/dist/lib/components/widgets/pivot-table-widget.component.d.ts +127 -0
  32. package/dist/lib/sdk-ui-core-exports.d.ts +2 -2
  33. package/dist/lib/sdk-ui.module.d.ts +4 -3
  34. package/dist/lib/services/query.service.d.ts +29 -3
  35. package/dist/lib/types/dashboard-config.d.ts +24 -0
  36. package/dist/lib/types/index.d.ts +1 -0
  37. package/dist/lib/utilities/dashboard-helpers.d.ts +105 -0
  38. package/dist/lib/utilities/dashboard-model-translator.d.ts +47 -0
  39. package/dist/lib/utilities/index.d.ts +23 -0
  40. package/dist/lib/utilities/widget-model-translator.d.ts +289 -0
  41. package/dist/package.json +1 -1
  42. package/dist/public-api.d.ts +2 -1
  43. package/dist/version.d.ts +1 -1
  44. package/package.json +4 -4
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Injectable, Inject, NgModule, Optional, EventEmitter, Component, ViewChild, Input, Output } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
- import { createContextProviderRenderer, CustomThemeProvider, CustomSisenseContextProvider, CustomPluginsProvider, createClientApplication, executeQuery, executeQueryByWidgetId, getDashboardModel, getDashboardModels, getWidgetModel, getHierarchyModels, getDefaultThemeSettings, getThemeSettingsByOid, ComponentAdapter, createElement, MemberFilterTile, DateRangeFilterTile, RelativeDateFilterTile, CriteriaFilterTile, Chart, Table, PivotTable, TableWidget, DashboardWidget, WidgetById, createWrapperElementHandler, createWrapperElement, DrilldownWidget, createComponentRenderer, ChartWidget, DashboardById, Dashboard, DrilldownBreadcrumbs, ContextMenu } from '@sisense/sdk-ui-preact';
5
- export { boxWhiskerProcessResult, dashboardHelpers, dashboardModelTranslator, widgetModelTranslator } from '@sisense/sdk-ui-preact';
4
+ import { createContextProviderRenderer, CustomThemeProvider, CustomSisenseContextProvider, CustomPluginsProvider, createClientApplication, executeQuery, executeQueryByWidgetId, executePivotQuery, getDashboardModel, getDashboardModels, getWidgetModel, getHierarchyModels, getDefaultThemeSettings, getThemeSettingsByOid, ComponentAdapter, createElement, MemberFilterTile, DateRangeFilterTile, RelativeDateFilterTile, CriteriaFilterTile, Chart, Table, PivotTable, TableWidget, DashboardWidget, WidgetById, createWrapperElementHandler, createWrapperElement, DrilldownWidget, createComponentRenderer, ChartWidget, PivotTableWidget, DashboardById, Dashboard, DrilldownBreadcrumbs, ContextMenu, dashboardModelTranslator as dashboardModelTranslator$1, dashboardHelpers as dashboardHelpers$1, widgetModelTranslator as widgetModelTranslator$1 } from '@sisense/sdk-ui-preact';
5
+ export { boxWhiskerProcessResult } from '@sisense/sdk-ui-preact';
6
6
  import { __awaiter, __decorate } from 'tslib';
7
7
  import { map, BehaviorSubject } from 'rxjs';
8
8
  import merge from 'ts-deepmerge';
@@ -171,7 +171,7 @@ let QueryService = class QueryService {
171
171
  */
172
172
  executeQuery(params) {
173
173
  return __awaiter(this, void 0, void 0, function* () {
174
- const { dataSource, dimensions, measures, filters, highlights, count, offset, onBeforeQuery } = params;
174
+ const { dataSource, dimensions, measures, filters, highlights, count, offset, beforeQuery, onBeforeQuery, } = params;
175
175
  const app = yield this.sisenseContextService.getApp();
176
176
  const { filters: filterList, relations: filterRelations } = getFilterListAndRelationsJaql(filters);
177
177
  const data = yield executeQuery({
@@ -183,7 +183,7 @@ let QueryService = class QueryService {
183
183
  highlights,
184
184
  count,
185
185
  offset,
186
- }, app, { onBeforeQuery });
186
+ }, app, { onBeforeQuery: beforeQuery !== null && beforeQuery !== void 0 ? beforeQuery : onBeforeQuery });
187
187
  return { data };
188
188
  });
189
189
  }
@@ -194,16 +194,44 @@ let QueryService = class QueryService {
194
194
  * @returns Query result
195
195
  */
196
196
  executeQueryByWidgetId(params) {
197
+ var _a;
197
198
  return __awaiter(this, void 0, void 0, function* () {
198
199
  const app = yield this.sisenseContextService.getApp();
199
- return executeQueryByWidgetId(Object.assign(Object.assign({}, params), { app }));
200
+ return executeQueryByWidgetId(Object.assign(Object.assign({}, params), { app, onBeforeQuery: (_a = params.beforeQuery) !== null && _a !== void 0 ? _a : params.onBeforeQuery }));
201
+ });
202
+ }
203
+ /**
204
+ * Executes a data query for a pivot table.
205
+ *
206
+ * @param params - Pivot query parameters
207
+ * @return Pivot query result
208
+ * @beta
209
+ */
210
+ executePivotQuery(params) {
211
+ return __awaiter(this, void 0, void 0, function* () {
212
+ const { dataSource, rows, columns, values, grandTotals, filters, highlights, count, offset, beforeQuery, } = params;
213
+ const { filters: filterList, relations: filterRelations } = getFilterListAndRelationsJaql(filters);
214
+ const app = yield this.sisenseContextService.getApp();
215
+ const data = yield executePivotQuery({
216
+ dataSource,
217
+ rows,
218
+ columns,
219
+ values,
220
+ grandTotals,
221
+ filters: filterList,
222
+ filterRelations,
223
+ highlights,
224
+ count,
225
+ offset,
226
+ }, app, { onBeforeQuery: beforeQuery });
227
+ return { data };
200
228
  });
201
229
  }
202
230
  };
203
231
  QueryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: QueryService, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.Injectable });
204
232
  QueryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: QueryService, providedIn: 'root' });
205
233
  QueryService = __decorate([
206
- TrackableService(['executeQuery', 'executeQueryByWidgetId'])
234
+ TrackableService(['executeQuery', 'executeQueryByWidgetId', 'executePivotQuery'])
207
235
  ], QueryService);
208
236
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: QueryService, decorators: [{
209
237
  type: Injectable,
@@ -401,7 +429,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
401
429
  }]
402
430
  }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
403
431
 
404
- var packageVersion = '1.32.0';
432
+ var packageVersion = '1.33.0';
405
433
 
406
434
  function Trackable(target, propertyKey, descriptor) {
407
435
  const originalMethod = descriptor.value;
@@ -4051,6 +4079,127 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
4051
4079
  type: Output
4052
4080
  }] } });
4053
4081
 
4082
+ /**
4083
+ * The Pivot Table Widget component extends the {@link PivotTableComponent} component to support widget features,
4084
+ * including a header, widget style options, and more.
4085
+ *
4086
+ * @example
4087
+ * ```html
4088
+ <csdk-pivot-table-widget
4089
+ [dataSource]="pivotProps.dataSource"
4090
+ [dataOptions]="pivotProps.dataOptions"
4091
+ [filters]="pivotProps.filters"
4092
+ [styleOptions]="pivotProps.styleOptions"
4093
+ [title]="pivotProps.title"
4094
+ [description]="pivotProps.description"
4095
+ />
4096
+ * ```
4097
+ * ```ts
4098
+ import { Component } from '@angular/core';
4099
+ import { type PivotTableWidgetProps } from '@sisense/sdk-ui-angular';
4100
+ import { measureFactory, filterFactory } from '@sisense/sdk-data';
4101
+ import * as DM from '../../assets/sample-ecommerce';
4102
+
4103
+ @Component({
4104
+ selector: 'app-analytics',
4105
+ templateUrl: './analytics.component.html',
4106
+ styleUrls: ['./analytics.component.scss'],
4107
+ })
4108
+ export class AnalyticsComponent {
4109
+
4110
+ pivotProps: PivotTableWidgetProps = {
4111
+ dataSource: DM.DataSource,
4112
+ dataOptions: {
4113
+ rows: [
4114
+ { column: DM.Category.Category, includeSubTotals: true },
4115
+ { column: DM.Commerce.AgeRange, includeSubTotals: true },
4116
+ DM.Commerce.Condition,
4117
+ ],
4118
+ columns: [{ column: DM.Commerce.Gender, includeSubTotals: true }],
4119
+ values: [
4120
+ measureFactory.sum(DM.Commerce.Cost, 'Total Cost'),
4121
+ {
4122
+ column: measureFactory.sum(DM.Commerce.Revenue, 'Total Revenue'),
4123
+ totalsCalculation: 'sum',
4124
+ dataBars: true,
4125
+ },
4126
+ ],
4127
+ grandTotals: { title: 'Grand Total', rows: true, columns: true },
4128
+ },
4129
+ filters: [filterFactory.members(DM.Commerce.Gender, ['Female', 'Male'])],
4130
+ styleOptions: { width: 1400, height: 600, rowsPerPage: 25 },
4131
+ title: 'Pivot Table Widget',
4132
+ description: 'Pivot Table Widget Description',
4133
+ };
4134
+ }
4135
+ * ```
4136
+ * <img src="media://angular-pivot-table-widget-example.png" width="800px" />
4137
+ * @group Dashboards
4138
+ * @beta
4139
+ */
4140
+ class PivotTableWidgetComponent {
4141
+ constructor(sisenseContextService, themeService) {
4142
+ this.sisenseContextService = sisenseContextService;
4143
+ this.themeService = themeService;
4144
+ this.componentAdapter = new ComponentAdapter(() => this.createPreactComponent(), [
4145
+ createSisenseContextConnector(this.sisenseContextService),
4146
+ createThemeContextConnector(this.themeService),
4147
+ ]);
4148
+ }
4149
+ /** @internal */
4150
+ ngAfterViewInit() {
4151
+ this.componentAdapter.render(this.preactRef.nativeElement);
4152
+ }
4153
+ /** @internal */
4154
+ ngOnChanges() {
4155
+ if (this.preactRef) {
4156
+ this.componentAdapter.render(this.preactRef.nativeElement);
4157
+ }
4158
+ }
4159
+ createPreactComponent() {
4160
+ const props = {
4161
+ dataSource: this.dataSource,
4162
+ dataOptions: this.dataOptions,
4163
+ filters: this.filters,
4164
+ highlights: this.highlights,
4165
+ styleOptions: this.styleOptions,
4166
+ title: this.title,
4167
+ description: this.description,
4168
+ };
4169
+ return createElement(PivotTableWidget, props);
4170
+ }
4171
+ /** @internal */
4172
+ ngOnDestroy() {
4173
+ this.componentAdapter.destroy();
4174
+ }
4175
+ }
4176
+ PivotTableWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PivotTableWidgetComponent, deps: [{ token: SisenseContextService }, { token: ThemeService }], target: i0.ɵɵFactoryTarget.Component });
4177
+ PivotTableWidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PivotTableWidgetComponent, selector: "csdk-pivot-table-widget", inputs: { dataSource: "dataSource", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", title: "title", description: "description" }, viewQueries: [{ propertyName: "preactRef", first: true, predicate: ["preact"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n <div #preact style=\"width: 100%; height: 100%\"></div>\n", isInline: true });
4178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PivotTableWidgetComponent, decorators: [{
4179
+ type: Component,
4180
+ args: [{
4181
+ selector: 'csdk-pivot-table-widget',
4182
+ template,
4183
+ }]
4184
+ }], ctorParameters: function () { return [{ type: SisenseContextService }, { type: ThemeService }]; }, propDecorators: { preactRef: [{
4185
+ type: ViewChild,
4186
+ args: [rootId]
4187
+ }], dataSource: [{
4188
+ type: Input
4189
+ }], dataOptions: [{
4190
+ type: Input
4191
+ }], filters: [{
4192
+ type: Input
4193
+ }], highlights: [{
4194
+ type: Input
4195
+ }], styleOptions: [{
4196
+ type: Input
4197
+ }], title: [{
4198
+ type: Input
4199
+ }], description: [{
4200
+ type: Input
4201
+ }] } });
4202
+
4054
4203
  /**
4055
4204
  * An Angular component used for easily rendering a dashboard by its ID created in a Sisense Fusion instance.
4056
4205
  *
@@ -4130,7 +4279,7 @@ class DashboardByIdComponent {
4130
4279
  createPreactComponent() {
4131
4280
  const props = {
4132
4281
  dashboardOid: this.dashboardOid,
4133
- persist: this.persist,
4282
+ config: this.config,
4134
4283
  };
4135
4284
  return createElement(DashboardById, props);
4136
4285
  }
@@ -4142,7 +4291,7 @@ class DashboardByIdComponent {
4142
4291
  }
4143
4292
  }
4144
4293
  DashboardByIdComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardByIdComponent, deps: [{ token: SisenseContextService }, { token: ThemeService }, { token: PluginsService }], target: i0.ɵɵFactoryTarget.Component });
4145
- DashboardByIdComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: DashboardByIdComponent, selector: "csdk-dashboard-by-id", inputs: { dashboardOid: "dashboardOid", persist: "persist" }, viewQueries: [{ propertyName: "preactRef", first: true, predicate: ["preact"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n <div #preact style=\"width: 100%; height: 100%\"></div>\n", isInline: true });
4294
+ DashboardByIdComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: DashboardByIdComponent, selector: "csdk-dashboard-by-id", inputs: { dashboardOid: "dashboardOid", config: "config" }, viewQueries: [{ propertyName: "preactRef", first: true, predicate: ["preact"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n <div #preact style=\"width: 100%; height: 100%\"></div>\n", isInline: true });
4146
4295
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardByIdComponent, decorators: [{
4147
4296
  type: Component,
4148
4297
  args: [{
@@ -4154,7 +4303,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
4154
4303
  args: [rootId]
4155
4304
  }], dashboardOid: [{
4156
4305
  type: Input
4157
- }], persist: [{
4306
+ }], config: [{
4158
4307
  type: Input
4159
4308
  }] } });
4160
4309
 
@@ -4538,7 +4687,8 @@ SdkUiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "1
4538
4687
  AreamapChartComponent,
4539
4688
  PivotTableComponent,
4540
4689
  DashboardByIdComponent,
4541
- DashboardComponent], imports: [CommonModule, DecoratorsModule], exports: [ChartComponent,
4690
+ DashboardComponent,
4691
+ PivotTableWidgetComponent], imports: [CommonModule, DecoratorsModule], exports: [ChartComponent,
4542
4692
  TableComponent,
4543
4693
  ChartWidgetComponent,
4544
4694
  ColumnChartComponent,
@@ -4568,7 +4718,8 @@ SdkUiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "1
4568
4718
  AreamapChartComponent,
4569
4719
  PivotTableComponent,
4570
4720
  DashboardByIdComponent,
4571
- DashboardComponent] });
4721
+ DashboardComponent,
4722
+ PivotTableWidgetComponent] });
4572
4723
  SdkUiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SdkUiModule, imports: [CommonModule, DecoratorsModule] });
4573
4724
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SdkUiModule, decorators: [{
4574
4725
  type: NgModule,
@@ -4605,6 +4756,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
4605
4756
  PivotTableComponent,
4606
4757
  DashboardByIdComponent,
4607
4758
  DashboardComponent,
4759
+ PivotTableWidgetComponent,
4608
4760
  ],
4609
4761
  imports: [CommonModule, DecoratorsModule],
4610
4762
  exports: [
@@ -4639,11 +4791,509 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
4639
4791
  PivotTableComponent,
4640
4792
  DashboardByIdComponent,
4641
4793
  DashboardComponent,
4794
+ PivotTableWidgetComponent,
4642
4795
  ],
4643
4796
  providers: [],
4644
4797
  }]
4645
4798
  }] });
4646
4799
 
4800
+ /**
4801
+ * Translates {@link DashboardModel} to {@link DashboardProps}.
4802
+ *
4803
+ * @example
4804
+ * ```html
4805
+ <csdk-dashboard
4806
+ *ngIf="dashboard"
4807
+ [title]="dashboard.title"
4808
+ [layoutOptions]="dashboard.layoutOptions"
4809
+ [widgets]="dashboard.widgets"
4810
+ [filters]="dashboard.filters"
4811
+ [defaultDataSource]="dashboard.defaultDataSource"
4812
+ [widgetsOptions]="dashboard.widgetsOptions"
4813
+ />
4814
+ * ```
4815
+ *
4816
+ * ```ts
4817
+ import { Component } from '@angular/core';
4818
+ import {
4819
+ type DashboardProps,
4820
+ DashboardService,
4821
+ dashboardModelTranslator,
4822
+ } from '@sisense/sdk-ui-angular';
4823
+
4824
+ @Component({
4825
+ selector: 'app-dashboard',
4826
+ templateUrl: './dashboard.component.html',
4827
+ styleUrls: ['./dashboard.component.scss'],
4828
+ })
4829
+ export class DashboardComponent {
4830
+ dashboard: DashboardProps | null = null;
4831
+
4832
+ constructor(private dashboardService: DashboardService) {}
4833
+
4834
+ async ngOnInit(): Promise<void> {
4835
+ const dashboardModel = await this.dashboardService.getDashboardModel('your-dashboard-oid', {
4836
+ includeWidgets: true,
4837
+ includeFilters: true,
4838
+ });
4839
+ this.dashboard = dashboardModelTranslator.toDashboardProps(dashboardModel);
4840
+ }
4841
+ }
4842
+ * ```
4843
+ */
4844
+ function toDashboardProps(dashboardModel) {
4845
+ return dashboardModelTranslator$1.toDashboardProps(dashboardModel);
4846
+ }
4847
+
4848
+ var dashboardModelTranslator = /*#__PURE__*/Object.freeze({
4849
+ __proto__: null,
4850
+ toDashboardProps: toDashboardProps
4851
+ });
4852
+
4853
+ /**
4854
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.replaceFilters}
4855
+ *
4856
+ * @example
4857
+ * Replace all filters on a dashboard with a new set of filters.
4858
+ * ```ts
4859
+ * const existingDashboard: DashboardProps = {...}
4860
+ * const newFilters: Filter[] = [{...}, {...}, ...];
4861
+ * const updatedDashboard = dashboardHelpers.replaceFilters(existingDashboard, newFilters);
4862
+ * ```
4863
+ * @param dashboard - The original dashboard (`DashboardProps`) whose filters are to be replaced.
4864
+ * @param newFilters - An array of new filters or filter relations to set on the dashboard.
4865
+ * @returns A new dashboard instance with the updated filters.
4866
+ */
4867
+ const replaceFilters = (dashboard, newFilters) => {
4868
+ return dashboardHelpers$1.replaceFilters(dashboard, newFilters);
4869
+ };
4870
+ /**
4871
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.addFilter}
4872
+ *
4873
+ * @example
4874
+ * Add a new filter to a dashboard.
4875
+ * ```ts
4876
+ * const existingDashboard: DashboardProps = {...};
4877
+ * const newFilter: Filter = {...};
4878
+ * const updatedDashboard = dashboardHelpers.addFilter(existingDashboard, newFilter);
4879
+ * ```
4880
+ * @param dashboard - The original dashboard (`DashboardProps`) to which the filter will be added.
4881
+ * @param newFilter - The filter to add to the dashboard.
4882
+ * @returns A new dashboard instance with the new filter added.
4883
+ */
4884
+ const addFilter = (dashboard, newFilter) => {
4885
+ return dashboardHelpers$1.addFilter(dashboard, newFilter);
4886
+ };
4887
+ /**
4888
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.addFilters}
4889
+ *
4890
+ * @example
4891
+ * Add multiple new filters to a dashboard.
4892
+ * ```ts
4893
+ * const existingDashboard: DashboardProps = {...};
4894
+ * const newFilters: Filter[] = [{...}, {...}, ...];
4895
+ * const updatedDashboard = dashboardHelpers.addFilters(existingDashboard, newFilters);
4896
+ * ```
4897
+ * @param dashboard - The original dashboard (`DashboardProps`) to which the filters will be added.
4898
+ * @param newFilters - An array of filters to add to the dashboard.
4899
+ * @returns A new dashboard instance with the new filters added.
4900
+ */
4901
+ const addFilters = (dashboard, newFilters) => {
4902
+ return dashboardHelpers$1.addFilters(dashboard, newFilters);
4903
+ };
4904
+ /**
4905
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.replaceFilter}
4906
+ *
4907
+ * @example
4908
+ * Replace a filter in a dashboard.
4909
+ * ```ts
4910
+ * const existingDashboard: DashboardProps = {...};
4911
+ * const filterToReplace: Filter = {...};
4912
+ * const newFilter: Filter = {...};
4913
+ * const updatedDashboard = dashboardHelpers.replaceFilter(existingDashboard, filterToReplace, newFilter);
4914
+ * ```
4915
+ * @param dashboard - The original dashboard (`DashboardProps`) containing the filter to be replaced.
4916
+ * @param filterToReplace - The existing filter to be replaced.
4917
+ * @param newFilter - The new filter to replace the existing one.
4918
+ * @returns A new dashboard instance with the specified filter replaced.
4919
+ */
4920
+ const replaceFilter = (dashboard, filterToReplace, newFilter) => {
4921
+ return dashboardHelpers$1.replaceFilter(dashboard, filterToReplace, newFilter);
4922
+ };
4923
+ /**
4924
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.modifyFilter}
4925
+ *
4926
+ * @deprecated Use {@link replaceFilter} instead
4927
+ *
4928
+ * @param dashboard - The original dashboard (`DashboardProps`) containing the filter to modify.
4929
+ * @param filterToModify - The existing filter to be modified.
4930
+ * @param newFilter - The new filter to replace the existing one.
4931
+ * @returns A new dashboard instance with the specified filter modified.
4932
+ */
4933
+ const modifyFilter = (dashboard, filterToModify, newFilter) => {
4934
+ return dashboardHelpers$1.modifyFilter(dashboard, filterToModify, newFilter);
4935
+ };
4936
+ /**
4937
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.removeFilter}
4938
+ *
4939
+ * @example
4940
+ * Remove a filter from a dashboard.
4941
+ * ```ts
4942
+ * const existingDashboard: DashboardProps = {...};
4943
+ * const filterToRemove: Filter = {...};
4944
+ * const updatedDashboard = dashboardHelpers.removeFilter(existingDashboard, filterToRemove);
4945
+ * ```
4946
+ * @param dashboard - The original dashboard (`DashboardProps`) from which to remove the filter.
4947
+ * @param filterToRemove - The filter to be removed.
4948
+ * @returns A new dashboard instance with the specified filter removed.
4949
+ */
4950
+ const removeFilter = (dashboard, filterToRemove) => {
4951
+ return dashboardHelpers$1.removeFilter(dashboard, filterToRemove);
4952
+ };
4953
+ /**
4954
+ * {@inheritDoc @sisense/sdk-ui!dashboardHelpers.removeFilters}
4955
+ *
4956
+ * @example
4957
+ * Remove multiple filters from a dashboard.
4958
+ * ```ts
4959
+ * const existingDashboard: DashboardProps = {...};
4960
+ * const filtersToRemove: Filter[] = [{...}, {...}, ...];
4961
+ * const updatedDashboard = dashboardHelpers.removeFilters(existingDashboard, filtersToRemove);
4962
+ * ```
4963
+ * @param dashboard - The original dashboard (`DashboardProps`) from which the specified filters are removed.
4964
+ * @param filtersToRemove - An array of filters to remove.
4965
+ * @returns A new dashboard instance with the specified filters removed.
4966
+ */
4967
+ const removeFilters = (dashboard, filtersToRemove) => {
4968
+ return dashboardHelpers$1.removeFilters(dashboard, filtersToRemove);
4969
+ };
4970
+
4971
+ var dashboardHelpers = /*#__PURE__*/Object.freeze({
4972
+ __proto__: null,
4973
+ addFilter: addFilter,
4974
+ addFilters: addFilters,
4975
+ modifyFilter: modifyFilter,
4976
+ removeFilter: removeFilter,
4977
+ removeFilters: removeFilters,
4978
+ replaceFilter: replaceFilter,
4979
+ replaceFilters: replaceFilters
4980
+ });
4981
+
4982
+ /**
4983
+ * Translates a {@link WidgetModel} to the parameters for executing a query for the widget.
4984
+ *
4985
+ * @example
4986
+ * ```ts
4987
+ const widgetModel = await widgetService.getWidgetModel({
4988
+ dashboardOid: 'your-dashboard-oid',
4989
+ widgetOid: 'your-widget-oid'
4990
+ });
4991
+ const executeQueryParams = widgetModelTranslator.toExecuteQueryParams(widgetModel);
4992
+ const queryResult = await queryService.executeQuery(executeQueryParams);
4993
+ * ```
4994
+ *
4995
+ * Note: this method is not supported for getting pivot query.
4996
+ * Use {@link toExecutePivotQueryParams} instead for getting query parameters for the pivot widget.
4997
+ */
4998
+ const toExecuteQueryParams = (widgetModel) => {
4999
+ return widgetModelTranslator$1.toExecuteQueryParams(widgetModel);
5000
+ };
5001
+ /**
5002
+ * Translates a {@link WidgetModel} to the parameters for executing a query for the pivot widget.
5003
+ *
5004
+ * @example
5005
+ * ```ts
5006
+ const widgetModel = await widgetService.getWidgetModel({
5007
+ dashboardOid: 'your-dashboard-oid',
5008
+ widgetOid: 'your-widget-oid'
5009
+ });
5010
+ const executePivotQueryParams = widgetModelTranslator.toExecutePivotQueryParams(widgetModel);
5011
+ const queryResult = await queryService.executePivotQuery(executeQueryParams);
5012
+ * ```
5013
+ *
5014
+ * Note: this method is supported only for getting pivot query.
5015
+ * Use {@link toExecuteQueryParams} instead for getting query parameters for non-pivot widgets.
5016
+ */
5017
+ const toExecutePivotQueryParams = (widgetModel) => {
5018
+ return widgetModelTranslator$1.toExecutePivotQueryParams(widgetModel);
5019
+ };
5020
+ /**
5021
+ * Translates a {@link WidgetModel} to the props for rendering a chart.
5022
+ *
5023
+ * @example
5024
+ * ```html
5025
+ <csdk-chart
5026
+ *ngIf="chartProps"
5027
+ [chartType]="chartProps.chartType"
5028
+ [dataSet]="chartProps.dataSet"
5029
+ [dataOptions]="chartProps.dataOptions"
5030
+ [filters]="chartProps.filters"
5031
+ [highlights]="chartProps.highlights"
5032
+ [styleOptions]="chartProps.styleOptions"
5033
+ />
5034
+ * ```
5035
+ *
5036
+ * ```ts
5037
+ import { Component } from '@angular/core';
5038
+ import {
5039
+ type ChartProps
5040
+ WidgetService,
5041
+ widgetModelTranslator,
5042
+ } from '@sisense/sdk-ui-angular';
5043
+
5044
+ @Component({
5045
+ selector: 'app-example',
5046
+ templateUrl: './example.component.html',
5047
+ styleUrls: ['./example.component.scss'],
5048
+ })
5049
+ export class ExampleComponent {
5050
+ chartProps: ChartProps | null = null;
5051
+
5052
+ constructor(private widgetService: WidgetService) {}
5053
+
5054
+ async ngOnInit(): Promise<void> {
5055
+ const widgetModel = await widgetService.getWidgetModel({
5056
+ dashboardOid: 'your-dashboard-oid',
5057
+ widgetOid: 'your-widget-oid'
5058
+ });
5059
+ this.chartProps = widgetModelTranslator.toChartProps(widgetModel);
5060
+ }
5061
+ }
5062
+ * ```
5063
+ *
5064
+ * Note: this method is not supported for pivot widgets.
5065
+ * Use {@link toPivotTableProps} instead for getting props for the {@link PivotTableComponent}.
5066
+ */
5067
+ function toChartProps(widgetModel) {
5068
+ return widgetModelTranslator$1.toChartProps(widgetModel);
5069
+ }
5070
+ /**
5071
+ * Translates a {@link WidgetModel} to the props for rendering a table.
5072
+ *
5073
+ * @example
5074
+ * ```html
5075
+ <csdk-table
5076
+ *ngIf="tableProps"
5077
+ [dataSet]="tableProps.dataSet"
5078
+ [dataOptions]="tableProps.dataOptions"
5079
+ [filters]="tableProps.filters"
5080
+ [styleOptions]="tableProps.styleOptions"
5081
+ />
5082
+ * ```
5083
+ *
5084
+ * ```ts
5085
+ import { Component } from '@angular/core';
5086
+ import {
5087
+ type TableProps
5088
+ WidgetService,
5089
+ widgetModelTranslator,
5090
+ } from '@sisense/sdk-ui-angular';
5091
+
5092
+ @Component({
5093
+ selector: 'app-example',
5094
+ templateUrl: './example.component.html',
5095
+ styleUrls: ['./example.component.scss'],
5096
+ })
5097
+ export class ExampleComponent {
5098
+ tableProps: TableProps | null = null;
5099
+
5100
+ constructor(private widgetService: WidgetService) {}
5101
+
5102
+ async ngOnInit(): Promise<void> {
5103
+ const widgetModel = await widgetService.getWidgetModel({
5104
+ dashboardOid: 'your-dashboard-oid',
5105
+ widgetOid: 'your-widget-oid'
5106
+ });
5107
+ this.tableProps = widgetModelTranslator.toTableProps(widgetModel);
5108
+ }
5109
+ }
5110
+ * ```
5111
+ *
5112
+ * Note: this method is not supported for chart and pivot widgets.
5113
+ * Use {@link toChartProps} instead for getting props for the {@link ChartComponent}.
5114
+ * Use {@link toPivotTableProps} instead for getting props for the {@link PivotTableComponent}.
5115
+ */
5116
+ function toTableProps(widgetModel) {
5117
+ return widgetModelTranslator$1.toTableProps(widgetModel);
5118
+ }
5119
+ /**
5120
+ * Translates a {@link WidgetModel} to the props for rendering a pivot table.
5121
+ *
5122
+ * @example
5123
+ * ```html
5124
+ <csdk-pivot-table
5125
+ *ngIf="pivotTableProps"
5126
+ [dataSet]="pivotTableProps.dataSet"
5127
+ [dataOptions]="pivotTableProps.dataOptions"
5128
+ [filters]="pivotTableProps.filters"
5129
+ [styleOptions]="pivotTableProps.styleOptions"
5130
+ />
5131
+ * ```
5132
+ *
5133
+ * ```ts
5134
+ import { Component } from '@angular/core';
5135
+ import {
5136
+ type PivotTableProps
5137
+ WidgetService,
5138
+ widgetModelTranslator,
5139
+ } from '@sisense/sdk-ui-angular';
5140
+
5141
+ @Component({
5142
+ selector: 'app-example',
5143
+ templateUrl: './example.component.html',
5144
+ styleUrls: ['./example.component.scss'],
5145
+ })
5146
+ export class ExampleComponent {
5147
+ pivotTableProps: PivotTableProps | null = null;
5148
+
5149
+ constructor(private widgetService: WidgetService) {}
5150
+
5151
+ async ngOnInit(): Promise<void> {
5152
+ const widgetModel = await widgetService.getWidgetModel({
5153
+ dashboardOid: 'your-dashboard-oid',
5154
+ widgetOid: 'your-widget-oid'
5155
+ });
5156
+ this.pivotTableProps = widgetModelTranslator.toPivotTableProps(widgetModel);
5157
+ }
5158
+ }
5159
+ * ```
5160
+ *
5161
+ * Note: this method is not supported for chart or table widgets.
5162
+ * Use {@link toChartProps} instead for getting props for the {@link ChartComponent}.
5163
+ * Use {@link toTableProps} instead for getting props for the {@link TableComponent}.
5164
+ */
5165
+ function toPivotTableProps(widgetModel) {
5166
+ return widgetModelTranslator$1.toPivotTableProps(widgetModel);
5167
+ }
5168
+ /**
5169
+ * Translates a {@link WidgetModel} to the props for rendering a chart widget.
5170
+ *
5171
+ * @example
5172
+ * ```html
5173
+ <csdk-chart-widget
5174
+ *ngIf="chartWidgetProps"
5175
+ [chartType]="chartWidgetProps.chartType"
5176
+ [dataSource]="chartWidgetProps.dataSource"
5177
+ [dataOptions]="chartWidgetProps.dataOptions"
5178
+ [filters]="chartWidgetProps.filters"
5179
+ [highlights]="chartWidgetProps.highlights"
5180
+ [styleOptions]="chartWidgetProps.styleOptions"
5181
+ />
5182
+ * ```
5183
+ *
5184
+ * ```ts
5185
+ import { Component } from '@angular/core';
5186
+ import {
5187
+ type ChartWidgetProps
5188
+ WidgetService,
5189
+ widgetModelTranslator,
5190
+ } from '@sisense/sdk-ui-angular';
5191
+
5192
+ @Component({
5193
+ selector: 'app-example',
5194
+ templateUrl: './example.component.html',
5195
+ styleUrls: ['./example.component.scss'],
5196
+ })
5197
+ export class ExampleComponent {
5198
+ chartWidgetProps: ChartWidgetProps | null = null;
5199
+
5200
+ constructor(private widgetService: WidgetService) {}
5201
+
5202
+ async ngOnInit(): Promise<void> {
5203
+ const widgetModel = await widgetService.getWidgetModel({
5204
+ dashboardOid: 'your-dashboard-oid',
5205
+ widgetOid: 'your-widget-oid'
5206
+ });
5207
+ this.chartWidgetProps = widgetModelTranslator.toChartWidgetProps(widgetModel);
5208
+ }
5209
+ }
5210
+ * ```
5211
+ *
5212
+ * Note: this method is not supported for pivot widgets.
5213
+ */
5214
+ function toChartWidgetProps(widgetModel) {
5215
+ return widgetModelTranslator$1.toChartWidgetProps(widgetModel);
5216
+ }
5217
+ /**
5218
+ * Translates a {@link WidgetModel} to the props for rendering a pivot table widget.
5219
+ *
5220
+ * @example
5221
+ * ```html
5222
+ <csdk-pivot-table-widget
5223
+ *ngIf="pivotWidgetProps"
5224
+ [dataSet]="pivotWidgetProps.dataSet"
5225
+ [dataOptions]="pivotWidgetProps.dataOptions"
5226
+ [filters]="pivotWidgetProps.filters"
5227
+ [styleOptions]="pivotWidgetProps.styleOptions"
5228
+ />
5229
+ * ```
5230
+ *
5231
+ * ```ts
5232
+ import { Component } from '@angular/core';
5233
+ import {
5234
+ type PivotTableWidgetProps
5235
+ WidgetService,
5236
+ widgetModelTranslator,
5237
+ } from '@sisense/sdk-ui-angular';
5238
+
5239
+ @Component({
5240
+ selector: 'app-example',
5241
+ templateUrl: './example.component.html',
5242
+ styleUrls: ['./example.component.scss'],
5243
+ })
5244
+ export class ExampleComponent {
5245
+ pivotWidgetProps: PivotTableWidgetProps | null = null;
5246
+
5247
+ constructor(private widgetService: WidgetService) {}
5248
+
5249
+ async ngOnInit(): Promise<void> {
5250
+ const widgetModel = await widgetService.getWidgetModel({
5251
+ dashboardOid: 'your-dashboard-oid',
5252
+ widgetOid: 'your-widget-oid'
5253
+ });
5254
+ this.pivotWidgetProps = widgetModelTranslator.toPivotTableWidgetProps(widgetModel);
5255
+ }
5256
+ }
5257
+ * ```
5258
+ *
5259
+ * Note: this method is not supported for chart or table widgets.
5260
+ * Use {@link toChartWidgetProps} instead for getting props for the {@link ChartWidgetComponent}.
5261
+ */
5262
+ function toPivotTableWidgetProps(widgetModel) {
5263
+ return widgetModelTranslator$1.toPivotTableWidgetProps(widgetModel);
5264
+ }
5265
+ /**
5266
+ * Translates a {@link WidgetModel} to the props for rendering a text widget.
5267
+ *
5268
+ * @example
5269
+ * ```ts
5270
+ const widgetModel = await widgetService.getWidgetModel({
5271
+ dashboardOid: 'your-dashboard-oid',
5272
+ widgetOid: 'your-widget-oid'
5273
+ });
5274
+ const textWidgetProps = widgetModelTranslator.toTextWidgetProps(widgetModel);
5275
+ * ```
5276
+ *
5277
+ * Note: this method is not supported for chart or pivot widgets.
5278
+ * Use {@link toChartWidgetProps} instead for getting props for the {@link ChartWidgetComponent}.
5279
+ * Use {@link toPivotTableWidgetProps} instead for getting props for the pivot table widget.
5280
+ */
5281
+ function toTextWidgetProps(widgetModel) {
5282
+ return widgetModelTranslator$1.toTextWidgetProps(widgetModel);
5283
+ }
5284
+
5285
+ var widgetModelTranslator = /*#__PURE__*/Object.freeze({
5286
+ __proto__: null,
5287
+ toChartProps: toChartProps,
5288
+ toChartWidgetProps: toChartWidgetProps,
5289
+ toExecutePivotQueryParams: toExecutePivotQueryParams,
5290
+ toExecuteQueryParams: toExecuteQueryParams,
5291
+ toPivotTableProps: toPivotTableProps,
5292
+ toPivotTableWidgetProps: toPivotTableWidgetProps,
5293
+ toTableProps: toTableProps,
5294
+ toTextWidgetProps: toTextWidgetProps
5295
+ });
5296
+
4647
5297
  // This file re-exports common types/utils from @sisense/sdk-ui-preact
4648
5298
  // Re-exports utils from @sisense/sdk-ui-preact
4649
5299
 
@@ -4655,5 +5305,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
4655
5305
  * Generated bundle index. Do not edit.
4656
5306
  */
4657
5307
 
4658
- export { AreaChartComponent, AreaRangeChartComponent, AreamapChartComponent, BarChartComponent, BoxplotChartComponent, ChartComponent, ChartWidgetComponent, ColumnChartComponent, ContextMenuComponent, CriteriaFilterTileComponent, DashboardByIdComponent, DashboardComponent, DashboardService, DashboardWidgetComponent, DateRangeFilterTileComponent, DrilldownBreadcrumbsComponent, DrilldownWidgetComponent, FunnelChartComponent, HierarchyService, IndicatorChartComponent, LineChartComponent, MemberFilterTileComponent, PieChartComponent, PivotTableComponent, PluginsService, PolarChartComponent, QueryService, RelativeDateFilterTileComponent, SISENSE_CONTEXT_CONFIG_TOKEN, ScatterChartComponent, ScattermapChartComponent, SdkUiModule, SisenseContextService, SunburstChartComponent, THEME_CONFIG_TOKEN, TableComponent, TableWidgetComponent, ThemeService, TrackableService, TreemapChartComponent, WidgetByIdComponent, WidgetService, createPluginsContextConnector, createSisenseContextConnector, createThemeContextConnector };
5308
+ export { AreaChartComponent, AreaRangeChartComponent, AreamapChartComponent, BarChartComponent, BoxplotChartComponent, ChartComponent, ChartWidgetComponent, ColumnChartComponent, ContextMenuComponent, CriteriaFilterTileComponent, DashboardByIdComponent, DashboardComponent, DashboardService, DashboardWidgetComponent, DateRangeFilterTileComponent, DrilldownBreadcrumbsComponent, DrilldownWidgetComponent, FunnelChartComponent, HierarchyService, IndicatorChartComponent, LineChartComponent, MemberFilterTileComponent, PieChartComponent, PivotTableComponent, PivotTableWidgetComponent, PluginsService, PolarChartComponent, QueryService, RelativeDateFilterTileComponent, SISENSE_CONTEXT_CONFIG_TOKEN, ScatterChartComponent, ScattermapChartComponent, SdkUiModule, SisenseContextService, SunburstChartComponent, THEME_CONFIG_TOKEN, TableComponent, TableWidgetComponent, ThemeService, TrackableService, TreemapChartComponent, WidgetByIdComponent, WidgetService, createPluginsContextConnector, createSisenseContextConnector, createThemeContextConnector, dashboardHelpers, dashboardModelTranslator, widgetModelTranslator };
4659
5309
  //# sourceMappingURL=sisense-sdk-ui-angular.mjs.map