@luzmo/embed 8.0.0 → 8.1.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.
- package/CHANGELOG.md +12 -0
- package/README.md +182 -145
- package/index.cjs +372 -290
- package/index.js +372 -290
- package/index.rn.cjs +329 -271
- package/index.rn.js +329 -271
- package/index.shared.cjs +329 -271
- package/index.shared.js +329 -271
- package/luzmo-embed.min.js +373 -291
- package/package.json +2 -2
- package/src/lib/dashboard/dashboard-base.d.ts +3 -3
- package/src/lib/iq-components/luzmo-iq-answer.d.ts +1 -1
- package/src/lib/iq-components/luzmo-iq-chat.d.ts +1 -1
- package/src/lib/luzmo-service.d.ts +1 -1
- package/src/lib/shared/helpers/default-parameters.d.ts +19 -2
- package/src/lib/shared/helpers/utils.d.ts +3 -3
- package/src/lib/shared/methods/export-dashboard.d.ts +1 -2
- package/src/lib/shared/methods/send-export-email.d.ts +3 -2
- package/src/lib/shared/models/common.model.d.ts +1 -1
- package/src/lib/shared/models/dashboard-context.model.d.ts +2 -0
- package/src/lib/shared/models/dashboard.model.d.ts +1 -2
- package/src/lib/shared/models/export.model.d.ts +3 -0
- package/src/lib/shared/models/index.d.ts +1 -0
- package/src/lib/viz-item/viz-item.base.d.ts +14 -5
package/index.cjs
CHANGED
|
@@ -407,41 +407,46 @@ var createIframeUrl = (dashboardContent) => {
|
|
|
407
407
|
// libs/embed-libs/embed/src/lib/shared/helpers/get-loader.ts
|
|
408
408
|
var getLoader = (dashboardComponent) => {
|
|
409
409
|
let errorMsg;
|
|
410
|
-
if (dashboardComponent.params
|
|
411
|
-
dashboardComponent.params
|
|
410
|
+
if (dashboardComponent.params?.error || (dashboardComponent.browserNotSupported?.length ?? 0) > 0) {
|
|
411
|
+
if (dashboardComponent.params) {
|
|
412
|
+
dashboardComponent.params.error = true;
|
|
413
|
+
}
|
|
412
414
|
if (dashboardComponent.browserNotSupported) {
|
|
413
415
|
errorMsg = "Browser is not supported.";
|
|
414
416
|
}
|
|
415
417
|
}
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
+
const language = dashboardComponent.params?.language;
|
|
419
|
+
const loadingMsg = (language ? translations_default.initializing[language] : void 0) || translations_default.initializing.en;
|
|
420
|
+
return dashboardComponent.browserNotSupported || dashboardComponent.params?.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
|
|
418
421
|
};
|
|
419
422
|
|
|
420
423
|
// libs/embed-libs/embed/src/lib/shared/helpers/promise-dispatch.ts
|
|
421
424
|
function resolvePromise(dashboardComponent, requestId, data) {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
+
const promises = dashboardComponent.promises;
|
|
426
|
+
if (promises?.[requestId]) {
|
|
427
|
+
promises[requestId].resolve(data);
|
|
428
|
+
delete promises[requestId];
|
|
425
429
|
}
|
|
426
430
|
}
|
|
427
431
|
function rejectPromise(dashboardComponent, requestId, data) {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
432
|
+
const promises = dashboardComponent.promises;
|
|
433
|
+
if (promises?.[requestId]) {
|
|
434
|
+
promises[requestId].reject(data);
|
|
435
|
+
delete promises[requestId];
|
|
431
436
|
}
|
|
432
437
|
}
|
|
433
438
|
|
|
434
439
|
// libs/embed-libs/embed/src/lib/shared/helpers/styles.ts
|
|
435
440
|
function containerStyles(dashboardComponent) {
|
|
436
441
|
const styles = {};
|
|
437
|
-
if (dashboardComponent.params
|
|
442
|
+
if (dashboardComponent.params?.loaderBackground && !dashboardComponent.iframeLoaded) {
|
|
438
443
|
styles.background = dashboardComponent.params.loaderBackground;
|
|
439
444
|
}
|
|
440
445
|
return styles;
|
|
441
446
|
}
|
|
442
447
|
function containerLoaderStyles(dashboardComponent) {
|
|
443
|
-
const height = dashboardComponent.params
|
|
444
|
-
const chartHeightDefined = dashboardComponent.params
|
|
448
|
+
const height = dashboardComponent.params?.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
449
|
+
const chartHeightDefined = dashboardComponent.params?.itemEmbedding && height !== "auto";
|
|
445
450
|
const display = dashboardComponent.iframeLoaded ? "none" : "";
|
|
446
451
|
return {
|
|
447
452
|
display,
|
|
@@ -449,8 +454,8 @@ function containerLoaderStyles(dashboardComponent) {
|
|
|
449
454
|
};
|
|
450
455
|
}
|
|
451
456
|
function loaderStyles(dashboardComponent) {
|
|
452
|
-
const background = dashboardComponent.params
|
|
453
|
-
if (dashboardComponent.params
|
|
457
|
+
const background = dashboardComponent.params?.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
|
|
458
|
+
if (dashboardComponent.params?.itemEmbedding) {
|
|
454
459
|
dashboardComponent.loaderSize = 24;
|
|
455
460
|
dashboardComponent.borderWidth = 4;
|
|
456
461
|
dashboardComponent.minHeight = 200;
|
|
@@ -479,11 +484,11 @@ function plStyles(dashboardComponent) {
|
|
|
479
484
|
} = DEFAULT_PARAMETERS;
|
|
480
485
|
const spinnerColorBorder = generateBorderStyle(
|
|
481
486
|
dashboardComponent.borderWidth,
|
|
482
|
-
dashboardComponent.params
|
|
487
|
+
dashboardComponent.params?.loaderSpinnerColor || defaultSpinnerColor
|
|
483
488
|
);
|
|
484
489
|
const spinnerBackgroundBorder = generateBorderStyle(
|
|
485
490
|
dashboardComponent.borderWidth,
|
|
486
|
-
dashboardComponent.params
|
|
491
|
+
dashboardComponent.params?.loaderSpinnerBackground || defaultSpinnerBackground
|
|
487
492
|
);
|
|
488
493
|
const size = `${dashboardComponent.loaderSize}px`;
|
|
489
494
|
return {
|
|
@@ -496,27 +501,28 @@ function plStyles(dashboardComponent) {
|
|
|
496
501
|
};
|
|
497
502
|
}
|
|
498
503
|
function lcStyles(dashboardComponent) {
|
|
499
|
-
const height = dashboardComponent.params
|
|
500
|
-
const chartHeightDefined = dashboardComponent.params
|
|
501
|
-
const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
|
|
502
|
-
const verticalPadding = dashboardComponent.params
|
|
504
|
+
const height = dashboardComponent.params?.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
505
|
+
const chartHeightDefined = dashboardComponent.params?.itemEmbedding && height !== "auto";
|
|
506
|
+
const getPaddingStr = (value) => `${((value ?? Number.NaN) - (dashboardComponent.loaderSize ?? Number.NaN) - 32) / 2}px`;
|
|
507
|
+
const verticalPadding = dashboardComponent.params?.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
|
|
503
508
|
return {
|
|
504
509
|
padding: `${verticalPadding} 16px`
|
|
505
510
|
};
|
|
506
511
|
}
|
|
507
512
|
function calculateIframeStyles(dashboardComponent) {
|
|
508
|
-
const height = dashboardComponent.params
|
|
509
|
-
const width = dashboardComponent.params
|
|
510
|
-
|
|
513
|
+
const height = dashboardComponent.params?.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
514
|
+
const width = dashboardComponent.params?.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
515
|
+
const editMode = dashboardComponent.params?.editMode;
|
|
516
|
+
if (dashboardComponent.params?.itemEmbedding && height !== "auto") {
|
|
511
517
|
dashboardComponent.iframeHeight = `${height}px`;
|
|
512
|
-
} else if (dashboardComponent.params
|
|
518
|
+
} else if (dashboardComponent.params?.itemEmbedding) {
|
|
513
519
|
dashboardComponent.iframeHeight = "200px";
|
|
514
|
-
} else if (["editFull", "editLimited"].includes(
|
|
520
|
+
} else if (editMode != null && ["editFull", "editLimited"].includes(editMode)) {
|
|
515
521
|
dashboardComponent.iframeHeight = "100%";
|
|
516
522
|
} else {
|
|
517
523
|
dashboardComponent.iframeHeight = "400px";
|
|
518
524
|
}
|
|
519
|
-
dashboardComponent.iframeWidth = dashboardComponent.params
|
|
525
|
+
dashboardComponent.iframeWidth = dashboardComponent.params?.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
|
|
520
526
|
const styles = {
|
|
521
527
|
height: dashboardComponent.iframeHeight,
|
|
522
528
|
width: dashboardComponent.iframeWidth
|
|
@@ -535,7 +541,7 @@ function calculateIframeStyles(dashboardComponent) {
|
|
|
535
541
|
|
|
536
542
|
// libs/embed-libs/embed/src/lib/shared/helpers/update-iframe-url.ts
|
|
537
543
|
var updateIframeUrl = (iframe, iframeUrl) => {
|
|
538
|
-
if (iframe?.contentWindow) {
|
|
544
|
+
if (iframe?.contentWindow && iframeUrl !== void 0) {
|
|
539
545
|
iframe.contentWindow.location.replace(iframeUrl);
|
|
540
546
|
}
|
|
541
547
|
};
|
|
@@ -544,7 +550,7 @@ var updateIframeUrl = (iframe, iframeUrl) => {
|
|
|
544
550
|
var selectedDataUtils = {
|
|
545
551
|
merge(...filters) {
|
|
546
552
|
return filters.reduce((acc, filter) => {
|
|
547
|
-
acc.and.push(...filter.and);
|
|
553
|
+
(acc.and ??= []).push(...filter.and ?? []);
|
|
548
554
|
return acc;
|
|
549
555
|
}, {
|
|
550
556
|
and: []
|
|
@@ -607,43 +613,46 @@ var selectedDataUtils = {
|
|
|
607
613
|
// libs/embed-libs/embed/src/lib/shared/methods/export-dashboard.ts
|
|
608
614
|
var exportDashboard = (dashboardComponent, iframe, format) => {
|
|
609
615
|
const requestId = uuidv4();
|
|
610
|
-
if (iframe?.contentWindow) {
|
|
611
|
-
|
|
612
|
-
{
|
|
613
|
-
action: "exportDashboard",
|
|
614
|
-
format: format || "png",
|
|
615
|
-
_version: dashboardComponent.libVersion,
|
|
616
|
-
requestId
|
|
617
|
-
},
|
|
618
|
-
"*"
|
|
619
|
-
);
|
|
620
|
-
return new Promise((resolve, reject) => {
|
|
621
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
622
|
-
setTimeout(() => {
|
|
623
|
-
if (dashboardComponent.promises[requestId]) {
|
|
624
|
-
const errorMessage = "exportDashboard request timed out.";
|
|
625
|
-
dashboardComponent.promises[requestId].reject(
|
|
626
|
-
new Error(errorMessage)
|
|
627
|
-
);
|
|
628
|
-
delete dashboardComponent.promises[requestId];
|
|
629
|
-
}
|
|
630
|
-
}, 12e5);
|
|
631
|
-
});
|
|
616
|
+
if (!iframe?.contentWindow) {
|
|
617
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
632
618
|
}
|
|
633
|
-
|
|
619
|
+
const { promises } = dashboardComponent;
|
|
620
|
+
if (!promises) {
|
|
621
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
622
|
+
}
|
|
623
|
+
iframe.contentWindow.postMessage(
|
|
624
|
+
{
|
|
625
|
+
action: "exportDashboard",
|
|
626
|
+
format: format || "png",
|
|
627
|
+
_version: dashboardComponent.libVersion,
|
|
628
|
+
requestId
|
|
629
|
+
},
|
|
630
|
+
"*"
|
|
631
|
+
);
|
|
632
|
+
return new Promise((resolve, reject) => {
|
|
633
|
+
promises[requestId] = { resolve, reject };
|
|
634
|
+
setTimeout(() => {
|
|
635
|
+
if (promises[requestId]) {
|
|
636
|
+
const errorMessage = "exportDashboard request timed out.";
|
|
637
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
638
|
+
delete promises[requestId];
|
|
639
|
+
}
|
|
640
|
+
}, 12e5);
|
|
641
|
+
});
|
|
634
642
|
};
|
|
635
643
|
|
|
636
644
|
// libs/embed-libs/embed/src/lib/shared/methods/get-accessible-dashboards.ts
|
|
637
645
|
var getAccessibleDashboards = async (dashboardComponent) => {
|
|
638
646
|
await dashboardComponent.updateComplete;
|
|
639
|
-
if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken)) {
|
|
647
|
+
if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken) && dashboardComponent.params) {
|
|
648
|
+
const { params } = dashboardComponent;
|
|
640
649
|
const fetchUser = new Promise((resolve, reject) => {
|
|
641
650
|
void (() => {
|
|
642
651
|
try {
|
|
643
652
|
const responsePromise = window.fetch(
|
|
644
653
|
// With embedMode="webComponent" URLs remove the trailing slash, since the web component expects them to not have it.
|
|
645
654
|
// Fixes incorrect url with embedMode="webComponent"
|
|
646
|
-
`${addTrailingSlash(
|
|
655
|
+
`${addTrailingSlash(params.apiHost)}0.1.0/authorization`,
|
|
647
656
|
{
|
|
648
657
|
method: "POST",
|
|
649
658
|
mode: "cors",
|
|
@@ -688,136 +697,144 @@ var getAccessibleDashboards = async (dashboardComponent) => {
|
|
|
688
697
|
}
|
|
689
698
|
})();
|
|
690
699
|
});
|
|
691
|
-
return new Promise((resolve, reject) =>
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
data.rows
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
700
|
+
return new Promise((resolve, reject) => {
|
|
701
|
+
void (() => {
|
|
702
|
+
try {
|
|
703
|
+
fetchUser.then((authorizationData) => {
|
|
704
|
+
const responsePromise = window.fetch(
|
|
705
|
+
// With embedMode="webComponent" URLs remove the trailing slash, since the web component expects them to not have it.
|
|
706
|
+
// Fixes incorrect url with embedMode="webComponent"
|
|
707
|
+
`${addTrailingSlash(params.apiHost)}0.1.0/securable`,
|
|
708
|
+
{
|
|
709
|
+
method: "POST",
|
|
710
|
+
mode: "cors",
|
|
711
|
+
cache: "no-cache",
|
|
712
|
+
headers: { "Content-Type": "application/json" },
|
|
713
|
+
redirect: "follow",
|
|
714
|
+
body: JSON.stringify({
|
|
715
|
+
action: "get",
|
|
716
|
+
version: "0.1.0",
|
|
717
|
+
key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
|
|
718
|
+
token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
|
|
719
|
+
find: {
|
|
720
|
+
where: { type: "dashboard", is_variant: false },
|
|
721
|
+
attributes: ["id", "name", "modified_at"],
|
|
722
|
+
order: [["modified_at", "desc"]],
|
|
723
|
+
include: [
|
|
724
|
+
{ model: "Tag", attributes: ["tag"] },
|
|
725
|
+
{ model: "User", attributes: ["id", "name"] },
|
|
726
|
+
{
|
|
727
|
+
model: "Group",
|
|
728
|
+
attributes: ["id", "name", "public"]
|
|
729
|
+
},
|
|
730
|
+
{ model: "Integration", attributes: ["id", "name"] }
|
|
731
|
+
]
|
|
732
|
+
}
|
|
733
|
+
})
|
|
734
|
+
}
|
|
735
|
+
);
|
|
736
|
+
responsePromise.then((response) => response.json()).then((data) => {
|
|
737
|
+
const dashboardList = data.rows.length > 0 ? formatDashboardList(
|
|
738
|
+
data.rows,
|
|
739
|
+
authorizationData.integrationId,
|
|
740
|
+
authorizationData.user,
|
|
741
|
+
dashboardComponent
|
|
742
|
+
) : [];
|
|
743
|
+
resolve(dashboardList);
|
|
744
|
+
});
|
|
745
|
+
}).catch((error) => {
|
|
746
|
+
reject(error);
|
|
734
747
|
});
|
|
735
|
-
}
|
|
748
|
+
} catch (error) {
|
|
736
749
|
reject(error);
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
}
|
|
741
|
-
})());
|
|
750
|
+
}
|
|
751
|
+
})();
|
|
752
|
+
});
|
|
742
753
|
}
|
|
743
754
|
throw new Error("No authKey or authToken found in the luzmo-dashboard component.");
|
|
744
755
|
};
|
|
745
756
|
|
|
746
757
|
// libs/embed-libs/embed/src/lib/shared/methods/get-dashboard-context.ts
|
|
747
758
|
var getDashboardContext = (dashboardComponent, iframe) => {
|
|
748
|
-
if (iframe?.contentWindow) {
|
|
749
|
-
|
|
750
|
-
iframe.contentWindow.postMessage(
|
|
751
|
-
{ action: "getDashboardContext", _version: dashboardComponent.libVersion, requestId },
|
|
752
|
-
"*"
|
|
753
|
-
);
|
|
754
|
-
return new Promise((resolve, reject) => {
|
|
755
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
756
|
-
setTimeout(() => {
|
|
757
|
-
if (dashboardComponent.promises[requestId]) {
|
|
758
|
-
const errorMessage = "getDashboardContext request timed out.";
|
|
759
|
-
dashboardComponent.promises[requestId].reject(
|
|
760
|
-
new Error(errorMessage)
|
|
761
|
-
);
|
|
762
|
-
delete dashboardComponent.promises[requestId];
|
|
763
|
-
}
|
|
764
|
-
}, 2e3);
|
|
765
|
-
});
|
|
759
|
+
if (!iframe?.contentWindow) {
|
|
760
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
766
761
|
}
|
|
767
|
-
|
|
762
|
+
const { promises } = dashboardComponent;
|
|
763
|
+
if (!promises) {
|
|
764
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
765
|
+
}
|
|
766
|
+
const requestId = uuidv4();
|
|
767
|
+
iframe.contentWindow.postMessage(
|
|
768
|
+
{ action: "getDashboardContext", _version: dashboardComponent.libVersion, requestId },
|
|
769
|
+
"*"
|
|
770
|
+
);
|
|
771
|
+
return new Promise((resolve, reject) => {
|
|
772
|
+
promises[requestId] = { resolve, reject };
|
|
773
|
+
setTimeout(() => {
|
|
774
|
+
if (promises[requestId]) {
|
|
775
|
+
const errorMessage = "getDashboardContext request timed out.";
|
|
776
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
777
|
+
delete promises[requestId];
|
|
778
|
+
}
|
|
779
|
+
}, 2e3);
|
|
780
|
+
});
|
|
768
781
|
};
|
|
769
782
|
|
|
770
783
|
// libs/embed-libs/embed/src/lib/shared/methods/get-data.ts
|
|
771
784
|
var getData = (dashboardComponent, iframe, itemId) => {
|
|
772
|
-
if (iframe?.contentWindow) {
|
|
773
|
-
|
|
774
|
-
iframe.contentWindow.postMessage(
|
|
775
|
-
{
|
|
776
|
-
action: "getData",
|
|
777
|
-
id: itemId,
|
|
778
|
-
_version: dashboardComponent.libVersion,
|
|
779
|
-
requestId
|
|
780
|
-
},
|
|
781
|
-
"*"
|
|
782
|
-
);
|
|
783
|
-
return new Promise((resolve, reject) => {
|
|
784
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
785
|
-
setTimeout(() => {
|
|
786
|
-
if (dashboardComponent.promises[requestId]) {
|
|
787
|
-
const errorMessage = "getData request timed out.";
|
|
788
|
-
dashboardComponent.promises[requestId].reject(
|
|
789
|
-
new Error(errorMessage)
|
|
790
|
-
);
|
|
791
|
-
delete dashboardComponent.promises[requestId];
|
|
792
|
-
}
|
|
793
|
-
}, 2e3);
|
|
794
|
-
});
|
|
785
|
+
if (!iframe?.contentWindow) {
|
|
786
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
795
787
|
}
|
|
796
|
-
|
|
788
|
+
const { promises } = dashboardComponent;
|
|
789
|
+
if (!promises) {
|
|
790
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
791
|
+
}
|
|
792
|
+
const requestId = uuidv4();
|
|
793
|
+
iframe.contentWindow.postMessage(
|
|
794
|
+
{
|
|
795
|
+
action: "getData",
|
|
796
|
+
id: itemId,
|
|
797
|
+
_version: dashboardComponent.libVersion,
|
|
798
|
+
requestId
|
|
799
|
+
},
|
|
800
|
+
"*"
|
|
801
|
+
);
|
|
802
|
+
return new Promise((resolve, reject) => {
|
|
803
|
+
promises[requestId] = { resolve, reject };
|
|
804
|
+
setTimeout(() => {
|
|
805
|
+
if (promises[requestId]) {
|
|
806
|
+
const errorMessage = "getData request timed out.";
|
|
807
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
808
|
+
delete promises[requestId];
|
|
809
|
+
}
|
|
810
|
+
}, 2e3);
|
|
811
|
+
});
|
|
797
812
|
};
|
|
798
813
|
|
|
799
814
|
// libs/embed-libs/embed/src/lib/shared/methods/get-filters.ts
|
|
800
815
|
var getFilters = (dashboardComponent, iframe) => {
|
|
801
|
-
if (iframe?.contentWindow) {
|
|
802
|
-
|
|
803
|
-
iframe.contentWindow.postMessage(
|
|
804
|
-
{ action: "getFilters", _version: dashboardComponent.libVersion, requestId },
|
|
805
|
-
"*"
|
|
806
|
-
);
|
|
807
|
-
return new Promise((resolve, reject) => {
|
|
808
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
809
|
-
setTimeout(() => {
|
|
810
|
-
if (dashboardComponent.promises[requestId]) {
|
|
811
|
-
const errorMessage = "getFilters request timed out.";
|
|
812
|
-
dashboardComponent.promises[requestId].reject(
|
|
813
|
-
new Error(errorMessage)
|
|
814
|
-
);
|
|
815
|
-
delete dashboardComponent.promises[requestId];
|
|
816
|
-
}
|
|
817
|
-
}, 2e3);
|
|
818
|
-
});
|
|
816
|
+
if (!iframe?.contentWindow) {
|
|
817
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
819
818
|
}
|
|
820
|
-
|
|
819
|
+
const { promises } = dashboardComponent;
|
|
820
|
+
if (!promises) {
|
|
821
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
822
|
+
}
|
|
823
|
+
const requestId = uuidv4();
|
|
824
|
+
iframe.contentWindow.postMessage(
|
|
825
|
+
{ action: "getFilters", _version: dashboardComponent.libVersion, requestId },
|
|
826
|
+
"*"
|
|
827
|
+
);
|
|
828
|
+
return new Promise((resolve, reject) => {
|
|
829
|
+
promises[requestId] = { resolve, reject };
|
|
830
|
+
setTimeout(() => {
|
|
831
|
+
if (promises[requestId]) {
|
|
832
|
+
const errorMessage = "getFilters request timed out.";
|
|
833
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
834
|
+
delete promises[requestId];
|
|
835
|
+
}
|
|
836
|
+
}, 2e3);
|
|
837
|
+
});
|
|
821
838
|
};
|
|
822
839
|
|
|
823
840
|
// libs/embed-libs/embed/src/lib/shared/methods/get-insights.ts
|
|
@@ -825,6 +842,10 @@ var getInsights = (dashboardComponent, iframe, options = {}) => {
|
|
|
825
842
|
if (!iframe?.contentWindow) {
|
|
826
843
|
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
827
844
|
}
|
|
845
|
+
const { promises } = dashboardComponent;
|
|
846
|
+
if (!promises) {
|
|
847
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
848
|
+
}
|
|
828
849
|
const requestId = uuidv4();
|
|
829
850
|
iframe.contentWindow.postMessage(
|
|
830
851
|
{
|
|
@@ -836,11 +857,11 @@ var getInsights = (dashboardComponent, iframe, options = {}) => {
|
|
|
836
857
|
"*"
|
|
837
858
|
);
|
|
838
859
|
return new Promise((resolve, reject) => {
|
|
839
|
-
|
|
860
|
+
promises[requestId] = { resolve, reject };
|
|
840
861
|
setTimeout(() => {
|
|
841
|
-
if (
|
|
842
|
-
|
|
843
|
-
delete
|
|
862
|
+
if (promises[requestId]) {
|
|
863
|
+
promises[requestId].reject(new Error("getInsights request timed out."));
|
|
864
|
+
delete promises[requestId];
|
|
844
865
|
}
|
|
845
866
|
}, 6e4);
|
|
846
867
|
});
|
|
@@ -848,7 +869,7 @@ var getInsights = (dashboardComponent, iframe, options = {}) => {
|
|
|
848
869
|
|
|
849
870
|
// libs/embed-libs/embed/src/lib/shared/methods/refresh-data.ts
|
|
850
871
|
var refreshData = (dashboardComponent, iframe, itemId) => {
|
|
851
|
-
if (iframe) {
|
|
872
|
+
if (iframe?.contentWindow) {
|
|
852
873
|
iframe.contentWindow.postMessage(
|
|
853
874
|
{
|
|
854
875
|
action: "refreshData",
|
|
@@ -864,7 +885,7 @@ var refreshData = (dashboardComponent, iframe, itemId) => {
|
|
|
864
885
|
|
|
865
886
|
// libs/embed-libs/embed/src/lib/shared/methods/reload-dashboard.ts
|
|
866
887
|
var reloadDashboard = (dashboardComponent, iframe) => {
|
|
867
|
-
if (iframe) {
|
|
888
|
+
if (iframe?.contentWindow) {
|
|
868
889
|
iframe.contentWindow.postMessage(
|
|
869
890
|
{ action: "reloadDashboard", _version: dashboardComponent.libVersion },
|
|
870
891
|
"*"
|
|
@@ -876,7 +897,7 @@ var reloadDashboard = (dashboardComponent, iframe) => {
|
|
|
876
897
|
|
|
877
898
|
// libs/embed-libs/embed/src/lib/shared/methods/send-export-email.ts
|
|
878
899
|
var sendExportEmail = (dashboardComponent, iframe, type, subject, message) => {
|
|
879
|
-
if (iframe) {
|
|
900
|
+
if (iframe?.contentWindow) {
|
|
880
901
|
iframe.contentWindow.postMessage(
|
|
881
902
|
{
|
|
882
903
|
action: "sendExportEmail",
|
|
@@ -894,7 +915,7 @@ var sendExportEmail = (dashboardComponent, iframe, type, subject, message) => {
|
|
|
894
915
|
|
|
895
916
|
// libs/embed-libs/embed/src/lib/shared/methods/set-authorization.ts
|
|
896
917
|
var setAuthorization = (dashboardComponent, iframe, key, token) => {
|
|
897
|
-
if (iframe) {
|
|
918
|
+
if (iframe?.contentWindow) {
|
|
898
919
|
iframe.contentWindow.postMessage(
|
|
899
920
|
{
|
|
900
921
|
action: "setAuthorization",
|
|
@@ -911,92 +932,100 @@ var setAuthorization = (dashboardComponent, iframe, key, token) => {
|
|
|
911
932
|
|
|
912
933
|
// libs/embed-libs/embed/src/lib/shared/methods/set-edit-mode.ts
|
|
913
934
|
var setEditMode = (dashboardComponent, iframe, editMode) => {
|
|
914
|
-
if (iframe
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
_version: dashboardComponent.libVersion,
|
|
932
|
-
requestId
|
|
933
|
-
},
|
|
934
|
-
"*"
|
|
935
|
+
if (!iframe?.contentWindow) {
|
|
936
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
937
|
+
}
|
|
938
|
+
const { params, promises } = dashboardComponent;
|
|
939
|
+
if (!params || !promises) {
|
|
940
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
941
|
+
}
|
|
942
|
+
const requestId = uuidv4();
|
|
943
|
+
if (params.editMode === editMode) {
|
|
944
|
+
return Promise.reject(
|
|
945
|
+
new Error("editMode parameter is currently already set to " + editMode)
|
|
946
|
+
);
|
|
947
|
+
} else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
|
|
948
|
+
return Promise.reject(
|
|
949
|
+
new Error(
|
|
950
|
+
"The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
|
|
951
|
+
)
|
|
935
952
|
);
|
|
936
|
-
return new Promise((resolve, reject) => {
|
|
937
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
938
|
-
});
|
|
939
953
|
}
|
|
940
|
-
|
|
954
|
+
iframe.contentWindow.postMessage(
|
|
955
|
+
{
|
|
956
|
+
action: "setEditMode",
|
|
957
|
+
editMode,
|
|
958
|
+
_version: dashboardComponent.libVersion,
|
|
959
|
+
requestId
|
|
960
|
+
},
|
|
961
|
+
"*"
|
|
962
|
+
);
|
|
963
|
+
return new Promise((resolve, reject) => {
|
|
964
|
+
promises[requestId] = { resolve, reject };
|
|
965
|
+
});
|
|
941
966
|
};
|
|
942
967
|
|
|
943
968
|
// libs/embed-libs/embed/src/lib/shared/methods/set-preview.ts
|
|
944
969
|
var setPreview = (dashboardComponent, iframe, preview) => {
|
|
945
|
-
if (iframe) {
|
|
946
|
-
|
|
947
|
-
iframe.contentWindow.postMessage(
|
|
948
|
-
{
|
|
949
|
-
action: "setPreview",
|
|
950
|
-
preview,
|
|
951
|
-
requestId,
|
|
952
|
-
_version: dashboardComponent.libVersion
|
|
953
|
-
},
|
|
954
|
-
"*"
|
|
955
|
-
);
|
|
956
|
-
return new Promise((resolve, reject) => {
|
|
957
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
958
|
-
setTimeout(() => {
|
|
959
|
-
if (dashboardComponent.promises[requestId]) {
|
|
960
|
-
const errorMessage = "setPreview request timed out.";
|
|
961
|
-
dashboardComponent.promises[requestId].reject(
|
|
962
|
-
new Error(errorMessage)
|
|
963
|
-
);
|
|
964
|
-
delete dashboardComponent.promises[requestId];
|
|
965
|
-
}
|
|
966
|
-
}, 2e3);
|
|
967
|
-
});
|
|
970
|
+
if (!iframe?.contentWindow) {
|
|
971
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
968
972
|
}
|
|
969
|
-
|
|
973
|
+
const { promises } = dashboardComponent;
|
|
974
|
+
if (!promises) {
|
|
975
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
976
|
+
}
|
|
977
|
+
const requestId = uuidv4();
|
|
978
|
+
iframe.contentWindow.postMessage(
|
|
979
|
+
{
|
|
980
|
+
action: "setPreview",
|
|
981
|
+
preview,
|
|
982
|
+
requestId,
|
|
983
|
+
_version: dashboardComponent.libVersion
|
|
984
|
+
},
|
|
985
|
+
"*"
|
|
986
|
+
);
|
|
987
|
+
return new Promise((resolve, reject) => {
|
|
988
|
+
promises[requestId] = { resolve, reject };
|
|
989
|
+
setTimeout(() => {
|
|
990
|
+
if (promises[requestId]) {
|
|
991
|
+
const errorMessage = "setPreview request timed out.";
|
|
992
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
993
|
+
delete promises[requestId];
|
|
994
|
+
}
|
|
995
|
+
}, 2e3);
|
|
996
|
+
});
|
|
970
997
|
};
|
|
971
998
|
|
|
972
999
|
// libs/embed-libs/embed/src/lib/shared/methods/set-selected-data.ts
|
|
973
1000
|
var setSelectedData = (dashboardComponent, iframe, itemId, filters) => {
|
|
974
|
-
if (iframe) {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
filters,
|
|
981
|
-
_version: dashboardComponent.libVersion,
|
|
982
|
-
requestId
|
|
983
|
-
},
|
|
984
|
-
"*"
|
|
985
|
-
);
|
|
986
|
-
return new Promise((resolve, reject) => {
|
|
987
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
988
|
-
setTimeout(() => {
|
|
989
|
-
if (dashboardComponent.promises[requestId]) {
|
|
990
|
-
const errorMessage = "setSelectedData request timed out.";
|
|
991
|
-
dashboardComponent.promises[requestId].reject(
|
|
992
|
-
new Error(errorMessage)
|
|
993
|
-
);
|
|
994
|
-
delete dashboardComponent.promises[requestId];
|
|
995
|
-
}
|
|
996
|
-
}, 2e3);
|
|
997
|
-
});
|
|
1001
|
+
if (!iframe?.contentWindow) {
|
|
1002
|
+
return Promise.reject();
|
|
1003
|
+
}
|
|
1004
|
+
const { promises } = dashboardComponent;
|
|
1005
|
+
if (!promises) {
|
|
1006
|
+
return Promise.reject();
|
|
998
1007
|
}
|
|
999
|
-
|
|
1008
|
+
const requestId = uuidv4();
|
|
1009
|
+
iframe.contentWindow.postMessage(
|
|
1010
|
+
{
|
|
1011
|
+
action: "setSelectedData",
|
|
1012
|
+
itemId,
|
|
1013
|
+
filters,
|
|
1014
|
+
_version: dashboardComponent.libVersion,
|
|
1015
|
+
requestId
|
|
1016
|
+
},
|
|
1017
|
+
"*"
|
|
1018
|
+
);
|
|
1019
|
+
return new Promise((resolve, reject) => {
|
|
1020
|
+
promises[requestId] = { resolve, reject };
|
|
1021
|
+
setTimeout(() => {
|
|
1022
|
+
if (promises[requestId]) {
|
|
1023
|
+
const errorMessage = "setSelectedData request timed out.";
|
|
1024
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
1025
|
+
delete promises[requestId];
|
|
1026
|
+
}
|
|
1027
|
+
}, 2e3);
|
|
1028
|
+
});
|
|
1000
1029
|
};
|
|
1001
1030
|
|
|
1002
1031
|
// libs/embed-libs/embed/src/lib/shared/service/calculate-dimensions.ts
|
|
@@ -1042,6 +1071,9 @@ var _setCalculatedDimensions = (dashboardComponent) => {
|
|
|
1042
1071
|
for (const key of dashboardDimensionKeys) {
|
|
1043
1072
|
if (screenModes.includes(key)) {
|
|
1044
1073
|
const screenMode = EXTENTS.find((extent) => extent.mode === key);
|
|
1074
|
+
if (!screenMode) {
|
|
1075
|
+
continue;
|
|
1076
|
+
}
|
|
1045
1077
|
availableScreenModeExtents.push({
|
|
1046
1078
|
...screenMode,
|
|
1047
1079
|
height: dashboardComponent.dimensions[key][1] || 50
|
|
@@ -1096,24 +1128,27 @@ var _setCalculatedDimensions = (dashboardComponent) => {
|
|
|
1096
1128
|
),
|
|
1097
1129
|
screenModeExtentMinWidth
|
|
1098
1130
|
);
|
|
1099
|
-
currentHeight = screenModeExtent.height;
|
|
1131
|
+
currentHeight = screenModeExtent.height ?? 0;
|
|
1100
1132
|
}
|
|
1101
1133
|
}
|
|
1102
1134
|
}
|
|
1103
1135
|
}
|
|
1104
1136
|
} else {
|
|
1105
|
-
const
|
|
1106
|
-
height: chosenModeHeight,
|
|
1107
|
-
width: [chosenModeMinWidth, chosenModeMaxWidth]
|
|
1108
|
-
} = availableScreenModeExtents.find(
|
|
1137
|
+
const chosenModeExtent = availableScreenModeExtents.find(
|
|
1109
1138
|
(d) => d.mode === dashboardComponent.params.screenMode
|
|
1110
1139
|
);
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1140
|
+
if (chosenModeExtent) {
|
|
1141
|
+
const {
|
|
1142
|
+
height: chosenModeHeight,
|
|
1143
|
+
width: [chosenModeMinWidth, chosenModeMaxWidth]
|
|
1144
|
+
} = chosenModeExtent;
|
|
1145
|
+
currentMode = dashboardComponent.params.screenMode;
|
|
1146
|
+
currentWidth = Math.max(
|
|
1147
|
+
Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
|
|
1148
|
+
chosenModeMinWidth
|
|
1149
|
+
);
|
|
1150
|
+
currentHeight = chosenModeHeight ?? 0;
|
|
1151
|
+
}
|
|
1117
1152
|
if (dashboardComponent.params.itemEmbedding) {
|
|
1118
1153
|
if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
|
|
1119
1154
|
currentWidth = Number.parseInt(
|
|
@@ -1133,7 +1168,7 @@ var _setCalculatedDimensions = (dashboardComponent) => {
|
|
|
1133
1168
|
const [lowestModeExtent] = availableScreenModeExtents;
|
|
1134
1169
|
currentMode = lowestModeExtent.mode;
|
|
1135
1170
|
currentWidth = lowestModeExtent.width[0];
|
|
1136
|
-
currentHeight = lowestModeExtent.height;
|
|
1171
|
+
currentHeight = lowestModeExtent.height ?? 0;
|
|
1137
1172
|
}
|
|
1138
1173
|
}
|
|
1139
1174
|
dashboardComponent.currentScreenMode = currentMode;
|
|
@@ -1195,6 +1230,9 @@ var _extendAndValidate = (dashboardContent) => {
|
|
|
1195
1230
|
"fixed",
|
|
1196
1231
|
"auto"
|
|
1197
1232
|
];
|
|
1233
|
+
if (!dashboardContent.params) {
|
|
1234
|
+
dashboardContent.params = {};
|
|
1235
|
+
}
|
|
1198
1236
|
for (const key of defaultKeys) {
|
|
1199
1237
|
if (dashboardContent.params[key] === null) {
|
|
1200
1238
|
delete dashboardContent.params[key];
|
|
@@ -1262,17 +1300,20 @@ var _extendAndValidate = (dashboardContent) => {
|
|
|
1262
1300
|
if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
|
|
1263
1301
|
dashboardContent.params.switchScreenModeOnResize = false;
|
|
1264
1302
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1303
|
+
const itemDimensions = dashboardContent.params.itemDimensions;
|
|
1304
|
+
if (itemDimensions) {
|
|
1305
|
+
if (itemDimensions.width !== "auto") {
|
|
1306
|
+
itemDimensions.width = Number.parseInt(
|
|
1307
|
+
`${itemDimensions.width}`.replace("px", ""),
|
|
1308
|
+
10
|
|
1309
|
+
) || "auto";
|
|
1310
|
+
}
|
|
1311
|
+
if (itemDimensions.height !== "auto") {
|
|
1312
|
+
itemDimensions.height = Number.parseInt(
|
|
1313
|
+
`${itemDimensions.height}`.replace("px", ""),
|
|
1314
|
+
10
|
|
1315
|
+
) || "auto";
|
|
1316
|
+
}
|
|
1276
1317
|
}
|
|
1277
1318
|
dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
|
|
1278
1319
|
if (dashboardContent.params.error || errorMessages.length > 0) {
|
|
@@ -1284,6 +1325,7 @@ var _extendAndValidate = (dashboardContent) => {
|
|
|
1284
1325
|
var libraryTypeToWebComponentTypeMapping = {
|
|
1285
1326
|
type: "type",
|
|
1286
1327
|
slots: "slots",
|
|
1328
|
+
inlineData: "inline-data",
|
|
1287
1329
|
options: "options",
|
|
1288
1330
|
appServer: "app-server",
|
|
1289
1331
|
apiHost: "api-host",
|
|
@@ -1414,7 +1456,7 @@ var import_decorators = require("lit/decorators.js");
|
|
|
1414
1456
|
var import_style_map = require("lit/directives/style-map.js");
|
|
1415
1457
|
|
|
1416
1458
|
// libs/embed-libs/embed/package.json
|
|
1417
|
-
var version = "8.
|
|
1459
|
+
var version = "8.1.0";
|
|
1418
1460
|
|
|
1419
1461
|
// libs/embed-libs/embed/src/lib/utils/embed-error.utils.ts
|
|
1420
1462
|
function buildEmbedErrorDetail(errorMsg) {
|
|
@@ -1833,8 +1875,8 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
1833
1875
|
this.browserNotSupported = [];
|
|
1834
1876
|
this.libVersion = version + "-wc-luzmo";
|
|
1835
1877
|
this.isLibraryLoaded = false;
|
|
1836
|
-
this.currentAuthKey =
|
|
1837
|
-
this.currentAuthToken =
|
|
1878
|
+
this.currentAuthKey = void 0;
|
|
1879
|
+
this.currentAuthToken = void 0;
|
|
1838
1880
|
this.isInitCalled = false;
|
|
1839
1881
|
this.attributesMap = {
|
|
1840
1882
|
dashboardId: "dashboard-id",
|
|
@@ -1972,6 +2014,9 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
1972
2014
|
this.dashboardErrorMsg = "";
|
|
1973
2015
|
const appServer = this.params.appServer;
|
|
1974
2016
|
const libraryLoadId = ++this._webComponentLibraryLoadId;
|
|
2017
|
+
if (!appServer) {
|
|
2018
|
+
return;
|
|
2019
|
+
}
|
|
1975
2020
|
loadLibrary(appServer, dashboardRemote).then(async () => {
|
|
1976
2021
|
if (libraryLoadId !== this._webComponentLibraryLoadId || !this.isWebComponentViewMode() || this.params.appServer !== appServer) {
|
|
1977
2022
|
return;
|
|
@@ -2428,8 +2473,9 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
2428
2473
|
}
|
|
2429
2474
|
// Public methods
|
|
2430
2475
|
getData(itemId) {
|
|
2431
|
-
|
|
2432
|
-
|
|
2476
|
+
const dashboardReference = this.dashboardReference;
|
|
2477
|
+
if (this.isWebComponentViewMode() && dashboardReference) {
|
|
2478
|
+
return Promise.resolve().then(() => dashboardReference.getData(itemId));
|
|
2433
2479
|
}
|
|
2434
2480
|
if (!this.isWebComponentViewMode()) {
|
|
2435
2481
|
return getData(this, this.iframe, itemId);
|
|
@@ -2514,6 +2560,9 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
2514
2560
|
return getAccessibleDashboards(this);
|
|
2515
2561
|
}
|
|
2516
2562
|
addFilters(itemId, filters) {
|
|
2563
|
+
if (!this.dashboardReference) {
|
|
2564
|
+
return Promise.reject();
|
|
2565
|
+
}
|
|
2517
2566
|
return this.dashboardReference.addFilters(itemId, filters);
|
|
2518
2567
|
}
|
|
2519
2568
|
setEditMode(editMode) {
|
|
@@ -2526,7 +2575,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
2526
2575
|
editMode
|
|
2527
2576
|
});
|
|
2528
2577
|
}
|
|
2529
|
-
if (this.dashboardReference && ["editFull", "editLimited"].includes(editMode)) {
|
|
2578
|
+
if (this.dashboardReference && editMode && ["editFull", "editLimited"].includes(editMode)) {
|
|
2530
2579
|
this.editMode = editMode;
|
|
2531
2580
|
this.params.editMode = editMode;
|
|
2532
2581
|
this.initComponent();
|
|
@@ -2535,7 +2584,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
2535
2584
|
editMode
|
|
2536
2585
|
});
|
|
2537
2586
|
}
|
|
2538
|
-
if (this.isWebComponentViewMode() && this.dashboardReference) {
|
|
2587
|
+
if (this.isWebComponentViewMode() && this.dashboardReference && editMode) {
|
|
2539
2588
|
return this.dashboardReference.setEditMode(editMode);
|
|
2540
2589
|
}
|
|
2541
2590
|
if (!this.isWebComponentViewMode()) {
|
|
@@ -2550,7 +2599,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
2550
2599
|
return setPreview(this, this.iframe, preview);
|
|
2551
2600
|
}
|
|
2552
2601
|
sendExportEmail(type, subject, message) {
|
|
2553
|
-
if (this.isWebComponentViewMode() && this.dashboardReference) {
|
|
2602
|
+
if (this.isWebComponentViewMode() && this.dashboardReference && type) {
|
|
2554
2603
|
return this.dashboardReference.sendExportEmail(type, subject, message);
|
|
2555
2604
|
} else if (!this.isWebComponentViewMode()) {
|
|
2556
2605
|
return sendExportEmail(this, this.iframe, type, subject, message);
|
|
@@ -2805,6 +2854,7 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
|
2805
2854
|
id: this.contextId ?? this.getAttribute("context-id") ?? this.id ?? this.itemId ?? "",
|
|
2806
2855
|
type: this.type,
|
|
2807
2856
|
slots,
|
|
2857
|
+
inlineData: this.inlineData,
|
|
2808
2858
|
options: this.options,
|
|
2809
2859
|
filters: typeof this.chartElement?.getContextFilters === "function" ? this.chartElement.getContextFilters() : typeof this.chartElement?.getFilters === "function" ? this.getFilters() : [],
|
|
2810
2860
|
datasetIds: collectVizItemDatasetIds(slots)
|
|
@@ -2867,18 +2917,31 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
|
2867
2917
|
});
|
|
2868
2918
|
this.chartElement.addEventListener("changedFilters", (payload) => {
|
|
2869
2919
|
this.dispatchEvent(new CustomEvent("changedFilters", payload));
|
|
2870
|
-
this.dispatchEvent(
|
|
2871
|
-
|
|
2872
|
-
|
|
2920
|
+
this.dispatchEvent(
|
|
2921
|
+
new CustomEvent("contextChanged", {
|
|
2922
|
+
detail: { data: { type: "contextChanged", context: this.getVizItemContext() } }
|
|
2923
|
+
})
|
|
2924
|
+
);
|
|
2873
2925
|
});
|
|
2874
|
-
this.chartElement.addEventListener(
|
|
2875
|
-
|
|
2926
|
+
this.chartElement.addEventListener(
|
|
2927
|
+
"exported",
|
|
2928
|
+
(payload) => this.dispatchEvent(new CustomEvent("exported", payload))
|
|
2929
|
+
);
|
|
2930
|
+
this.chartElement.addEventListener(
|
|
2931
|
+
"customEvent",
|
|
2932
|
+
(payload) => this.dispatchEvent(new CustomEvent("customEvent", payload))
|
|
2933
|
+
);
|
|
2876
2934
|
this.chartElement.addEventListener("error", (event) => {
|
|
2877
|
-
this.dispatchEvent(
|
|
2878
|
-
|
|
2879
|
-
|
|
2935
|
+
this.dispatchEvent(
|
|
2936
|
+
new CustomEvent("error", {
|
|
2937
|
+
detail: normalizeEmbedErrorDetail(event.detail)
|
|
2938
|
+
})
|
|
2939
|
+
);
|
|
2880
2940
|
});
|
|
2881
|
-
this.chartElement.addEventListener(
|
|
2941
|
+
this.chartElement.addEventListener(
|
|
2942
|
+
"authorizationExpired",
|
|
2943
|
+
(payload) => this.dispatchEvent(new CustomEvent("authorizationExpired", payload))
|
|
2944
|
+
);
|
|
2882
2945
|
this.updateVizItemProperties();
|
|
2883
2946
|
this.renderRoot.append(this.chartElement);
|
|
2884
2947
|
}
|
|
@@ -2901,8 +2964,21 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
|
2901
2964
|
if (this.chartElement) {
|
|
2902
2965
|
for (const [propertyName] of changedProperties.entries()) {
|
|
2903
2966
|
const mappedAttributeName = libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
2904
|
-
const
|
|
2905
|
-
|
|
2967
|
+
const value = this[propertyName];
|
|
2968
|
+
if (propertyName === "inlineData" && (value === void 0 || value === null)) {
|
|
2969
|
+
this.inlineData = void 0;
|
|
2970
|
+
this.chartElement.removeAttribute(mappedAttributeName);
|
|
2971
|
+
} else {
|
|
2972
|
+
const attributeValue = typeof value === "object" ? JSON.stringify(value) : value?.toString() ?? value;
|
|
2973
|
+
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
if (["inlineData", "options", "slots"].some((propertyName) => changedProperties.has(propertyName))) {
|
|
2977
|
+
this.dispatchEvent(
|
|
2978
|
+
new CustomEvent("contextChanged", {
|
|
2979
|
+
detail: { data: { type: "contextChanged", context: this.getVizItemContext() } }
|
|
2980
|
+
})
|
|
2981
|
+
);
|
|
2906
2982
|
}
|
|
2907
2983
|
} else {
|
|
2908
2984
|
if (this.canInitializeVizItem()) {
|
|
@@ -2912,7 +2988,7 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
|
2912
2988
|
}
|
|
2913
2989
|
}
|
|
2914
2990
|
render() {
|
|
2915
|
-
return import_lit3.html
|
|
2991
|
+
return import_lit3.html``;
|
|
2916
2992
|
}
|
|
2917
2993
|
};
|
|
2918
2994
|
__decorateClass([
|
|
@@ -2924,6 +3000,9 @@ __decorateClass([
|
|
|
2924
3000
|
__decorateClass([
|
|
2925
3001
|
(0, import_decorators2.property)({ type: Array })
|
|
2926
3002
|
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
3003
|
+
__decorateClass([
|
|
3004
|
+
(0, import_decorators2.property)({ type: Object })
|
|
3005
|
+
], LuzmoBaseVizItem.prototype, "inlineData", 2);
|
|
2927
3006
|
__decorateClass([
|
|
2928
3007
|
(0, import_decorators2.property)({ type: Object })
|
|
2929
3008
|
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
@@ -2945,6 +3024,9 @@ __decorateClass([
|
|
|
2945
3024
|
__decorateClass([
|
|
2946
3025
|
(0, import_decorators2.property)({
|
|
2947
3026
|
converter: (value) => {
|
|
3027
|
+
if (value == null) {
|
|
3028
|
+
return value;
|
|
3029
|
+
}
|
|
2948
3030
|
try {
|
|
2949
3031
|
return JSON.parse(value);
|
|
2950
3032
|
} catch {
|