@luzmo/embed 5.1.3-beta.3 → 5.1.4
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 +21 -0
- package/index.cjs +69 -173
- package/index.d.ts +0 -1
- package/index.js +71 -171
- package/index.libs.cjs +69 -173
- package/index.libs.d.ts +0 -1
- package/index.libs.js +71 -171
- package/lib/dashboard-component/dashboard-base.d.ts +4 -3
- package/luzmo-embed.libs.js +79 -4395
- package/luzmo-embed.min.js +79 -4395
- package/package.json +2 -3
- 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 -24
- package/src/lib/viz-item/viz-item-component.d.ts +0 -3
- package/src/lib/viz-item/viz-item.base.d.ts +0 -24
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.
|
|
40
|
+
var version = "5.1.4";
|
|
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,156 +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 customElement2 } 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
|
-
import { fromError } from "zod-validation-error";
|
|
1049
|
-
var LuzmoBaseVizItem = class extends LitElement2 {
|
|
1050
|
-
constructor() {
|
|
1051
|
-
super();
|
|
1052
|
-
this.appServer = "https://app.luzmo.com";
|
|
1053
|
-
this.apiHost = "https://api.luzmo.com";
|
|
1054
|
-
this.slots = [];
|
|
1055
|
-
this.options = {
|
|
1056
|
-
title: {
|
|
1057
|
-
en: ""
|
|
1058
|
-
},
|
|
1059
|
-
theme: "default"
|
|
1060
|
-
};
|
|
1061
|
-
this.version = version + "-wc-luzmo";
|
|
1062
|
-
}
|
|
1063
|
-
static {
|
|
1064
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1065
|
-
this.styles = css2`
|
|
1066
|
-
:host {
|
|
1067
|
-
display: block;
|
|
1068
|
-
width: 100%;
|
|
1069
|
-
height: 100%;
|
|
1070
|
-
}
|
|
1071
|
-
`;
|
|
1072
|
-
}
|
|
1073
|
-
async firstUpdated(_changedProperties) {
|
|
1074
|
-
super.firstUpdated(_changedProperties);
|
|
1075
|
-
if (this.type) {
|
|
1076
|
-
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1077
|
-
this.createAndAppendElement();
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
createAndAppendElement() {
|
|
1081
|
-
if (!this.chartElement) {
|
|
1082
|
-
this.chartElement = document.createElement("chart-component");
|
|
1083
|
-
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
1084
|
-
this.updateVizItemProperties();
|
|
1085
|
-
this.renderRoot.append(this.chartElement);
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
updateVizItemProperties() {
|
|
1089
|
-
if (this.chartElement) {
|
|
1090
|
-
for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
|
|
1091
|
-
const value = this[key];
|
|
1092
|
-
if (value) {
|
|
1093
|
-
this.parseAndValidate(key);
|
|
1094
|
-
const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
|
|
1095
|
-
this.chartElement.setAttribute(
|
|
1096
|
-
SharedLib3.libraryTypeToWebComponentTypeMapping[key],
|
|
1097
|
-
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
1098
|
-
);
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
async updated(changedProperties) {
|
|
1104
|
-
if (this.chartElement) {
|
|
1105
|
-
for (const [propertyName] of changedProperties.entries()) {
|
|
1106
|
-
const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
1107
|
-
this.parseAndValidate(propertyName);
|
|
1108
|
-
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
1109
|
-
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1110
|
-
}
|
|
1111
|
-
} else {
|
|
1112
|
-
if (this.type) {
|
|
1113
|
-
this.parseAndValidate("type");
|
|
1114
|
-
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1115
|
-
this.createAndAppendElement();
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
parseAndValidate(key) {
|
|
1120
|
-
try {
|
|
1121
|
-
if (key === "slots") {
|
|
1122
|
-
SharedLib3.slotsParser.parse(this.slots);
|
|
1123
|
-
} else if (key === "options") {
|
|
1124
|
-
SharedLib3.vizItemOptionsParser.parse(this.options);
|
|
1125
|
-
} else if (key === "canFilter") {
|
|
1126
|
-
SharedLib3.canFilterParser.parse(this.canFilter);
|
|
1127
|
-
} else if (key === "type") {
|
|
1128
|
-
SharedLib3.itemTypeParser.parse(this.type);
|
|
1129
|
-
}
|
|
1130
|
-
} catch (err) {
|
|
1131
|
-
const validationError = fromError(err);
|
|
1132
|
-
console.error(err);
|
|
1133
|
-
console.error(validationError.toString());
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
render() {
|
|
1137
|
-
return html2` `;
|
|
1138
|
-
}
|
|
1139
|
-
};
|
|
1140
|
-
__decorateClass([
|
|
1141
|
-
property2()
|
|
1142
|
-
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1143
|
-
__decorateClass([
|
|
1144
|
-
property2()
|
|
1145
|
-
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1146
|
-
__decorateClass([
|
|
1147
|
-
property2({ type: Array })
|
|
1148
|
-
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1149
|
-
__decorateClass([
|
|
1150
|
-
property2({ type: Object })
|
|
1151
|
-
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1152
|
-
__decorateClass([
|
|
1153
|
-
property2()
|
|
1154
|
-
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1155
|
-
__decorateClass([
|
|
1156
|
-
property2()
|
|
1157
|
-
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1158
|
-
__decorateClass([
|
|
1159
|
-
property2()
|
|
1160
|
-
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1161
|
-
__decorateClass([
|
|
1162
|
-
property2()
|
|
1163
|
-
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1164
|
-
__decorateClass([
|
|
1165
|
-
property2()
|
|
1166
|
-
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1167
|
-
__decorateClass([
|
|
1168
|
-
property2({
|
|
1169
|
-
converter: (value) => {
|
|
1170
|
-
try {
|
|
1171
|
-
return JSON.parse(value);
|
|
1172
|
-
} catch (exc) {
|
|
1173
|
-
return value;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
})
|
|
1177
|
-
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1178
|
-
__decorateClass([
|
|
1179
|
-
property2({ type: Array })
|
|
1180
|
-
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1181
|
-
|
|
1182
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1183
|
-
var LuzmoVizItem = class extends LuzmoBaseVizItem {
|
|
1184
|
-
};
|
|
1185
|
-
LuzmoVizItem = __decorateClass([
|
|
1186
|
-
customElement2("luzmo-viz-item")
|
|
1187
|
-
], LuzmoVizItem);
|
|
1188
1089
|
export {
|
|
1189
1090
|
LuzmoDashboard2 as LuzmoDashboard,
|
|
1190
|
-
LuzmoEmbedDashboard
|
|
1191
|
-
LuzmoVizItem
|
|
1091
|
+
LuzmoEmbedDashboard
|
|
1192
1092
|
};
|
package/index.libs.cjs
CHANGED
|
@@ -39,8 +39,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
39
39
|
// libs/embed-libs/embed/src/index.libs.ts
|
|
40
40
|
var index_libs_exports = {};
|
|
41
41
|
__export(index_libs_exports, {
|
|
42
|
-
LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent
|
|
43
|
-
LuzmoVizItemWebComponent: () => LuzmoVizItemWebComponent
|
|
42
|
+
LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent
|
|
44
43
|
});
|
|
45
44
|
module.exports = __toCommonJS(index_libs_exports);
|
|
46
45
|
|
|
@@ -55,7 +54,7 @@ var import_style_map = require("lit/directives/style-map.js");
|
|
|
55
54
|
var import_shared_embed = require("@luzmo/shared-embed");
|
|
56
55
|
|
|
57
56
|
// libs/embed-libs/embed/package.json
|
|
58
|
-
var version = "5.1.
|
|
57
|
+
var version = "5.1.4";
|
|
59
58
|
|
|
60
59
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
61
60
|
var LuzmoService = class {
|
|
@@ -227,6 +226,7 @@ var import_lit = require("lit");
|
|
|
227
226
|
var dashboardStyles = import_lit.css`
|
|
228
227
|
:host {
|
|
229
228
|
display: block;
|
|
229
|
+
height: 100%;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
@-webkit-keyframes spin {
|
|
@@ -261,6 +261,9 @@ var dashboardStyles = import_lit.css`
|
|
|
261
261
|
border: 0;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
+
.luzmo-embed-dashboard-ede {
|
|
265
|
+
}
|
|
266
|
+
|
|
264
267
|
.luzmo-embed-container-ede {
|
|
265
268
|
width: 100%;
|
|
266
269
|
height: 100%;
|
|
@@ -337,7 +340,7 @@ var dashboardStyles = import_lit.css`
|
|
|
337
340
|
|
|
338
341
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
|
|
339
342
|
var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
340
|
-
constructor() {
|
|
343
|
+
constructor(inputParameters) {
|
|
341
344
|
super();
|
|
342
345
|
this.language = "auto";
|
|
343
346
|
this.screenMode = "auto";
|
|
@@ -356,11 +359,10 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
356
359
|
this.browserErrorMsg = "";
|
|
357
360
|
this.dashboardError = false;
|
|
358
361
|
this.browserNotSupported = [];
|
|
359
|
-
this.
|
|
362
|
+
this.VERSION = version + "-wc-luzmo";
|
|
360
363
|
this.isLibraryLoaded = false;
|
|
361
364
|
this.currentAuthKey = null;
|
|
362
365
|
this.currentAuthToken = null;
|
|
363
|
-
this.isInitCalled = false;
|
|
364
366
|
this.attributesMap = {
|
|
365
367
|
dashboardId: "dashboard-id",
|
|
366
368
|
dashboardSlug: "dashboard-slug",
|
|
@@ -390,6 +392,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
390
392
|
this._iframeId = `luzmo-dashboard-${this._containerId}`;
|
|
391
393
|
this.iframeLoaded = false;
|
|
392
394
|
this.promises = {};
|
|
395
|
+
this.setInputParameters(inputParameters);
|
|
393
396
|
this.params = this._setOptions();
|
|
394
397
|
this._onResize = () => {
|
|
395
398
|
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
@@ -420,6 +423,60 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
420
423
|
});
|
|
421
424
|
});
|
|
422
425
|
}
|
|
426
|
+
loadLibrary(appServer) {
|
|
427
|
+
if (import_shared_embed.remotesMap[appServer]) {
|
|
428
|
+
return Promise.resolve(import_shared_embed.remotesMap[appServer].module);
|
|
429
|
+
}
|
|
430
|
+
import_shared_embed.remotesMap[appServer] = {
|
|
431
|
+
url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
|
|
432
|
+
format: "esm",
|
|
433
|
+
from: "vite",
|
|
434
|
+
module: void 0
|
|
435
|
+
};
|
|
436
|
+
return (0, import_shared_embed.__federationMethodGetRemote)(appServer, "./DashboardApp").then((module2) => {
|
|
437
|
+
const wrappedModule = (0, import_shared_embed.__federationMethodWrapDefault)(module2, true);
|
|
438
|
+
import_shared_embed.remotesMap[appServer].module = wrappedModule;
|
|
439
|
+
return wrappedModule;
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
setInputParameters(inputParameters) {
|
|
443
|
+
if (!inputParameters) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
const params = [
|
|
447
|
+
"dashboardId",
|
|
448
|
+
"dashboardSlug",
|
|
449
|
+
"itemId",
|
|
450
|
+
"language",
|
|
451
|
+
"qeVersion",
|
|
452
|
+
"screenMode",
|
|
453
|
+
"switchScreenModeOnResize",
|
|
454
|
+
"accentColor",
|
|
455
|
+
"mainColor",
|
|
456
|
+
"authToken",
|
|
457
|
+
"authKey",
|
|
458
|
+
"editMode",
|
|
459
|
+
"loaderBackground",
|
|
460
|
+
"loaderFontColor",
|
|
461
|
+
"loaderSpinnerColor",
|
|
462
|
+
"loaderSpinnerBackground",
|
|
463
|
+
"timezoneId",
|
|
464
|
+
"itemDimensions",
|
|
465
|
+
"apiHost"
|
|
466
|
+
];
|
|
467
|
+
for (const key of params) {
|
|
468
|
+
const value = inputParameters[key];
|
|
469
|
+
if (value) {
|
|
470
|
+
this[key] = value;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
if (inputParameters.experimental) {
|
|
474
|
+
this.experimental = inputParameters.experimental;
|
|
475
|
+
}
|
|
476
|
+
if (inputParameters.appServer) {
|
|
477
|
+
this.appServer = SharedLib2.addTrailingSlash(inputParameters.appServer);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
423
480
|
// Set resize event listener
|
|
424
481
|
connectedCallback() {
|
|
425
482
|
super.connectedCallback();
|
|
@@ -438,6 +495,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
438
495
|
this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
|
|
439
496
|
this._loaderStyles();
|
|
440
497
|
luzmo_service_default._components.push(this);
|
|
498
|
+
this.initComponent();
|
|
441
499
|
if (this.luzmoEmbedContainer) {
|
|
442
500
|
this._resizeObserver.observe(this.luzmoEmbedContainer);
|
|
443
501
|
}
|
|
@@ -445,7 +503,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
445
503
|
initComponent() {
|
|
446
504
|
this.params = this._setOptions();
|
|
447
505
|
if (this.getIsViewMode()) {
|
|
448
|
-
|
|
506
|
+
this.loadLibrary(this.params.appServer).then(async () => {
|
|
449
507
|
this.isLibraryLoaded = true;
|
|
450
508
|
await this.updateComplete;
|
|
451
509
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -517,21 +575,11 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
517
575
|
"timezoneId",
|
|
518
576
|
"itemDimensions"
|
|
519
577
|
]);
|
|
520
|
-
const conditionsToCheck = ["dashboardId", "dashboardSlug", "itemId"];
|
|
521
|
-
let callInitComponent = false;
|
|
522
|
-
for (const condition of conditionsToCheck) {
|
|
523
|
-
callInitComponent = callInitComponent || changedProperties.get(condition) === void 0 && this[condition];
|
|
524
|
-
}
|
|
525
|
-
if (callInitComponent && !this.isInitCalled) {
|
|
526
|
-
this.initComponent();
|
|
527
|
-
this.isInitCalled = true;
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
578
|
if (this.getIsViewMode()) {
|
|
531
579
|
if (this.dashboardReference) {
|
|
532
580
|
for (const [propertyName] of changedProperties.entries()) {
|
|
533
581
|
if (propertyName === "appSever") {
|
|
534
|
-
|
|
582
|
+
this.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
535
583
|
this.isLibraryLoaded = true;
|
|
536
584
|
await this.updateComplete;
|
|
537
585
|
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -739,7 +787,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
739
787
|
${this.dashboardId || this.dashboardSlug ? import_lit2.html`
|
|
740
788
|
${loader}
|
|
741
789
|
<iframe
|
|
742
|
-
class="luzmo-embed-dashboard"
|
|
790
|
+
class="luzmo-embed-dashboard ${!this.getIsViewMode() ? `luzmo-embed-dashboard-ede` : ""}"
|
|
743
791
|
id="${this._iframeId}"
|
|
744
792
|
name="${this._iframeId}"
|
|
745
793
|
style=${(0, import_style_map.styleMap)(this.iframeStyle)}
|
|
@@ -1030,7 +1078,7 @@ __decorateClass([
|
|
|
1030
1078
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
1031
1079
|
__decorateClass([
|
|
1032
1080
|
(0, import_decorators.property)()
|
|
1033
|
-
], LuzmoDashboard.prototype, "
|
|
1081
|
+
], LuzmoDashboard.prototype, "VERSION", 2);
|
|
1034
1082
|
__decorateClass([
|
|
1035
1083
|
(0, import_decorators.state)()
|
|
1036
1084
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
@@ -1043,9 +1091,6 @@ __decorateClass([
|
|
|
1043
1091
|
__decorateClass([
|
|
1044
1092
|
(0, import_decorators.state)()
|
|
1045
1093
|
], LuzmoDashboard.prototype, "currentAuthToken", 2);
|
|
1046
|
-
__decorateClass([
|
|
1047
|
-
(0, import_decorators.state)()
|
|
1048
|
-
], LuzmoDashboard.prototype, "isInitCalled", 2);
|
|
1049
1094
|
|
|
1050
1095
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-web-component.ts
|
|
1051
1096
|
var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
|
|
@@ -1053,156 +1098,7 @@ var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
|
|
|
1053
1098
|
LuzmoDashboardWebComponent = __decorateClass([
|
|
1054
1099
|
(0, import_decorators2.customElement)("luzmo-dashboard-web-component")
|
|
1055
1100
|
], LuzmoDashboardWebComponent);
|
|
1056
|
-
|
|
1057
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item-web-component.ts
|
|
1058
|
-
var import_decorators4 = require("lit/decorators.js");
|
|
1059
|
-
|
|
1060
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
|
|
1061
|
-
var import_decorators3 = require("lit/decorators.js");
|
|
1062
|
-
var import_lit3 = require("lit");
|
|
1063
|
-
var SharedLib3 = __toESM(require("@luzmo/shared-embed"), 1);
|
|
1064
|
-
var import_zod_validation_error = require("zod-validation-error");
|
|
1065
|
-
var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
1066
|
-
constructor() {
|
|
1067
|
-
super();
|
|
1068
|
-
this.appServer = "https://app.luzmo.com";
|
|
1069
|
-
this.apiHost = "https://api.luzmo.com";
|
|
1070
|
-
this.slots = [];
|
|
1071
|
-
this.options = {
|
|
1072
|
-
title: {
|
|
1073
|
-
en: ""
|
|
1074
|
-
},
|
|
1075
|
-
theme: "default"
|
|
1076
|
-
};
|
|
1077
|
-
this.version = version + "-wc-luzmo";
|
|
1078
|
-
}
|
|
1079
|
-
static {
|
|
1080
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1081
|
-
this.styles = import_lit3.css`
|
|
1082
|
-
:host {
|
|
1083
|
-
display: block;
|
|
1084
|
-
width: 100%;
|
|
1085
|
-
height: 100%;
|
|
1086
|
-
}
|
|
1087
|
-
`;
|
|
1088
|
-
}
|
|
1089
|
-
async firstUpdated(_changedProperties) {
|
|
1090
|
-
super.firstUpdated(_changedProperties);
|
|
1091
|
-
if (this.type) {
|
|
1092
|
-
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1093
|
-
this.createAndAppendElement();
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
createAndAppendElement() {
|
|
1097
|
-
if (!this.chartElement) {
|
|
1098
|
-
this.chartElement = document.createElement("chart-component");
|
|
1099
|
-
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
1100
|
-
this.updateVizItemProperties();
|
|
1101
|
-
this.renderRoot.append(this.chartElement);
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
updateVizItemProperties() {
|
|
1105
|
-
if (this.chartElement) {
|
|
1106
|
-
for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
|
|
1107
|
-
const value = this[key];
|
|
1108
|
-
if (value) {
|
|
1109
|
-
this.parseAndValidate(key);
|
|
1110
|
-
const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
|
|
1111
|
-
this.chartElement.setAttribute(
|
|
1112
|
-
SharedLib3.libraryTypeToWebComponentTypeMapping[key],
|
|
1113
|
-
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
1114
|
-
);
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
async updated(changedProperties) {
|
|
1120
|
-
if (this.chartElement) {
|
|
1121
|
-
for (const [propertyName] of changedProperties.entries()) {
|
|
1122
|
-
const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
1123
|
-
this.parseAndValidate(propertyName);
|
|
1124
|
-
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
1125
|
-
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1126
|
-
}
|
|
1127
|
-
} else {
|
|
1128
|
-
if (this.type) {
|
|
1129
|
-
this.parseAndValidate("type");
|
|
1130
|
-
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1131
|
-
this.createAndAppendElement();
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
parseAndValidate(key) {
|
|
1136
|
-
try {
|
|
1137
|
-
if (key === "slots") {
|
|
1138
|
-
SharedLib3.slotsParser.parse(this.slots);
|
|
1139
|
-
} else if (key === "options") {
|
|
1140
|
-
SharedLib3.vizItemOptionsParser.parse(this.options);
|
|
1141
|
-
} else if (key === "canFilter") {
|
|
1142
|
-
SharedLib3.canFilterParser.parse(this.canFilter);
|
|
1143
|
-
} else if (key === "type") {
|
|
1144
|
-
SharedLib3.itemTypeParser.parse(this.type);
|
|
1145
|
-
}
|
|
1146
|
-
} catch (err) {
|
|
1147
|
-
const validationError = (0, import_zod_validation_error.fromError)(err);
|
|
1148
|
-
console.error(err);
|
|
1149
|
-
console.error(validationError.toString());
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
render() {
|
|
1153
|
-
return import_lit3.html` `;
|
|
1154
|
-
}
|
|
1155
|
-
};
|
|
1156
|
-
__decorateClass([
|
|
1157
|
-
(0, import_decorators3.property)()
|
|
1158
|
-
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1159
|
-
__decorateClass([
|
|
1160
|
-
(0, import_decorators3.property)()
|
|
1161
|
-
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1162
|
-
__decorateClass([
|
|
1163
|
-
(0, import_decorators3.property)({ type: Array })
|
|
1164
|
-
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1165
|
-
__decorateClass([
|
|
1166
|
-
(0, import_decorators3.property)({ type: Object })
|
|
1167
|
-
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1168
|
-
__decorateClass([
|
|
1169
|
-
(0, import_decorators3.property)()
|
|
1170
|
-
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1171
|
-
__decorateClass([
|
|
1172
|
-
(0, import_decorators3.property)()
|
|
1173
|
-
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1174
|
-
__decorateClass([
|
|
1175
|
-
(0, import_decorators3.property)()
|
|
1176
|
-
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1177
|
-
__decorateClass([
|
|
1178
|
-
(0, import_decorators3.property)()
|
|
1179
|
-
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1180
|
-
__decorateClass([
|
|
1181
|
-
(0, import_decorators3.property)()
|
|
1182
|
-
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1183
|
-
__decorateClass([
|
|
1184
|
-
(0, import_decorators3.property)({
|
|
1185
|
-
converter: (value) => {
|
|
1186
|
-
try {
|
|
1187
|
-
return JSON.parse(value);
|
|
1188
|
-
} catch (exc) {
|
|
1189
|
-
return value;
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
})
|
|
1193
|
-
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1194
|
-
__decorateClass([
|
|
1195
|
-
(0, import_decorators3.property)({ type: Array })
|
|
1196
|
-
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1197
|
-
|
|
1198
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item-web-component.ts
|
|
1199
|
-
var LuzmoVizItemWebComponent = class extends LuzmoBaseVizItem {
|
|
1200
|
-
};
|
|
1201
|
-
LuzmoVizItemWebComponent = __decorateClass([
|
|
1202
|
-
(0, import_decorators4.customElement)("luzmo-viz-item-web-component")
|
|
1203
|
-
], LuzmoVizItemWebComponent);
|
|
1204
1101
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1205
1102
|
0 && (module.exports = {
|
|
1206
|
-
LuzmoDashboardWebComponent
|
|
1207
|
-
LuzmoVizItemWebComponent
|
|
1103
|
+
LuzmoDashboardWebComponent
|
|
1208
1104
|
});
|
package/index.libs.d.ts
CHANGED