@sisense/sdk-ui-angular 2.18.0 → 2.19.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.
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Optional, Inject, createComponent, NgModule, EventEmitter, Component, ViewChild, Input, Output } from '@angular/core';
3
- import { DataObserver, CustomThemeProvider, CustomSisenseContextProvider, CustomWidgetsProviderAdapter, createClientApplication, TabberButtonsWidget, createWrapperElement, getDashboardModel, getDashboardModels, HookAdapter, useComposedDashboardInternal, createHookApiFacade, useGetFilterMembers, getHierarchyModels, executeQuery, executeQueryByWidgetId, executePivotQuery, useExecuteCsvQueryInternal, useExecuteCustomWidgetQueryInternal, getWidgetModel, useJtdWidget, getDefaultThemeSettings, getThemeSettingsByOid, ComponentAdapter, Chart, PivotTable, Table, ContextMenu, Dashboard, DashboardById, DrilldownBreadcrumbs, CriteriaFilterTile, DateRangeFilterTile, FilterTile, FiltersPanel, MemberFilterTile, RelativeDateFilterTile, ChartWidget, DrilldownWidget, createWrapperElementHandler, createComponentRenderer, PivotTableWidget, TableWidget, Widget, WidgetById, dashboardModelTranslator as dashboardModelTranslator$1, dashboardHelpers as dashboardHelpers$1, widgetModelTranslator as widgetModelTranslator$1 } from '@sisense/sdk-ui-preact';
2
+ import { InjectionToken, Injectable, Optional, Inject, NgModule, EventEmitter, Component, ViewChild, Input, Output, createComponent } from '@angular/core';
3
+ import { DataObserver, CustomThemeProvider, CustomSisenseContextProvider, CustomWidgetsProviderAdapter, createClientApplication, getDefaultThemeSettings, getThemeSettingsByOid, ComponentAdapter, Chart, TabberButtonsWidget, createWrapperElement, getDashboardModel, getDashboardModels, HookAdapter, useComposedDashboardInternal, createHookApiFacade, useGetFilterMembers, getHierarchyModels, executeQuery, executeQueryByWidgetId, executePivotQuery, useExecuteCsvQueryInternal, useExecuteCustomWidgetQueryInternal, getWidgetModel, useJtdWidget, PivotTable, Table, ContextMenu, Dashboard, DashboardById, DrilldownBreadcrumbs, CriteriaFilterTile, DateRangeFilterTile, FilterTile, FiltersPanel, MemberFilterTile, RelativeDateFilterTile, ChartWidget, DrilldownWidget, createWrapperElementHandler, createComponentRenderer, PivotTableWidget, TableWidget, Widget, WidgetById, dashboardModelTranslator as dashboardModelTranslator$1, dashboardHelpers as dashboardHelpers$1, widgetModelTranslator as widgetModelTranslator$1 } from '@sisense/sdk-ui-preact';
4
4
  export { boxWhiskerProcessResult, extractDimensionsAndMeasures } from '@sisense/sdk-ui-preact';
5
- import { __awaiter, __rest, __decorate } from 'tslib';
5
+ import { __awaiter, __decorate, __rest } from 'tslib';
6
6
  import { ReplaySubject, firstValueFrom, concat, of, BehaviorSubject, skip } from 'rxjs';
7
7
  import merge from 'ts-deepmerge';
8
8
  import { trackProductEvent } from '@sisense/sdk-tracking';
@@ -287,1030 +287,855 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
287
287
  }] }];
288
288
  } });
289
289
 
290
- var packageVersion = '2.18.0';
290
+ var packageVersion = '2.19.0';
291
291
 
292
- /**
293
- * Service for rendering components dynamically.
294
- *
295
- * @internal
296
- */
297
- class DynamicRenderer {
298
- constructor(appRef, injector, envInjector) {
299
- this.appRef = appRef;
300
- this.injector = injector;
301
- this.envInjector = envInjector;
302
- }
303
- renderComponent(component, props) {
304
- const componentRef = createComponent(component, {
305
- environmentInjector: this.envInjector,
306
- elementInjector: this.injector,
307
- });
308
- // Apply props to the component instance
309
- Object.assign(componentRef.instance, props);
310
- // Attach the component to the application
311
- this.appRef.attachView(componentRef.hostView);
312
- // Get the DOM element
313
- const domElem = componentRef.hostView.rootNodes[0];
314
- // Create destroy function
315
- const destroy = () => {
316
- // Detach from application
317
- this.appRef.detachView(componentRef.hostView);
318
- // Destroy the component
319
- componentRef.destroy();
320
- };
321
- return {
322
- element: domElem,
323
- componentRef,
324
- destroy,
325
- };
326
- }
327
- }
328
- DynamicRenderer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicRenderer, deps: [{ token: i0.ApplicationRef }, { token: i0.Injector }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
329
- DynamicRenderer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicRenderer, providedIn: 'root' });
330
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicRenderer, decorators: [{
331
- type: Injectable,
332
- args: [{ providedIn: 'root' }]
333
- }], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i0.Injector }, { type: i0.EnvironmentInjector }]; } });
334
-
335
- /**
336
- * Service for working with custom widgets.
337
- *
338
- * @group Dashboards
339
- */
340
- class CustomWidgetsService {
341
- constructor(
342
- /** @internal */
343
- dynamicRenderer) {
344
- this.dynamicRenderer = dynamicRenderer;
345
- this.customWidgetsMap$ = new BehaviorSubject(new Map([['tabber-buttons', TabberButtonsWidget]]));
346
- }
347
- /**
348
- * Registers a new custom widget.
349
- *
350
- * @param customWidgetType - The unique identifier for the custom widget type.
351
- * @param customWidget - The custom widget component class to register.
352
- */
353
- registerCustomWidget(customWidgetType, customWidget) {
354
- const customWidgetPreactComponent = (props) => {
355
- const renderedComponent = this.dynamicRenderer.renderComponent(customWidget, props);
356
- return createWrapperElement(renderedComponent.element, () => renderedComponent.destroy());
357
- };
358
- const customWidgetsMap = this.customWidgetsMap$.value;
359
- if (!customWidgetsMap.has(customWidgetType)) {
360
- customWidgetsMap.set(customWidgetType, customWidgetPreactComponent);
361
- this.customWidgetsMap$.next(customWidgetsMap);
362
- }
363
- }
364
- /**
365
- * Checks if a custom widget is registered.
366
- *
367
- * @param customWidgetType - The type of the custom widget.
368
- * @returns True if the custom widget is registered, false otherwise.
369
- */
370
- hasCustomWidget(customWidgetType) {
371
- return this.customWidgetsMap$.value.has(customWidgetType);
292
+ class DecoratorsModule {
293
+ constructor(sisenseContextService) {
294
+ DecoratorsModule.sisenseContextService = sisenseContextService;
372
295
  }
373
296
  }
374
- CustomWidgetsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomWidgetsService, deps: [{ token: DynamicRenderer }], target: i0.ɵɵFactoryTarget.Injectable });
375
- CustomWidgetsServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomWidgetsService, providedIn: 'root' });
376
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomWidgetsService, decorators: [{
377
- type: Injectable,
297
+ DecoratorsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DecoratorsModule, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.NgModule });
298
+ DecoratorsModulemod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: DecoratorsModule });
299
+ DecoratorsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DecoratorsModule });
300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DecoratorsModule, decorators: [{
301
+ type: NgModule,
378
302
  args: [{
379
- providedIn: 'root',
303
+ declarations: [],
304
+ exports: [],
380
305
  }]
381
- }], ctorParameters: function () { return [{ type: DynamicRenderer }]; } });
306
+ }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
382
307
 
383
- function translateToPreactWidgetProps(widgetProps) {
384
- const { beforeRender, dataReady, beforeMenuOpen, dataPointClick, dataPointContextMenu, dataPointsSelect } = widgetProps, commonWidgetProps = __rest(widgetProps, ["beforeRender", "dataReady", "beforeMenuOpen", "dataPointClick", "dataPointContextMenu", "dataPointsSelect"]);
385
- return Object.assign(Object.assign({}, commonWidgetProps), { onBeforeRender: beforeRender, onDataReady: dataReady, onBeforeMenuOpen: beforeMenuOpen, onDataPointClick: dataPointClick
386
- ? (...[point, nativeEvent]) => dataPointClick({
387
- point,
388
- nativeEvent,
389
- })
390
- : undefined, onDataPointContextMenu: dataPointContextMenu
391
- ? (...[point, nativeEvent]) => dataPointContextMenu({
392
- point,
393
- nativeEvent,
394
- })
395
- : undefined, onDataPointsSelected: dataPointsSelect
396
- ? (...[points, nativeEvent]) => dataPointsSelect({ points, nativeEvent })
397
- : undefined });
398
- }
399
- function translateFromPreactWidgetProps(widgetProps) {
400
- const { onBeforeRender, onDataReady, onBeforeMenuOpen, onDataPointClick, onDataPointContextMenu, onDataPointsSelected } = widgetProps, commonWidgetProps = __rest(widgetProps, ["onBeforeRender", "onDataReady", "onBeforeMenuOpen", "onDataPointClick", "onDataPointContextMenu", "onDataPointsSelected"]);
401
- return Object.assign(Object.assign({}, commonWidgetProps), { beforeRender: onBeforeRender, dataReady: onDataReady, beforeMenuOpen: onBeforeMenuOpen, dataPointClick: onDataPointClick
402
- ? ({ point, nativeEvent }) => onDataPointClick(point, nativeEvent)
403
- : undefined, dataPointContextMenu: onDataPointContextMenu
404
- ? ({ point, nativeEvent }) => onDataPointContextMenu(point, nativeEvent)
405
- : undefined, dataPointsSelect: onDataPointsSelected
406
- ? ({ points, nativeEvent }) => onDataPointsSelected(points, nativeEvent)
407
- : undefined });
308
+ function Trackable(target, propertyKey, descriptor) {
309
+ const originalMethod = descriptor.value;
310
+ descriptor.value = function (...args) {
311
+ track('sdkAngularServiceMethodExecuted', propertyKey);
312
+ return originalMethod.apply(this, args);
313
+ };
314
+ return descriptor;
408
315
  }
409
-
410
- function translateToPreactDashboardProps(dashboardProps) {
411
- return Object.assign(Object.assign({}, dashboardProps), { widgets: dashboardProps.widgets.map(translateToPreactWidgetProps) });
316
+ /** @internal */
317
+ function TrackableService(trackableMethods) {
318
+ return function (ServiceClass) {
319
+ trackableMethods.forEach((methodName) => {
320
+ // eslint-disable-next-line security/detect-object-injection
321
+ const original = ServiceClass.prototype[methodName];
322
+ // eslint-disable-next-line security/detect-object-injection
323
+ ServiceClass.prototype[methodName] = function (...params) {
324
+ track('sdkAngularServiceMethodExecuted', `${ServiceClass.name}.${methodName}`);
325
+ return original.apply(this, params);
326
+ };
327
+ });
328
+ };
412
329
  }
413
- function translateFromPreactDashboardProps(dashboardProps) {
414
- return Object.assign(Object.assign({}, dashboardProps), { widgets: dashboardProps.widgets.map(translateFromPreactWidgetProps) });
330
+ function track(action, methodName) {
331
+ var _a, _b, _c;
332
+ return __awaiter(this, void 0, void 0, function* () {
333
+ try {
334
+ const app = yield DecoratorsModule.sisenseContextService.getApp();
335
+ const trackingEnabled = (_c = (_b = (_a = app.settings) === null || _a === void 0 ? void 0 : _a.trackingConfig) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : true;
336
+ if (app === null || app === void 0 ? void 0 : app.httpClient) {
337
+ const payload = {
338
+ packageName: 'sdk-ui-angular',
339
+ packageVersion,
340
+ methodName,
341
+ };
342
+ void trackProductEvent(action, payload, app.httpClient, !trackingEnabled);
343
+ }
344
+ }
345
+ catch (e) {
346
+ console.warn('tracking error', e);
347
+ }
348
+ });
415
349
  }
416
350
 
417
351
  /**
418
- * Service for working with Sisense Fusion dashboards.
352
+ * Token used to inject {@link ThemeConfig} into your application
419
353
  *
420
- * **Note:** Dashboard and Widget extensions based on JS scripts and add-ons in Fusion – for example, Blox and Jump To Dashboard – are not supported.
354
+ * @example
421
355
  *
422
- * @group Fusion Assets
423
- * @fusionEmbed
356
+ * Example of injecting both {@link SisenseContextConfig} and {@link ThemeConfig} into your application:
357
+ *
358
+ * ```ts
359
+ * export const SISENSE_CONTEXT_CONFIG: SisenseContextConfig = {
360
+ * url: "<instance url>", // replace with the URL of your Sisense instance
361
+ * token: "<api token>", // replace with the API token of your user account
362
+ * defaultDataSource: DM.DataSource,
363
+ * };
364
+ *
365
+ * @NgModule({
366
+ * imports: [
367
+ * BrowserModule,
368
+ * SdkUiModule,
369
+ * ],
370
+ * declarations: [AppComponent],
371
+ * providers: [
372
+ * { provide: SISENSE_CONTEXT_CONFIG_TOKEN, useValue: SISENSE_CONTEXT_CONFIG },
373
+ * {
374
+ * provide: THEME_CONFIG_TOKEN,
375
+ * useValue: {
376
+ * // initial theme settings
377
+ * } as ThemeConfig,
378
+ * },
379
+ * ],
380
+ * bootstrap: [AppComponent],
381
+ * })
382
+ * ```
383
+ * @group Contexts
424
384
  */
425
- let DashboardService = class DashboardService {
426
- constructor(sisenseContextService) {
385
+ const THEME_CONFIG_TOKEN = new InjectionToken('theme configuration');
386
+ /**
387
+ * Service for working with Sisense Fusion themes.
388
+ *
389
+ * If no theme service is used, the current Fusion theme is applied by default.
390
+ *
391
+ * @group Contexts
392
+ */
393
+ let ThemeService = class ThemeService {
394
+ constructor(sisenseContextService, themeConfig) {
427
395
  this.sisenseContextService = sisenseContextService;
428
- }
429
- /**
430
- * Retrieves an existing dashboard model from the Sisense instance.
431
- *
432
- * @param dashboardOid - Identifier of the dashboard
433
- * @param options - Advanced configuration options
434
- * @returns Dashboard model
435
- */
436
- getDashboardModel(dashboardOid, options) {
437
- return __awaiter(this, void 0, void 0, function* () {
438
- const app = yield this.sisenseContextService.getApp();
439
- return getDashboardModel(app.httpClient, dashboardOid, options);
396
+ this.initializationPromise = Promise.resolve();
397
+ this.themeSettings$ = new BehaviorSubject(getDefaultThemeSettings());
398
+ this.initializationPromise = this.initThemeSettings(themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.theme);
399
+ this.sisenseContextService
400
+ .getApp$()
401
+ // Skip current app value
402
+ .pipe(skip(1))
403
+ // Subscribe to new app values
404
+ .subscribe({
405
+ next: ({ app }) => {
406
+ if (app) {
407
+ this.initializationPromise = this.applyThemeSettings(app.settings.serverThemeSettings);
408
+ }
409
+ },
440
410
  });
441
411
  }
442
- /**
443
- * Retrieves existing dashboard models from the Sisense instance.
444
- *
445
- * @param options - Advanced configuration options
446
- * @returns Dashboard models array
447
- */
448
- getDashboardModels(options) {
412
+ initThemeSettings(theme) {
449
413
  return __awaiter(this, void 0, void 0, function* () {
450
414
  const app = yield this.sisenseContextService.getApp();
451
- return getDashboardModels(app.httpClient, options);
415
+ // apply system theme settings first
416
+ yield this.applyThemeSettings(app.settings.serverThemeSettings);
417
+ if (theme) {
418
+ // Manually tracks theme update during initialization as execution of updateThemeSettings for consistency.
419
+ track('sdkAngularServiceMethodExecuted', 'ThemeService.updateThemeSettings');
420
+ yield this.applyThemeSettings(theme);
421
+ }
452
422
  });
453
423
  }
454
- /**
455
- * Сomposes dashboard or separate dashboard elements into a coordinated dashboard
456
- * with cross filtering, and change detection.
457
- *
458
- * @example
459
- * An example of using the `createComposedDashboard` to construct a composed dashboard and render it:
460
- * ```html
461
- <!--Component HTML template in example.component.html-->
462
- <div *ngIf="dashboard$ | async as dashboard">
463
- <csdk-filter-tile
464
- *ngFor="let filter of getDashboardFilters(dashboard); trackBy: trackByIndex"
465
- [filter]="filter"
466
- />
467
- <csdk-widget
468
- *ngFor="let widget of dashboard.widgets; trackBy: trackByIndex"
469
- [id]="widget.id"
470
- [widgetType]="widget.widgetType"
471
- [chartType]="widget.chartType"
472
- [customWidgetType]="widget.customWidgetType"
473
- [dataSource]="widget.dataSource"
474
- [dataOptions]="widget.dataOptions"
475
- [filters]="widget.filters"
476
- [highlights]="widget.highlights"
477
- [styleOptions]="widget.styleOptions"
478
- [drilldownOptions]="widget.drilldownOptions"
479
- [title]="widget.title"
480
- [description]="widget.description"
481
- [beforeMenuOpen]="widget.beforeMenuOpen"
482
- (dataPointClick)="widget.dataPointClick?.($event)"
483
- (dataPointContextMenu)="widget.dataPointContextMenu?.($event)"
484
- (dataPointsSelect)="widget.dataPointsSelect?.($event)"
485
- />
486
- </div>
487
- * ```
488
- *
489
- * ```ts
490
- // Component behavior in example.component.ts
491
- import { Component, OnDestroy } from '@angular/core';
492
- import { BehaviorSubject } from 'rxjs';
493
- import { DashboardService, type DashboardProps } from '@sisense/sdk-ui-angular';
494
-
495
- @Component({
496
- selector: 'example',
497
- templateUrl: './example.component.html',
498
- styleUrls: ['./example.component.scss'],
499
- })
500
- export class ExampleComponent implements OnDestroy {
501
- dashboard$: BehaviorSubject<DashboardProps> | undefined;
502
- private composedDashboard: ReturnType<DashboardService['createComposedDashboard']> | undefined;
503
-
504
- constructor(private dashboardService: DashboardService) {}
505
-
506
- ngOnInit() {
507
- const initialDashboard: DashboardProps = { ... };
508
- this.composedDashboard = this.dashboardService.createComposedDashboard(initialDashboard);
509
- this.dashboard$ = this.composedDashboard.dashboard$;
510
- }
511
-
512
- ngOnDestroy() {
513
- this.composedDashboard?.destroy();
514
- }
515
-
516
- trackByIndex = (index: number) => index;
517
-
518
- getDashboardFilters = ({ filters }: DashboardProps) => Array.isArray(filters) ? filters : [];
519
- }
520
- * ```
521
- * @param initialDashboard - Initial dashboard
522
- * @param options - Configuration options
523
- * @returns Reactive composed dashboard object and API methods for interacting with it.
524
- * The returned object includes a `destroy()` method that should be called when
525
- * the dashboard is no longer needed to prevent memory leaks (e.g., in `ngOnDestroy`).
526
- */
527
- createComposedDashboard(initialDashboard, options = {}) {
528
- const hookAdapter = new HookAdapter((useComposedDashboardInternal), [createSisenseContextConnector(this.sisenseContextService)]);
529
- const dashboard$ = new BehaviorSubject(initialDashboard);
530
- hookAdapter.subscribe(({ dashboard }) => {
531
- dashboard$.next(translateFromPreactDashboardProps(dashboard));
424
+ applyThemeSettings(theme) {
425
+ return __awaiter(this, void 0, void 0, function* () {
426
+ try {
427
+ const app = yield this.sisenseContextService.getApp();
428
+ const isThemeOid = typeof theme === 'string';
429
+ let userThemeSettings = theme;
430
+ if (isThemeOid) {
431
+ userThemeSettings = yield getThemeSettingsByOid(theme, app.httpClient);
432
+ }
433
+ const mergedThemeSettings = merge.withOptions({ mergeArrays: false }, this.themeSettings$.value, userThemeSettings);
434
+ this.themeSettings$.next(mergedThemeSettings);
435
+ }
436
+ catch (error) {
437
+ this.themeSettings$.error(error);
438
+ }
532
439
  });
533
- hookAdapter.run(translateToPreactDashboardProps(initialDashboard), options);
534
- const setFilters = createHookApiFacade(hookAdapter, 'setFilters', true);
535
- const setWidgetsLayout = createHookApiFacade(hookAdapter, 'setWidgetsLayout', true);
536
- const destroy = () => {
537
- hookAdapter.destroy();
538
- dashboard$.complete();
539
- };
540
- return {
541
- dashboard$,
542
- setFilters,
543
- setWidgetsLayout,
544
- destroy,
545
- };
546
440
  }
547
- };
548
- DashboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardService, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.Injectable });
549
- DashboardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardService, providedIn: 'root' });
550
- DashboardService = __decorate([
551
- TrackableService(['getDashboardModel', 'getDashboardModels'])
552
- ], DashboardService);
553
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardService, decorators: [{
554
- type: Injectable,
555
- args: [{
556
- providedIn: 'root',
557
- }]
558
- }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
559
-
560
- /**
561
- * Service for working with filter.
562
- *
563
- * @group Filters
564
- */
565
- let FilterService = class FilterService {
566
- constructor(sisenseContextService) {
567
- this.sisenseContextService = sisenseContextService;
441
+ /** @internal */
442
+ getThemeSettings() {
443
+ return this.themeSettings$.asObservable();
568
444
  }
569
- /**
570
- * Retrieves members of the provided filter.
571
- *
572
- * Those members can be used to display a list of members in a third-party filter component such as Material UI Select.
573
- *
574
- * ## Example
575
- *
576
- * Retrieve selected members from a Filter on Country of the Sample ECommerce data model.
577
- *
578
- * ```ts
579
- * try {
580
- * const data = await filterService.getFilterMembers({
581
- * filter: filterFactory.members(DM.Country.Country, ['United States', 'Canada'])
582
- * });
583
- *
584
- * const { selectedMembers, allMembers, excludeMembers, enableMultiSelection } = data;
585
- * console.log('selectedMembers', selectedMembers);
586
- * } catch (error) {
587
- * console.error('Error:', error);
588
- * }
589
- * ```
590
- *
591
- * @param params - Parameters for retrieving filter members
592
- * @returns Promise that resolves to the filter members data
593
- */
594
- getFilterMembers(params) {
445
+ updateThemeSettings(theme) {
595
446
  return __awaiter(this, void 0, void 0, function* () {
596
- const hookAdapter = new HookAdapter(useGetFilterMembers, [
597
- createSisenseContextConnector(this.sisenseContextService),
598
- ]);
599
- const resultPromise = new Promise((resolve, reject) => {
600
- hookAdapter.subscribe((res) => {
601
- const { isError, isSuccess, error } = res;
602
- if (isError) {
603
- reject(error);
604
- }
605
- else if (isSuccess) {
606
- resolve(res.data);
607
- }
608
- });
609
- });
610
- hookAdapter.run(params);
611
- return resultPromise.finally(() => {
612
- hookAdapter.destroy();
613
- });
447
+ yield this.initializationPromise;
448
+ yield this.applyThemeSettings(theme);
614
449
  });
615
450
  }
616
451
  };
617
- FilterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FilterService, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.Injectable });
618
- FilterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FilterService, providedIn: 'root' });
619
- FilterService = __decorate([
620
- TrackableService(['getFilterMembers'])
621
- ], FilterService);
622
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FilterService, decorators: [{
452
+ ThemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThemeService, deps: [{ token: SisenseContextService }, { token: THEME_CONFIG_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
453
+ ThemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThemeService, providedIn: 'root' });
454
+ ThemeService = __decorate([
455
+ TrackableService(['updateThemeSettings'])
456
+ ], ThemeService);
457
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThemeService, decorators: [{
623
458
  type: Injectable,
624
459
  args: [{
625
460
  providedIn: 'root',
626
461
  }]
627
- }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
462
+ }], ctorParameters: function () {
463
+ return [{ type: SisenseContextService }, { type: undefined, decorators: [{
464
+ type: Optional
465
+ }, {
466
+ type: Inject,
467
+ args: [THEME_CONFIG_TOKEN]
468
+ }] }];
469
+ } });
628
470
 
629
471
  /**
630
- * Service for working with Sisense Fusion hierarchies.
472
+ * An Angular component used for easily switching chart types or rendering multiple series of different chart types.
631
473
  *
632
- * @group Fusion Assets
633
- * @fusionEmbed
474
+ * @example
475
+ * An example of using the `Chart` component to
476
+ * plot a column chart of the Sample Healthcare data source hosted in a Sisense instance:
477
+ *
478
+ * ```html
479
+ * <!--Component HTML template in .component.html-->
480
+ * <csdk-chart
481
+ * [chartType]="chart.chartType"
482
+ * [dataSet]="chart.dataSet"
483
+ * [dataOptions]="chart.dataOptions"
484
+ * [filters]="chart.filters"
485
+ * [styleOptions]="chart.styleOptions"
486
+ * />
487
+ * ```
488
+ *
489
+ * ```ts
490
+ * // Component behavior in .component.ts
491
+ * chart = {
492
+ * chartType: 'column' as ChartType,
493
+ * dataSet: DM.DataSource,
494
+ * dataOptions: {
495
+ * category: [DM.Admissions.Admission_Time.Months],
496
+ * value: [measureFactory.count(DM.Admissions.Patient_ID, 'Total Patients')],
497
+ * breakBy: [],
498
+ * },
499
+ * filters: [filterFactory.members(DM.Doctors.Specialty, ['Oncology', 'Cardiology'])],
500
+ * styleOptions: {
501
+ * width: 800,
502
+ * height: 500,
503
+ * xAxis: {
504
+ * title: {
505
+ * text: 'Months',
506
+ * enabled: true,
507
+ * },
508
+ * },
509
+ * yAxis: {
510
+ * title: {
511
+ * text: 'Total Patients',
512
+ * enabled: true,
513
+ * },
514
+ * },
515
+ * },
516
+ * };
517
+ * ```
518
+ *
519
+ * <img src="media://angular-chart-example.png" width="800px" />
520
+ * @shortDescription Common component for rendering charts of different types including table
521
+ * @group Charts
634
522
  */
635
- let HierarchyService = class HierarchyService {
636
- constructor(sisenseContextService) {
637
- this.sisenseContextService = sisenseContextService;
638
- }
523
+ class ChartComponent {
639
524
  /**
640
- * Retrieves existing hierarchy models from the Sisense instance.
525
+ * Constructor for the `Chart` component.
641
526
  *
642
- * @param params - Parameters to identify the target hierarchy models
643
- * @returns Hierarchy models array
527
+ * @param sisenseContextService - Sisense context service
528
+ * @param themeService - Theme service
644
529
  */
645
- getHierarchyModels(params) {
646
- return __awaiter(this, void 0, void 0, function* () {
647
- const app = yield this.sisenseContextService.getApp();
648
- return getHierarchyModels(app.httpClient, params, app.defaultDataSource);
649
- });
650
- }
651
- };
652
- HierarchyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyService, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.Injectable });
653
- HierarchyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyService, providedIn: 'root' });
654
- HierarchyService = __decorate([
655
- TrackableService(['getHierarchyModels'])
656
- ], HierarchyService);
657
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyService, decorators: [{
658
- type: Injectable,
659
- args: [{
660
- providedIn: 'root',
661
- }]
662
- }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
663
-
664
- /**
665
- * Service for executing data queries.
666
- *
667
- * @group Queries
668
- */
669
- let QueryService = class QueryService {
670
- constructor(sisenseContextService) {
671
- this.sisenseContextService = sisenseContextService;
672
- }
530
+ constructor(
673
531
  /**
674
- * Executes a data query. If you want to display the query results, you can use
675
- * them to populate Compose SDK UI elements or third party UI elements.
676
- *
677
- * To learn how to populate third party UI elements with query results, see the
678
- * [External Charts Guide](/guides/sdk/guides/charts/guide-external-charts.html#query)
532
+ * Sisense context service
679
533
  *
680
- * @param params - Query parameters
681
- * @return Query result
534
+ * @category Constructor
682
535
  */
683
- executeQuery(params) {
684
- return __awaiter(this, void 0, void 0, function* () {
685
- const { dataSource, dimensions, measures, filters, highlights, count, offset, ungroup, beforeQuery, } = params;
686
- const app = yield this.sisenseContextService.getApp();
687
- const { filters: filterList, relations: filterRelations } = getFilterListAndRelationsJaql(filters);
688
- const data = yield executeQuery({
689
- dataSource,
690
- dimensions,
691
- measures,
692
- filters: filterList,
693
- filterRelations,
694
- highlights,
695
- count,
696
- offset,
697
- ungroup,
698
- }, app, { onBeforeQuery: beforeQuery });
699
- return { data };
700
- });
701
- }
536
+ sisenseContextService,
702
537
  /**
703
- * Executes a data query extracted from an existing widget in the Sisense instance.
538
+ * Theme service
704
539
  *
705
- * @param params - Parameters to identify the target widget
706
- * @returns Query result
540
+ * @category Constructor
707
541
  */
708
- executeQueryByWidgetId(params) {
709
- return __awaiter(this, void 0, void 0, function* () {
710
- const app = yield this.sisenseContextService.getApp();
711
- return executeQueryByWidgetId(Object.assign(Object.assign({}, params), { app, onBeforeQuery: params.beforeQuery }));
712
- });
542
+ themeService) {
543
+ this.sisenseContextService = sisenseContextService;
544
+ this.themeService = themeService;
545
+ /**
546
+ * {@inheritDoc @sisense/sdk-ui!ChartProps.onDataPointClick}
547
+ *
548
+ * @category Callbacks
549
+ */
550
+ this.dataPointClick = new EventEmitter();
551
+ /**
552
+ * {@inheritDoc @sisense/sdk-ui!ChartProps.onDataPointContextMenu}
553
+ *
554
+ * @category Callbacks
555
+ */
556
+ this.dataPointContextMenu = new EventEmitter();
557
+ /**
558
+ * {@inheritDoc @sisense/sdk-ui!ChartProps.onDataPointsSelected}
559
+ *
560
+ * @category Callbacks
561
+ */
562
+ this.dataPointsSelect = new EventEmitter();
563
+ this.componentAdapter = new ComponentAdapter(Chart, [
564
+ createSisenseContextConnector(this.sisenseContextService),
565
+ createThemeContextConnector(this.themeService),
566
+ ]);
713
567
  }
714
568
  /**
715
- * Executes a data query for a pivot table.
716
- *
717
- * @param params - Pivot query parameters
718
- * @return Pivot query result
569
+ * @internal
719
570
  */
720
- executePivotQuery(params) {
721
- return __awaiter(this, void 0, void 0, function* () {
722
- const { dataSource, rows, columns, values, grandTotals, filters, highlights, count, offset, beforeQuery, } = params;
723
- const { filters: filterList, relations: filterRelations } = getFilterListAndRelationsJaql(filters);
724
- const app = yield this.sisenseContextService.getApp();
725
- const data = yield executePivotQuery({
726
- dataSource,
727
- rows,
728
- columns,
729
- values,
730
- grandTotals,
731
- filters: filterList,
732
- filterRelations,
733
- highlights,
734
- count,
735
- offset,
736
- }, app, { onBeforeQuery: beforeQuery });
737
- return { data };
738
- });
571
+ ngAfterViewInit() {
572
+ this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());
739
573
  }
740
574
  /**
741
- * Executes a CSV data query.
742
- * Similar to {@link QueryService.executeQuery}, but returns the data in CSV format as text or as a stream.
743
- *
744
- * @param params - CSV query parameters
745
- * @return CSV query result
575
+ * @internal
746
576
  */
747
- executeCsvQuery(params) {
748
- return __awaiter(this, void 0, void 0, function* () {
749
- const hookAdapter = new HookAdapter(useExecuteCsvQueryInternal, [
750
- createSisenseContextConnector(this.sisenseContextService),
751
- ]);
752
- const resultPromise = new Promise((resolve, reject) => {
753
- hookAdapter.subscribe((res) => {
754
- const { data, isSuccess, isError, error } = res;
755
- if (isSuccess) {
756
- resolve({ data });
757
- }
758
- else if (isError) {
759
- reject(error);
760
- }
761
- });
762
- });
763
- hookAdapter.run(params);
764
- return resultPromise.finally(() => {
765
- hookAdapter.destroy();
766
- });
767
- });
577
+ ngOnChanges() {
578
+ if (this.preactRef) {
579
+ this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());
580
+ }
581
+ }
582
+ getPreactComponentProps() {
583
+ var _a, _b;
584
+ return {
585
+ chartType: this.chartType,
586
+ dataSet: this.dataSet,
587
+ dataOptions: this.dataOptions,
588
+ filters: this.filters,
589
+ highlights: this.highlights,
590
+ styleOptions: this.styleOptions,
591
+ onBeforeRender: (_a = this.beforeRender) === null || _a === void 0 ? void 0 : _a.bind(this),
592
+ onDataReady: (_b = this.dataReady) === null || _b === void 0 ? void 0 : _b.bind(this),
593
+ onDataPointClick: (...[point, nativeEvent]) => this.dataPointClick.emit({ point, nativeEvent }),
594
+ onDataPointContextMenu: (...[point, nativeEvent]) => this.dataPointContextMenu.emit({ point, nativeEvent }),
595
+ onDataPointsSelected: (...[points, nativeEvent]) => this.dataPointsSelect.emit({ points, nativeEvent }),
596
+ };
768
597
  }
769
598
  /**
770
- * Executes a data query from custom widget component props.
771
- *
772
- * This method takes custom widget props (dataSource, dataOptions, filters, etc.)
773
- * and executes the appropriate data query
774
- *
775
- * @param params - Custom widget component props containing data source, data options, filters, etc.
776
- * @returns Promise resolving to query result with formatted data
599
+ * @internal
777
600
  */
778
- executeCustomWidgetQuery(params) {
779
- return __awaiter(this, void 0, void 0, function* () {
780
- const hookAdapter = new HookAdapter(useExecuteCustomWidgetQueryInternal, [
781
- createSisenseContextConnector(this.sisenseContextService),
782
- ]);
783
- const resultPromise = new Promise((resolve, reject) => {
784
- hookAdapter.subscribe((res) => {
785
- const { data, isSuccess, isError, error } = res;
786
- if (isSuccess) {
787
- resolve({ data });
788
- }
789
- else if (isError) {
790
- reject(error);
791
- }
792
- });
793
- });
794
- hookAdapter.run(params);
795
- return resultPromise.finally(() => {
796
- hookAdapter.destroy();
797
- });
798
- });
601
+ ngOnDestroy() {
602
+ this.componentAdapter.destroy();
799
603
  }
800
- };
801
- QueryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: QueryService, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.Injectable });
802
- QueryServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: QueryService, providedIn: 'root' });
803
- QueryService = __decorate([
804
- TrackableService([
805
- 'executeQuery',
806
- 'executeQueryByWidgetId',
807
- 'executePivotQuery',
808
- 'executeCustomWidgetQuery',
809
- ])
810
- ], QueryService);
811
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: QueryService, decorators: [{
812
- type: Injectable,
813
- args: [{
814
- providedIn: 'root',
815
- }]
816
- }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
604
+ }
605
+ ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChartComponent, deps: [{ token: SisenseContextService }, { token: ThemeService }], target: i0.ɵɵFactoryTarget.Component });
606
+ ChartComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ChartComponent, selector: "csdk-chart", inputs: { chartType: "chartType", dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, viewQueries: [{ propertyName: "preactRef", first: true, predicate: ["preact"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n <div #preact class=\"csdk-full-size-container\"></div>\n", isInline: true, styles: [".csdk-full-size-container{width:100%;height:100%}\n"] });
607
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChartComponent, decorators: [{
608
+ type: Component,
609
+ args: [{ selector: 'csdk-chart', template: template, styles: [".csdk-full-size-container{width:100%;height:100%}\n"] }]
610
+ }], ctorParameters: function () { return [{ type: SisenseContextService }, { type: ThemeService }]; }, propDecorators: { preactRef: [{
611
+ type: ViewChild,
612
+ args: [rootId]
613
+ }], chartType: [{
614
+ type: Input
615
+ }], dataSet: [{
616
+ type: Input
617
+ }], dataOptions: [{
618
+ type: Input
619
+ }], filters: [{
620
+ type: Input
621
+ }], highlights: [{
622
+ type: Input
623
+ }], styleOptions: [{
624
+ type: Input
625
+ }], beforeRender: [{
626
+ type: Input
627
+ }], dataReady: [{
628
+ type: Input
629
+ }], dataPointClick: [{
630
+ type: Output
631
+ }], dataPointContextMenu: [{
632
+ type: Output
633
+ }], dataPointsSelect: [{
634
+ type: Output
635
+ }] } });
817
636
 
818
637
  /**
819
- * Service for working with Sisense Fusion widgets.
638
+ * A component similar to a {@link LineChartComponent},
639
+ * but with filled in areas under each line and an option to display them as stacked.
820
640
  *
821
- * @group Fusion Assets
822
- * @fusionEmbed
823
- */
824
- let WidgetService = class WidgetService {
825
- constructor(sisenseContextService, themeService) {
826
- this.sisenseContextService = sisenseContextService;
827
- this.themeService = themeService;
828
- }
829
- /**
830
- * Retrieves an existing widget model from the Sisense instance.
831
- *
832
- * @param params - Parameters to identify the target widget
833
- * @returns Widget model
834
- */
835
- getWidgetModel(params) {
836
- return __awaiter(this, void 0, void 0, function* () {
837
- const { dashboardOid, widgetOid } = params;
838
- const app = yield this.sisenseContextService.getApp();
839
- return getWidgetModel(app.httpClient, dashboardOid, widgetOid);
840
- });
841
- }
842
- /**
843
- * Adds Jump To Dashboard (JTD) functionality to widget props.
844
- *
845
- * Jump To Dashboard (JTD) allows users to navigate from one dashboard to another when interacting with widgets,
846
- * such as clicking on chart data points or using context menus. This method is particularly useful when rendering
847
- * Widget components directly (not through a Dashboard component), but you still want JTD navigation functionality.
848
- *
849
- * For widgets that are part of a dashboard, consider using `applyJtdConfig` or `applyJtdConfigs` instead,
850
- * as they apply JTD configuration at the dashboard level rather than individual widget level.
851
- *
852
- * Note: dashboard-only 'includeDashboardFilters' is not supported and would just be ignored, since we do not have a dashboard in the current context.
853
- *
854
- * This method enhances the provided widget props with JTD navigation capabilities, including:
855
- * - Click and right-click event handlers for navigation
856
- * - Hyperlink styling for actionable pivot cells (when applicable)
857
- * - JTD icon display in widget headers
858
- * @example
859
- * ```TypeScript
860
- * import { Component, OnDestroy } from '@angular/core';
861
- * import {
862
- * WidgetService,
863
- * widgetModelTranslator,
864
- * type WidgetProps,
865
- * } from '@sisense/sdk-ui-angular';
866
- * import { BehaviorSubject } from 'rxjs';
867
- *
868
- * @Component({
869
- * selector: 'code-example',
870
- * template: `
871
- * <csdk-widget
872
- * *ngIf="widgetProps$ && (widgetProps$ | async) as widgetProps"
873
- * [id]="widgetProps.id"
874
- * [widgetType]="widgetProps.widgetType"
875
- * [chartType]="widgetProps.chartType"
876
- * [title]="widgetProps.title"
877
- * [dataSource]="widgetProps.dataSource"
878
- * [dataOptions]="widgetProps.dataOptions"
879
- * [filters]="widgetProps.filters"
880
- * [highlights]="widgetProps.highlights"
881
- * [styleOptions]="widgetProps.styleOptions"
882
- * [beforeMenuOpen]="widgetProps.beforeMenuOpen"
883
- * (dataPointClick)="widgetProps.dataPointClick?.($event)"
884
- * (dataPointContextMenu)="widgetProps.dataPointContextMenu?.($event)"
885
- * (dataPointsSelect)="widgetProps.dataPointsSelect?.($event)"
886
- * />
887
- * `,
888
- * })
889
- * export class CodeExample implements OnDestroy {
890
- * constructor(private widgetService: WidgetService) {}
891
- *
892
- * widgetProps$: BehaviorSubject<WidgetProps | null> | null = null;
893
- * private jtdDestroy: (() => void) | null = null;
894
- *
895
- * async ngOnInit(): Promise<void> {
896
- * const widget = await this.widgetService.getWidgetModel({
897
- * dashboardOid: '65a82171719e7f004018691c',
898
- * widgetOid: '65a82171719e7f004018691f',
899
- * });
900
- *
901
- * const baseProps = widget
902
- * ? widgetModelTranslator.toWidgetProps(widget)
903
- * : null;
904
- *
905
- * if (baseProps) {
906
- * const jtdConfig = {
907
- * targets: [{ id: 'target-dashboard-id', caption: 'Details' }],
908
- * interaction: { triggerMethod: 'rightclick' },
909
- * };
910
- * const jtdResult = this.widgetService.createJtdWidget(
911
- * baseProps,
912
- * jtdConfig,
913
- * );
914
- * this.widgetProps$ = jtdResult.widget$;
915
- * this.jtdDestroy = jtdResult.destroy;
916
- * }
917
- * }
918
- *
919
- * ngOnDestroy(): void {
920
- * this.jtdDestroy?.();
921
- * }
922
- * }
923
- * ```
924
- *
925
- * @param widgetProps - Base widget props to enhance with JTD functionality
926
- * @param jtdConfig - JTD configuration defining navigation targets and behavior
927
- * @returns Object containing:
928
- * - `widget$`: The observable that emits enhanced widget props with JTD handlers.
929
- * - `destroy`: Function to clean up resources. Call this when the component is destroyed.
930
- * @group Dashboards
931
- */
932
- createJtdWidget(widgetProps, jtdConfig) {
933
- // Create BehaviorSubject initialized with base props (or null)
934
- const enhancedProps$ = new BehaviorSubject(widgetProps);
935
- if (!widgetProps) {
936
- return {
937
- widget$: enhancedProps$,
938
- destroy: () => {
939
- enhancedProps$.complete();
940
- },
941
- };
942
- }
943
- // Create HookAdapter with useJtdWidget hook and context connectors
944
- const hookAdapter = new HookAdapter(useJtdWidget, [
945
- createSisenseContextConnector(this.sisenseContextService),
946
- createThemeContextConnector(this.themeService),
947
- ]);
948
- // Convert Angular props to preact props
949
- const preactProps = translateToPreactWidgetProps(widgetProps);
950
- // Subscribe to hook adapter results and capture the subscription
951
- const hookAdapterSubscription = hookAdapter.subscribe((enhancedPreactProps) => {
952
- if (enhancedPreactProps) {
953
- // Convert back to Angular props
954
- const angularProps = translateFromPreactWidgetProps(enhancedPreactProps);
955
- enhancedProps$.next(angularProps);
956
- }
957
- else {
958
- enhancedProps$.next(null);
959
- }
960
- });
961
- // Run the hook with widget props and JTD config
962
- // This will trigger the subscription above asynchronously when React contexts are ready
963
- hookAdapter.run(preactProps, jtdConfig);
964
- // Return the BehaviorSubject and destroy function for cleanup
965
- return {
966
- widget$: enhancedProps$,
967
- destroy: () => {
968
- // Unsubscribe from hook adapter
969
- hookAdapterSubscription.unsubscribe();
970
- // Destroy the hook adapter to clean up React components and contexts
971
- hookAdapter.destroy();
972
- // Complete the BehaviorSubject to release subscribers and avoid leaks
973
- enhancedProps$.complete();
974
- },
975
- };
976
- }
977
- };
978
- WidgetService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WidgetService, deps: [{ token: SisenseContextService }, { token: ThemeService }], target: i0.ɵɵFactoryTarget.Injectable });
979
- WidgetService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WidgetService, providedIn: 'root' });
980
- WidgetService = __decorate([
981
- TrackableService(['getWidgetModel', 'createJtdWidget'])
982
- ], WidgetService);
983
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WidgetService, decorators: [{
984
- type: Injectable,
985
- args: [{
986
- providedIn: 'root',
987
- }]
988
- }], ctorParameters: function () { return [{ type: SisenseContextService }, { type: ThemeService }]; } });
641
+ * @example
642
+ * ```html
643
+ * <csdk-area-chart
644
+ * [dataSet]="chart.dataSet"
645
+ * [dataOptions]="chart.dataOptions"
646
+ * [highlights]="filters"
647
+ * [beforeRender]="onBeforeRender"
648
+ * (dataPointClick)="logArguments($event)"
649
+ * (dataPointContextMenu)="logArguments($event)"
650
+ * (dataPointsSelect)="logArguments($event)"
651
+ * />
652
+ * ```
653
+ * ```ts
654
+ import { Component } from '@angular/core';
655
+ import { measureFactory, filterFactory, Filter } from '@sisense/sdk-data';
656
+ import * as DM from '../../assets/sample-healthcare-model';
657
+ import type { ChartType } from '@sisense/sdk-ui-angular';
989
658
 
990
- class DecoratorsModule {
991
- constructor(sisenseContextService) {
992
- DecoratorsModule.sisenseContextService = sisenseContextService;
659
+ @Component({
660
+ selector: 'app-analytics',
661
+ templateUrl: './analytics.component.html',
662
+ styleUrls: ['./analytics.component.scss'],
663
+ })
664
+ export class AnalyticsComponent {
665
+ DM = DM;
666
+ filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
667
+ chart = {
668
+ chartType: 'column' as ChartType,
669
+ dataSet: DM.DataSource,
670
+ dataOptions: {
671
+ category: [DM.Divisions.Divison_name],
672
+ value: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
673
+ breakBy: [],
674
+ },
675
+ };
676
+
677
+ onBeforeRender(options: any) {
678
+ console.log('beforeRender');
679
+ console.log(options);
680
+ return options;
681
+ }
682
+
683
+ logArguments(...args: any[]) {
684
+ console.log(args);
685
+ }
686
+ }
687
+ * ```
688
+ * <img src="media://angular-area-chart-example.png" width="800px" />
689
+ * @group Charts
690
+ */
691
+ class AreaChartComponent {
692
+ constructor() {
693
+ /**
694
+ * {@inheritDoc @sisense/sdk-ui!AreaChartProps.onDataPointClick}
695
+ *
696
+ * @category Callbacks
697
+ */
698
+ this.dataPointClick = new EventEmitter();
699
+ /**
700
+ * {@inheritDoc @sisense/sdk-ui!AreaChartProps.onDataPointContextMenu}
701
+ *
702
+ * @category Callbacks
703
+ */
704
+ this.dataPointContextMenu = new EventEmitter();
705
+ /**
706
+ * {@inheritDoc @sisense/sdk-ui!AreaChartProps.onDataPointsSelected}
707
+ *
708
+ * @category Callbacks
709
+ */
710
+ this.dataPointsSelect = new EventEmitter();
711
+ /** @internal */
712
+ this.chartType = 'area';
993
713
  }
994
714
  }
995
- DecoratorsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DecoratorsModule, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.NgModule });
996
- DecoratorsModulemod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: DecoratorsModule });
997
- DecoratorsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DecoratorsModule });
998
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DecoratorsModule, decorators: [{
999
- type: NgModule,
715
+ AreaChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreaChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
716
+ AreaChartComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AreaChartComponent, selector: "csdk-area-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
717
+ <csdk-chart
718
+ [chartType]="chartType"
719
+ [dataSet]="dataSet"
720
+ [dataOptions]="dataOptions"
721
+ [filters]="filters"
722
+ [highlights]="highlights"
723
+ [styleOptions]="styleOptions"
724
+ [beforeRender]="beforeRender"
725
+ [dataReady]="dataReady"
726
+ (dataPointClick)="dataPointClick.emit($any($event))"
727
+ (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
728
+ (dataPointsSelect)="dataPointsSelect.emit($any($event))"
729
+ />
730
+ `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
731
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreaChartComponent, decorators: [{
732
+ type: Component,
1000
733
  args: [{
1001
- declarations: [],
1002
- exports: [],
734
+ selector: 'csdk-area-chart',
735
+ template: `
736
+ <csdk-chart
737
+ [chartType]="chartType"
738
+ [dataSet]="dataSet"
739
+ [dataOptions]="dataOptions"
740
+ [filters]="filters"
741
+ [highlights]="highlights"
742
+ [styleOptions]="styleOptions"
743
+ [beforeRender]="beforeRender"
744
+ [dataReady]="dataReady"
745
+ (dataPointClick)="dataPointClick.emit($any($event))"
746
+ (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
747
+ (dataPointsSelect)="dataPointsSelect.emit($any($event))"
748
+ />
749
+ `,
1003
750
  }]
1004
- }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
751
+ }], propDecorators: { dataSet: [{
752
+ type: Input
753
+ }], dataOptions: [{
754
+ type: Input
755
+ }], filters: [{
756
+ type: Input
757
+ }], highlights: [{
758
+ type: Input
759
+ }], styleOptions: [{
760
+ type: Input
761
+ }], beforeRender: [{
762
+ type: Input
763
+ }], dataReady: [{
764
+ type: Input
765
+ }], dataPointClick: [{
766
+ type: Output
767
+ }], dataPointContextMenu: [{
768
+ type: Output
769
+ }], dataPointsSelect: [{
770
+ type: Output
771
+ }] } });
1005
772
 
1006
- function Trackable(target, propertyKey, descriptor) {
1007
- const originalMethod = descriptor.value;
1008
- descriptor.value = function (...args) {
1009
- track('sdkAngularServiceMethodExecuted', propertyKey);
1010
- return originalMethod.apply(this, args);
1011
- };
1012
- return descriptor;
1013
- }
1014
- /** @internal */
1015
- function TrackableService(trackableMethods) {
1016
- return function (ServiceClass) {
1017
- trackableMethods.forEach((methodName) => {
1018
- // eslint-disable-next-line security/detect-object-injection
1019
- const original = ServiceClass.prototype[methodName];
1020
- // eslint-disable-next-line security/detect-object-injection
1021
- ServiceClass.prototype[methodName] = function (...params) {
1022
- track('sdkAngularServiceMethodExecuted', `${ServiceClass.name}.${methodName}`);
1023
- return original.apply(this, params);
1024
- };
1025
- });
1026
- };
1027
- }
1028
- function track(action, methodName) {
1029
- var _a, _b, _c;
1030
- return __awaiter(this, void 0, void 0, function* () {
1031
- try {
1032
- const app = yield DecoratorsModule.sisenseContextService.getApp();
1033
- const trackingEnabled = (_c = (_b = (_a = app.settings) === null || _a === void 0 ? void 0 : _a.trackingConfig) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : true;
1034
- if (app === null || app === void 0 ? void 0 : app.httpClient) {
1035
- const payload = {
1036
- packageName: 'sdk-ui-angular',
1037
- packageVersion,
1038
- methodName,
1039
- };
1040
- void trackProductEvent(action, payload, app.httpClient, !trackingEnabled);
1041
- }
1042
- }
1043
- catch (e) {
1044
- console.warn('tracking error', e);
773
+ /**
774
+ * A component that displays a range of data over a given time period or across multiple categories.
775
+ * It is particularly useful for visualizing the minimum and maximum values in a dataset, along with
776
+ * the area between these values.
777
+ *
778
+ * @example
779
+ * ```html
780
+ * <csdk-area-range-chart
781
+ * [dataSet]="chart.dataSet"
782
+ * [dataOptions]="chart.dataOptions"
783
+ * [highlights]="filters"
784
+ * [beforeRender]="onBeforeRender"
785
+ * (dataPointClick)="logArguments($event)"
786
+ * (dataPointContextMenu)="logArguments($event)"
787
+ * (dataPointsSelect)="logArguments($event)"
788
+ * />
789
+ * ```
790
+ * ```ts
791
+ import { Component } from '@angular/core';
792
+ import { measureFactory, filterFactory, Filter } from '@sisense/sdk-data';
793
+ import * as DM from '../../assets/sample-healthcare-model';
794
+ import type { ChartType, RangeChartDataOptions } from '@sisense/sdk-ui-angular';
795
+
796
+ @Component({
797
+ selector: 'app-analytics',
798
+ templateUrl: './analytics.component.html',
799
+ styleUrls: ['./analytics.component.scss'],
800
+ })
801
+ export class AnalyticsComponent {
802
+ DM = DM;
803
+ filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
804
+ chart = {
805
+ chartType: 'arearange' as ChartType,
806
+ dataSet: DM.DataSource,
807
+ dataOptions: {
808
+ category: [DM.Admissions.Admission_Time.Years],
809
+ value: [
810
+ {
811
+ title: 'Admission Cost Range',
812
+ upperBound: measureFactory.multiply(
813
+ measureFactory.sum(DM.Admissions.Cost_of_admission, 'Lower Admission'),
814
+ 0.6,
815
+ ),
816
+ lowerBound: measureFactory.multiply(
817
+ measureFactory.sum(DM.Admissions.Cost_of_admission, 'Upper Admission'),
818
+ 1.4,
819
+ ),
1045
820
  }
1046
- });
821
+ ],
822
+ breakBy: [],
823
+ } as RangeChartDataOptions,
824
+ };
825
+
826
+ onBeforeRender(options: any) {
827
+ console.log('beforeRender');
828
+ console.log(options);
829
+ return options;
830
+ }
831
+
832
+ logArguments(...args: any[]) {
833
+ console.log(args);
834
+ }
835
+ }
836
+ * ```
837
+ * <img src="media://angular-area-range-chart-example.png" width="800px" />
838
+ * @group Charts
839
+ */
840
+ class AreaRangeChartComponent {
841
+ constructor() {
842
+ /**
843
+ * {@inheritDoc @sisense/sdk-ui!AreaRangeChartProps.onDataPointClick}
844
+ *
845
+ * @category Callbacks
846
+ */
847
+ this.dataPointClick = new EventEmitter();
848
+ /**
849
+ * {@inheritDoc @sisense/sdk-ui!AreaRangeChartProps.onDataPointContextMenu}
850
+ *
851
+ * @category Callbacks
852
+ */
853
+ this.dataPointContextMenu = new EventEmitter();
854
+ /**
855
+ * {@inheritDoc @sisense/sdk-ui!AreaRangeChartProps.onDataPointsSelected}
856
+ *
857
+ * @category Callbacks
858
+ */
859
+ this.dataPointsSelect = new EventEmitter();
860
+ /** @internal */
861
+ this.chartType = 'arearange';
862
+ }
1047
863
  }
864
+ AreaRangeChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreaRangeChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
865
+ AreaRangeChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AreaRangeChartComponent, selector: "csdk-area-range-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
866
+ <csdk-chart
867
+ [chartType]="chartType"
868
+ [dataSet]="dataSet"
869
+ [dataOptions]="dataOptions"
870
+ [filters]="filters"
871
+ [highlights]="highlights"
872
+ [styleOptions]="styleOptions"
873
+ [beforeRender]="beforeRender"
874
+ [dataReady]="dataReady"
875
+ (dataPointClick)="dataPointClick.emit($any($event))"
876
+ (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
877
+ (dataPointsSelect)="dataPointsSelect.emit($any($event))"
878
+ />
879
+ `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
880
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreaRangeChartComponent, decorators: [{
881
+ type: Component,
882
+ args: [{
883
+ selector: 'csdk-area-range-chart',
884
+ template: `
885
+ <csdk-chart
886
+ [chartType]="chartType"
887
+ [dataSet]="dataSet"
888
+ [dataOptions]="dataOptions"
889
+ [filters]="filters"
890
+ [highlights]="highlights"
891
+ [styleOptions]="styleOptions"
892
+ [beforeRender]="beforeRender"
893
+ [dataReady]="dataReady"
894
+ (dataPointClick)="dataPointClick.emit($any($event))"
895
+ (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
896
+ (dataPointsSelect)="dataPointsSelect.emit($any($event))"
897
+ />
898
+ `,
899
+ }]
900
+ }], propDecorators: { dataSet: [{
901
+ type: Input
902
+ }], dataOptions: [{
903
+ type: Input
904
+ }], filters: [{
905
+ type: Input
906
+ }], highlights: [{
907
+ type: Input
908
+ }], styleOptions: [{
909
+ type: Input
910
+ }], beforeRender: [{
911
+ type: Input
912
+ }], dataReady: [{
913
+ type: Input
914
+ }], dataPointClick: [{
915
+ type: Output
916
+ }], dataPointContextMenu: [{
917
+ type: Output
918
+ }], dataPointsSelect: [{
919
+ type: Output
920
+ }] } });
1048
921
 
1049
922
  /**
1050
- * Token used to inject {@link ThemeConfig} into your application
923
+ * An Angular component that allows to visualize geographical data as polygons on a map.
1051
924
  *
1052
925
  * @example
1053
- *
1054
- * Example of injecting both {@link SisenseContextConfig} and {@link ThemeConfig} into your application:
926
+ * ```html
927
+ * <csdk-areamap-chart
928
+ * [dataSet]="areamapChart.dataSet"
929
+ * [dataOptions]="areamapChart.dataOptions"
930
+ * [styleOptions]="areamapChart.styleOptions"
931
+ * (dataPointClick)="logArguments($event)"
932
+ * />
933
+ * ```
1055
934
  *
1056
935
  * ```ts
1057
- * export const SISENSE_CONTEXT_CONFIG: SisenseContextConfig = {
1058
- * url: "<instance url>", // replace with the URL of your Sisense instance
1059
- * token: "<api token>", // replace with the API token of your user account
1060
- * defaultDataSource: DM.DataSource,
1061
- * };
1062
- *
1063
- * @NgModule({
1064
- * imports: [
1065
- * BrowserModule,
1066
- * SdkUiModule,
1067
- * ],
1068
- * declarations: [AppComponent],
1069
- * providers: [
1070
- * { provide: SISENSE_CONTEXT_CONFIG_TOKEN, useValue: SISENSE_CONTEXT_CONFIG },
1071
- * {
1072
- * provide: THEME_CONFIG_TOKEN,
1073
- * useValue: {
1074
- * // initial theme settings
1075
- * } as ThemeConfig,
1076
- * },
1077
- * ],
1078
- * bootstrap: [AppComponent],
1079
- * })
936
+ import { Component } from '@angular/core';
937
+ import { measureFactory } from '@sisense/sdk-data';
938
+ import * as DM from '../../assets/sample-ecommerce';
939
+
940
+ @Component({
941
+ selector: 'app-analytics',
942
+ templateUrl: './analytics.component.html',
943
+ styleUrls: ['./analytics.component.scss'],
944
+ })
945
+ export class AnalyticsComponent {
946
+ areamapChart = {
947
+ dataSet: DM.DataSource,
948
+ dataOptions: {
949
+ geo: [DM.Country.Country],
950
+ color: [measureFactory.sum(DM.Commerce.Revenue, 'Color by Revenue')],
951
+ } as AreamapChartDataOptions,
952
+ styleOptions: {
953
+ mapType: 'world',
954
+ } as AreamapStyleOptions,
955
+ };
956
+
957
+ logArguments(...args: any[]) {
958
+ console.log(args);
959
+ }
960
+ }
1080
961
  * ```
1081
- * @group Contexts
1082
- */
1083
- const THEME_CONFIG_TOKEN = new InjectionToken('theme configuration');
1084
- /**
1085
- * Service for working with Sisense Fusion themes.
1086
- *
1087
- * If no theme service is used, the current Fusion theme is applied by default.
1088
- *
1089
- * @group Contexts
962
+ * <img src="media://angular-areamap-chart-example.png" width="800px" />
963
+ * @group Charts
1090
964
  */
1091
- let ThemeService = class ThemeService {
1092
- constructor(sisenseContextService, themeConfig) {
1093
- this.sisenseContextService = sisenseContextService;
1094
- this.initializationPromise = Promise.resolve();
1095
- this.themeSettings$ = new BehaviorSubject(getDefaultThemeSettings());
1096
- this.initializationPromise = this.initThemeSettings(themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.theme);
1097
- this.sisenseContextService
1098
- .getApp$()
1099
- // Skip current app value
1100
- .pipe(skip(1))
1101
- // Subscribe to new app values
1102
- .subscribe({
1103
- next: ({ app }) => {
1104
- if (app) {
1105
- this.initializationPromise = this.applyThemeSettings(app.settings.serverThemeSettings);
1106
- }
1107
- },
1108
- });
1109
- }
1110
- initThemeSettings(theme) {
1111
- return __awaiter(this, void 0, void 0, function* () {
1112
- const app = yield this.sisenseContextService.getApp();
1113
- // apply system theme settings first
1114
- yield this.applyThemeSettings(app.settings.serverThemeSettings);
1115
- if (theme) {
1116
- // Manually tracks theme update during initialization as execution of updateThemeSettings for consistency.
1117
- track('sdkAngularServiceMethodExecuted', 'ThemeService.updateThemeSettings');
1118
- yield this.applyThemeSettings(theme);
1119
- }
1120
- });
1121
- }
1122
- applyThemeSettings(theme) {
1123
- return __awaiter(this, void 0, void 0, function* () {
1124
- try {
1125
- const app = yield this.sisenseContextService.getApp();
1126
- const isThemeOid = typeof theme === 'string';
1127
- let userThemeSettings = theme;
1128
- if (isThemeOid) {
1129
- userThemeSettings = yield getThemeSettingsByOid(theme, app.httpClient);
1130
- }
1131
- const mergedThemeSettings = merge.withOptions({ mergeArrays: false }, this.themeSettings$.value, userThemeSettings);
1132
- this.themeSettings$.next(mergedThemeSettings);
1133
- }
1134
- catch (error) {
1135
- this.themeSettings$.error(error);
1136
- }
1137
- });
1138
- }
1139
- /** @internal */
1140
- getThemeSettings() {
1141
- return this.themeSettings$.asObservable();
1142
- }
1143
- updateThemeSettings(theme) {
1144
- return __awaiter(this, void 0, void 0, function* () {
1145
- yield this.initializationPromise;
1146
- yield this.applyThemeSettings(theme);
1147
- });
965
+ class AreamapChartComponent {
966
+ constructor() {
967
+ /**
968
+ * {@inheritDoc @sisense/sdk-ui!AreamapChartProps.onDataPointClick}
969
+ *
970
+ * @category Callbacks
971
+ */
972
+ this.dataPointClick = new EventEmitter();
973
+ /** @internal */
974
+ this.chartType = 'areamap';
1148
975
  }
1149
- };
1150
- ThemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThemeService, deps: [{ token: SisenseContextService }, { token: THEME_CONFIG_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
1151
- ThemeServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThemeService, providedIn: 'root' });
1152
- ThemeService = __decorate([
1153
- TrackableService(['updateThemeSettings'])
1154
- ], ThemeService);
1155
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThemeService, decorators: [{
1156
- type: Injectable,
976
+ }
977
+ AreamapChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreamapChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
978
+ AreamapChartComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AreamapChartComponent, selector: "csdk-areamap-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick" }, ngImport: i0, template: `
979
+ <csdk-chart
980
+ [chartType]="chartType"
981
+ [dataSet]="dataSet"
982
+ [dataOptions]="dataOptions"
983
+ [filters]="filters"
984
+ [highlights]="highlights"
985
+ [styleOptions]="styleOptions"
986
+ [dataReady]="dataReady"
987
+ (dataPointClick)="dataPointClick.emit($any($event))"
988
+ />
989
+ `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
990
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreamapChartComponent, decorators: [{
991
+ type: Component,
1157
992
  args: [{
1158
- providedIn: 'root',
993
+ selector: 'csdk-areamap-chart',
994
+ template: `
995
+ <csdk-chart
996
+ [chartType]="chartType"
997
+ [dataSet]="dataSet"
998
+ [dataOptions]="dataOptions"
999
+ [filters]="filters"
1000
+ [highlights]="highlights"
1001
+ [styleOptions]="styleOptions"
1002
+ [dataReady]="dataReady"
1003
+ (dataPointClick)="dataPointClick.emit($any($event))"
1004
+ />
1005
+ `,
1159
1006
  }]
1160
- }], ctorParameters: function () {
1161
- return [{ type: SisenseContextService }, { type: undefined, decorators: [{
1162
- type: Optional
1163
- }, {
1164
- type: Inject,
1165
- args: [THEME_CONFIG_TOKEN]
1166
- }] }];
1167
- } });
1007
+ }], propDecorators: { dataSet: [{
1008
+ type: Input
1009
+ }], dataOptions: [{
1010
+ type: Input
1011
+ }], filters: [{
1012
+ type: Input
1013
+ }], highlights: [{
1014
+ type: Input
1015
+ }], styleOptions: [{
1016
+ type: Input
1017
+ }], dataReady: [{
1018
+ type: Input
1019
+ }], dataPointClick: [{
1020
+ type: Output
1021
+ }] } });
1168
1022
 
1169
1023
  /**
1170
- * An Angular component used for easily switching chart types or rendering multiple series of different chart types.
1024
+ * A component representing categorical data with horizontal rectangular bars,
1025
+ * whose lengths are proportional to the values that they represent.
1171
1026
  *
1172
1027
  * @example
1173
- * An example of using the `Chart` component to
1174
- * plot a column chart of the Sample Healthcare data source hosted in a Sisense instance:
1175
- *
1176
1028
  * ```html
1177
- * <!--Component HTML template in .component.html-->
1178
- * <csdk-chart
1179
- * [chartType]="chart.chartType"
1180
- * [dataSet]="chart.dataSet"
1181
- * [dataOptions]="chart.dataOptions"
1182
- * [filters]="chart.filters"
1183
- * [styleOptions]="chart.styleOptions"
1184
- * />
1029
+ * <csdk-bar-chart
1030
+ * [dataSet]="chart.dataSet"
1031
+ * [dataOptions]="chart.dataOptions"
1032
+ * [highlights]="filters"
1033
+ * [beforeRender]="onBeforeRender"
1034
+ * (dataPointClick)="logArguments($event)"
1035
+ * (dataPointContextMenu)="logArguments($event)"
1036
+ * (dataPointsSelect)="logArguments($event)"
1037
+ * />
1185
1038
  * ```
1186
1039
  *
1187
1040
  * ```ts
1188
- * // Component behavior in .component.ts
1189
- * chart = {
1190
- * chartType: 'column' as ChartType,
1191
- * dataSet: DM.DataSource,
1192
- * dataOptions: {
1193
- * category: [DM.Admissions.Admission_Time.Months],
1194
- * value: [measureFactory.count(DM.Admissions.Patient_ID, 'Total Patients')],
1195
- * breakBy: [],
1196
- * },
1197
- * filters: [filterFactory.members(DM.Doctors.Specialty, ['Oncology', 'Cardiology'])],
1198
- * styleOptions: {
1199
- * width: 800,
1200
- * height: 500,
1201
- * xAxis: {
1202
- * title: {
1203
- * text: 'Months',
1204
- * enabled: true,
1205
- * },
1206
- * },
1207
- * yAxis: {
1208
- * title: {
1209
- * text: 'Total Patients',
1210
- * enabled: true,
1211
- * },
1212
- * },
1213
- * },
1214
- * };
1041
+ import { Component } from '@angular/core';
1042
+ import { measureFactory, filterFactory } from '@sisense/sdk-data';
1043
+ import * as DM from '../../assets/sample-healthcare-model';
1044
+ import type { ChartType } from '@sisense/sdk-ui-angular';
1045
+
1046
+ @Component({
1047
+ selector: 'app-analytics',
1048
+ templateUrl: './analytics.component.html',
1049
+ styleUrls: ['./analytics.component.scss'],
1050
+ })
1051
+ export class AnalyticsComponent {
1052
+ DM = DM;
1053
+ filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
1054
+ chart = {
1055
+ chartType: 'column' as ChartType,
1056
+ dataSet: DM.DataSource,
1057
+ dataOptions: {
1058
+ category: [DM.Divisions.Divison_name],
1059
+ value: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
1060
+ breakBy: [],
1061
+ },
1062
+ };
1063
+
1064
+ onBeforeRender(options: any) {
1065
+ console.log('beforeRender');
1066
+ console.log(options);
1067
+ return options;
1068
+ }
1069
+
1070
+ logArguments(...args: any[]) {
1071
+ console.log(args);
1072
+ }
1073
+ }
1215
1074
  * ```
1216
- *
1217
- * <img src="media://angular-chart-example.png" width="800px" />
1218
- * @shortDescription Common component for rendering charts of different types including table
1075
+ * <img src="media://angular-bar-chart-example.png" width="800px" />
1219
1076
  * @group Charts
1220
1077
  */
1221
- class ChartComponent {
1222
- /**
1223
- * Constructor for the `Chart` component.
1224
- *
1225
- * @param sisenseContextService - Sisense context service
1226
- * @param themeService - Theme service
1227
- */
1228
- constructor(
1229
- /**
1230
- * Sisense context service
1231
- *
1232
- * @category Constructor
1233
- */
1234
- sisenseContextService,
1235
- /**
1236
- * Theme service
1237
- *
1238
- * @category Constructor
1239
- */
1240
- themeService) {
1241
- this.sisenseContextService = sisenseContextService;
1242
- this.themeService = themeService;
1078
+ class BarChartComponent {
1079
+ constructor() {
1243
1080
  /**
1244
- * {@inheritDoc @sisense/sdk-ui!ChartProps.onDataPointClick}
1081
+ * {@inheritDoc @sisense/sdk-ui!BarChartProps.onDataPointClick}
1245
1082
  *
1246
1083
  * @category Callbacks
1247
1084
  */
1248
1085
  this.dataPointClick = new EventEmitter();
1249
1086
  /**
1250
- * {@inheritDoc @sisense/sdk-ui!ChartProps.onDataPointContextMenu}
1087
+ * {@inheritDoc @sisense/sdk-ui!BarChartProps.onDataPointContextMenu}
1251
1088
  *
1252
1089
  * @category Callbacks
1253
1090
  */
1254
1091
  this.dataPointContextMenu = new EventEmitter();
1255
1092
  /**
1256
- * {@inheritDoc @sisense/sdk-ui!ChartProps.onDataPointsSelected}
1093
+ * {@inheritDoc @sisense/sdk-ui!BarChartProps.onDataPointsSelected}
1257
1094
  *
1258
1095
  * @category Callbacks
1259
1096
  */
1260
1097
  this.dataPointsSelect = new EventEmitter();
1261
- this.componentAdapter = new ComponentAdapter(Chart, [
1262
- createSisenseContextConnector(this.sisenseContextService),
1263
- createThemeContextConnector(this.themeService),
1264
- ]);
1265
- }
1266
- /**
1267
- * @internal
1268
- */
1269
- ngAfterViewInit() {
1270
- this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());
1271
- }
1272
- /**
1273
- * @internal
1274
- */
1275
- ngOnChanges() {
1276
- if (this.preactRef) {
1277
- this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());
1278
- }
1279
- }
1280
- getPreactComponentProps() {
1281
- var _a, _b;
1282
- return {
1283
- chartType: this.chartType,
1284
- dataSet: this.dataSet,
1285
- dataOptions: this.dataOptions,
1286
- filters: this.filters,
1287
- highlights: this.highlights,
1288
- styleOptions: this.styleOptions,
1289
- onBeforeRender: (_a = this.beforeRender) === null || _a === void 0 ? void 0 : _a.bind(this),
1290
- onDataReady: (_b = this.dataReady) === null || _b === void 0 ? void 0 : _b.bind(this),
1291
- onDataPointClick: (...[point, nativeEvent]) => this.dataPointClick.emit({ point, nativeEvent }),
1292
- onDataPointContextMenu: (...[point, nativeEvent]) => this.dataPointContextMenu.emit({ point, nativeEvent }),
1293
- onDataPointsSelected: (...[points, nativeEvent]) => this.dataPointsSelect.emit({ points, nativeEvent }),
1294
- };
1295
- }
1296
- /**
1297
- * @internal
1298
- */
1299
- ngOnDestroy() {
1300
- this.componentAdapter.destroy();
1098
+ /** @internal */
1099
+ this.chartType = 'bar';
1301
1100
  }
1302
1101
  }
1303
- ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChartComponent, deps: [{ token: SisenseContextService }, { token: ThemeService }], target: i0.ɵɵFactoryTarget.Component });
1304
- ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ChartComponent, selector: "csdk-chart", inputs: { chartType: "chartType", dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, viewQueries: [{ propertyName: "preactRef", first: true, predicate: ["preact"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n <div #preact class=\"csdk-full-size-container\"></div>\n", isInline: true, styles: [".csdk-full-size-container{width:100%;height:100%}\n"] });
1305
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChartComponent, decorators: [{
1102
+ BarChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BarChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1103
+ BarChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: BarChartComponent, selector: "csdk-bar-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
1104
+ <csdk-chart
1105
+ [chartType]="chartType"
1106
+ [dataSet]="dataSet"
1107
+ [dataOptions]="dataOptions"
1108
+ [filters]="filters"
1109
+ [highlights]="highlights"
1110
+ [styleOptions]="styleOptions"
1111
+ [beforeRender]="beforeRender"
1112
+ [dataReady]="dataReady"
1113
+ (dataPointClick)="dataPointClick.emit($any($event))"
1114
+ (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
1115
+ (dataPointsSelect)="dataPointsSelect.emit($any($event))"
1116
+ />
1117
+ `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
1118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BarChartComponent, decorators: [{
1306
1119
  type: Component,
1307
- args: [{ selector: 'csdk-chart', template: template, styles: [".csdk-full-size-container{width:100%;height:100%}\n"] }]
1308
- }], ctorParameters: function () { return [{ type: SisenseContextService }, { type: ThemeService }]; }, propDecorators: { preactRef: [{
1309
- type: ViewChild,
1310
- args: [rootId]
1311
- }], chartType: [{
1312
- type: Input
1313
- }], dataSet: [{
1120
+ args: [{
1121
+ selector: 'csdk-bar-chart',
1122
+ template: `
1123
+ <csdk-chart
1124
+ [chartType]="chartType"
1125
+ [dataSet]="dataSet"
1126
+ [dataOptions]="dataOptions"
1127
+ [filters]="filters"
1128
+ [highlights]="highlights"
1129
+ [styleOptions]="styleOptions"
1130
+ [beforeRender]="beforeRender"
1131
+ [dataReady]="dataReady"
1132
+ (dataPointClick)="dataPointClick.emit($any($event))"
1133
+ (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
1134
+ (dataPointsSelect)="dataPointsSelect.emit($any($event))"
1135
+ />
1136
+ `,
1137
+ }]
1138
+ }], propDecorators: { dataSet: [{
1314
1139
  type: Input
1315
1140
  }], dataOptions: [{
1316
1141
  type: Input
@@ -1333,26 +1158,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1333
1158
  }] } });
1334
1159
 
1335
1160
  /**
1336
- * A component similar to a {@link LineChartComponent},
1337
- * but with filled in areas under each line and an option to display them as stacked.
1161
+ * An Angular component representing data in a way that visually describes the distribution
1162
+ * variability, and center of a data set along an axis.
1338
1163
  *
1339
1164
  * @example
1340
1165
  * ```html
1341
- * <csdk-area-chart
1342
- * [dataSet]="chart.dataSet"
1343
- * [dataOptions]="chart.dataOptions"
1344
- * [highlights]="filters"
1166
+ * <csdk-boxplot-chart
1167
+ * [dataSet]="boxplotChart.dataSet"
1168
+ * [dataOptions]="boxplotChart.dataOptions"
1169
+ * [highlights]="boxplotChart.highlights"
1345
1170
  * [beforeRender]="onBeforeRender"
1346
1171
  * (dataPointClick)="logArguments($event)"
1347
1172
  * (dataPointContextMenu)="logArguments($event)"
1348
1173
  * (dataPointsSelect)="logArguments($event)"
1349
1174
  * />
1350
1175
  * ```
1176
+ *
1351
1177
  * ```ts
1352
1178
  import { Component } from '@angular/core';
1353
- import { measureFactory, filterFactory, Filter } from '@sisense/sdk-data';
1179
+ import { filterFactory } from '@sisense/sdk-data';
1180
+ import type { BoxplotChartDataOptions } from '@sisense/sdk-ui-angular';
1354
1181
  import * as DM from '../../assets/sample-healthcare-model';
1355
- import type { ChartType } from '@sisense/sdk-ui-angular';
1356
1182
 
1357
1183
  @Component({
1358
1184
  selector: 'app-analytics',
@@ -1360,58 +1186,51 @@ import type { ChartType } from '@sisense/sdk-ui-angular';
1360
1186
  styleUrls: ['./analytics.component.scss'],
1361
1187
  })
1362
1188
  export class AnalyticsComponent {
1363
- DM = DM;
1364
- filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
1365
- chart = {
1366
- chartType: 'column' as ChartType,
1189
+ boxplotChart = {
1367
1190
  dataSet: DM.DataSource,
1368
1191
  dataOptions: {
1369
1192
  category: [DM.Divisions.Divison_name],
1370
- value: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
1371
- breakBy: [],
1372
- },
1193
+ value: [DM.Admissions.TimeofStay],
1194
+ boxType: 'iqr',
1195
+ outliersEnabled: true,
1196
+ } as BoxplotChartDataOptions,
1197
+ highlights: [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])],
1373
1198
  };
1374
1199
 
1375
- onBeforeRender(options: any) {
1376
- console.log('beforeRender');
1377
- console.log(options);
1378
- return options;
1379
- }
1380
-
1381
1200
  logArguments(...args: any[]) {
1382
1201
  console.log(args);
1383
1202
  }
1384
1203
  }
1385
1204
  * ```
1386
- * <img src="media://angular-area-chart-example.png" width="800px" />
1205
+ * <img src="media://angular-boxplot-chart-example.png" width="800px" />
1387
1206
  * @group Charts
1388
1207
  */
1389
- class AreaChartComponent {
1208
+ class BoxplotChartComponent {
1390
1209
  constructor() {
1391
1210
  /**
1392
- * {@inheritDoc @sisense/sdk-ui!AreaChartProps.onDataPointClick}
1211
+ * {@inheritDoc @sisense/sdk-ui!BoxplotChartProps.onDataPointClick}
1393
1212
  *
1394
1213
  * @category Callbacks
1395
1214
  */
1396
1215
  this.dataPointClick = new EventEmitter();
1397
1216
  /**
1398
- * {@inheritDoc @sisense/sdk-ui!AreaChartProps.onDataPointContextMenu}
1217
+ * {@inheritDoc @sisense/sdk-ui!BoxplotChartProps.onDataPointContextMenu}
1399
1218
  *
1400
1219
  * @category Callbacks
1401
1220
  */
1402
1221
  this.dataPointContextMenu = new EventEmitter();
1403
1222
  /**
1404
- * {@inheritDoc @sisense/sdk-ui!AreaChartProps.onDataPointsSelected}
1223
+ * {@inheritDoc @sisense/sdk-ui!BoxplotChartProps.onDataPointsSelected}
1405
1224
  *
1406
1225
  * @category Callbacks
1407
1226
  */
1408
1227
  this.dataPointsSelect = new EventEmitter();
1409
1228
  /** @internal */
1410
- this.chartType = 'area';
1229
+ this.chartType = 'boxplot';
1411
1230
  }
1412
1231
  }
1413
- AreaChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreaChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1414
- AreaChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AreaChartComponent, selector: "csdk-area-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
1232
+ BoxplotChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BoxplotChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1233
+ BoxplotChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: BoxplotChartComponent, selector: "csdk-boxplot-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
1415
1234
  <csdk-chart
1416
1235
  [chartType]="chartType"
1417
1236
  [dataSet]="dataSet"
@@ -1426,10 +1245,10 @@ AreaChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ver
1426
1245
  (dataPointsSelect)="dataPointsSelect.emit($any($event))"
1427
1246
  />
1428
1247
  `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
1429
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreaChartComponent, decorators: [{
1248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BoxplotChartComponent, decorators: [{
1430
1249
  type: Component,
1431
1250
  args: [{
1432
- selector: 'csdk-area-chart',
1251
+ selector: 'csdk-boxplot-chart',
1433
1252
  template: `
1434
1253
  <csdk-chart
1435
1254
  [chartType]="chartType"
@@ -1469,27 +1288,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1469
1288
  }] } });
1470
1289
 
1471
1290
  /**
1472
- * A component that displays a range of data over a given time period or across multiple categories.
1473
- * It is particularly useful for visualizing the minimum and maximum values in a dataset, along with
1474
- * the area between these values.
1291
+ * A component that visualizes values over days in a calendar-like view,
1292
+ * making it easy to identify daily patterns or anomalies
1475
1293
  *
1476
1294
  * @example
1477
1295
  * ```html
1478
- * <csdk-area-range-chart
1296
+ * <csdk-calendar-heatmap-chart
1479
1297
  * [dataSet]="chart.dataSet"
1480
- * [dataOptions]="chart.dataOptions"
1481
- * [highlights]="filters"
1482
- * [beforeRender]="onBeforeRender"
1483
- * (dataPointClick)="logArguments($event)"
1484
- * (dataPointContextMenu)="logArguments($event)"
1485
- * (dataPointsSelect)="logArguments($event)"
1298
+ * [dataOptions]="chart.dataOptions"
1299
+ * [highlights]="chart.highlights"
1300
+ * [styleOptions]="chart.styleOptions"
1486
1301
  * />
1487
1302
  * ```
1488
1303
  * ```ts
1489
1304
  import { Component } from '@angular/core';
1490
- import { measureFactory, filterFactory, Filter } from '@sisense/sdk-data';
1491
- import * as DM from '../../assets/sample-healthcare-model';
1492
- import type { ChartType, RangeChartDataOptions } from '@sisense/sdk-ui-angular';
1305
+ import { measureFactory, filterFactory } from '@sisense/sdk-data';
1306
+ import * as DM from '../../assets/sample-ecommerce';
1307
+ import type { CalendarHeatmapChartProps } from '@sisense/sdk-ui-angular';
1493
1308
 
1494
1309
  @Component({
1495
1310
  selector: 'app-analytics',
@@ -1498,69 +1313,54 @@ import type { ChartType, RangeChartDataOptions } from '@sisense/sdk-ui-angular';
1498
1313
  })
1499
1314
  export class AnalyticsComponent {
1500
1315
  DM = DM;
1501
- filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
1502
1316
  chart = {
1503
- chartType: 'arearange' as ChartType,
1504
1317
  dataSet: DM.DataSource,
1505
1318
  dataOptions: {
1506
- category: [DM.Admissions.Admission_Time.Years],
1507
- value: [
1508
- {
1509
- title: 'Admission Cost Range',
1510
- upperBound: measureFactory.multiply(
1511
- measureFactory.sum(DM.Admissions.Cost_of_admission, 'Lower Admission'),
1512
- 0.6,
1513
- ),
1514
- lowerBound: measureFactory.multiply(
1515
- measureFactory.sum(DM.Admissions.Cost_of_admission, 'Upper Admission'),
1516
- 1.4,
1517
- ),
1518
- }
1519
- ],
1520
- breakBy: [],
1521
- } as RangeChartDataOptions,
1319
+ date: DM.Commerce.Date.Days,
1320
+ value: measureFactory.sum(DM.Commerce.Cost),
1321
+ },
1322
+ highlights: [
1323
+ filterFactory.dateRange(
1324
+ DM.Commerce.Date.Days,
1325
+ '2009-11-29',
1326
+ '2009-12-15'
1327
+ ),
1328
+ ],
1329
+ styleOptions: {
1330
+ viewType: 'quarter',
1331
+ },
1522
1332
  };
1523
-
1524
- onBeforeRender(options: any) {
1525
- console.log('beforeRender');
1526
- console.log(options);
1527
- return options;
1528
- }
1529
-
1530
- logArguments(...args: any[]) {
1531
- console.log(args);
1532
- }
1533
1333
  }
1534
1334
  * ```
1535
- * <img src="media://angular-area-range-chart-example.png" width="800px" />
1335
+ * <img src="media://angular-calendar-heatmap-chart-example.png" width="800px" />
1536
1336
  * @group Charts
1537
1337
  */
1538
- class AreaRangeChartComponent {
1338
+ class CalendarHeatmapChartComponent {
1539
1339
  constructor() {
1540
1340
  /**
1541
- * {@inheritDoc @sisense/sdk-ui!AreaRangeChartProps.onDataPointClick}
1341
+ * {@inheritDoc @sisense/sdk-ui!CalendarHeatmapChartProps.onDataPointClick}
1542
1342
  *
1543
1343
  * @category Callbacks
1544
1344
  */
1545
1345
  this.dataPointClick = new EventEmitter();
1546
1346
  /**
1547
- * {@inheritDoc @sisense/sdk-ui!AreaRangeChartProps.onDataPointContextMenu}
1347
+ * {@inheritDoc @sisense/sdk-ui!CalendarHeatmapChartProps.onDataPointContextMenu}
1548
1348
  *
1549
1349
  * @category Callbacks
1550
1350
  */
1551
1351
  this.dataPointContextMenu = new EventEmitter();
1552
1352
  /**
1553
- * {@inheritDoc @sisense/sdk-ui!AreaRangeChartProps.onDataPointsSelected}
1353
+ * {@inheritDoc @sisense/sdk-ui!CalendarHeatmapChartProps.onDataPointsSelected}
1554
1354
  *
1555
1355
  * @category Callbacks
1556
1356
  */
1557
1357
  this.dataPointsSelect = new EventEmitter();
1558
1358
  /** @internal */
1559
- this.chartType = 'arearange';
1359
+ this.chartType = 'calendar-heatmap';
1560
1360
  }
1561
1361
  }
1562
- AreaRangeChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreaRangeChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1563
- AreaRangeChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AreaRangeChartComponent, selector: "csdk-area-range-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
1362
+ CalendarHeatmapChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CalendarHeatmapChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1363
+ CalendarHeatmapChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CalendarHeatmapChartComponent, selector: "csdk-calendar-heatmap-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
1564
1364
  <csdk-chart
1565
1365
  [chartType]="chartType"
1566
1366
  [dataSet]="dataSet"
@@ -1575,10 +1375,10 @@ AreaRangeChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
1575
1375
  (dataPointsSelect)="dataPointsSelect.emit($any($event))"
1576
1376
  />
1577
1377
  `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
1578
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreaRangeChartComponent, decorators: [{
1378
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CalendarHeatmapChartComponent, decorators: [{
1579
1379
  type: Component,
1580
1380
  args: [{
1581
- selector: 'csdk-area-range-chart',
1381
+ selector: 'csdk-calendar-heatmap-chart',
1582
1382
  template: `
1583
1383
  <csdk-chart
1584
1384
  [chartType]="chartType"
@@ -1618,22 +1418,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1618
1418
  }] } });
1619
1419
 
1620
1420
  /**
1621
- * An Angular component that allows to visualize geographical data as polygons on a map.
1421
+ * A component representing categorical data with vertical rectangular bars
1422
+ * whose heights are proportional to the values that they represent.
1622
1423
  *
1623
1424
  * @example
1624
1425
  * ```html
1625
- * <csdk-areamap-chart
1626
- * [dataSet]="areamapChart.dataSet"
1627
- * [dataOptions]="areamapChart.dataOptions"
1628
- * [styleOptions]="areamapChart.styleOptions"
1426
+ * <csdk-column-chart
1427
+ * [dataSet]="chart.dataSet"
1428
+ * [dataOptions]="chart.dataOptions"
1429
+ * [highlights]="filters"
1430
+ * [beforeRender]="onBeforeRender"
1629
1431
  * (dataPointClick)="logArguments($event)"
1432
+ * (dataPointContextMenu)="logArguments($event)"
1433
+ * (dataPointsSelect)="logArguments($event)"
1630
1434
  * />
1631
1435
  * ```
1632
- *
1633
1436
  * ```ts
1634
1437
  import { Component } from '@angular/core';
1635
- import { measureFactory } from '@sisense/sdk-data';
1636
- import * as DM from '../../assets/sample-ecommerce';
1438
+ import { measureFactory, filterFactory } from '@sisense/sdk-data';
1439
+ import * as DM from '../../assets/sample-healthcare-model';
1440
+ import type { ChartType } from '@sisense/sdk-ui-angular';
1637
1441
 
1638
1442
  @Component({
1639
1443
  selector: 'app-analytics',
@@ -1641,39 +1445,58 @@ import * as DM from '../../assets/sample-ecommerce';
1641
1445
  styleUrls: ['./analytics.component.scss'],
1642
1446
  })
1643
1447
  export class AnalyticsComponent {
1644
- areamapChart = {
1448
+ DM = DM;
1449
+ filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
1450
+ chart = {
1451
+ chartType: 'column' as ChartType,
1645
1452
  dataSet: DM.DataSource,
1646
1453
  dataOptions: {
1647
- geo: [DM.Country.Country],
1648
- color: [measureFactory.sum(DM.Commerce.Revenue, 'Color by Revenue')],
1649
- } as AreamapChartDataOptions,
1650
- styleOptions: {
1651
- mapType: 'world',
1652
- } as AreamapStyleOptions,
1454
+ category: [DM.Divisions.Divison_name],
1455
+ value: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
1456
+ breakBy: [],
1457
+ },
1653
1458
  };
1654
1459
 
1460
+ onBeforeRender(options: any) {
1461
+ console.log('beforeRender');
1462
+ console.log(options);
1463
+ return options;
1464
+ }
1465
+
1655
1466
  logArguments(...args: any[]) {
1656
1467
  console.log(args);
1657
1468
  }
1658
1469
  }
1659
1470
  * ```
1660
- * <img src="media://angular-areamap-chart-example.png" width="800px" />
1471
+ * <img src="media://angular-column-chart-example.png" width="800px" />
1661
1472
  * @group Charts
1662
1473
  */
1663
- class AreamapChartComponent {
1474
+ class ColumnChartComponent {
1664
1475
  constructor() {
1665
1476
  /**
1666
- * {@inheritDoc @sisense/sdk-ui!AreamapChartProps.onDataPointClick}
1477
+ * {@inheritDoc @sisense/sdk-ui!ColumnChartProps.onDataPointClick}
1667
1478
  *
1668
1479
  * @category Callbacks
1669
1480
  */
1670
1481
  this.dataPointClick = new EventEmitter();
1482
+ /**
1483
+ * {@inheritDoc @sisense/sdk-ui!ColumnChartProps.onDataPointContextMenu}
1484
+ *
1485
+ * @category Callbacks
1486
+ */
1487
+ this.dataPointContextMenu = new EventEmitter();
1488
+ /**
1489
+ * {@inheritDoc @sisense/sdk-ui!ColumnChartProps.onDataPointsSelected}
1490
+ *
1491
+ * @category Callbacks
1492
+ */
1493
+ this.dataPointsSelect = new EventEmitter();
1671
1494
  /** @internal */
1672
- this.chartType = 'areamap';
1495
+ this.chartType = 'column';
1673
1496
  }
1674
1497
  }
1675
- AreamapChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreamapChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1676
- AreamapChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AreamapChartComponent, selector: "csdk-areamap-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick" }, ngImport: i0, template: `
1498
+ ColumnChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1499
+ ColumnChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ColumnChartComponent, selector: "csdk-column-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
1677
1500
  <csdk-chart
1678
1501
  [chartType]="chartType"
1679
1502
  [dataSet]="dataSet"
@@ -1681,14 +1504,17 @@ AreamapChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0",
1681
1504
  [filters]="filters"
1682
1505
  [highlights]="highlights"
1683
1506
  [styleOptions]="styleOptions"
1507
+ [beforeRender]="beforeRender"
1684
1508
  [dataReady]="dataReady"
1685
1509
  (dataPointClick)="dataPointClick.emit($any($event))"
1510
+ (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
1511
+ (dataPointsSelect)="dataPointsSelect.emit($any($event))"
1686
1512
  />
1687
1513
  `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
1688
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AreamapChartComponent, decorators: [{
1514
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnChartComponent, decorators: [{
1689
1515
  type: Component,
1690
1516
  args: [{
1691
- selector: 'csdk-areamap-chart',
1517
+ selector: 'csdk-column-chart',
1692
1518
  template: `
1693
1519
  <csdk-chart
1694
1520
  [chartType]="chartType"
@@ -1697,8 +1523,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1697
1523
  [filters]="filters"
1698
1524
  [highlights]="highlights"
1699
1525
  [styleOptions]="styleOptions"
1526
+ [beforeRender]="beforeRender"
1700
1527
  [dataReady]="dataReady"
1701
1528
  (dataPointClick)="dataPointClick.emit($any($event))"
1529
+ (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
1530
+ (dataPointsSelect)="dataPointsSelect.emit($any($event))"
1702
1531
  />
1703
1532
  `,
1704
1533
  }]
@@ -1712,19 +1541,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1712
1541
  type: Input
1713
1542
  }], styleOptions: [{
1714
1543
  type: Input
1544
+ }], beforeRender: [{
1545
+ type: Input
1715
1546
  }], dataReady: [{
1716
1547
  type: Input
1717
1548
  }], dataPointClick: [{
1718
1549
  type: Output
1550
+ }], dataPointContextMenu: [{
1551
+ type: Output
1552
+ }], dataPointsSelect: [{
1553
+ type: Output
1719
1554
  }] } });
1720
1555
 
1721
1556
  /**
1722
- * A component representing categorical data with horizontal rectangular bars,
1723
- * whose lengths are proportional to the values that they represent.
1557
+ * A component representing data progressively decreasing in size or quantity through a funnel shape.
1724
1558
  *
1725
1559
  * @example
1726
1560
  * ```html
1727
- * <csdk-bar-chart
1561
+ * <csdk-funnel-chart
1728
1562
  * [dataSet]="chart.dataSet"
1729
1563
  * [dataOptions]="chart.dataOptions"
1730
1564
  * [highlights]="filters"
@@ -1734,13 +1568,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1734
1568
  * (dataPointsSelect)="logArguments($event)"
1735
1569
  * />
1736
1570
  * ```
1737
- *
1738
1571
  * ```ts
1739
1572
  import { Component } from '@angular/core';
1740
- import { measureFactory, filterFactory } from '@sisense/sdk-data';
1573
+ import { measureFactory, filterFactory, Filter } from '@sisense/sdk-data';
1741
1574
  import * as DM from '../../assets/sample-healthcare-model';
1742
1575
  import type { ChartType } from '@sisense/sdk-ui-angular';
1743
-
1744
1576
  @Component({
1745
1577
  selector: 'app-analytics',
1746
1578
  templateUrl: './analytics.component.html',
@@ -1770,35 +1602,35 @@ export class AnalyticsComponent {
1770
1602
  }
1771
1603
  }
1772
1604
  * ```
1773
- * <img src="media://angular-bar-chart-example.png" width="800px" />
1605
+ * <img src="media://angular-funnel-chart-example.png" width="800px" />
1774
1606
  * @group Charts
1775
1607
  */
1776
- class BarChartComponent {
1608
+ class FunnelChartComponent {
1777
1609
  constructor() {
1778
1610
  /**
1779
- * {@inheritDoc @sisense/sdk-ui!BarChartProps.onDataPointClick}
1611
+ * {@inheritDoc @sisense/sdk-ui!FunnelChartProps.onDataPointClick}
1780
1612
  *
1781
1613
  * @category Callbacks
1782
1614
  */
1783
1615
  this.dataPointClick = new EventEmitter();
1784
1616
  /**
1785
- * {@inheritDoc @sisense/sdk-ui!BarChartProps.onDataPointContextMenu}
1617
+ * {@inheritDoc @sisense/sdk-ui!FunnelChartProps.onDataPointContextMenu}
1786
1618
  *
1787
1619
  * @category Callbacks
1788
1620
  */
1789
1621
  this.dataPointContextMenu = new EventEmitter();
1790
1622
  /**
1791
- * {@inheritDoc @sisense/sdk-ui!BarChartProps.onDataPointsSelected}
1623
+ * {@inheritDoc @sisense/sdk-ui!FunnelChartProps.onDataPointsSelected}
1792
1624
  *
1793
1625
  * @category Callbacks
1794
1626
  */
1795
1627
  this.dataPointsSelect = new EventEmitter();
1796
1628
  /** @internal */
1797
- this.chartType = 'bar';
1629
+ this.chartType = 'funnel';
1798
1630
  }
1799
1631
  }
1800
- BarChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BarChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1801
- BarChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: BarChartComponent, selector: "csdk-bar-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
1632
+ FunnelChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FunnelChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1633
+ FunnelChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FunnelChartComponent, selector: "csdk-funnel-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
1802
1634
  <csdk-chart
1803
1635
  [chartType]="chartType"
1804
1636
  [dataSet]="dataSet"
@@ -1813,10 +1645,10 @@ BarChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
1813
1645
  (dataPointsSelect)="dataPointsSelect.emit($any($event))"
1814
1646
  />
1815
1647
  `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
1816
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BarChartComponent, decorators: [{
1648
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FunnelChartComponent, decorators: [{
1817
1649
  type: Component,
1818
1650
  args: [{
1819
- selector: 'csdk-bar-chart',
1651
+ selector: 'csdk-funnel-chart',
1820
1652
  template: `
1821
1653
  <csdk-chart
1822
1654
  [chartType]="chartType"
@@ -1856,27 +1688,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1856
1688
  }] } });
1857
1689
 
1858
1690
  /**
1859
- * An Angular component representing data in a way that visually describes the distribution
1860
- * variability, and center of a data set along an axis.
1691
+ * A component that provides various options for displaying one or two numeric values as a number, gauge or ticker.
1861
1692
  *
1862
1693
  * @example
1863
1694
  * ```html
1864
- * <csdk-boxplot-chart
1865
- * [dataSet]="boxplotChart.dataSet"
1866
- * [dataOptions]="boxplotChart.dataOptions"
1867
- * [highlights]="boxplotChart.highlights"
1868
- * [beforeRender]="onBeforeRender"
1869
- * (dataPointClick)="logArguments($event)"
1870
- * (dataPointContextMenu)="logArguments($event)"
1871
- * (dataPointsSelect)="logArguments($event)"
1695
+ * <csdk-indicator-chart
1696
+ * [dataSet]="indicator.dataSet"
1697
+ * [dataOptions]="indicator.dataOptions"
1698
+ * [filters]="filters"
1699
+ * [styleOptions]="indicator.styleOptions"
1872
1700
  * />
1873
1701
  * ```
1874
- *
1875
1702
  * ```ts
1876
1703
  import { Component } from '@angular/core';
1877
- import { filterFactory } from '@sisense/sdk-data';
1878
- import type { BoxplotChartDataOptions } from '@sisense/sdk-ui-angular';
1704
+ import { measureFactory, filterFactory } from '@sisense/sdk-data';
1879
1705
  import * as DM from '../../assets/sample-healthcare-model';
1706
+ import type { IndicatorStyleOptions } from '@sisense/sdk-ui-angular';
1880
1707
 
1881
1708
  @Component({
1882
1709
  selector: 'app-analytics',
@@ -1884,51 +1711,48 @@ import * as DM from '../../assets/sample-healthcare-model';
1884
1711
  styleUrls: ['./analytics.component.scss'],
1885
1712
  })
1886
1713
  export class AnalyticsComponent {
1887
- boxplotChart = {
1714
+ DM = DM;
1715
+ filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
1716
+ indicator = {
1888
1717
  dataSet: DM.DataSource,
1889
1718
  dataOptions: {
1890
- category: [DM.Divisions.Divison_name],
1891
- value: [DM.Admissions.TimeofStay],
1892
- boxType: 'iqr',
1893
- outliersEnabled: true,
1894
- } as BoxplotChartDataOptions,
1895
- highlights: [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])],
1896
- };
1897
-
1898
- logArguments(...args: any[]) {
1899
- console.log(args);
1900
- }
1901
- }
1902
- * ```
1903
- * <img src="media://angular-boxplot-chart-example.png" width="800px" />
1904
- * @group Charts
1905
- */
1906
- class BoxplotChartComponent {
1907
- constructor() {
1908
- /**
1909
- * {@inheritDoc @sisense/sdk-ui!BoxplotChartProps.onDataPointClick}
1910
- *
1911
- * @category Callbacks
1912
- */
1913
- this.dataPointClick = new EventEmitter();
1914
- /**
1915
- * {@inheritDoc @sisense/sdk-ui!BoxplotChartProps.onDataPointContextMenu}
1916
- *
1917
- * @category Callbacks
1918
- */
1919
- this.dataPointContextMenu = new EventEmitter();
1920
- /**
1921
- * {@inheritDoc @sisense/sdk-ui!BoxplotChartProps.onDataPointsSelected}
1922
- *
1923
- * @category Callbacks
1924
- */
1925
- this.dataPointsSelect = new EventEmitter();
1719
+ value: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
1720
+ secondary: [measureFactory.sum(DM.Admissions.Diagnosis_ID)],
1721
+ },
1722
+ styleOptions: {
1723
+ indicatorComponents: {
1724
+ title: {
1725
+ shouldBeShown: true,
1726
+ text: 'Total Cost_of_admission',
1727
+ },
1728
+ secondaryTitle: {
1729
+ text: 'Total Diagnosis_ID',
1730
+ },
1731
+ ticks: {
1732
+ shouldBeShown: true,
1733
+ },
1734
+ labels: {
1735
+ shouldBeShown: true,
1736
+ },
1737
+ },
1738
+ subtype: 'indicator/gauge',
1739
+ skin: 2,
1740
+ } as IndicatorStyleOptions,
1741
+ };
1742
+
1743
+ }
1744
+ * ```
1745
+ * <img src="media://angular-indicator-chart-example.png" width="800px" />
1746
+ * @group Charts
1747
+ */
1748
+ class IndicatorChartComponent {
1749
+ constructor() {
1926
1750
  /** @internal */
1927
- this.chartType = 'boxplot';
1751
+ this.chartType = 'indicator';
1928
1752
  }
1929
1753
  }
1930
- BoxplotChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BoxplotChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1931
- BoxplotChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: BoxplotChartComponent, selector: "csdk-boxplot-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
1754
+ IndicatorChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: IndicatorChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1755
+ IndicatorChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: IndicatorChartComponent, selector: "csdk-indicator-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, ngImport: i0, template: `
1932
1756
  <csdk-chart
1933
1757
  [chartType]="chartType"
1934
1758
  [dataSet]="dataSet"
@@ -1938,15 +1762,12 @@ BoxplotChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0",
1938
1762
  [styleOptions]="styleOptions"
1939
1763
  [beforeRender]="beforeRender"
1940
1764
  [dataReady]="dataReady"
1941
- (dataPointClick)="dataPointClick.emit($any($event))"
1942
- (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
1943
- (dataPointsSelect)="dataPointsSelect.emit($any($event))"
1944
1765
  />
1945
1766
  `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
1946
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BoxplotChartComponent, decorators: [{
1767
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: IndicatorChartComponent, decorators: [{
1947
1768
  type: Component,
1948
1769
  args: [{
1949
- selector: 'csdk-boxplot-chart',
1770
+ selector: 'csdk-indicator-chart',
1950
1771
  template: `
1951
1772
  <csdk-chart
1952
1773
  [chartType]="chartType"
@@ -1957,9 +1778,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1957
1778
  [styleOptions]="styleOptions"
1958
1779
  [beforeRender]="beforeRender"
1959
1780
  [dataReady]="dataReady"
1960
- (dataPointClick)="dataPointClick.emit($any($event))"
1961
- (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
1962
- (dataPointsSelect)="dataPointsSelect.emit($any($event))"
1963
1781
  />
1964
1782
  `,
1965
1783
  }]
@@ -1977,33 +1795,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1977
1795
  type: Input
1978
1796
  }], dataReady: [{
1979
1797
  type: Input
1980
- }], dataPointClick: [{
1981
- type: Output
1982
- }], dataPointContextMenu: [{
1983
- type: Output
1984
- }], dataPointsSelect: [{
1985
- type: Output
1986
1798
  }] } });
1987
1799
 
1988
1800
  /**
1989
- * A component that visualizes values over days in a calendar-like view,
1990
- * making it easy to identify daily patterns or anomalies
1801
+ * A component displaying data as a series of points connected by a line. Used to show trends or changes over time.
1991
1802
  *
1992
1803
  * @example
1993
1804
  * ```html
1994
- * <csdk-calendar-heatmap-chart
1805
+ * <csdk-line-chart
1995
1806
  * [dataSet]="chart.dataSet"
1996
1807
  * [dataOptions]="chart.dataOptions"
1997
- * [highlights]="chart.highlights"
1998
- * [styleOptions]="chart.styleOptions"
1808
+ * [highlights]="filters"
1809
+ * [beforeRender]="onBeforeRender"
1810
+ * (dataPointClick)="logArguments($event)"
1811
+ * (dataPointContextMenu)="logArguments($event)"
1812
+ * (dataPointsSelect)="logArguments($event)"
1999
1813
  * />
2000
1814
  * ```
2001
1815
  * ```ts
2002
1816
  import { Component } from '@angular/core';
2003
- import { measureFactory, filterFactory } from '@sisense/sdk-data';
2004
- import * as DM from '../../assets/sample-ecommerce';
2005
- import type { CalendarHeatmapChartProps } from '@sisense/sdk-ui-angular';
2006
-
1817
+ import { measureFactory, filterFactory, Filter } from '@sisense/sdk-data';
1818
+ import * as DM from '../../assets/sample-healthcare-model';
1819
+ import type { ChartType } from '@sisense/sdk-ui-angular';
2007
1820
  @Component({
2008
1821
  selector: 'app-analytics',
2009
1822
  templateUrl: './analytics.component.html',
@@ -2011,54 +1824,57 @@ import type { CalendarHeatmapChartProps } from '@sisense/sdk-ui-angular';
2011
1824
  })
2012
1825
  export class AnalyticsComponent {
2013
1826
  DM = DM;
1827
+ filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
2014
1828
  chart = {
1829
+ chartType: 'column' as ChartType,
2015
1830
  dataSet: DM.DataSource,
2016
1831
  dataOptions: {
2017
- date: DM.Commerce.Date.Days,
2018
- value: measureFactory.sum(DM.Commerce.Cost),
2019
- },
2020
- highlights: [
2021
- filterFactory.dateRange(
2022
- DM.Commerce.Date.Days,
2023
- '2009-11-29',
2024
- '2009-12-15'
2025
- ),
2026
- ],
2027
- styleOptions: {
2028
- viewType: 'quarter',
1832
+ category: [DM.Divisions.Divison_name],
1833
+ value: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
1834
+ breakBy: [],
2029
1835
  },
2030
1836
  };
1837
+
1838
+ onBeforeRender(options: any) {
1839
+ console.log('beforeRender');
1840
+ console.log(options);
1841
+ return options;
1842
+ }
1843
+
1844
+ logArguments(...args: any[]) {
1845
+ console.log(args);
1846
+ }
2031
1847
  }
2032
1848
  * ```
2033
- * <img src="media://angular-calendar-heatmap-chart-example.png" width="800px" />
1849
+ * <img src="media://angular-line-chart-example.png" width="800px" />
2034
1850
  * @group Charts
2035
1851
  */
2036
- class CalendarHeatmapChartComponent {
1852
+ class LineChartComponent {
2037
1853
  constructor() {
2038
1854
  /**
2039
- * {@inheritDoc @sisense/sdk-ui!CalendarHeatmapChartProps.onDataPointClick}
1855
+ * {@inheritDoc @sisense/sdk-ui!LineChartProps.onDataPointClick}
2040
1856
  *
2041
1857
  * @category Callbacks
2042
1858
  */
2043
1859
  this.dataPointClick = new EventEmitter();
2044
1860
  /**
2045
- * {@inheritDoc @sisense/sdk-ui!CalendarHeatmapChartProps.onDataPointContextMenu}
1861
+ * {@inheritDoc @sisense/sdk-ui!LineChartProps.onDataPointContextMenu}
2046
1862
  *
2047
1863
  * @category Callbacks
2048
1864
  */
2049
1865
  this.dataPointContextMenu = new EventEmitter();
2050
1866
  /**
2051
- * {@inheritDoc @sisense/sdk-ui!CalendarHeatmapChartProps.onDataPointsSelected}
1867
+ * {@inheritDoc @sisense/sdk-ui!LineChartProps.onDataPointsSelected}
2052
1868
  *
2053
1869
  * @category Callbacks
2054
1870
  */
2055
1871
  this.dataPointsSelect = new EventEmitter();
2056
1872
  /** @internal */
2057
- this.chartType = 'calendar-heatmap';
1873
+ this.chartType = 'line';
2058
1874
  }
2059
1875
  }
2060
- CalendarHeatmapChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CalendarHeatmapChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2061
- CalendarHeatmapChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CalendarHeatmapChartComponent, selector: "csdk-calendar-heatmap-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
1876
+ LineChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LineChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1877
+ LineChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: LineChartComponent, selector: "csdk-line-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
2062
1878
  <csdk-chart
2063
1879
  [chartType]="chartType"
2064
1880
  [dataSet]="dataSet"
@@ -2073,10 +1889,10 @@ CalendarHeatmapChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "1
2073
1889
  (dataPointsSelect)="dataPointsSelect.emit($any($event))"
2074
1890
  />
2075
1891
  `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
2076
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CalendarHeatmapChartComponent, decorators: [{
1892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LineChartComponent, decorators: [{
2077
1893
  type: Component,
2078
1894
  args: [{
2079
- selector: 'csdk-calendar-heatmap-chart',
1895
+ selector: 'csdk-line-chart',
2080
1896
  template: `
2081
1897
  <csdk-chart
2082
1898
  [chartType]="chartType"
@@ -2116,12 +1932,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2116
1932
  }] } });
2117
1933
 
2118
1934
  /**
2119
- * A component representing categorical data with vertical rectangular bars
2120
- * whose heights are proportional to the values that they represent.
1935
+ * A component representing data in a circular graph with the data shown as slices of a whole,
1936
+ * with each slice representing a proportion of the total.
2121
1937
  *
2122
1938
  * @example
2123
1939
  * ```html
2124
- * <csdk-column-chart
1940
+ * <csdk-pie-chart
2125
1941
  * [dataSet]="chart.dataSet"
2126
1942
  * [dataOptions]="chart.dataOptions"
2127
1943
  * [highlights]="filters"
@@ -2166,35 +1982,35 @@ export class AnalyticsComponent {
2166
1982
  }
2167
1983
  }
2168
1984
  * ```
2169
- * <img src="media://angular-column-chart-example.png" width="800px" />
1985
+ * <img src="media://angular-pie-chart-example.png" width="800px" />
2170
1986
  * @group Charts
2171
1987
  */
2172
- class ColumnChartComponent {
1988
+ class PieChartComponent {
2173
1989
  constructor() {
2174
1990
  /**
2175
- * {@inheritDoc @sisense/sdk-ui!ColumnChartProps.onDataPointClick}
1991
+ * {@inheritDoc @sisense/sdk-ui!PieChartProps.onDataPointClick}
2176
1992
  *
2177
1993
  * @category Callbacks
2178
1994
  */
2179
1995
  this.dataPointClick = new EventEmitter();
2180
1996
  /**
2181
- * {@inheritDoc @sisense/sdk-ui!ColumnChartProps.onDataPointContextMenu}
1997
+ * {@inheritDoc @sisense/sdk-ui!PieChartProps.onDataPointContextMenu}
2182
1998
  *
2183
1999
  * @category Callbacks
2184
2000
  */
2185
2001
  this.dataPointContextMenu = new EventEmitter();
2186
2002
  /**
2187
- * {@inheritDoc @sisense/sdk-ui!ColumnChartProps.onDataPointsSelected}
2003
+ * {@inheritDoc @sisense/sdk-ui!PieChartProps.onDataPointsSelected}
2188
2004
  *
2189
2005
  * @category Callbacks
2190
2006
  */
2191
2007
  this.dataPointsSelect = new EventEmitter();
2192
2008
  /** @internal */
2193
- this.chartType = 'column';
2009
+ this.chartType = 'pie';
2194
2010
  }
2195
2011
  }
2196
- ColumnChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2197
- ColumnChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ColumnChartComponent, selector: "csdk-column-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
2012
+ PieChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PieChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2013
+ PieChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PieChartComponent, selector: "csdk-pie-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
2198
2014
  <csdk-chart
2199
2015
  [chartType]="chartType"
2200
2016
  [dataSet]="dataSet"
@@ -2209,10 +2025,10 @@ ColumnChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", v
2209
2025
  (dataPointsSelect)="dataPointsSelect.emit($any($event))"
2210
2026
  />
2211
2027
  `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
2212
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnChartComponent, decorators: [{
2028
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PieChartComponent, decorators: [{
2213
2029
  type: Component,
2214
2030
  args: [{
2215
- selector: 'csdk-column-chart',
2031
+ selector: 'csdk-pie-chart',
2216
2032
  template: `
2217
2033
  <csdk-chart
2218
2034
  [chartType]="chartType"
@@ -2252,518 +2068,702 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2252
2068
  }] } });
2253
2069
 
2254
2070
  /**
2255
- * A component representing data progressively decreasing in size or quantity through a funnel shape.
2071
+ * Service for rendering components dynamically.
2256
2072
  *
2257
- * @example
2258
- * ```html
2259
- * <csdk-funnel-chart
2260
- * [dataSet]="chart.dataSet"
2261
- * [dataOptions]="chart.dataOptions"
2262
- * [highlights]="filters"
2263
- * [beforeRender]="onBeforeRender"
2264
- * (dataPointClick)="logArguments($event)"
2265
- * (dataPointContextMenu)="logArguments($event)"
2266
- * (dataPointsSelect)="logArguments($event)"
2267
- * />
2268
- * ```
2269
- * ```ts
2270
- import { Component } from '@angular/core';
2271
- import { measureFactory, filterFactory, Filter } from '@sisense/sdk-data';
2272
- import * as DM from '../../assets/sample-healthcare-model';
2273
- import type { ChartType } from '@sisense/sdk-ui-angular';
2274
- @Component({
2275
- selector: 'app-analytics',
2276
- templateUrl: './analytics.component.html',
2277
- styleUrls: ['./analytics.component.scss'],
2278
- })
2279
- export class AnalyticsComponent {
2280
- DM = DM;
2281
- filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
2282
- chart = {
2283
- chartType: 'column' as ChartType,
2284
- dataSet: DM.DataSource,
2285
- dataOptions: {
2286
- category: [DM.Divisions.Divison_name],
2287
- value: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
2288
- breakBy: [],
2289
- },
2290
- };
2073
+ * @internal
2074
+ */
2075
+ class DynamicRenderer {
2076
+ constructor(appRef, injector, envInjector) {
2077
+ this.appRef = appRef;
2078
+ this.injector = injector;
2079
+ this.envInjector = envInjector;
2080
+ }
2081
+ renderComponent(component, props) {
2082
+ const componentRef = createComponent(component, {
2083
+ environmentInjector: this.envInjector,
2084
+ elementInjector: this.injector,
2085
+ });
2086
+ // Apply props to the component instance
2087
+ Object.assign(componentRef.instance, props);
2088
+ // Attach the component to the application
2089
+ this.appRef.attachView(componentRef.hostView);
2090
+ // Get the DOM element
2091
+ const domElem = componentRef.hostView.rootNodes[0];
2092
+ // Create destroy function
2093
+ const destroy = () => {
2094
+ // Detach from application
2095
+ this.appRef.detachView(componentRef.hostView);
2096
+ // Destroy the component
2097
+ componentRef.destroy();
2098
+ };
2099
+ return {
2100
+ element: domElem,
2101
+ componentRef,
2102
+ destroy,
2103
+ };
2104
+ }
2105
+ }
2106
+ DynamicRenderer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicRenderer, deps: [{ token: i0.ApplicationRef }, { token: i0.Injector }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2107
+ DynamicRenderer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicRenderer, providedIn: 'root' });
2108
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicRenderer, decorators: [{
2109
+ type: Injectable,
2110
+ args: [{ providedIn: 'root' }]
2111
+ }], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i0.Injector }, { type: i0.EnvironmentInjector }]; } });
2291
2112
 
2292
- onBeforeRender(options: any) {
2293
- console.log('beforeRender');
2294
- console.log(options);
2295
- return options;
2296
- }
2113
+ /**
2114
+ * Service for working with custom widgets.
2115
+ *
2116
+ * @group Dashboards
2117
+ */
2118
+ class CustomWidgetsService {
2119
+ constructor(
2120
+ /** @internal */
2121
+ dynamicRenderer) {
2122
+ this.dynamicRenderer = dynamicRenderer;
2123
+ this.customWidgetsMap$ = new BehaviorSubject(new Map([['tabber-buttons', TabberButtonsWidget]]));
2124
+ }
2125
+ /**
2126
+ * Registers a new custom widget.
2127
+ *
2128
+ * @param customWidgetType - The unique identifier for the custom widget type.
2129
+ * @param customWidget - The custom widget component class to register.
2130
+ */
2131
+ registerCustomWidget(customWidgetType, customWidget) {
2132
+ const customWidgetPreactComponent = (props) => {
2133
+ const renderedComponent = this.dynamicRenderer.renderComponent(customWidget, props);
2134
+ return createWrapperElement(renderedComponent.element, () => renderedComponent.destroy());
2135
+ };
2136
+ const customWidgetsMap = this.customWidgetsMap$.value;
2137
+ if (!customWidgetsMap.has(customWidgetType)) {
2138
+ customWidgetsMap.set(customWidgetType, customWidgetPreactComponent);
2139
+ this.customWidgetsMap$.next(customWidgetsMap);
2140
+ }
2141
+ }
2142
+ /**
2143
+ * Checks if a custom widget is registered.
2144
+ *
2145
+ * @param customWidgetType - The type of the custom widget.
2146
+ * @returns True if the custom widget is registered, false otherwise.
2147
+ */
2148
+ hasCustomWidget(customWidgetType) {
2149
+ return this.customWidgetsMap$.value.has(customWidgetType);
2150
+ }
2151
+ }
2152
+ CustomWidgetsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomWidgetsService, deps: [{ token: DynamicRenderer }], target: i0.ɵɵFactoryTarget.Injectable });
2153
+ CustomWidgetsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomWidgetsService, providedIn: 'root' });
2154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomWidgetsService, decorators: [{
2155
+ type: Injectable,
2156
+ args: [{
2157
+ providedIn: 'root',
2158
+ }]
2159
+ }], ctorParameters: function () { return [{ type: DynamicRenderer }]; } });
2297
2160
 
2298
- logArguments(...args: any[]) {
2299
- console.log(args);
2300
- }
2161
+ function translateToPreactWidgetProps(widgetProps) {
2162
+ const { beforeRender, dataReady, beforeMenuOpen, dataPointClick, dataPointContextMenu, dataPointsSelect } = widgetProps, commonWidgetProps = __rest(widgetProps, ["beforeRender", "dataReady", "beforeMenuOpen", "dataPointClick", "dataPointContextMenu", "dataPointsSelect"]);
2163
+ return Object.assign(Object.assign({}, commonWidgetProps), { onBeforeRender: beforeRender, onDataReady: dataReady, onBeforeMenuOpen: beforeMenuOpen, onDataPointClick: dataPointClick
2164
+ ? (...[point, nativeEvent]) => dataPointClick({
2165
+ point,
2166
+ nativeEvent,
2167
+ })
2168
+ : undefined, onDataPointContextMenu: dataPointContextMenu
2169
+ ? (...[point, nativeEvent]) => dataPointContextMenu({
2170
+ point,
2171
+ nativeEvent,
2172
+ })
2173
+ : undefined, onDataPointsSelected: dataPointsSelect
2174
+ ? (...[points, nativeEvent]) => dataPointsSelect({ points, nativeEvent })
2175
+ : undefined });
2301
2176
  }
2302
- * ```
2303
- * <img src="media://angular-funnel-chart-example.png" width="800px" />
2304
- * @group Charts
2177
+ function translateFromPreactWidgetProps(widgetProps) {
2178
+ const { onBeforeRender, onDataReady, onBeforeMenuOpen, onDataPointClick, onDataPointContextMenu, onDataPointsSelected } = widgetProps, commonWidgetProps = __rest(widgetProps, ["onBeforeRender", "onDataReady", "onBeforeMenuOpen", "onDataPointClick", "onDataPointContextMenu", "onDataPointsSelected"]);
2179
+ return Object.assign(Object.assign({}, commonWidgetProps), { beforeRender: onBeforeRender, dataReady: onDataReady, beforeMenuOpen: onBeforeMenuOpen, dataPointClick: onDataPointClick
2180
+ ? ({ point, nativeEvent }) => onDataPointClick(point, nativeEvent)
2181
+ : undefined, dataPointContextMenu: onDataPointContextMenu
2182
+ ? ({ point, nativeEvent }) => onDataPointContextMenu(point, nativeEvent)
2183
+ : undefined, dataPointsSelect: onDataPointsSelected
2184
+ ? ({ points, nativeEvent }) => onDataPointsSelected(points, nativeEvent)
2185
+ : undefined });
2186
+ }
2187
+
2188
+ function translateToPreactDashboardProps(dashboardProps) {
2189
+ return Object.assign(Object.assign({}, dashboardProps), { widgets: dashboardProps.widgets.map(translateToPreactWidgetProps) });
2190
+ }
2191
+ function translateFromPreactDashboardProps(dashboardProps) {
2192
+ return Object.assign(Object.assign({}, dashboardProps), { widgets: dashboardProps.widgets.map(translateFromPreactWidgetProps) });
2193
+ }
2194
+
2195
+ /**
2196
+ * Service for working with Sisense Fusion dashboards.
2197
+ *
2198
+ * **Note:** Dashboard and Widget extensions based on JS scripts and add-ons in Fusion – for example, Blox and Jump To Dashboard – are not supported.
2199
+ *
2200
+ * @group Fusion Assets
2201
+ * @fusionEmbed
2305
2202
  */
2306
- class FunnelChartComponent {
2307
- constructor() {
2308
- /**
2309
- * {@inheritDoc @sisense/sdk-ui!FunnelChartProps.onDataPointClick}
2310
- *
2311
- * @category Callbacks
2312
- */
2313
- this.dataPointClick = new EventEmitter();
2314
- /**
2315
- * {@inheritDoc @sisense/sdk-ui!FunnelChartProps.onDataPointContextMenu}
2316
- *
2317
- * @category Callbacks
2318
- */
2319
- this.dataPointContextMenu = new EventEmitter();
2320
- /**
2321
- * {@inheritDoc @sisense/sdk-ui!FunnelChartProps.onDataPointsSelected}
2322
- *
2323
- * @category Callbacks
2324
- */
2325
- this.dataPointsSelect = new EventEmitter();
2326
- /** @internal */
2327
- this.chartType = 'funnel';
2203
+ let DashboardService = class DashboardService {
2204
+ constructor(sisenseContextService) {
2205
+ this.sisenseContextService = sisenseContextService;
2328
2206
  }
2329
- }
2330
- FunnelChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FunnelChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2331
- FunnelChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FunnelChartComponent, selector: "csdk-funnel-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
2332
- <csdk-chart
2333
- [chartType]="chartType"
2334
- [dataSet]="dataSet"
2335
- [dataOptions]="dataOptions"
2336
- [filters]="filters"
2337
- [highlights]="highlights"
2338
- [styleOptions]="styleOptions"
2339
- [beforeRender]="beforeRender"
2340
- [dataReady]="dataReady"
2341
- (dataPointClick)="dataPointClick.emit($any($event))"
2342
- (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
2343
- (dataPointsSelect)="dataPointsSelect.emit($any($event))"
2344
- />
2345
- `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
2346
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FunnelChartComponent, decorators: [{
2347
- type: Component,
2207
+ /**
2208
+ * Retrieves an existing dashboard model from the Sisense instance.
2209
+ *
2210
+ * @param dashboardOid - Identifier of the dashboard
2211
+ * @param options - Advanced configuration options
2212
+ * @returns Dashboard model
2213
+ */
2214
+ getDashboardModel(dashboardOid, options) {
2215
+ return __awaiter(this, void 0, void 0, function* () {
2216
+ const app = yield this.sisenseContextService.getApp();
2217
+ return getDashboardModel(app.httpClient, dashboardOid, options);
2218
+ });
2219
+ }
2220
+ /**
2221
+ * Retrieves existing dashboard models from the Sisense instance.
2222
+ *
2223
+ * @param options - Advanced configuration options
2224
+ * @returns Dashboard models array
2225
+ */
2226
+ getDashboardModels(options) {
2227
+ return __awaiter(this, void 0, void 0, function* () {
2228
+ const app = yield this.sisenseContextService.getApp();
2229
+ return getDashboardModels(app.httpClient, options);
2230
+ });
2231
+ }
2232
+ /**
2233
+ * Сomposes dashboard or separate dashboard elements into a coordinated dashboard
2234
+ * with cross filtering, and change detection.
2235
+ *
2236
+ * @example
2237
+ * An example of using the `createComposedDashboard` to construct a composed dashboard and render it:
2238
+ * ```html
2239
+ <!--Component HTML template in example.component.html-->
2240
+ <div *ngIf="dashboard$ | async as dashboard">
2241
+ <csdk-filter-tile
2242
+ *ngFor="let filter of getDashboardFilters(dashboard); trackBy: trackByIndex"
2243
+ [filter]="filter"
2244
+ />
2245
+ <csdk-widget
2246
+ *ngFor="let widget of dashboard.widgets; trackBy: trackByIndex"
2247
+ [id]="widget.id"
2248
+ [widgetType]="widget.widgetType"
2249
+ [chartType]="widget.chartType"
2250
+ [customWidgetType]="widget.customWidgetType"
2251
+ [dataSource]="widget.dataSource"
2252
+ [dataOptions]="widget.dataOptions"
2253
+ [filters]="widget.filters"
2254
+ [highlights]="widget.highlights"
2255
+ [styleOptions]="widget.styleOptions"
2256
+ [drilldownOptions]="widget.drilldownOptions"
2257
+ [title]="widget.title"
2258
+ [description]="widget.description"
2259
+ [beforeMenuOpen]="widget.beforeMenuOpen"
2260
+ (dataPointClick)="widget.dataPointClick?.($event)"
2261
+ (dataPointContextMenu)="widget.dataPointContextMenu?.($event)"
2262
+ (dataPointsSelect)="widget.dataPointsSelect?.($event)"
2263
+ />
2264
+ </div>
2265
+ * ```
2266
+ *
2267
+ * ```ts
2268
+ // Component behavior in example.component.ts
2269
+ import { Component, OnDestroy } from '@angular/core';
2270
+ import { BehaviorSubject } from 'rxjs';
2271
+ import { DashboardService, type DashboardProps } from '@sisense/sdk-ui-angular';
2272
+
2273
+ @Component({
2274
+ selector: 'example',
2275
+ templateUrl: './example.component.html',
2276
+ styleUrls: ['./example.component.scss'],
2277
+ })
2278
+ export class ExampleComponent implements OnDestroy {
2279
+ dashboard$: BehaviorSubject<DashboardProps> | undefined;
2280
+ private composedDashboard: ReturnType<DashboardService['createComposedDashboard']> | undefined;
2281
+
2282
+ constructor(private dashboardService: DashboardService) {}
2283
+
2284
+ ngOnInit() {
2285
+ const initialDashboard: DashboardProps = { ... };
2286
+ this.composedDashboard = this.dashboardService.createComposedDashboard(initialDashboard);
2287
+ this.dashboard$ = this.composedDashboard.dashboard$;
2288
+ }
2289
+
2290
+ ngOnDestroy() {
2291
+ this.composedDashboard?.destroy();
2292
+ }
2293
+
2294
+ trackByIndex = (index: number) => index;
2295
+
2296
+ getDashboardFilters = ({ filters }: DashboardProps) => Array.isArray(filters) ? filters : [];
2297
+ }
2298
+ * ```
2299
+ * @param initialDashboard - Initial dashboard
2300
+ * @param options - Configuration options
2301
+ * @returns Reactive composed dashboard object and API methods for interacting with it.
2302
+ * The returned object includes a `destroy()` method that should be called when
2303
+ * the dashboard is no longer needed to prevent memory leaks (e.g., in `ngOnDestroy`).
2304
+ */
2305
+ createComposedDashboard(initialDashboard, options = {}) {
2306
+ const hookAdapter = new HookAdapter((useComposedDashboardInternal), [createSisenseContextConnector(this.sisenseContextService)]);
2307
+ const dashboard$ = new BehaviorSubject(initialDashboard);
2308
+ hookAdapter.subscribe(({ dashboard }) => {
2309
+ dashboard$.next(translateFromPreactDashboardProps(dashboard));
2310
+ });
2311
+ hookAdapter.run(translateToPreactDashboardProps(initialDashboard), options);
2312
+ const setFilters = createHookApiFacade(hookAdapter, 'setFilters', true);
2313
+ const setWidgetsLayout = createHookApiFacade(hookAdapter, 'setWidgetsLayout', true);
2314
+ const destroy = () => {
2315
+ hookAdapter.destroy();
2316
+ dashboard$.complete();
2317
+ };
2318
+ return {
2319
+ dashboard$,
2320
+ setFilters,
2321
+ setWidgetsLayout,
2322
+ destroy,
2323
+ };
2324
+ }
2325
+ };
2326
+ DashboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardService, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.Injectable });
2327
+ DashboardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardService, providedIn: 'root' });
2328
+ DashboardService = __decorate([
2329
+ TrackableService(['getDashboardModel', 'getDashboardModels'])
2330
+ ], DashboardService);
2331
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardService, decorators: [{
2332
+ type: Injectable,
2348
2333
  args: [{
2349
- selector: 'csdk-funnel-chart',
2350
- template: `
2351
- <csdk-chart
2352
- [chartType]="chartType"
2353
- [dataSet]="dataSet"
2354
- [dataOptions]="dataOptions"
2355
- [filters]="filters"
2356
- [highlights]="highlights"
2357
- [styleOptions]="styleOptions"
2358
- [beforeRender]="beforeRender"
2359
- [dataReady]="dataReady"
2360
- (dataPointClick)="dataPointClick.emit($any($event))"
2361
- (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
2362
- (dataPointsSelect)="dataPointsSelect.emit($any($event))"
2363
- />
2364
- `,
2365
- }]
2366
- }], propDecorators: { dataSet: [{
2367
- type: Input
2368
- }], dataOptions: [{
2369
- type: Input
2370
- }], filters: [{
2371
- type: Input
2372
- }], highlights: [{
2373
- type: Input
2374
- }], styleOptions: [{
2375
- type: Input
2376
- }], beforeRender: [{
2377
- type: Input
2378
- }], dataReady: [{
2379
- type: Input
2380
- }], dataPointClick: [{
2381
- type: Output
2382
- }], dataPointContextMenu: [{
2383
- type: Output
2384
- }], dataPointsSelect: [{
2385
- type: Output
2386
- }] } });
2334
+ providedIn: 'root',
2335
+ }]
2336
+ }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
2387
2337
 
2388
2338
  /**
2389
- * A component that provides various options for displaying one or two numeric values as a number, gauge or ticker.
2339
+ * Service for working with filter.
2390
2340
  *
2391
- * @example
2392
- * ```html
2393
- * <csdk-indicator-chart
2394
- * [dataSet]="indicator.dataSet"
2395
- * [dataOptions]="indicator.dataOptions"
2396
- * [filters]="filters"
2397
- * [styleOptions]="indicator.styleOptions"
2398
- * />
2399
- * ```
2400
- * ```ts
2401
- import { Component } from '@angular/core';
2402
- import { measureFactory, filterFactory } from '@sisense/sdk-data';
2403
- import * as DM from '../../assets/sample-healthcare-model';
2404
- import type { IndicatorStyleOptions } from '@sisense/sdk-ui-angular';
2405
-
2406
- @Component({
2407
- selector: 'app-analytics',
2408
- templateUrl: './analytics.component.html',
2409
- styleUrls: ['./analytics.component.scss'],
2410
- })
2411
- export class AnalyticsComponent {
2412
- DM = DM;
2413
- filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
2414
- indicator = {
2415
- dataSet: DM.DataSource,
2416
- dataOptions: {
2417
- value: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
2418
- secondary: [measureFactory.sum(DM.Admissions.Diagnosis_ID)],
2419
- },
2420
- styleOptions: {
2421
- indicatorComponents: {
2422
- title: {
2423
- shouldBeShown: true,
2424
- text: 'Total Cost_of_admission',
2425
- },
2426
- secondaryTitle: {
2427
- text: 'Total Diagnosis_ID',
2428
- },
2429
- ticks: {
2430
- shouldBeShown: true,
2431
- },
2432
- labels: {
2433
- shouldBeShown: true,
2434
- },
2435
- },
2436
- subtype: 'indicator/gauge',
2437
- skin: 2,
2438
- } as IndicatorStyleOptions,
2439
- };
2440
-
2441
- }
2442
- * ```
2443
- * <img src="media://angular-indicator-chart-example.png" width="800px" />
2444
- * @group Charts
2341
+ * @group Filters
2445
2342
  */
2446
- class IndicatorChartComponent {
2447
- constructor() {
2448
- /** @internal */
2449
- this.chartType = 'indicator';
2343
+ let FilterService = class FilterService {
2344
+ constructor(sisenseContextService) {
2345
+ this.sisenseContextService = sisenseContextService;
2450
2346
  }
2451
- }
2452
- IndicatorChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: IndicatorChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2453
- IndicatorChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: IndicatorChartComponent, selector: "csdk-indicator-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, ngImport: i0, template: `
2454
- <csdk-chart
2455
- [chartType]="chartType"
2456
- [dataSet]="dataSet"
2457
- [dataOptions]="dataOptions"
2458
- [filters]="filters"
2459
- [highlights]="highlights"
2460
- [styleOptions]="styleOptions"
2461
- [beforeRender]="beforeRender"
2462
- [dataReady]="dataReady"
2463
- />
2464
- `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
2465
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: IndicatorChartComponent, decorators: [{
2466
- type: Component,
2347
+ /**
2348
+ * Retrieves members of the provided filter.
2349
+ *
2350
+ * Those members can be used to display a list of members in a third-party filter component such as Material UI Select.
2351
+ *
2352
+ * ## Example
2353
+ *
2354
+ * Retrieve selected members from a Filter on Country of the Sample ECommerce data model.
2355
+ *
2356
+ * ```ts
2357
+ * try {
2358
+ * const data = await filterService.getFilterMembers({
2359
+ * filter: filterFactory.members(DM.Country.Country, ['United States', 'Canada'])
2360
+ * });
2361
+ *
2362
+ * const { selectedMembers, allMembers, excludeMembers, enableMultiSelection } = data;
2363
+ * console.log('selectedMembers', selectedMembers);
2364
+ * } catch (error) {
2365
+ * console.error('Error:', error);
2366
+ * }
2367
+ * ```
2368
+ *
2369
+ * @param params - Parameters for retrieving filter members
2370
+ * @returns Promise that resolves to the filter members data
2371
+ */
2372
+ getFilterMembers(params) {
2373
+ return __awaiter(this, void 0, void 0, function* () {
2374
+ const hookAdapter = new HookAdapter(useGetFilterMembers, [
2375
+ createSisenseContextConnector(this.sisenseContextService),
2376
+ ]);
2377
+ const resultPromise = new Promise((resolve, reject) => {
2378
+ hookAdapter.subscribe((res) => {
2379
+ const { isError, isSuccess, error } = res;
2380
+ if (isError) {
2381
+ reject(error);
2382
+ }
2383
+ else if (isSuccess) {
2384
+ resolve(res.data);
2385
+ }
2386
+ });
2387
+ });
2388
+ hookAdapter.run(params);
2389
+ return resultPromise.finally(() => {
2390
+ hookAdapter.destroy();
2391
+ });
2392
+ });
2393
+ }
2394
+ };
2395
+ FilterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FilterService, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.Injectable });
2396
+ FilterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FilterService, providedIn: 'root' });
2397
+ FilterService = __decorate([
2398
+ TrackableService(['getFilterMembers'])
2399
+ ], FilterService);
2400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FilterService, decorators: [{
2401
+ type: Injectable,
2467
2402
  args: [{
2468
- selector: 'csdk-indicator-chart',
2469
- template: `
2470
- <csdk-chart
2471
- [chartType]="chartType"
2472
- [dataSet]="dataSet"
2473
- [dataOptions]="dataOptions"
2474
- [filters]="filters"
2475
- [highlights]="highlights"
2476
- [styleOptions]="styleOptions"
2477
- [beforeRender]="beforeRender"
2478
- [dataReady]="dataReady"
2479
- />
2480
- `,
2403
+ providedIn: 'root',
2481
2404
  }]
2482
- }], propDecorators: { dataSet: [{
2483
- type: Input
2484
- }], dataOptions: [{
2485
- type: Input
2486
- }], filters: [{
2487
- type: Input
2488
- }], highlights: [{
2489
- type: Input
2490
- }], styleOptions: [{
2491
- type: Input
2492
- }], beforeRender: [{
2493
- type: Input
2494
- }], dataReady: [{
2495
- type: Input
2496
- }] } });
2405
+ }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
2497
2406
 
2498
2407
  /**
2499
- * A component displaying data as a series of points connected by a line. Used to show trends or changes over time.
2408
+ * Service for working with Sisense Fusion hierarchies.
2500
2409
  *
2501
- * @example
2502
- * ```html
2503
- * <csdk-line-chart
2504
- * [dataSet]="chart.dataSet"
2505
- * [dataOptions]="chart.dataOptions"
2506
- * [highlights]="filters"
2507
- * [beforeRender]="onBeforeRender"
2508
- * (dataPointClick)="logArguments($event)"
2509
- * (dataPointContextMenu)="logArguments($event)"
2510
- * (dataPointsSelect)="logArguments($event)"
2511
- * />
2512
- * ```
2513
- * ```ts
2514
- import { Component } from '@angular/core';
2515
- import { measureFactory, filterFactory, Filter } from '@sisense/sdk-data';
2516
- import * as DM from '../../assets/sample-healthcare-model';
2517
- import type { ChartType } from '@sisense/sdk-ui-angular';
2518
- @Component({
2519
- selector: 'app-analytics',
2520
- templateUrl: './analytics.component.html',
2521
- styleUrls: ['./analytics.component.scss'],
2522
- })
2523
- export class AnalyticsComponent {
2524
- DM = DM;
2525
- filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
2526
- chart = {
2527
- chartType: 'column' as ChartType,
2528
- dataSet: DM.DataSource,
2529
- dataOptions: {
2530
- category: [DM.Divisions.Divison_name],
2531
- value: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
2532
- breakBy: [],
2533
- },
2534
- };
2535
-
2536
- onBeforeRender(options: any) {
2537
- console.log('beforeRender');
2538
- console.log(options);
2539
- return options;
2540
- }
2541
-
2542
- logArguments(...args: any[]) {
2543
- console.log(args);
2544
- }
2545
- }
2546
- * ```
2547
- * <img src="media://angular-line-chart-example.png" width="800px" />
2548
- * @group Charts
2410
+ * @group Fusion Assets
2411
+ * @fusionEmbed
2549
2412
  */
2550
- class LineChartComponent {
2551
- constructor() {
2552
- /**
2553
- * {@inheritDoc @sisense/sdk-ui!LineChartProps.onDataPointClick}
2554
- *
2555
- * @category Callbacks
2556
- */
2557
- this.dataPointClick = new EventEmitter();
2558
- /**
2559
- * {@inheritDoc @sisense/sdk-ui!LineChartProps.onDataPointContextMenu}
2560
- *
2561
- * @category Callbacks
2562
- */
2563
- this.dataPointContextMenu = new EventEmitter();
2564
- /**
2565
- * {@inheritDoc @sisense/sdk-ui!LineChartProps.onDataPointsSelected}
2566
- *
2567
- * @category Callbacks
2568
- */
2569
- this.dataPointsSelect = new EventEmitter();
2570
- /** @internal */
2571
- this.chartType = 'line';
2413
+ let HierarchyService = class HierarchyService {
2414
+ constructor(sisenseContextService) {
2415
+ this.sisenseContextService = sisenseContextService;
2416
+ }
2417
+ /**
2418
+ * Retrieves existing hierarchy models from the Sisense instance.
2419
+ *
2420
+ * @param params - Parameters to identify the target hierarchy models
2421
+ * @returns Hierarchy models array
2422
+ */
2423
+ getHierarchyModels(params) {
2424
+ return __awaiter(this, void 0, void 0, function* () {
2425
+ const app = yield this.sisenseContextService.getApp();
2426
+ return getHierarchyModels(app.httpClient, params, app.defaultDataSource);
2427
+ });
2572
2428
  }
2573
- }
2574
- LineChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LineChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2575
- LineChartComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: LineChartComponent, selector: "csdk-line-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
2576
- <csdk-chart
2577
- [chartType]="chartType"
2578
- [dataSet]="dataSet"
2579
- [dataOptions]="dataOptions"
2580
- [filters]="filters"
2581
- [highlights]="highlights"
2582
- [styleOptions]="styleOptions"
2583
- [beforeRender]="beforeRender"
2584
- [dataReady]="dataReady"
2585
- (dataPointClick)="dataPointClick.emit($any($event))"
2586
- (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
2587
- (dataPointsSelect)="dataPointsSelect.emit($any($event))"
2588
- />
2589
- `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
2590
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LineChartComponent, decorators: [{
2591
- type: Component,
2429
+ };
2430
+ HierarchyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyService, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.Injectable });
2431
+ HierarchyServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyService, providedIn: 'root' });
2432
+ HierarchyService = __decorate([
2433
+ TrackableService(['getHierarchyModels'])
2434
+ ], HierarchyService);
2435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyService, decorators: [{
2436
+ type: Injectable,
2592
2437
  args: [{
2593
- selector: 'csdk-line-chart',
2594
- template: `
2595
- <csdk-chart
2596
- [chartType]="chartType"
2597
- [dataSet]="dataSet"
2598
- [dataOptions]="dataOptions"
2599
- [filters]="filters"
2600
- [highlights]="highlights"
2601
- [styleOptions]="styleOptions"
2602
- [beforeRender]="beforeRender"
2603
- [dataReady]="dataReady"
2604
- (dataPointClick)="dataPointClick.emit($any($event))"
2605
- (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
2606
- (dataPointsSelect)="dataPointsSelect.emit($any($event))"
2607
- />
2608
- `,
2438
+ providedIn: 'root',
2609
2439
  }]
2610
- }], propDecorators: { dataSet: [{
2611
- type: Input
2612
- }], dataOptions: [{
2613
- type: Input
2614
- }], filters: [{
2615
- type: Input
2616
- }], highlights: [{
2617
- type: Input
2618
- }], styleOptions: [{
2619
- type: Input
2620
- }], beforeRender: [{
2621
- type: Input
2622
- }], dataReady: [{
2623
- type: Input
2624
- }], dataPointClick: [{
2625
- type: Output
2626
- }], dataPointContextMenu: [{
2627
- type: Output
2628
- }], dataPointsSelect: [{
2629
- type: Output
2630
- }] } });
2440
+ }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
2631
2441
 
2632
2442
  /**
2633
- * A component representing data in a circular graph with the data shown as slices of a whole,
2634
- * with each slice representing a proportion of the total.
2443
+ * Service for executing data queries.
2635
2444
  *
2636
- * @example
2637
- * ```html
2638
- * <csdk-pie-chart
2639
- * [dataSet]="chart.dataSet"
2640
- * [dataOptions]="chart.dataOptions"
2641
- * [highlights]="filters"
2642
- * [beforeRender]="onBeforeRender"
2643
- * (dataPointClick)="logArguments($event)"
2644
- * (dataPointContextMenu)="logArguments($event)"
2645
- * (dataPointsSelect)="logArguments($event)"
2646
- * />
2647
- * ```
2648
- * ```ts
2649
- import { Component } from '@angular/core';
2650
- import { measureFactory, filterFactory } from '@sisense/sdk-data';
2651
- import * as DM from '../../assets/sample-healthcare-model';
2652
- import type { ChartType } from '@sisense/sdk-ui-angular';
2653
-
2654
- @Component({
2655
- selector: 'app-analytics',
2656
- templateUrl: './analytics.component.html',
2657
- styleUrls: ['./analytics.component.scss'],
2658
- })
2659
- export class AnalyticsComponent {
2660
- DM = DM;
2661
- filters = [filterFactory.members(DM.Divisions.Divison_name, ['Cardiology', 'Neurology'])];
2662
- chart = {
2663
- chartType: 'column' as ChartType,
2664
- dataSet: DM.DataSource,
2665
- dataOptions: {
2666
- category: [DM.Divisions.Divison_name],
2667
- value: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
2668
- breakBy: [],
2669
- },
2670
- };
2671
-
2672
- onBeforeRender(options: any) {
2673
- console.log('beforeRender');
2674
- console.log(options);
2675
- return options;
2676
- }
2445
+ * @group Queries
2446
+ */
2447
+ let QueryService = class QueryService {
2448
+ constructor(sisenseContextService) {
2449
+ this.sisenseContextService = sisenseContextService;
2450
+ }
2451
+ /**
2452
+ * Executes a data query. If you want to display the query results, you can use
2453
+ * them to populate Compose SDK UI elements or third party UI elements.
2454
+ *
2455
+ * To learn how to populate third party UI elements with query results, see the
2456
+ * [External Charts Guide](/guides/sdk/guides/charts/guide-external-charts.html#query)
2457
+ *
2458
+ * @param params - Query parameters
2459
+ * @return Query result
2460
+ */
2461
+ executeQuery(params) {
2462
+ return __awaiter(this, void 0, void 0, function* () {
2463
+ const { dataSource, dimensions, measures, filters, highlights, count, offset, ungroup, beforeQuery, } = params;
2464
+ const app = yield this.sisenseContextService.getApp();
2465
+ const { filters: filterList, relations: filterRelations } = getFilterListAndRelationsJaql(filters);
2466
+ const data = yield executeQuery({
2467
+ dataSource,
2468
+ dimensions,
2469
+ measures,
2470
+ filters: filterList,
2471
+ filterRelations,
2472
+ highlights,
2473
+ count,
2474
+ offset,
2475
+ ungroup,
2476
+ }, app, { onBeforeQuery: beforeQuery });
2477
+ return { data };
2478
+ });
2479
+ }
2480
+ /**
2481
+ * Executes a data query extracted from an existing widget in the Sisense instance.
2482
+ *
2483
+ * @param params - Parameters to identify the target widget
2484
+ * @returns Query result
2485
+ */
2486
+ executeQueryByWidgetId(params) {
2487
+ return __awaiter(this, void 0, void 0, function* () {
2488
+ const app = yield this.sisenseContextService.getApp();
2489
+ return executeQueryByWidgetId(Object.assign(Object.assign({}, params), { app, onBeforeQuery: params.beforeQuery }));
2490
+ });
2491
+ }
2492
+ /**
2493
+ * Executes a data query for a pivot table.
2494
+ *
2495
+ * @param params - Pivot query parameters
2496
+ * @return Pivot query result
2497
+ */
2498
+ executePivotQuery(params) {
2499
+ return __awaiter(this, void 0, void 0, function* () {
2500
+ const { dataSource, rows, columns, values, grandTotals, filters, highlights, count, offset, beforeQuery, } = params;
2501
+ const { filters: filterList, relations: filterRelations } = getFilterListAndRelationsJaql(filters);
2502
+ const app = yield this.sisenseContextService.getApp();
2503
+ const data = yield executePivotQuery({
2504
+ dataSource,
2505
+ rows,
2506
+ columns,
2507
+ values,
2508
+ grandTotals,
2509
+ filters: filterList,
2510
+ filterRelations,
2511
+ highlights,
2512
+ count,
2513
+ offset,
2514
+ }, app, { onBeforeQuery: beforeQuery });
2515
+ return { data };
2516
+ });
2517
+ }
2518
+ /**
2519
+ * Executes a CSV data query.
2520
+ * Similar to {@link QueryService.executeQuery}, but returns the data in CSV format as text or as a stream.
2521
+ *
2522
+ * @param params - CSV query parameters
2523
+ * @return CSV query result
2524
+ */
2525
+ executeCsvQuery(params) {
2526
+ return __awaiter(this, void 0, void 0, function* () {
2527
+ const hookAdapter = new HookAdapter(useExecuteCsvQueryInternal, [
2528
+ createSisenseContextConnector(this.sisenseContextService),
2529
+ ]);
2530
+ const resultPromise = new Promise((resolve, reject) => {
2531
+ hookAdapter.subscribe((res) => {
2532
+ const { data, isSuccess, isError, error } = res;
2533
+ if (isSuccess) {
2534
+ resolve({ data });
2535
+ }
2536
+ else if (isError) {
2537
+ reject(error);
2538
+ }
2539
+ });
2540
+ });
2541
+ hookAdapter.run(params);
2542
+ return resultPromise.finally(() => {
2543
+ hookAdapter.destroy();
2544
+ });
2545
+ });
2546
+ }
2547
+ /**
2548
+ * Executes a data query from custom widget component props.
2549
+ *
2550
+ * This method takes custom widget props (dataSource, dataOptions, filters, etc.)
2551
+ * and executes the appropriate data query
2552
+ *
2553
+ * @param params - Custom widget component props containing data source, data options, filters, etc.
2554
+ * @returns Promise resolving to query result with formatted data
2555
+ */
2556
+ executeCustomWidgetQuery(params) {
2557
+ return __awaiter(this, void 0, void 0, function* () {
2558
+ const hookAdapter = new HookAdapter(useExecuteCustomWidgetQueryInternal, [
2559
+ createSisenseContextConnector(this.sisenseContextService),
2560
+ ]);
2561
+ const resultPromise = new Promise((resolve, reject) => {
2562
+ hookAdapter.subscribe((res) => {
2563
+ const { data, isSuccess, isError, error } = res;
2564
+ if (isSuccess) {
2565
+ resolve({ data });
2566
+ }
2567
+ else if (isError) {
2568
+ reject(error);
2569
+ }
2570
+ });
2571
+ });
2572
+ hookAdapter.run(params);
2573
+ return resultPromise.finally(() => {
2574
+ hookAdapter.destroy();
2575
+ });
2576
+ });
2577
+ }
2578
+ };
2579
+ QueryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: QueryService, deps: [{ token: SisenseContextService }], target: i0.ɵɵFactoryTarget.Injectable });
2580
+ QueryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: QueryService, providedIn: 'root' });
2581
+ QueryService = __decorate([
2582
+ TrackableService([
2583
+ 'executeQuery',
2584
+ 'executeQueryByWidgetId',
2585
+ 'executePivotQuery',
2586
+ 'executeCustomWidgetQuery',
2587
+ ])
2588
+ ], QueryService);
2589
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: QueryService, decorators: [{
2590
+ type: Injectable,
2591
+ args: [{
2592
+ providedIn: 'root',
2593
+ }]
2594
+ }], ctorParameters: function () { return [{ type: SisenseContextService }]; } });
2677
2595
 
2678
- logArguments(...args: any[]) {
2679
- console.log(args);
2680
- }
2681
- }
2682
- * ```
2683
- * <img src="media://angular-pie-chart-example.png" width="800px" />
2684
- * @group Charts
2596
+ /**
2597
+ * Service for working with Sisense Fusion widgets.
2598
+ *
2599
+ * @group Fusion Assets
2600
+ * @fusionEmbed
2685
2601
  */
2686
- class PieChartComponent {
2687
- constructor() {
2688
- /**
2689
- * {@inheritDoc @sisense/sdk-ui!PieChartProps.onDataPointClick}
2690
- *
2691
- * @category Callbacks
2692
- */
2693
- this.dataPointClick = new EventEmitter();
2694
- /**
2695
- * {@inheritDoc @sisense/sdk-ui!PieChartProps.onDataPointContextMenu}
2696
- *
2697
- * @category Callbacks
2698
- */
2699
- this.dataPointContextMenu = new EventEmitter();
2700
- /**
2701
- * {@inheritDoc @sisense/sdk-ui!PieChartProps.onDataPointsSelected}
2702
- *
2703
- * @category Callbacks
2704
- */
2705
- this.dataPointsSelect = new EventEmitter();
2706
- /** @internal */
2707
- this.chartType = 'pie';
2602
+ let WidgetService = class WidgetService {
2603
+ constructor(sisenseContextService, themeService) {
2604
+ this.sisenseContextService = sisenseContextService;
2605
+ this.themeService = themeService;
2708
2606
  }
2709
- }
2710
- PieChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PieChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2711
- PieChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PieChartComponent, selector: "csdk-pie-chart", inputs: { dataSet: "dataSet", dataOptions: "dataOptions", filters: "filters", highlights: "highlights", styleOptions: "styleOptions", beforeRender: "beforeRender", dataReady: "dataReady" }, outputs: { dataPointClick: "dataPointClick", dataPointContextMenu: "dataPointContextMenu", dataPointsSelect: "dataPointsSelect" }, ngImport: i0, template: `
2712
- <csdk-chart
2713
- [chartType]="chartType"
2714
- [dataSet]="dataSet"
2715
- [dataOptions]="dataOptions"
2716
- [filters]="filters"
2717
- [highlights]="highlights"
2718
- [styleOptions]="styleOptions"
2719
- [beforeRender]="beforeRender"
2720
- [dataReady]="dataReady"
2721
- (dataPointClick)="dataPointClick.emit($any($event))"
2722
- (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
2723
- (dataPointsSelect)="dataPointsSelect.emit($any($event))"
2724
- />
2725
- `, isInline: true, dependencies: [{ kind: "component", type: ChartComponent, selector: "csdk-chart", inputs: ["chartType", "dataSet", "dataOptions", "filters", "highlights", "styleOptions", "beforeRender", "dataReady"], outputs: ["dataPointClick", "dataPointContextMenu", "dataPointsSelect"] }] });
2726
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PieChartComponent, decorators: [{
2727
- type: Component,
2607
+ /**
2608
+ * Retrieves an existing widget model from the Sisense instance.
2609
+ *
2610
+ * @param params - Parameters to identify the target widget
2611
+ * @returns Widget model
2612
+ */
2613
+ getWidgetModel(params) {
2614
+ return __awaiter(this, void 0, void 0, function* () {
2615
+ const { dashboardOid, widgetOid } = params;
2616
+ const app = yield this.sisenseContextService.getApp();
2617
+ return getWidgetModel(app.httpClient, dashboardOid, widgetOid);
2618
+ });
2619
+ }
2620
+ /**
2621
+ * Adds Jump To Dashboard (JTD) functionality to widget props.
2622
+ *
2623
+ * Jump To Dashboard (JTD) allows users to navigate from one dashboard to another when interacting with widgets,
2624
+ * such as clicking on chart data points or using context menus. This method is particularly useful when rendering
2625
+ * Widget components directly (not through a Dashboard component), but you still want JTD navigation functionality.
2626
+ *
2627
+ * For widgets that are part of a dashboard, consider using `applyJtdConfig` or `applyJtdConfigs` instead,
2628
+ * as they apply JTD configuration at the dashboard level rather than individual widget level.
2629
+ *
2630
+ * Note: dashboard-only 'includeDashboardFilters' is not supported and would just be ignored, since we do not have a dashboard in the current context.
2631
+ *
2632
+ * This method enhances the provided widget props with JTD navigation capabilities, including:
2633
+ * - Click and right-click event handlers for navigation
2634
+ * - Hyperlink styling for actionable pivot cells (when applicable)
2635
+ * - JTD icon display in widget headers
2636
+ * @example
2637
+ * ```TypeScript
2638
+ * import { Component, OnDestroy } from '@angular/core';
2639
+ * import {
2640
+ * WidgetService,
2641
+ * widgetModelTranslator,
2642
+ * type WidgetProps,
2643
+ * } from '@sisense/sdk-ui-angular';
2644
+ * import { BehaviorSubject } from 'rxjs';
2645
+ *
2646
+ * @Component({
2647
+ * selector: 'code-example',
2648
+ * template: `
2649
+ * <csdk-widget
2650
+ * *ngIf="widgetProps$ && (widgetProps$ | async) as widgetProps"
2651
+ * [id]="widgetProps.id"
2652
+ * [widgetType]="widgetProps.widgetType"
2653
+ * [chartType]="widgetProps.chartType"
2654
+ * [title]="widgetProps.title"
2655
+ * [dataSource]="widgetProps.dataSource"
2656
+ * [dataOptions]="widgetProps.dataOptions"
2657
+ * [filters]="widgetProps.filters"
2658
+ * [highlights]="widgetProps.highlights"
2659
+ * [styleOptions]="widgetProps.styleOptions"
2660
+ * [beforeMenuOpen]="widgetProps.beforeMenuOpen"
2661
+ * (dataPointClick)="widgetProps.dataPointClick?.($event)"
2662
+ * (dataPointContextMenu)="widgetProps.dataPointContextMenu?.($event)"
2663
+ * (dataPointsSelect)="widgetProps.dataPointsSelect?.($event)"
2664
+ * />
2665
+ * `,
2666
+ * })
2667
+ * export class CodeExample implements OnDestroy {
2668
+ * constructor(private widgetService: WidgetService) {}
2669
+ *
2670
+ * widgetProps$: BehaviorSubject<WidgetProps | null> | null = null;
2671
+ * private jtdDestroy: (() => void) | null = null;
2672
+ *
2673
+ * async ngOnInit(): Promise<void> {
2674
+ * const widget = await this.widgetService.getWidgetModel({
2675
+ * dashboardOid: '65a82171719e7f004018691c',
2676
+ * widgetOid: '65a82171719e7f004018691f',
2677
+ * });
2678
+ *
2679
+ * const baseProps = widget
2680
+ * ? widgetModelTranslator.toWidgetProps(widget)
2681
+ * : null;
2682
+ *
2683
+ * if (baseProps) {
2684
+ * const jtdConfig = {
2685
+ * targets: [{ id: 'target-dashboard-id', caption: 'Details' }],
2686
+ * interaction: { triggerMethod: 'rightclick' },
2687
+ * };
2688
+ * const jtdResult = this.widgetService.createJtdWidget(
2689
+ * baseProps,
2690
+ * jtdConfig,
2691
+ * );
2692
+ * this.widgetProps$ = jtdResult.widget$;
2693
+ * this.jtdDestroy = jtdResult.destroy;
2694
+ * }
2695
+ * }
2696
+ *
2697
+ * ngOnDestroy(): void {
2698
+ * this.jtdDestroy?.();
2699
+ * }
2700
+ * }
2701
+ * ```
2702
+ *
2703
+ * @param widgetProps - Base widget props to enhance with JTD functionality
2704
+ * @param jtdConfig - JTD configuration defining navigation targets and behavior
2705
+ * @returns Object containing:
2706
+ * - `widget$`: The observable that emits enhanced widget props with JTD handlers.
2707
+ * - `destroy`: Function to clean up resources. Call this when the component is destroyed.
2708
+ * @group Dashboards
2709
+ */
2710
+ createJtdWidget(widgetProps, jtdConfig) {
2711
+ // Create BehaviorSubject initialized with base props (or null)
2712
+ const enhancedProps$ = new BehaviorSubject(widgetProps);
2713
+ if (!widgetProps) {
2714
+ return {
2715
+ widget$: enhancedProps$,
2716
+ destroy: () => {
2717
+ enhancedProps$.complete();
2718
+ },
2719
+ };
2720
+ }
2721
+ // Create HookAdapter with useJtdWidget hook and context connectors
2722
+ const hookAdapter = new HookAdapter(useJtdWidget, [
2723
+ createSisenseContextConnector(this.sisenseContextService),
2724
+ createThemeContextConnector(this.themeService),
2725
+ ]);
2726
+ // Convert Angular props to preact props
2727
+ const preactProps = translateToPreactWidgetProps(widgetProps);
2728
+ // Subscribe to hook adapter results and capture the subscription
2729
+ const hookAdapterSubscription = hookAdapter.subscribe((enhancedPreactProps) => {
2730
+ if (enhancedPreactProps) {
2731
+ // Convert back to Angular props
2732
+ const angularProps = translateFromPreactWidgetProps(enhancedPreactProps);
2733
+ enhancedProps$.next(angularProps);
2734
+ }
2735
+ else {
2736
+ enhancedProps$.next(null);
2737
+ }
2738
+ });
2739
+ // Run the hook with widget props and JTD config
2740
+ // This will trigger the subscription above asynchronously when React contexts are ready
2741
+ hookAdapter.run(preactProps, jtdConfig);
2742
+ // Return the BehaviorSubject and destroy function for cleanup
2743
+ return {
2744
+ widget$: enhancedProps$,
2745
+ destroy: () => {
2746
+ // Unsubscribe from hook adapter
2747
+ hookAdapterSubscription.unsubscribe();
2748
+ // Destroy the hook adapter to clean up React components and contexts
2749
+ hookAdapter.destroy();
2750
+ // Complete the BehaviorSubject to release subscribers and avoid leaks
2751
+ enhancedProps$.complete();
2752
+ },
2753
+ };
2754
+ }
2755
+ };
2756
+ WidgetService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WidgetService, deps: [{ token: SisenseContextService }, { token: ThemeService }], target: i0.ɵɵFactoryTarget.Injectable });
2757
+ WidgetService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WidgetService, providedIn: 'root' });
2758
+ WidgetService = __decorate([
2759
+ TrackableService(['getWidgetModel', 'createJtdWidget'])
2760
+ ], WidgetService);
2761
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WidgetService, decorators: [{
2762
+ type: Injectable,
2728
2763
  args: [{
2729
- selector: 'csdk-pie-chart',
2730
- template: `
2731
- <csdk-chart
2732
- [chartType]="chartType"
2733
- [dataSet]="dataSet"
2734
- [dataOptions]="dataOptions"
2735
- [filters]="filters"
2736
- [highlights]="highlights"
2737
- [styleOptions]="styleOptions"
2738
- [beforeRender]="beforeRender"
2739
- [dataReady]="dataReady"
2740
- (dataPointClick)="dataPointClick.emit($any($event))"
2741
- (dataPointContextMenu)="dataPointContextMenu.emit($any($event))"
2742
- (dataPointsSelect)="dataPointsSelect.emit($any($event))"
2743
- />
2744
- `,
2764
+ providedIn: 'root',
2745
2765
  }]
2746
- }], propDecorators: { dataSet: [{
2747
- type: Input
2748
- }], dataOptions: [{
2749
- type: Input
2750
- }], filters: [{
2751
- type: Input
2752
- }], highlights: [{
2753
- type: Input
2754
- }], styleOptions: [{
2755
- type: Input
2756
- }], beforeRender: [{
2757
- type: Input
2758
- }], dataReady: [{
2759
- type: Input
2760
- }], dataPointClick: [{
2761
- type: Output
2762
- }], dataPointContextMenu: [{
2763
- type: Output
2764
- }], dataPointsSelect: [{
2765
- type: Output
2766
- }] } });
2766
+ }], ctorParameters: function () { return [{ type: SisenseContextService }, { type: ThemeService }]; } });
2767
2767
 
2768
2768
  /**
2769
2769
  * Pivot Table with and pagination.