intelica-library-ui 0.1.228 → 0.1.231
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.
- package/fesm2022/intelica-library-ui.mjs +240 -43
- package/fesm2022/intelica-library-ui.mjs.map +1 -1
- package/lib/components/dashboard-qs/dashboard-qs.component.d.ts +18 -3
- package/lib/components/dashboard-qs-interactive/dashboard-qs-interactive.component.d.ts +34 -0
- package/lib/constants/quicksight.constants.d.ts +10 -0
- package/lib/dto/embed-dashboard-command.d.ts +4 -0
- package/lib/dto/embed-visual-command.d.ts +5 -0
- package/lib/functions/quicksight-event.util.d.ts +3 -0
- package/lib/model/quicksight.model.d.ts +30 -0
- package/lib/services/shared.d.ts +16 -20
- package/package.json +1 -1
- package/public-api.d.ts +4 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, signal, Pipe, Component, HostListener, Directive, EventEmitter, Output, Input, forwardRef, TemplateRef, ContentChild, ContentChildren, ViewChild, PLATFORM_ID, Inject, ChangeDetectorRef, computed, effect, ViewChildren, Optional, Host } from '@angular/core';
|
|
2
|
+
import { inject, Injectable, signal, Pipe, Component, HostListener, Directive, EventEmitter, Output, Input, forwardRef, TemplateRef, ContentChild, ContentChildren, ViewChild, PLATFORM_ID, Inject, ChangeDetectorRef, input, computed, output, effect, ViewChildren, Optional, Host } from '@angular/core';
|
|
3
3
|
import { getCookie, Cookies, setCookie } from 'typescript-cookie';
|
|
4
|
-
import { HttpClient, HttpHeaders, HttpResponse
|
|
4
|
+
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
|
|
5
5
|
import { BehaviorSubject, catchError, throwError, from, switchMap, Subject, Subscription, firstValueFrom, of, tap as tap$1, map } from 'rxjs';
|
|
6
6
|
import Swal from 'sweetalert2';
|
|
7
7
|
import { tap } from 'rxjs/operators';
|
|
@@ -49,6 +49,8 @@ import { AccordionModule } from 'primeng/accordion';
|
|
|
49
49
|
import { ActivatedRoute } from '@angular/router';
|
|
50
50
|
import { createEmbeddingContext } from 'amazon-quicksight-embedding-sdk';
|
|
51
51
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
52
|
+
import * as i2$4 from 'primeng/panel';
|
|
53
|
+
import { PanelModule } from 'primeng/panel';
|
|
52
54
|
import * as XLSX from 'xlsx';
|
|
53
55
|
import { Workbook } from 'exceljs';
|
|
54
56
|
import { saveAs } from 'file-saver';
|
|
@@ -261,6 +263,17 @@ const DateModeOptions = {
|
|
|
261
263
|
Year: { value: "year", format: "y" },
|
|
262
264
|
};
|
|
263
265
|
|
|
266
|
+
const QuicksightEventName = {
|
|
267
|
+
ERROR_OCCURRED: "ERROR_OCCURRED",
|
|
268
|
+
CONTENT_LOADED: "CONTENT_LOADED",
|
|
269
|
+
PARAMETERS_CHANGED: "PARAMETERS_CHANGED",
|
|
270
|
+
SIZE_CHANGED: "SIZE_CHANGED",
|
|
271
|
+
SELECTED_SHEET_CHANGED: "SELECTED_SHEET_CHANGED",
|
|
272
|
+
MODAL_OPENED: "MODAL_OPENED",
|
|
273
|
+
EXPERIENCE_INITIALIZED: "EXPERIENCE_INITIALIZED",
|
|
274
|
+
};
|
|
275
|
+
const QUICKSIGHT_AUTH_ERROR_CODES = ["Forbidden", "Unauthorized", "EmbeddingNotAuthorized", "TokenExpired"];
|
|
276
|
+
|
|
264
277
|
class FeatureFlagService {
|
|
265
278
|
_http = inject(HttpClient);
|
|
266
279
|
_configService = inject(ConfigService);
|
|
@@ -6643,33 +6656,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
6643
6656
|
class Shared {
|
|
6644
6657
|
http = inject(HttpClient);
|
|
6645
6658
|
configService = inject(ConfigService);
|
|
6646
|
-
path = `${this.configService.environment?.sharedPath}
|
|
6647
|
-
getEmbedUrl(
|
|
6648
|
-
return this.http.
|
|
6649
|
-
}
|
|
6650
|
-
getEmbedVisualUrl(
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
Object.entries(request.parameters).forEach(([key, values]) => {
|
|
6656
|
-
values.forEach(value => {
|
|
6657
|
-
params = params.append(`parameters[${key}]`, value);
|
|
6658
|
-
});
|
|
6659
|
-
});
|
|
6660
|
-
return this.http.get(`${this.path}/embed-visual-url`, { params });
|
|
6661
|
-
}
|
|
6662
|
-
getEmbedVisualUrlsAnonymous(request) {
|
|
6663
|
-
let params = new HttpParams()
|
|
6664
|
-
.set('dashboardId', request.dashboardId)
|
|
6665
|
-
.set('sheetId', request.sheetId)
|
|
6666
|
-
.set('visualId', request.visualId);
|
|
6667
|
-
Object.entries(request.parameters).forEach(([key, values]) => {
|
|
6668
|
-
values.forEach(value => {
|
|
6669
|
-
params = params.append(`parameters[${key}]`, value);
|
|
6670
|
-
});
|
|
6671
|
-
});
|
|
6672
|
-
return this.http.get(`${this.path}/embed-visual-anonymous`, { params });
|
|
6659
|
+
path = `${this.configService.environment?.sharedPath}`;
|
|
6660
|
+
getEmbedUrl(command) {
|
|
6661
|
+
return this.http.post(`${this.path}/quicksight-embed-url`, command);
|
|
6662
|
+
}
|
|
6663
|
+
getEmbedVisualUrl(command) {
|
|
6664
|
+
return this.http.post(`${this.path}/quicksight-embed-visual-url`, command);
|
|
6665
|
+
}
|
|
6666
|
+
getEmbedVisualUrlsAnonymous(command) {
|
|
6667
|
+
return this.http.post(`${this.path}/quicksight-embed-visual-anonymous`, command);
|
|
6673
6668
|
}
|
|
6674
6669
|
async createEmbedContext(embedUrl, container, options) {
|
|
6675
6670
|
const embeddingContext = await createEmbeddingContext();
|
|
@@ -6678,12 +6673,44 @@ class Shared {
|
|
|
6678
6673
|
container,
|
|
6679
6674
|
...(options?.height && { height: options.height }),
|
|
6680
6675
|
...(options?.width && { width: options.width }),
|
|
6676
|
+
}, {
|
|
6677
|
+
...(options?.onMessage && { onMessage: this.toSdkMessageListener(options.onMessage) }),
|
|
6681
6678
|
});
|
|
6682
6679
|
}
|
|
6683
|
-
async embedDashboard(
|
|
6684
|
-
|
|
6680
|
+
async embedDashboard(command, container, options) {
|
|
6681
|
+
container.replaceChildren();
|
|
6682
|
+
const embedUrl = await firstValueFrom(this.getEmbedUrl(command));
|
|
6685
6683
|
await this.createEmbedContext(embedUrl, container, options);
|
|
6686
6684
|
}
|
|
6685
|
+
async embedDashboardInteractive(command, container, options) {
|
|
6686
|
+
container.replaceChildren();
|
|
6687
|
+
const embedUrl = await firstValueFrom(this.getEmbedUrl({ ...command, parameters: undefined }));
|
|
6688
|
+
const embeddingContext = await createEmbeddingContext();
|
|
6689
|
+
const sdkParameters = command.parameters ? Object.entries(command.parameters).map(([Name, Values]) => ({ Name, Values })) : undefined;
|
|
6690
|
+
return await embeddingContext.embedDashboard({
|
|
6691
|
+
url: embedUrl,
|
|
6692
|
+
container,
|
|
6693
|
+
...(options?.height && { height: options.height }),
|
|
6694
|
+
...(options?.width && { width: options.width }),
|
|
6695
|
+
}, {
|
|
6696
|
+
...(sdkParameters ? { parameters: sdkParameters } : {}),
|
|
6697
|
+
...(options?.onMessage && { onMessage: this.toSdkMessageListener(options.onMessage) }),
|
|
6698
|
+
});
|
|
6699
|
+
}
|
|
6700
|
+
toSdkMessageListener(emit) {
|
|
6701
|
+
return (changeEvent) => {
|
|
6702
|
+
emit({
|
|
6703
|
+
eventName: changeEvent?.eventName,
|
|
6704
|
+
eventLevel: changeEvent?.eventLevel,
|
|
6705
|
+
message: changeEvent?.message,
|
|
6706
|
+
data: changeEvent?.data,
|
|
6707
|
+
});
|
|
6708
|
+
};
|
|
6709
|
+
}
|
|
6710
|
+
async setDashboardParameters(dashboard, parameters) {
|
|
6711
|
+
const sdkParameters = Object.entries(parameters).map(([Name, Values]) => ({ Name, Values }));
|
|
6712
|
+
await dashboard.setParameters(sdkParameters);
|
|
6713
|
+
}
|
|
6687
6714
|
async createEmbedVisualContext(embedUrl, container, options) {
|
|
6688
6715
|
const embeddingContext = await createEmbeddingContext();
|
|
6689
6716
|
await embeddingContext.embedVisual({
|
|
@@ -6693,16 +6720,43 @@ class Shared {
|
|
|
6693
6720
|
...(options?.width && { width: options.width }),
|
|
6694
6721
|
}, { scaleToContainer: true, fitToIframeWidth: false });
|
|
6695
6722
|
}
|
|
6696
|
-
async embedSequentialVisuals(
|
|
6723
|
+
async embedSequentialVisuals(command, configs, onVisualLoaded) {
|
|
6697
6724
|
for (const config of configs) {
|
|
6698
6725
|
config.container?.nativeElement?.replaceChildren();
|
|
6699
|
-
const { visual } = await firstValueFrom(this.getEmbedVisualUrl({ dashboardId, sheetId, visualId: config.visualId, parameters }));
|
|
6726
|
+
const { visual } = await firstValueFrom(this.getEmbedVisualUrl({ dashboardId: command.dashboardId, sheetId: command.sheetId, visualId: config.visualId, parameters: command.parameters }));
|
|
6700
6727
|
if (!visual)
|
|
6701
6728
|
continue;
|
|
6702
6729
|
await this.createEmbedVisualContext(visual.embedUrl, config.container.nativeElement);
|
|
6703
6730
|
onVisualLoaded?.(config.visualId);
|
|
6704
6731
|
}
|
|
6705
6732
|
}
|
|
6733
|
+
async embedSequentialVisualsInteractive(command, configs, onVisualLoaded) {
|
|
6734
|
+
const refs = new Map();
|
|
6735
|
+
const sdkParameters = command.parameters ? Object.entries(command.parameters).map(([Name, Values]) => ({ Name, Values })) : undefined;
|
|
6736
|
+
for (const config of configs) {
|
|
6737
|
+
config.container?.nativeElement?.replaceChildren();
|
|
6738
|
+
const { visual } = await firstValueFrom(this.getEmbedVisualUrl({ dashboardId: command.dashboardId, sheetId: command.sheetId, visualId: config.visualId, parameters: {} }));
|
|
6739
|
+
if (!visual)
|
|
6740
|
+
continue;
|
|
6741
|
+
const embeddingContext = await createEmbeddingContext();
|
|
6742
|
+
const visualRef = await embeddingContext.embedVisual({ url: visual.embedUrl, container: config.container.nativeElement }, {
|
|
6743
|
+
scaleToContainer: true,
|
|
6744
|
+
fitToIframeWidth: false,
|
|
6745
|
+
...(sdkParameters ? { parameters: sdkParameters } : {}),
|
|
6746
|
+
});
|
|
6747
|
+
refs.set(config.visualId, visualRef);
|
|
6748
|
+
onVisualLoaded?.(config.visualId, visualRef);
|
|
6749
|
+
}
|
|
6750
|
+
return refs;
|
|
6751
|
+
}
|
|
6752
|
+
async setVisualParameters(visual, parameters) {
|
|
6753
|
+
const sdkParameters = Object.entries(parameters).map(([Name, Values]) => ({ Name, Values }));
|
|
6754
|
+
await visual.setParameters(sdkParameters);
|
|
6755
|
+
}
|
|
6756
|
+
async setVisualsParameters(visuals, parameters) {
|
|
6757
|
+
const sdkParameters = Object.entries(parameters).map(([Name, Values]) => ({ Name, Values }));
|
|
6758
|
+
await Promise.all([...visuals].map(v => v.setParameters(sdkParameters)));
|
|
6759
|
+
}
|
|
6706
6760
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: Shared, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6707
6761
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: Shared, providedIn: 'root' });
|
|
6708
6762
|
}
|
|
@@ -6713,47 +6767,190 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
6713
6767
|
}]
|
|
6714
6768
|
}] });
|
|
6715
6769
|
|
|
6770
|
+
function isQuicksightSessionExpiredEvent(event) {
|
|
6771
|
+
if (event.eventName !== QuicksightEventName.ERROR_OCCURRED)
|
|
6772
|
+
return false;
|
|
6773
|
+
const code = event.data?.errorCode ?? event.data?.code ?? "";
|
|
6774
|
+
return typeof code === "string" && QUICKSIGHT_AUTH_ERROR_CODES.some(c => code.includes(c));
|
|
6775
|
+
}
|
|
6776
|
+
function dispatchQuicksightEvent(event, outputs) {
|
|
6777
|
+
outputs.sdkEvent.emit(event);
|
|
6778
|
+
if (event.eventName === QuicksightEventName.CONTENT_LOADED)
|
|
6779
|
+
outputs.contentLoaded?.emit(event);
|
|
6780
|
+
if (event.eventName === QuicksightEventName.ERROR_OCCURRED) {
|
|
6781
|
+
outputs.errorOccurred?.emit(event);
|
|
6782
|
+
if (isQuicksightSessionExpiredEvent(event))
|
|
6783
|
+
outputs.sessionExpired?.emit(event);
|
|
6784
|
+
}
|
|
6785
|
+
}
|
|
6786
|
+
|
|
6716
6787
|
class DashboardQsComponent {
|
|
6717
6788
|
sharedService = inject(Shared);
|
|
6789
|
+
sweetAlertService = inject(SweetAlertService);
|
|
6790
|
+
termPipe = inject(TermPipe);
|
|
6791
|
+
GlobalTermService = inject(GlobalTermService);
|
|
6718
6792
|
route = inject(ActivatedRoute);
|
|
6793
|
+
sessionExpiredShown = false;
|
|
6719
6794
|
containers;
|
|
6795
|
+
dashboardIdInput = input(undefined, { alias: 'dashboardId' });
|
|
6796
|
+
parametersInput = input(undefined, { alias: 'parameters' });
|
|
6797
|
+
heightInput = input(undefined, { alias: 'height' });
|
|
6720
6798
|
routeData = toSignal(this.route.data, { initialValue: this.route.snapshot.data });
|
|
6721
|
-
dashboardId = computed(() => this.routeData()['dashboardId']);
|
|
6722
|
-
|
|
6799
|
+
dashboardId = computed(() => this.dashboardIdInput() ?? this.routeData()['dashboardId']);
|
|
6800
|
+
parameters = computed(() => this.parametersInput() ?? this.routeData()['parameters']);
|
|
6801
|
+
height = computed(() => this.heightInput() ?? this.routeData()['height']);
|
|
6723
6802
|
isLoading = signal(true);
|
|
6803
|
+
isLoadingChange = output();
|
|
6804
|
+
sdkEvent = output();
|
|
6805
|
+
contentLoaded = output();
|
|
6806
|
+
errorOccurred = output();
|
|
6807
|
+
sessionExpired = output();
|
|
6724
6808
|
viewReady = signal(false);
|
|
6725
6809
|
constructor() {
|
|
6810
|
+
effect(() => {
|
|
6811
|
+
this.isLoadingChange.emit(this.isLoading());
|
|
6812
|
+
});
|
|
6726
6813
|
effect(() => {
|
|
6727
6814
|
const id = this.dashboardId();
|
|
6815
|
+
const parameters = this.parameters();
|
|
6728
6816
|
if (!this.viewReady() || !id)
|
|
6729
6817
|
return;
|
|
6730
|
-
this.EmbedDashboard(id);
|
|
6818
|
+
this.EmbedDashboard(id, parameters);
|
|
6731
6819
|
});
|
|
6732
6820
|
}
|
|
6733
6821
|
ngAfterViewInit() {
|
|
6734
6822
|
this.viewReady.set(true);
|
|
6735
6823
|
}
|
|
6736
|
-
async EmbedDashboard(dashboardId) {
|
|
6824
|
+
async EmbedDashboard(dashboardId, parameters) {
|
|
6737
6825
|
const container = this.containers.first?.nativeElement;
|
|
6738
6826
|
if (!container)
|
|
6739
6827
|
return;
|
|
6740
6828
|
this.isLoading.set(true);
|
|
6741
6829
|
try {
|
|
6742
|
-
await this.sharedService.embedDashboard(dashboardId, container
|
|
6830
|
+
await this.sharedService.embedDashboard({ dashboardId, parameters }, container, {
|
|
6831
|
+
height: this.height() ?? `${window.innerHeight - 50}px`,
|
|
6832
|
+
onMessage: event => {
|
|
6833
|
+
dispatchQuicksightEvent(event, this);
|
|
6834
|
+
if (event.eventName === QuicksightEventName.CONTENT_LOADED || event.eventName === QuicksightEventName.ERROR_OCCURRED)
|
|
6835
|
+
this.isLoading.set(false);
|
|
6836
|
+
if (isQuicksightSessionExpiredEvent(event))
|
|
6837
|
+
this.handleSessionExpired();
|
|
6838
|
+
},
|
|
6839
|
+
});
|
|
6743
6840
|
}
|
|
6744
6841
|
catch (error) {
|
|
6745
6842
|
console.error('Error embedding dashboard:', error);
|
|
6746
|
-
}
|
|
6747
|
-
finally {
|
|
6748
6843
|
this.isLoading.set(false);
|
|
6749
6844
|
}
|
|
6750
6845
|
}
|
|
6846
|
+
async handleSessionExpired() {
|
|
6847
|
+
if (this.sessionExpiredShown)
|
|
6848
|
+
return;
|
|
6849
|
+
this.sessionExpiredShown = true;
|
|
6850
|
+
const result = await this.sweetAlertService.confirmBox(this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_MESSAGE', this.GlobalTermService.languageCode), this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_CONFIRM', this.GlobalTermService.languageCode), this.termPipe.transform('CANCEL', this.GlobalTermService.languageCode), this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_TITLE', this.GlobalTermService.languageCode));
|
|
6851
|
+
if (result.isConfirmed)
|
|
6852
|
+
window.location.reload();
|
|
6853
|
+
else
|
|
6854
|
+
this.sessionExpiredShown = false;
|
|
6855
|
+
}
|
|
6751
6856
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: DashboardQsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6752
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
6857
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: DashboardQsComponent, isStandalone: true, selector: "intelica-dashboard-qs", inputs: { dashboardIdInput: { classPropertyName: "dashboardIdInput", publicName: "dashboardId", isSignal: true, isRequired: false, transformFunction: null }, parametersInput: { classPropertyName: "parametersInput", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, heightInput: { classPropertyName: "heightInput", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isLoadingChange: "isLoadingChange", sdkEvent: "sdkEvent", contentLoaded: "contentLoaded", errorOccurred: "errorOccurred", sessionExpired: "sessionExpired" }, viewQueries: [{ propertyName: "containers", predicate: ["visualContainer"], descendants: true }], ngImport: i0, template: "@if (isLoading()) {\r\n<div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <div class=\"u-display-flex u-background-white u-px-1 u-pt-1\">\r\n <div class=\"u-display-flex u-flex-column u-px-1\" style=\"height: 33px\">\r\n <p-skeleton class=\"prSkeleton u-m-auto\" [width]=\"'61px'\" [height]=\"'14px'\" />\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'2px'\" />\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-px-1\" style=\"height: 33px\">\r\n <p-skeleton class=\"prSkeleton u-m-auto\" [width]=\"'61px'\" [height]=\"'14px'\" />\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'2px'\" />\r\n </div>\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '1061.57 / 93.02' }\" />\r\n </p-panel>\r\n </div>\r\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\r\n @for (_ of [].constructor(4); track $index) {\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '244.87 / 123.12' }\" />\r\n </p-panel>\r\n }\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '1061.57 / 303.7' }\" />\r\n </p-panel>\r\n </div>\r\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\r\n @for (_ of [].constructor(2); track $index) {\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '517.1 / 123.12' }\" />\r\n </p-panel>\r\n }\r\n </div>\r\n</div>\r\n}\r\n<div #visualContainer [style.height]=\"height()\" [hidden]=\"isLoading()\"></div>", dependencies: [{ kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i2$3.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: PanelModule }, { kind: "component", type: i2$4.Panel, selector: "p-panel", inputs: ["toggleable", "header", "collapsed", "style", "styleClass", "iconPos", "expandIcon", "collapseIcon", "showHeader", "toggler", "transitionOptions", "toggleButtonProps"], outputs: ["collapsedChange", "onBeforeToggle", "onAfterToggle"] }] });
|
|
6753
6858
|
}
|
|
6754
6859
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: DashboardQsComponent, decorators: [{
|
|
6755
6860
|
type: Component,
|
|
6756
|
-
args: [{ selector: 'intelica-dashboard-qs', imports: [], template: "<div #visualContainer [style.height]=\"height()\" [
|
|
6861
|
+
args: [{ selector: 'intelica-dashboard-qs', imports: [SkeletonModule, PanelModule], template: "@if (isLoading()) {\r\n<div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <div class=\"u-display-flex u-background-white u-px-1 u-pt-1\">\r\n <div class=\"u-display-flex u-flex-column u-px-1\" style=\"height: 33px\">\r\n <p-skeleton class=\"prSkeleton u-m-auto\" [width]=\"'61px'\" [height]=\"'14px'\" />\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'2px'\" />\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-px-1\" style=\"height: 33px\">\r\n <p-skeleton class=\"prSkeleton u-m-auto\" [width]=\"'61px'\" [height]=\"'14px'\" />\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'2px'\" />\r\n </div>\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '1061.57 / 93.02' }\" />\r\n </p-panel>\r\n </div>\r\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\r\n @for (_ of [].constructor(4); track $index) {\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '244.87 / 123.12' }\" />\r\n </p-panel>\r\n }\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '1061.57 / 303.7' }\" />\r\n </p-panel>\r\n </div>\r\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\r\n @for (_ of [].constructor(2); track $index) {\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '517.1 / 123.12' }\" />\r\n </p-panel>\r\n }\r\n </div>\r\n</div>\r\n}\r\n<div #visualContainer [style.height]=\"height()\" [hidden]=\"isLoading()\"></div>" }]
|
|
6862
|
+
}], ctorParameters: () => [], propDecorators: { containers: [{
|
|
6863
|
+
type: ViewChildren,
|
|
6864
|
+
args: ['visualContainer']
|
|
6865
|
+
}] } });
|
|
6866
|
+
|
|
6867
|
+
class DashboardQsInteractiveComponent {
|
|
6868
|
+
sharedService = inject(Shared);
|
|
6869
|
+
sweetAlertService = inject(SweetAlertService);
|
|
6870
|
+
termPipe = inject(TermPipe);
|
|
6871
|
+
GlobalTermService = inject(GlobalTermService);
|
|
6872
|
+
route = inject(ActivatedRoute);
|
|
6873
|
+
sessionExpiredShown = false;
|
|
6874
|
+
containers;
|
|
6875
|
+
dashboardIdInput = input(undefined, { alias: 'dashboardId' });
|
|
6876
|
+
parametersInput = input(undefined, { alias: 'parameters' });
|
|
6877
|
+
heightInput = input(undefined, { alias: 'height' });
|
|
6878
|
+
routeData = toSignal(this.route.data, { initialValue: this.route.snapshot.data });
|
|
6879
|
+
dashboardId = computed(() => this.dashboardIdInput() ?? this.routeData()['dashboardId']);
|
|
6880
|
+
parameters = computed(() => this.parametersInput() ?? this.routeData()['parameters']);
|
|
6881
|
+
height = computed(() => this.heightInput() ?? this.routeData()['height']);
|
|
6882
|
+
isLoading = signal(true);
|
|
6883
|
+
isLoadingChange = output();
|
|
6884
|
+
sdkEvent = output();
|
|
6885
|
+
contentLoaded = output();
|
|
6886
|
+
errorOccurred = output();
|
|
6887
|
+
sessionExpired = output();
|
|
6888
|
+
viewReady = signal(false);
|
|
6889
|
+
dashboardRef = null;
|
|
6890
|
+
lastEmbeddedId = undefined;
|
|
6891
|
+
constructor() {
|
|
6892
|
+
effect(() => {
|
|
6893
|
+
this.isLoadingChange.emit(this.isLoading());
|
|
6894
|
+
});
|
|
6895
|
+
effect(() => {
|
|
6896
|
+
const id = this.dashboardId();
|
|
6897
|
+
if (!this.viewReady() || !id)
|
|
6898
|
+
return;
|
|
6899
|
+
if (id === this.lastEmbeddedId)
|
|
6900
|
+
return;
|
|
6901
|
+
this.lastEmbeddedId = id;
|
|
6902
|
+
this.firstEmbed(id);
|
|
6903
|
+
});
|
|
6904
|
+
effect(() => {
|
|
6905
|
+
const params = this.parameters();
|
|
6906
|
+
if (!this.dashboardRef || !params)
|
|
6907
|
+
return;
|
|
6908
|
+
this.isLoading.set(true);
|
|
6909
|
+
this.sharedService.setDashboardParameters(this.dashboardRef, params)
|
|
6910
|
+
.catch(() => this.isLoading.set(false));
|
|
6911
|
+
});
|
|
6912
|
+
}
|
|
6913
|
+
ngAfterViewInit() {
|
|
6914
|
+
this.viewReady.set(true);
|
|
6915
|
+
}
|
|
6916
|
+
async firstEmbed(dashboardId) {
|
|
6917
|
+
const container = this.containers.first?.nativeElement;
|
|
6918
|
+
if (!container)
|
|
6919
|
+
return;
|
|
6920
|
+
this.isLoading.set(true);
|
|
6921
|
+
try {
|
|
6922
|
+
this.dashboardRef = await this.sharedService.embedDashboardInteractive({ dashboardId, parameters: this.parameters() }, container, {
|
|
6923
|
+
height: this.height() ?? `${window.innerHeight - 50}px`,
|
|
6924
|
+
onMessage: event => {
|
|
6925
|
+
dispatchQuicksightEvent(event, this);
|
|
6926
|
+
if (event.eventName === QuicksightEventName.CONTENT_LOADED || event.eventName === QuicksightEventName.ERROR_OCCURRED || event.eventName === QuicksightEventName.PARAMETERS_CHANGED)
|
|
6927
|
+
this.isLoading.set(false);
|
|
6928
|
+
if (isQuicksightSessionExpiredEvent(event))
|
|
6929
|
+
this.handleSessionExpired();
|
|
6930
|
+
},
|
|
6931
|
+
});
|
|
6932
|
+
}
|
|
6933
|
+
catch (error) {
|
|
6934
|
+
console.error('Error embedding dashboard:', error);
|
|
6935
|
+
this.isLoading.set(false);
|
|
6936
|
+
}
|
|
6937
|
+
}
|
|
6938
|
+
async handleSessionExpired() {
|
|
6939
|
+
if (this.sessionExpiredShown)
|
|
6940
|
+
return;
|
|
6941
|
+
this.sessionExpiredShown = true;
|
|
6942
|
+
const result = await this.sweetAlertService.confirmBox(this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_MESSAGE', this.GlobalTermService.languageCode), this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_CONFIRM', this.GlobalTermService.languageCode), this.termPipe.transform('CANCEL', this.GlobalTermService.languageCode), this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_TITLE', this.GlobalTermService.languageCode));
|
|
6943
|
+
if (result.isConfirmed)
|
|
6944
|
+
window.location.reload();
|
|
6945
|
+
else
|
|
6946
|
+
this.sessionExpiredShown = false;
|
|
6947
|
+
}
|
|
6948
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: DashboardQsInteractiveComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6949
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: DashboardQsInteractiveComponent, isStandalone: true, selector: "intelica-dashboard-qs-interactive", inputs: { dashboardIdInput: { classPropertyName: "dashboardIdInput", publicName: "dashboardId", isSignal: true, isRequired: false, transformFunction: null }, parametersInput: { classPropertyName: "parametersInput", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, heightInput: { classPropertyName: "heightInput", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isLoadingChange: "isLoadingChange", sdkEvent: "sdkEvent", contentLoaded: "contentLoaded", errorOccurred: "errorOccurred", sessionExpired: "sessionExpired" }, viewQueries: [{ propertyName: "containers", predicate: ["visualContainer"], descendants: true }], ngImport: i0, template: "@if (isLoading()) {\r\n<div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <div class=\"u-display-flex u-background-white u-px-1 u-pt-1\">\r\n <div class=\"u-display-flex u-flex-column u-px-1\" style=\"height: 33px\">\r\n <p-skeleton class=\"prSkeleton u-m-auto\" [width]=\"'61px'\" [height]=\"'14px'\" />\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'2px'\" />\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-px-1\" style=\"height: 33px\">\r\n <p-skeleton class=\"prSkeleton u-m-auto\" [width]=\"'61px'\" [height]=\"'14px'\" />\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'2px'\" />\r\n </div>\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '1061.57 / 93.02' }\" />\r\n </p-panel>\r\n </div>\r\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\r\n @for (_ of [].constructor(4); track $index) {\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '244.87 / 123.12' }\" />\r\n </p-panel>\r\n }\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '1061.57 / 303.7' }\" />\r\n </p-panel>\r\n </div>\r\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\r\n @for (_ of [].constructor(2); track $index) {\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '517.1 / 123.12' }\" />\r\n </p-panel>\r\n }\r\n </div>\r\n</div>\r\n}\r\n<div #visualContainer [style.height]=\"height()\" [hidden]=\"isLoading()\"></div>", dependencies: [{ kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i2$3.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: PanelModule }, { kind: "component", type: i2$4.Panel, selector: "p-panel", inputs: ["toggleable", "header", "collapsed", "style", "styleClass", "iconPos", "expandIcon", "collapseIcon", "showHeader", "toggler", "transitionOptions", "toggleButtonProps"], outputs: ["collapsedChange", "onBeforeToggle", "onAfterToggle"] }] });
|
|
6950
|
+
}
|
|
6951
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: DashboardQsInteractiveComponent, decorators: [{
|
|
6952
|
+
type: Component,
|
|
6953
|
+
args: [{ selector: 'intelica-dashboard-qs-interactive', imports: [SkeletonModule, PanelModule], template: "@if (isLoading()) {\r\n<div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <div class=\"u-display-flex u-background-white u-px-1 u-pt-1\">\r\n <div class=\"u-display-flex u-flex-column u-px-1\" style=\"height: 33px\">\r\n <p-skeleton class=\"prSkeleton u-m-auto\" [width]=\"'61px'\" [height]=\"'14px'\" />\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'2px'\" />\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-px-1\" style=\"height: 33px\">\r\n <p-skeleton class=\"prSkeleton u-m-auto\" [width]=\"'61px'\" [height]=\"'14px'\" />\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'2px'\" />\r\n </div>\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '1061.57 / 93.02' }\" />\r\n </p-panel>\r\n </div>\r\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\r\n @for (_ of [].constructor(4); track $index) {\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '244.87 / 123.12' }\" />\r\n </p-panel>\r\n }\r\n </div>\r\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '1061.57 / 303.7' }\" />\r\n </p-panel>\r\n </div>\r\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\r\n @for (_ of [].constructor(2); track $index) {\r\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\r\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" [style]=\"{ 'aspect-ratio': '517.1 / 123.12' }\" />\r\n </p-panel>\r\n }\r\n </div>\r\n</div>\r\n}\r\n<div #visualContainer [style.height]=\"height()\" [hidden]=\"isLoading()\"></div>" }]
|
|
6757
6954
|
}], ctorParameters: () => [], propDecorators: { containers: [{
|
|
6758
6955
|
type: ViewChildren,
|
|
6759
6956
|
args: ['visualContainer']
|
|
@@ -10682,5 +10879,5 @@ const IntelicaTheme = definePreset(Aura, {
|
|
|
10682
10879
|
* Generated bundle index. Do not edit.
|
|
10683
10880
|
*/
|
|
10684
10881
|
|
|
10685
|
-
export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, CheckboxFilterDirective, Color, ColumnComponent, ColumnGroupComponent, CompareByField, CompressService, ConfigService, CookieAttributesGeneral, DashboardQsComponent, DataDirective, DateFilterDirective, DateModeOptions, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaCellCheckboxDirective, IntelicaTheme, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, RecordPerPageComponent, RefreshTokenInterceptor, ResponseHeadersInterceptor, RouteGuard, RowResumenComponent, RowResumenTreeComponent, SearchComponent, SelectDetailFilterDirective, SelectFilterDirective, Shared, SharedService, SkeletonChartComponent, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TableFetchComponent, TableSortOrder, TemplateDirective, TemplateMenuComponent, TermGuard, TermPipe, TermService, TextAreaFilterDirective, TextFilterDirective, TextRangeFilterDirective, TitlesComponent, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TreeTableFetchComponent, TruncatePipe, decryptData, encryptData, getColor };
|
|
10882
|
+
export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, CheckboxFilterDirective, Color, ColumnComponent, ColumnGroupComponent, CompareByField, CompressService, ConfigService, CookieAttributesGeneral, DashboardQsComponent, DashboardQsInteractiveComponent, DataDirective, DateFilterDirective, DateModeOptions, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaCellCheckboxDirective, IntelicaTheme, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, QUICKSIGHT_AUTH_ERROR_CODES, QuicksightEventName, RecordPerPageComponent, RefreshTokenInterceptor, ResponseHeadersInterceptor, RouteGuard, RowResumenComponent, RowResumenTreeComponent, SearchComponent, SelectDetailFilterDirective, SelectFilterDirective, Shared, SharedService, SkeletonChartComponent, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TableFetchComponent, TableSortOrder, TemplateDirective, TemplateMenuComponent, TermGuard, TermPipe, TermService, TextAreaFilterDirective, TextFilterDirective, TextRangeFilterDirective, TitlesComponent, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TreeTableFetchComponent, TruncatePipe, decryptData, dispatchQuicksightEvent, encryptData, getColor, isQuicksightSessionExpiredEvent };
|
|
10686
10883
|
//# sourceMappingURL=intelica-library-ui.mjs.map
|