@luzmo/embed 5.1.3-beta.0 → 5.1.3
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 +15 -0
- package/index.cjs +69 -152
- package/index.d.ts +0 -1
- package/index.js +71 -150
- package/index.libs.cjs +69 -152
- package/index.libs.d.ts +0 -1
- package/index.libs.js +71 -150
- package/lib/dashboard-component/dashboard-base.d.ts +4 -3
- package/luzmo-embed.libs.js +68 -174
- package/luzmo-embed.min.js +68 -174
- package/package.json +2 -2
- package/src/index.d.ts +0 -1
- package/src/lib/dashboard-component/dashboard-base.d.ts +4 -3
- package/lib/viz-item/viz-item-component.d.ts +0 -3
- package/lib/viz-item/viz-item-web-component.d.ts +0 -3
- package/lib/viz-item/viz-item.base.d.ts +0 -23
- package/src/lib/viz-item/viz-item-component.d.ts +0 -3
- package/src/lib/viz-item/viz-item.base.d.ts +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [5.1.3] - 2024-05-02
|
|
5
|
+
|
|
6
|
+
### Bugfixes
|
|
7
|
+
|
|
8
|
+
- Height in edit mode is set to 100%, taking 100% of parent height.
|
|
9
|
+
|
|
10
|
+
## [5.1.2] - 2024-04-29
|
|
11
|
+
|
|
12
|
+
### Bugfixes
|
|
13
|
+
|
|
14
|
+
- Height in edit mode is set to a minimum of 100vh.
|
|
15
|
+
|
|
16
|
+
|
|
4
17
|
## [5.1.1] - 2024-04-24
|
|
5
18
|
|
|
19
|
+
### Updates
|
|
20
|
+
|
|
6
21
|
- Show actual error messages from luzmo application
|
|
7
22
|
|
|
8
23
|
## [5.1.0] - 2024-04-17
|
package/index.cjs
CHANGED
|
@@ -40,8 +40,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
40
40
|
var src_exports = {};
|
|
41
41
|
__export(src_exports, {
|
|
42
42
|
LuzmoDashboard: () => LuzmoDashboard2,
|
|
43
|
-
LuzmoEmbedDashboard: () => LuzmoEmbedDashboard
|
|
44
|
-
LuzmoVizItem: () => LuzmoVizItem
|
|
43
|
+
LuzmoEmbedDashboard: () => LuzmoEmbedDashboard
|
|
45
44
|
});
|
|
46
45
|
module.exports = __toCommonJS(src_exports);
|
|
47
46
|
|
|
@@ -56,7 +55,7 @@ var import_style_map = require("lit/directives/style-map.js");
|
|
|
56
55
|
var import_shared_embed = require("@luzmo/shared-embed");
|
|
57
56
|
|
|
58
57
|
// libs/embed-libs/embed/package.json
|
|
59
|
-
var version = "5.1.3
|
|
58
|
+
var version = "5.1.3";
|
|
60
59
|
|
|
61
60
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
62
61
|
var LuzmoService = class {
|
|
@@ -228,6 +227,7 @@ var import_lit = require("lit");
|
|
|
228
227
|
var dashboardStyles = import_lit.css`
|
|
229
228
|
:host {
|
|
230
229
|
display: block;
|
|
230
|
+
height: 100%;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
@-webkit-keyframes spin {
|
|
@@ -262,6 +262,9 @@ var dashboardStyles = import_lit.css`
|
|
|
262
262
|
border: 0;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
.luzmo-embed-dashboard-ede {
|
|
266
|
+
}
|
|
267
|
+
|
|
265
268
|
.luzmo-embed-container-ede {
|
|
266
269
|
width: 100%;
|
|
267
270
|
height: 100%;
|
|
@@ -338,7 +341,7 @@ var dashboardStyles = import_lit.css`
|
|
|
338
341
|
|
|
339
342
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
|
|
340
343
|
var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
341
|
-
constructor() {
|
|
344
|
+
constructor(inputParameters) {
|
|
342
345
|
super();
|
|
343
346
|
this.language = "auto";
|
|
344
347
|
this.screenMode = "auto";
|
|
@@ -357,11 +360,10 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
357
360
|
this.browserErrorMsg = "";
|
|
358
361
|
this.dashboardError = false;
|
|
359
362
|
this.browserNotSupported = [];
|
|
360
|
-
this.
|
|
363
|
+
this.VERSION = version + "-wc-luzmo";
|
|
361
364
|
this.isLibraryLoaded = false;
|
|
362
365
|
this.currentAuthKey = null;
|
|
363
366
|
this.currentAuthToken = null;
|
|
364
|
-
this.isInitCalled = false;
|
|
365
367
|
this.attributesMap = {
|
|
366
368
|
dashboardId: "dashboard-id",
|
|
367
369
|
dashboardSlug: "dashboard-slug",
|
|
@@ -391,6 +393,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
391
393
|
this._iframeId = `luzmo-dashboard-${this._containerId}`;
|
|
392
394
|
this.iframeLoaded = false;
|
|
393
395
|
this.promises = {};
|
|
396
|
+
this.setInputParameters(inputParameters);
|
|
394
397
|
this.params = this._setOptions();
|
|
395
398
|
this._onResize = () => {
|
|
396
399
|
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
@@ -421,6 +424,60 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
421
424
|
});
|
|
422
425
|
});
|
|
423
426
|
}
|
|
427
|
+
loadLibrary(appServer) {
|
|
428
|
+
if (import_shared_embed.remotesMap[appServer]) {
|
|
429
|
+
return Promise.resolve(import_shared_embed.remotesMap[appServer].module);
|
|
430
|
+
}
|
|
431
|
+
import_shared_embed.remotesMap[appServer] = {
|
|
432
|
+
url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
|
|
433
|
+
format: "esm",
|
|
434
|
+
from: "vite",
|
|
435
|
+
module: void 0
|
|
436
|
+
};
|
|
437
|
+
return (0, import_shared_embed.__federationMethodGetRemote)(appServer, "./DashboardApp").then((module2) => {
|
|
438
|
+
const wrappedModule = (0, import_shared_embed.__federationMethodWrapDefault)(module2, true);
|
|
439
|
+
import_shared_embed.remotesMap[appServer].module = wrappedModule;
|
|
440
|
+
return wrappedModule;
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
setInputParameters(inputParameters) {
|
|
444
|
+
if (!inputParameters) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
const params = [
|
|
448
|
+
"dashboardId",
|
|
449
|
+
"dashboardSlug",
|
|
450
|
+
"itemId",
|
|
451
|
+
"language",
|
|
452
|
+
"qeVersion",
|
|
453
|
+
"screenMode",
|
|
454
|
+
"switchScreenModeOnResize",
|
|
455
|
+
"accentColor",
|
|
456
|
+
"mainColor",
|
|
457
|
+
"authToken",
|
|
458
|
+
"authKey",
|
|
459
|
+
"editMode",
|
|
460
|
+
"loaderBackground",
|
|
461
|
+
"loaderFontColor",
|
|
462
|
+
"loaderSpinnerColor",
|
|
463
|
+
"loaderSpinnerBackground",
|
|
464
|
+
"timezoneId",
|
|
465
|
+
"itemDimensions",
|
|
466
|
+
"apiHost"
|
|
467
|
+
];
|
|
468
|
+
for (const key of params) {
|
|
469
|
+
const value = inputParameters[key];
|
|
470
|
+
if (value) {
|
|
471
|
+
this[key] = value;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (inputParameters.experimental) {
|
|
475
|
+
this.experimental = inputParameters.experimental;
|
|
476
|
+
}
|
|
477
|
+
if (inputParameters.appServer) {
|
|
478
|
+
this.appServer = SharedLib2.addTrailingSlash(inputParameters.appServer);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
424
481
|
// Set resize event listener
|
|
425
482
|
connectedCallback() {
|
|
426
483
|
super.connectedCallback();
|
|
@@ -439,6 +496,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
439
496
|
this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
|
|
440
497
|
this._loaderStyles();
|
|
441
498
|
luzmo_service_default._components.push(this);
|
|
499
|
+
this.initComponent();
|
|
442
500
|
if (this.luzmoEmbedContainer) {
|
|
443
501
|
this._resizeObserver.observe(this.luzmoEmbedContainer);
|
|
444
502
|
}
|
|
@@ -446,7 +504,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
446
504
|
initComponent() {
|
|
447
505
|
this.params = this._setOptions();
|
|
448
506
|
if (this.getIsViewMode()) {
|
|
449
|
-
|
|
507
|
+
this.loadLibrary(this.params.appServer).then(async () => {
|
|
450
508
|
this.isLibraryLoaded = true;
|
|
451
509
|
await this.updateComplete;
|
|
452
510
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -518,21 +576,11 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
518
576
|
"timezoneId",
|
|
519
577
|
"itemDimensions"
|
|
520
578
|
]);
|
|
521
|
-
const conditionsToCheck = ["dashboardId", "dashboardSlug", "itemId"];
|
|
522
|
-
let callInitComponent = false;
|
|
523
|
-
for (const condition of conditionsToCheck) {
|
|
524
|
-
callInitComponent = callInitComponent || changedProperties.get(condition) === void 0 && this[condition];
|
|
525
|
-
}
|
|
526
|
-
if (callInitComponent && !this.isInitCalled) {
|
|
527
|
-
this.initComponent();
|
|
528
|
-
this.isInitCalled = true;
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
579
|
if (this.getIsViewMode()) {
|
|
532
580
|
if (this.dashboardReference) {
|
|
533
581
|
for (const [propertyName] of changedProperties.entries()) {
|
|
534
582
|
if (propertyName === "appSever") {
|
|
535
|
-
|
|
583
|
+
this.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
536
584
|
this.isLibraryLoaded = true;
|
|
537
585
|
await this.updateComplete;
|
|
538
586
|
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -740,7 +788,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
740
788
|
${this.dashboardId || this.dashboardSlug ? import_lit2.html`
|
|
741
789
|
${loader}
|
|
742
790
|
<iframe
|
|
743
|
-
class="luzmo-embed-dashboard"
|
|
791
|
+
class="luzmo-embed-dashboard ${!this.getIsViewMode() ? `luzmo-embed-dashboard-ede` : ""}"
|
|
744
792
|
id="${this._iframeId}"
|
|
745
793
|
name="${this._iframeId}"
|
|
746
794
|
style=${(0, import_style_map.styleMap)(this.iframeStyle)}
|
|
@@ -1031,7 +1079,7 @@ __decorateClass([
|
|
|
1031
1079
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
1032
1080
|
__decorateClass([
|
|
1033
1081
|
(0, import_decorators.property)()
|
|
1034
|
-
], LuzmoDashboard.prototype, "
|
|
1082
|
+
], LuzmoDashboard.prototype, "VERSION", 2);
|
|
1035
1083
|
__decorateClass([
|
|
1036
1084
|
(0, import_decorators.state)()
|
|
1037
1085
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
@@ -1044,9 +1092,6 @@ __decorateClass([
|
|
|
1044
1092
|
__decorateClass([
|
|
1045
1093
|
(0, import_decorators.state)()
|
|
1046
1094
|
], LuzmoDashboard.prototype, "currentAuthToken", 2);
|
|
1047
|
-
__decorateClass([
|
|
1048
|
-
(0, import_decorators.state)()
|
|
1049
|
-
], LuzmoDashboard.prototype, "isInitCalled", 2);
|
|
1050
1095
|
|
|
1051
1096
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
1052
1097
|
var LuzmoDashboard2 = class extends LuzmoDashboard {
|
|
@@ -1059,136 +1104,8 @@ var LuzmoEmbedDashboard = class extends LuzmoDashboard {
|
|
|
1059
1104
|
LuzmoEmbedDashboard = __decorateClass([
|
|
1060
1105
|
(0, import_decorators2.customElement)("luzmo-embed-dashboard")
|
|
1061
1106
|
], LuzmoEmbedDashboard);
|
|
1062
|
-
|
|
1063
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1064
|
-
var import_decorators4 = require("lit/decorators.js");
|
|
1065
|
-
|
|
1066
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
|
|
1067
|
-
var import_decorators3 = require("lit/decorators.js");
|
|
1068
|
-
var import_lit3 = require("lit");
|
|
1069
|
-
var SharedLib3 = __toESM(require("@luzmo/shared-embed"), 1);
|
|
1070
|
-
var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
1071
|
-
constructor() {
|
|
1072
|
-
super();
|
|
1073
|
-
this.appServer = "https://app.luzmo.com";
|
|
1074
|
-
this.apiHost = "https://api.luzmo.com";
|
|
1075
|
-
this.slots = [];
|
|
1076
|
-
this.options = {
|
|
1077
|
-
title: {
|
|
1078
|
-
en: ""
|
|
1079
|
-
},
|
|
1080
|
-
theme: "default"
|
|
1081
|
-
};
|
|
1082
|
-
this.version = version + "-wc-luzmo";
|
|
1083
|
-
}
|
|
1084
|
-
static {
|
|
1085
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1086
|
-
this.styles = import_lit3.css`
|
|
1087
|
-
:host {
|
|
1088
|
-
display: block;
|
|
1089
|
-
width: 100%;
|
|
1090
|
-
height: 100%;
|
|
1091
|
-
}
|
|
1092
|
-
`;
|
|
1093
|
-
}
|
|
1094
|
-
async firstUpdated(_changedProperties) {
|
|
1095
|
-
super.firstUpdated(_changedProperties);
|
|
1096
|
-
if (this.type) {
|
|
1097
|
-
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1098
|
-
this.createAndAppendElement();
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
createAndAppendElement() {
|
|
1102
|
-
if (!this.chartElement) {
|
|
1103
|
-
this.chartElement = document.createElement("chart-component");
|
|
1104
|
-
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
1105
|
-
this.updateVizItemProperties();
|
|
1106
|
-
this.renderRoot.append(this.chartElement);
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
updateVizItemProperties() {
|
|
1110
|
-
if (this.chartElement) {
|
|
1111
|
-
for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
|
|
1112
|
-
const value = this[key];
|
|
1113
|
-
if (value) {
|
|
1114
|
-
const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
|
|
1115
|
-
this.chartElement.setAttribute(
|
|
1116
|
-
SharedLib3.libraryTypeToWebComponentTypeMapping[key],
|
|
1117
|
-
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
1118
|
-
);
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
async updated(changedProperties) {
|
|
1124
|
-
if (this.chartElement) {
|
|
1125
|
-
for (const [propertyName] of changedProperties.entries()) {
|
|
1126
|
-
const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
1127
|
-
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
1128
|
-
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1129
|
-
}
|
|
1130
|
-
} else {
|
|
1131
|
-
if (this.type) {
|
|
1132
|
-
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1133
|
-
this.createAndAppendElement();
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
render() {
|
|
1138
|
-
return import_lit3.html` `;
|
|
1139
|
-
}
|
|
1140
|
-
};
|
|
1141
|
-
__decorateClass([
|
|
1142
|
-
(0, import_decorators3.property)()
|
|
1143
|
-
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1144
|
-
__decorateClass([
|
|
1145
|
-
(0, import_decorators3.property)()
|
|
1146
|
-
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1147
|
-
__decorateClass([
|
|
1148
|
-
(0, import_decorators3.property)({ type: Array })
|
|
1149
|
-
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1150
|
-
__decorateClass([
|
|
1151
|
-
(0, import_decorators3.property)({ type: Object })
|
|
1152
|
-
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1153
|
-
__decorateClass([
|
|
1154
|
-
(0, import_decorators3.property)()
|
|
1155
|
-
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1156
|
-
__decorateClass([
|
|
1157
|
-
(0, import_decorators3.property)()
|
|
1158
|
-
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1159
|
-
__decorateClass([
|
|
1160
|
-
(0, import_decorators3.property)()
|
|
1161
|
-
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1162
|
-
__decorateClass([
|
|
1163
|
-
(0, import_decorators3.property)()
|
|
1164
|
-
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1165
|
-
__decorateClass([
|
|
1166
|
-
(0, import_decorators3.property)()
|
|
1167
|
-
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1168
|
-
__decorateClass([
|
|
1169
|
-
(0, import_decorators3.property)({
|
|
1170
|
-
converter: (value) => {
|
|
1171
|
-
try {
|
|
1172
|
-
return JSON.parse(value);
|
|
1173
|
-
} catch (exc) {
|
|
1174
|
-
return value;
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
})
|
|
1178
|
-
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1179
|
-
__decorateClass([
|
|
1180
|
-
(0, import_decorators3.property)({ type: Array })
|
|
1181
|
-
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1182
|
-
|
|
1183
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1184
|
-
var LuzmoVizItem = class extends LuzmoBaseVizItem {
|
|
1185
|
-
};
|
|
1186
|
-
LuzmoVizItem = __decorateClass([
|
|
1187
|
-
(0, import_decorators4.customElement)("luzmo-viz-item")
|
|
1188
|
-
], LuzmoVizItem);
|
|
1189
1107
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1190
1108
|
0 && (module.exports = {
|
|
1191
1109
|
LuzmoDashboard,
|
|
1192
|
-
LuzmoEmbedDashboard
|
|
1193
|
-
LuzmoVizItem
|
|
1110
|
+
LuzmoEmbedDashboard
|
|
1194
1111
|
});
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export type { LoadEvent, ChangedFiltersEvent, CustomEvent, ItemsRenderedEvent, ExportedEvent, DashboardActionEvent, Filter, FilterExpression, FilterOrigin, FilterInput, FilterGroup, ExportType, ItemData, ExportDashboard, AccessibleDashboard, SetEditMode } from '@luzmo/shared-embed';
|
|
2
2
|
export * from './lib/dashboard-component/dashboard-component';
|
|
3
|
-
export * from './lib/viz-item/viz-item-component';
|
package/index.js
CHANGED
|
@@ -30,11 +30,14 @@ import {
|
|
|
30
30
|
styleMap
|
|
31
31
|
} from "lit/directives/style-map.js";
|
|
32
32
|
import {
|
|
33
|
+
__federationMethodGetRemote,
|
|
34
|
+
__federationMethodWrapDefault,
|
|
35
|
+
remotesMap,
|
|
33
36
|
luzmoEmbedContainerClass
|
|
34
37
|
} from "@luzmo/shared-embed";
|
|
35
38
|
|
|
36
39
|
// libs/embed-libs/embed/package.json
|
|
37
|
-
var version = "5.1.3
|
|
40
|
+
var version = "5.1.3";
|
|
38
41
|
|
|
39
42
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
40
43
|
var LuzmoService = class {
|
|
@@ -206,6 +209,7 @@ import { css } from "lit";
|
|
|
206
209
|
var dashboardStyles = css`
|
|
207
210
|
:host {
|
|
208
211
|
display: block;
|
|
212
|
+
height: 100%;
|
|
209
213
|
}
|
|
210
214
|
|
|
211
215
|
@-webkit-keyframes spin {
|
|
@@ -240,6 +244,9 @@ var dashboardStyles = css`
|
|
|
240
244
|
border: 0;
|
|
241
245
|
}
|
|
242
246
|
|
|
247
|
+
.luzmo-embed-dashboard-ede {
|
|
248
|
+
}
|
|
249
|
+
|
|
243
250
|
.luzmo-embed-container-ede {
|
|
244
251
|
width: 100%;
|
|
245
252
|
height: 100%;
|
|
@@ -316,7 +323,7 @@ var dashboardStyles = css`
|
|
|
316
323
|
|
|
317
324
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
|
|
318
325
|
var LuzmoDashboard = class extends LitElement {
|
|
319
|
-
constructor() {
|
|
326
|
+
constructor(inputParameters) {
|
|
320
327
|
super();
|
|
321
328
|
this.language = "auto";
|
|
322
329
|
this.screenMode = "auto";
|
|
@@ -335,11 +342,10 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
335
342
|
this.browserErrorMsg = "";
|
|
336
343
|
this.dashboardError = false;
|
|
337
344
|
this.browserNotSupported = [];
|
|
338
|
-
this.
|
|
345
|
+
this.VERSION = version + "-wc-luzmo";
|
|
339
346
|
this.isLibraryLoaded = false;
|
|
340
347
|
this.currentAuthKey = null;
|
|
341
348
|
this.currentAuthToken = null;
|
|
342
|
-
this.isInitCalled = false;
|
|
343
349
|
this.attributesMap = {
|
|
344
350
|
dashboardId: "dashboard-id",
|
|
345
351
|
dashboardSlug: "dashboard-slug",
|
|
@@ -369,6 +375,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
369
375
|
this._iframeId = `luzmo-dashboard-${this._containerId}`;
|
|
370
376
|
this.iframeLoaded = false;
|
|
371
377
|
this.promises = {};
|
|
378
|
+
this.setInputParameters(inputParameters);
|
|
372
379
|
this.params = this._setOptions();
|
|
373
380
|
this._onResize = () => {
|
|
374
381
|
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
@@ -399,6 +406,60 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
399
406
|
});
|
|
400
407
|
});
|
|
401
408
|
}
|
|
409
|
+
loadLibrary(appServer) {
|
|
410
|
+
if (remotesMap[appServer]) {
|
|
411
|
+
return Promise.resolve(remotesMap[appServer].module);
|
|
412
|
+
}
|
|
413
|
+
remotesMap[appServer] = {
|
|
414
|
+
url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
|
|
415
|
+
format: "esm",
|
|
416
|
+
from: "vite",
|
|
417
|
+
module: void 0
|
|
418
|
+
};
|
|
419
|
+
return __federationMethodGetRemote(appServer, "./DashboardApp").then((module) => {
|
|
420
|
+
const wrappedModule = __federationMethodWrapDefault(module, true);
|
|
421
|
+
remotesMap[appServer].module = wrappedModule;
|
|
422
|
+
return wrappedModule;
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
setInputParameters(inputParameters) {
|
|
426
|
+
if (!inputParameters) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
const params = [
|
|
430
|
+
"dashboardId",
|
|
431
|
+
"dashboardSlug",
|
|
432
|
+
"itemId",
|
|
433
|
+
"language",
|
|
434
|
+
"qeVersion",
|
|
435
|
+
"screenMode",
|
|
436
|
+
"switchScreenModeOnResize",
|
|
437
|
+
"accentColor",
|
|
438
|
+
"mainColor",
|
|
439
|
+
"authToken",
|
|
440
|
+
"authKey",
|
|
441
|
+
"editMode",
|
|
442
|
+
"loaderBackground",
|
|
443
|
+
"loaderFontColor",
|
|
444
|
+
"loaderSpinnerColor",
|
|
445
|
+
"loaderSpinnerBackground",
|
|
446
|
+
"timezoneId",
|
|
447
|
+
"itemDimensions",
|
|
448
|
+
"apiHost"
|
|
449
|
+
];
|
|
450
|
+
for (const key of params) {
|
|
451
|
+
const value = inputParameters[key];
|
|
452
|
+
if (value) {
|
|
453
|
+
this[key] = value;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (inputParameters.experimental) {
|
|
457
|
+
this.experimental = inputParameters.experimental;
|
|
458
|
+
}
|
|
459
|
+
if (inputParameters.appServer) {
|
|
460
|
+
this.appServer = SharedLib2.addTrailingSlash(inputParameters.appServer);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
402
463
|
// Set resize event listener
|
|
403
464
|
connectedCallback() {
|
|
404
465
|
super.connectedCallback();
|
|
@@ -417,6 +478,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
417
478
|
this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
|
|
418
479
|
this._loaderStyles();
|
|
419
480
|
luzmo_service_default._components.push(this);
|
|
481
|
+
this.initComponent();
|
|
420
482
|
if (this.luzmoEmbedContainer) {
|
|
421
483
|
this._resizeObserver.observe(this.luzmoEmbedContainer);
|
|
422
484
|
}
|
|
@@ -424,7 +486,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
424
486
|
initComponent() {
|
|
425
487
|
this.params = this._setOptions();
|
|
426
488
|
if (this.getIsViewMode()) {
|
|
427
|
-
|
|
489
|
+
this.loadLibrary(this.params.appServer).then(async () => {
|
|
428
490
|
this.isLibraryLoaded = true;
|
|
429
491
|
await this.updateComplete;
|
|
430
492
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -496,21 +558,11 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
496
558
|
"timezoneId",
|
|
497
559
|
"itemDimensions"
|
|
498
560
|
]);
|
|
499
|
-
const conditionsToCheck = ["dashboardId", "dashboardSlug", "itemId"];
|
|
500
|
-
let callInitComponent = false;
|
|
501
|
-
for (const condition of conditionsToCheck) {
|
|
502
|
-
callInitComponent = callInitComponent || changedProperties.get(condition) === void 0 && this[condition];
|
|
503
|
-
}
|
|
504
|
-
if (callInitComponent && !this.isInitCalled) {
|
|
505
|
-
this.initComponent();
|
|
506
|
-
this.isInitCalled = true;
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
561
|
if (this.getIsViewMode()) {
|
|
510
562
|
if (this.dashboardReference) {
|
|
511
563
|
for (const [propertyName] of changedProperties.entries()) {
|
|
512
564
|
if (propertyName === "appSever") {
|
|
513
|
-
|
|
565
|
+
this.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
514
566
|
this.isLibraryLoaded = true;
|
|
515
567
|
await this.updateComplete;
|
|
516
568
|
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -718,7 +770,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
718
770
|
${this.dashboardId || this.dashboardSlug ? html`
|
|
719
771
|
${loader}
|
|
720
772
|
<iframe
|
|
721
|
-
class="luzmo-embed-dashboard"
|
|
773
|
+
class="luzmo-embed-dashboard ${!this.getIsViewMode() ? `luzmo-embed-dashboard-ede` : ""}"
|
|
722
774
|
id="${this._iframeId}"
|
|
723
775
|
name="${this._iframeId}"
|
|
724
776
|
style=${styleMap(this.iframeStyle)}
|
|
@@ -1009,7 +1061,7 @@ __decorateClass([
|
|
|
1009
1061
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
1010
1062
|
__decorateClass([
|
|
1011
1063
|
property()
|
|
1012
|
-
], LuzmoDashboard.prototype, "
|
|
1064
|
+
], LuzmoDashboard.prototype, "VERSION", 2);
|
|
1013
1065
|
__decorateClass([
|
|
1014
1066
|
state()
|
|
1015
1067
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
@@ -1022,9 +1074,6 @@ __decorateClass([
|
|
|
1022
1074
|
__decorateClass([
|
|
1023
1075
|
state()
|
|
1024
1076
|
], LuzmoDashboard.prototype, "currentAuthToken", 2);
|
|
1025
|
-
__decorateClass([
|
|
1026
|
-
state()
|
|
1027
|
-
], LuzmoDashboard.prototype, "isInitCalled", 2);
|
|
1028
1077
|
|
|
1029
1078
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
1030
1079
|
var LuzmoDashboard2 = class extends LuzmoDashboard {
|
|
@@ -1037,135 +1086,7 @@ var LuzmoEmbedDashboard = class extends LuzmoDashboard {
|
|
|
1037
1086
|
LuzmoEmbedDashboard = __decorateClass([
|
|
1038
1087
|
customElement("luzmo-embed-dashboard")
|
|
1039
1088
|
], LuzmoEmbedDashboard);
|
|
1040
|
-
|
|
1041
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1042
|
-
import { customElement as customElement3 } from "lit/decorators.js";
|
|
1043
|
-
|
|
1044
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
|
|
1045
|
-
import { property as property2 } from "lit/decorators.js";
|
|
1046
|
-
import { LitElement as LitElement2, html as html2, css as css2 } from "lit";
|
|
1047
|
-
import * as SharedLib3 from "@luzmo/shared-embed";
|
|
1048
|
-
var LuzmoBaseVizItem = class extends LitElement2 {
|
|
1049
|
-
constructor() {
|
|
1050
|
-
super();
|
|
1051
|
-
this.appServer = "https://app.luzmo.com";
|
|
1052
|
-
this.apiHost = "https://api.luzmo.com";
|
|
1053
|
-
this.slots = [];
|
|
1054
|
-
this.options = {
|
|
1055
|
-
title: {
|
|
1056
|
-
en: ""
|
|
1057
|
-
},
|
|
1058
|
-
theme: "default"
|
|
1059
|
-
};
|
|
1060
|
-
this.version = version + "-wc-luzmo";
|
|
1061
|
-
}
|
|
1062
|
-
static {
|
|
1063
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1064
|
-
this.styles = css2`
|
|
1065
|
-
:host {
|
|
1066
|
-
display: block;
|
|
1067
|
-
width: 100%;
|
|
1068
|
-
height: 100%;
|
|
1069
|
-
}
|
|
1070
|
-
`;
|
|
1071
|
-
}
|
|
1072
|
-
async firstUpdated(_changedProperties) {
|
|
1073
|
-
super.firstUpdated(_changedProperties);
|
|
1074
|
-
if (this.type) {
|
|
1075
|
-
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1076
|
-
this.createAndAppendElement();
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
createAndAppendElement() {
|
|
1080
|
-
if (!this.chartElement) {
|
|
1081
|
-
this.chartElement = document.createElement("chart-component");
|
|
1082
|
-
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
1083
|
-
this.updateVizItemProperties();
|
|
1084
|
-
this.renderRoot.append(this.chartElement);
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
updateVizItemProperties() {
|
|
1088
|
-
if (this.chartElement) {
|
|
1089
|
-
for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
|
|
1090
|
-
const value = this[key];
|
|
1091
|
-
if (value) {
|
|
1092
|
-
const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
|
|
1093
|
-
this.chartElement.setAttribute(
|
|
1094
|
-
SharedLib3.libraryTypeToWebComponentTypeMapping[key],
|
|
1095
|
-
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
1096
|
-
);
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
async updated(changedProperties) {
|
|
1102
|
-
if (this.chartElement) {
|
|
1103
|
-
for (const [propertyName] of changedProperties.entries()) {
|
|
1104
|
-
const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
1105
|
-
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
1106
|
-
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1107
|
-
}
|
|
1108
|
-
} else {
|
|
1109
|
-
if (this.type) {
|
|
1110
|
-
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1111
|
-
this.createAndAppendElement();
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
render() {
|
|
1116
|
-
return html2` `;
|
|
1117
|
-
}
|
|
1118
|
-
};
|
|
1119
|
-
__decorateClass([
|
|
1120
|
-
property2()
|
|
1121
|
-
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1122
|
-
__decorateClass([
|
|
1123
|
-
property2()
|
|
1124
|
-
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1125
|
-
__decorateClass([
|
|
1126
|
-
property2({ type: Array })
|
|
1127
|
-
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1128
|
-
__decorateClass([
|
|
1129
|
-
property2({ type: Object })
|
|
1130
|
-
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1131
|
-
__decorateClass([
|
|
1132
|
-
property2()
|
|
1133
|
-
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1134
|
-
__decorateClass([
|
|
1135
|
-
property2()
|
|
1136
|
-
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1137
|
-
__decorateClass([
|
|
1138
|
-
property2()
|
|
1139
|
-
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1140
|
-
__decorateClass([
|
|
1141
|
-
property2()
|
|
1142
|
-
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1143
|
-
__decorateClass([
|
|
1144
|
-
property2()
|
|
1145
|
-
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1146
|
-
__decorateClass([
|
|
1147
|
-
property2({
|
|
1148
|
-
converter: (value) => {
|
|
1149
|
-
try {
|
|
1150
|
-
return JSON.parse(value);
|
|
1151
|
-
} catch (exc) {
|
|
1152
|
-
return value;
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
})
|
|
1156
|
-
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1157
|
-
__decorateClass([
|
|
1158
|
-
property2({ type: Array })
|
|
1159
|
-
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1160
|
-
|
|
1161
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1162
|
-
var LuzmoVizItem = class extends LuzmoBaseVizItem {
|
|
1163
|
-
};
|
|
1164
|
-
LuzmoVizItem = __decorateClass([
|
|
1165
|
-
customElement3("luzmo-viz-item")
|
|
1166
|
-
], LuzmoVizItem);
|
|
1167
1089
|
export {
|
|
1168
1090
|
LuzmoDashboard2 as LuzmoDashboard,
|
|
1169
|
-
LuzmoEmbedDashboard
|
|
1170
|
-
LuzmoVizItem
|
|
1091
|
+
LuzmoEmbedDashboard
|
|
1171
1092
|
};
|