@luzmo/embed 5.1.1 → 5.1.3-beta.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/index.cjs +151 -64
- package/index.d.ts +1 -0
- package/index.js +149 -66
- package/index.libs.cjs +151 -64
- package/index.libs.d.ts +1 -0
- package/index.libs.js +149 -66
- package/lib/dashboard-component/dashboard-base.d.ts +3 -4
- package/lib/viz-item/viz-item-component.d.ts +3 -0
- package/lib/viz-item/viz-item-web-component.d.ts +3 -0
- package/lib/viz-item/viz-item.base.d.ts +23 -0
- package/luzmo-embed.libs.js +173 -63
- package/luzmo-embed.min.js +173 -63
- package/package.json +2 -2
- package/src/index.d.ts +1 -0
- package/src/lib/dashboard-component/dashboard-base.d.ts +3 -4
- package/src/lib/viz-item/viz-item-component.d.ts +3 -0
- package/src/lib/viz-item/viz-item.base.d.ts +23 -0
package/index.libs.cjs
CHANGED
|
@@ -39,7 +39,8 @@ 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
|
|
42
|
+
LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent,
|
|
43
|
+
LuzmoVizItemWebComponent: () => LuzmoVizItemWebComponent
|
|
43
44
|
});
|
|
44
45
|
module.exports = __toCommonJS(index_libs_exports);
|
|
45
46
|
|
|
@@ -54,7 +55,7 @@ var import_style_map = require("lit/directives/style-map.js");
|
|
|
54
55
|
var import_shared_embed = require("@luzmo/shared-embed");
|
|
55
56
|
|
|
56
57
|
// libs/embed-libs/embed/package.json
|
|
57
|
-
var version = "5.1.
|
|
58
|
+
var version = "5.1.3-beta.0";
|
|
58
59
|
|
|
59
60
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
60
61
|
var LuzmoService = class {
|
|
@@ -336,7 +337,7 @@ var dashboardStyles = import_lit.css`
|
|
|
336
337
|
|
|
337
338
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
|
|
338
339
|
var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
339
|
-
constructor(
|
|
340
|
+
constructor() {
|
|
340
341
|
super();
|
|
341
342
|
this.language = "auto";
|
|
342
343
|
this.screenMode = "auto";
|
|
@@ -355,10 +356,11 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
355
356
|
this.browserErrorMsg = "";
|
|
356
357
|
this.dashboardError = false;
|
|
357
358
|
this.browserNotSupported = [];
|
|
358
|
-
this.
|
|
359
|
+
this.version = version + "-wc-luzmo";
|
|
359
360
|
this.isLibraryLoaded = false;
|
|
360
361
|
this.currentAuthKey = null;
|
|
361
362
|
this.currentAuthToken = null;
|
|
363
|
+
this.isInitCalled = false;
|
|
362
364
|
this.attributesMap = {
|
|
363
365
|
dashboardId: "dashboard-id",
|
|
364
366
|
dashboardSlug: "dashboard-slug",
|
|
@@ -388,7 +390,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
388
390
|
this._iframeId = `luzmo-dashboard-${this._containerId}`;
|
|
389
391
|
this.iframeLoaded = false;
|
|
390
392
|
this.promises = {};
|
|
391
|
-
this.setInputParameters(inputParameters);
|
|
392
393
|
this.params = this._setOptions();
|
|
393
394
|
this._onResize = () => {
|
|
394
395
|
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
@@ -419,60 +420,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
419
420
|
});
|
|
420
421
|
});
|
|
421
422
|
}
|
|
422
|
-
loadLibrary(appServer) {
|
|
423
|
-
if (import_shared_embed.remotesMap[appServer]) {
|
|
424
|
-
return Promise.resolve(import_shared_embed.remotesMap[appServer].module);
|
|
425
|
-
}
|
|
426
|
-
import_shared_embed.remotesMap[appServer] = {
|
|
427
|
-
url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
|
|
428
|
-
format: "esm",
|
|
429
|
-
from: "vite",
|
|
430
|
-
module: void 0
|
|
431
|
-
};
|
|
432
|
-
return (0, import_shared_embed.__federationMethodGetRemote)(appServer, "./DashboardApp").then((module2) => {
|
|
433
|
-
const wrappedModule = (0, import_shared_embed.__federationMethodWrapDefault)(module2, true);
|
|
434
|
-
import_shared_embed.remotesMap[appServer].module = wrappedModule;
|
|
435
|
-
return wrappedModule;
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
setInputParameters(inputParameters) {
|
|
439
|
-
if (!inputParameters) {
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
const params = [
|
|
443
|
-
"dashboardId",
|
|
444
|
-
"dashboardSlug",
|
|
445
|
-
"itemId",
|
|
446
|
-
"language",
|
|
447
|
-
"qeVersion",
|
|
448
|
-
"screenMode",
|
|
449
|
-
"switchScreenModeOnResize",
|
|
450
|
-
"accentColor",
|
|
451
|
-
"mainColor",
|
|
452
|
-
"authToken",
|
|
453
|
-
"authKey",
|
|
454
|
-
"editMode",
|
|
455
|
-
"loaderBackground",
|
|
456
|
-
"loaderFontColor",
|
|
457
|
-
"loaderSpinnerColor",
|
|
458
|
-
"loaderSpinnerBackground",
|
|
459
|
-
"timezoneId",
|
|
460
|
-
"itemDimensions",
|
|
461
|
-
"apiHost"
|
|
462
|
-
];
|
|
463
|
-
for (const key of params) {
|
|
464
|
-
const value = inputParameters[key];
|
|
465
|
-
if (value) {
|
|
466
|
-
this[key] = value;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
if (inputParameters.experimental) {
|
|
470
|
-
this.experimental = inputParameters.experimental;
|
|
471
|
-
}
|
|
472
|
-
if (inputParameters.appServer) {
|
|
473
|
-
this.appServer = SharedLib2.addTrailingSlash(inputParameters.appServer);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
423
|
// Set resize event listener
|
|
477
424
|
connectedCallback() {
|
|
478
425
|
super.connectedCallback();
|
|
@@ -491,7 +438,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
491
438
|
this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
|
|
492
439
|
this._loaderStyles();
|
|
493
440
|
luzmo_service_default._components.push(this);
|
|
494
|
-
this.initComponent();
|
|
495
441
|
if (this.luzmoEmbedContainer) {
|
|
496
442
|
this._resizeObserver.observe(this.luzmoEmbedContainer);
|
|
497
443
|
}
|
|
@@ -499,7 +445,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
499
445
|
initComponent() {
|
|
500
446
|
this.params = this._setOptions();
|
|
501
447
|
if (this.getIsViewMode()) {
|
|
502
|
-
|
|
448
|
+
SharedLib2.loadLibrary(this.params.appServer).then(async () => {
|
|
503
449
|
this.isLibraryLoaded = true;
|
|
504
450
|
await this.updateComplete;
|
|
505
451
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -571,11 +517,21 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
571
517
|
"timezoneId",
|
|
572
518
|
"itemDimensions"
|
|
573
519
|
]);
|
|
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
|
+
}
|
|
574
530
|
if (this.getIsViewMode()) {
|
|
575
531
|
if (this.dashboardReference) {
|
|
576
532
|
for (const [propertyName] of changedProperties.entries()) {
|
|
577
533
|
if (propertyName === "appSever") {
|
|
578
|
-
|
|
534
|
+
SharedLib2.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
579
535
|
this.isLibraryLoaded = true;
|
|
580
536
|
await this.updateComplete;
|
|
581
537
|
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -1074,7 +1030,7 @@ __decorateClass([
|
|
|
1074
1030
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
1075
1031
|
__decorateClass([
|
|
1076
1032
|
(0, import_decorators.property)()
|
|
1077
|
-
], LuzmoDashboard.prototype, "
|
|
1033
|
+
], LuzmoDashboard.prototype, "version", 2);
|
|
1078
1034
|
__decorateClass([
|
|
1079
1035
|
(0, import_decorators.state)()
|
|
1080
1036
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
@@ -1087,6 +1043,9 @@ __decorateClass([
|
|
|
1087
1043
|
__decorateClass([
|
|
1088
1044
|
(0, import_decorators.state)()
|
|
1089
1045
|
], LuzmoDashboard.prototype, "currentAuthToken", 2);
|
|
1046
|
+
__decorateClass([
|
|
1047
|
+
(0, import_decorators.state)()
|
|
1048
|
+
], LuzmoDashboard.prototype, "isInitCalled", 2);
|
|
1090
1049
|
|
|
1091
1050
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-web-component.ts
|
|
1092
1051
|
var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
|
|
@@ -1094,7 +1053,135 @@ var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
|
|
|
1094
1053
|
LuzmoDashboardWebComponent = __decorateClass([
|
|
1095
1054
|
(0, import_decorators2.customElement)("luzmo-dashboard-web-component")
|
|
1096
1055
|
], 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 LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
1065
|
+
constructor() {
|
|
1066
|
+
super();
|
|
1067
|
+
this.appServer = "https://app.luzmo.com";
|
|
1068
|
+
this.apiHost = "https://api.luzmo.com";
|
|
1069
|
+
this.slots = [];
|
|
1070
|
+
this.options = {
|
|
1071
|
+
title: {
|
|
1072
|
+
en: ""
|
|
1073
|
+
},
|
|
1074
|
+
theme: "default"
|
|
1075
|
+
};
|
|
1076
|
+
this.version = version + "-wc-luzmo";
|
|
1077
|
+
}
|
|
1078
|
+
static {
|
|
1079
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1080
|
+
this.styles = import_lit3.css`
|
|
1081
|
+
:host {
|
|
1082
|
+
display: block;
|
|
1083
|
+
width: 100%;
|
|
1084
|
+
height: 100%;
|
|
1085
|
+
}
|
|
1086
|
+
`;
|
|
1087
|
+
}
|
|
1088
|
+
async firstUpdated(_changedProperties) {
|
|
1089
|
+
super.firstUpdated(_changedProperties);
|
|
1090
|
+
if (this.type) {
|
|
1091
|
+
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1092
|
+
this.createAndAppendElement();
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
createAndAppendElement() {
|
|
1096
|
+
if (!this.chartElement) {
|
|
1097
|
+
this.chartElement = document.createElement("chart-component");
|
|
1098
|
+
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
1099
|
+
this.updateVizItemProperties();
|
|
1100
|
+
this.renderRoot.append(this.chartElement);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
updateVizItemProperties() {
|
|
1104
|
+
if (this.chartElement) {
|
|
1105
|
+
for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
|
|
1106
|
+
const value = this[key];
|
|
1107
|
+
if (value) {
|
|
1108
|
+
const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
|
|
1109
|
+
this.chartElement.setAttribute(
|
|
1110
|
+
SharedLib3.libraryTypeToWebComponentTypeMapping[key],
|
|
1111
|
+
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
1112
|
+
);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
async updated(changedProperties) {
|
|
1118
|
+
if (this.chartElement) {
|
|
1119
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
1120
|
+
const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
1121
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
1122
|
+
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1123
|
+
}
|
|
1124
|
+
} else {
|
|
1125
|
+
if (this.type) {
|
|
1126
|
+
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1127
|
+
this.createAndAppendElement();
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
render() {
|
|
1132
|
+
return import_lit3.html` `;
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
__decorateClass([
|
|
1136
|
+
(0, import_decorators3.property)()
|
|
1137
|
+
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1138
|
+
__decorateClass([
|
|
1139
|
+
(0, import_decorators3.property)()
|
|
1140
|
+
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1141
|
+
__decorateClass([
|
|
1142
|
+
(0, import_decorators3.property)({ type: Array })
|
|
1143
|
+
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1144
|
+
__decorateClass([
|
|
1145
|
+
(0, import_decorators3.property)({ type: Object })
|
|
1146
|
+
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1147
|
+
__decorateClass([
|
|
1148
|
+
(0, import_decorators3.property)()
|
|
1149
|
+
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1150
|
+
__decorateClass([
|
|
1151
|
+
(0, import_decorators3.property)()
|
|
1152
|
+
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1153
|
+
__decorateClass([
|
|
1154
|
+
(0, import_decorators3.property)()
|
|
1155
|
+
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1156
|
+
__decorateClass([
|
|
1157
|
+
(0, import_decorators3.property)()
|
|
1158
|
+
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1159
|
+
__decorateClass([
|
|
1160
|
+
(0, import_decorators3.property)()
|
|
1161
|
+
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1162
|
+
__decorateClass([
|
|
1163
|
+
(0, import_decorators3.property)({
|
|
1164
|
+
converter: (value) => {
|
|
1165
|
+
try {
|
|
1166
|
+
return JSON.parse(value);
|
|
1167
|
+
} catch (exc) {
|
|
1168
|
+
return value;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
})
|
|
1172
|
+
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1173
|
+
__decorateClass([
|
|
1174
|
+
(0, import_decorators3.property)({ type: Array })
|
|
1175
|
+
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1176
|
+
|
|
1177
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item-web-component.ts
|
|
1178
|
+
var LuzmoVizItemWebComponent = class extends LuzmoBaseVizItem {
|
|
1179
|
+
};
|
|
1180
|
+
LuzmoVizItemWebComponent = __decorateClass([
|
|
1181
|
+
(0, import_decorators4.customElement)("luzmo-viz-item-web-component")
|
|
1182
|
+
], LuzmoVizItemWebComponent);
|
|
1097
1183
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1098
1184
|
0 && (module.exports = {
|
|
1099
|
-
LuzmoDashboardWebComponent
|
|
1185
|
+
LuzmoDashboardWebComponent,
|
|
1186
|
+
LuzmoVizItemWebComponent
|
|
1100
1187
|
});
|
package/index.libs.d.ts
CHANGED
package/index.libs.js
CHANGED
|
@@ -28,14 +28,11 @@ import {
|
|
|
28
28
|
styleMap
|
|
29
29
|
} from "lit/directives/style-map.js";
|
|
30
30
|
import {
|
|
31
|
-
__federationMethodGetRemote,
|
|
32
|
-
__federationMethodWrapDefault,
|
|
33
|
-
remotesMap,
|
|
34
31
|
luzmoEmbedContainerClass
|
|
35
32
|
} from "@luzmo/shared-embed";
|
|
36
33
|
|
|
37
34
|
// libs/embed-libs/embed/package.json
|
|
38
|
-
var version = "5.1.
|
|
35
|
+
var version = "5.1.3-beta.0";
|
|
39
36
|
|
|
40
37
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
41
38
|
var LuzmoService = class {
|
|
@@ -317,7 +314,7 @@ var dashboardStyles = css`
|
|
|
317
314
|
|
|
318
315
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
|
|
319
316
|
var LuzmoDashboard = class extends LitElement {
|
|
320
|
-
constructor(
|
|
317
|
+
constructor() {
|
|
321
318
|
super();
|
|
322
319
|
this.language = "auto";
|
|
323
320
|
this.screenMode = "auto";
|
|
@@ -336,10 +333,11 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
336
333
|
this.browserErrorMsg = "";
|
|
337
334
|
this.dashboardError = false;
|
|
338
335
|
this.browserNotSupported = [];
|
|
339
|
-
this.
|
|
336
|
+
this.version = version + "-wc-luzmo";
|
|
340
337
|
this.isLibraryLoaded = false;
|
|
341
338
|
this.currentAuthKey = null;
|
|
342
339
|
this.currentAuthToken = null;
|
|
340
|
+
this.isInitCalled = false;
|
|
343
341
|
this.attributesMap = {
|
|
344
342
|
dashboardId: "dashboard-id",
|
|
345
343
|
dashboardSlug: "dashboard-slug",
|
|
@@ -369,7 +367,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
369
367
|
this._iframeId = `luzmo-dashboard-${this._containerId}`;
|
|
370
368
|
this.iframeLoaded = false;
|
|
371
369
|
this.promises = {};
|
|
372
|
-
this.setInputParameters(inputParameters);
|
|
373
370
|
this.params = this._setOptions();
|
|
374
371
|
this._onResize = () => {
|
|
375
372
|
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
@@ -400,60 +397,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
400
397
|
});
|
|
401
398
|
});
|
|
402
399
|
}
|
|
403
|
-
loadLibrary(appServer) {
|
|
404
|
-
if (remotesMap[appServer]) {
|
|
405
|
-
return Promise.resolve(remotesMap[appServer].module);
|
|
406
|
-
}
|
|
407
|
-
remotesMap[appServer] = {
|
|
408
|
-
url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
|
|
409
|
-
format: "esm",
|
|
410
|
-
from: "vite",
|
|
411
|
-
module: void 0
|
|
412
|
-
};
|
|
413
|
-
return __federationMethodGetRemote(appServer, "./DashboardApp").then((module) => {
|
|
414
|
-
const wrappedModule = __federationMethodWrapDefault(module, true);
|
|
415
|
-
remotesMap[appServer].module = wrappedModule;
|
|
416
|
-
return wrappedModule;
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
setInputParameters(inputParameters) {
|
|
420
|
-
if (!inputParameters) {
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
const params = [
|
|
424
|
-
"dashboardId",
|
|
425
|
-
"dashboardSlug",
|
|
426
|
-
"itemId",
|
|
427
|
-
"language",
|
|
428
|
-
"qeVersion",
|
|
429
|
-
"screenMode",
|
|
430
|
-
"switchScreenModeOnResize",
|
|
431
|
-
"accentColor",
|
|
432
|
-
"mainColor",
|
|
433
|
-
"authToken",
|
|
434
|
-
"authKey",
|
|
435
|
-
"editMode",
|
|
436
|
-
"loaderBackground",
|
|
437
|
-
"loaderFontColor",
|
|
438
|
-
"loaderSpinnerColor",
|
|
439
|
-
"loaderSpinnerBackground",
|
|
440
|
-
"timezoneId",
|
|
441
|
-
"itemDimensions",
|
|
442
|
-
"apiHost"
|
|
443
|
-
];
|
|
444
|
-
for (const key of params) {
|
|
445
|
-
const value = inputParameters[key];
|
|
446
|
-
if (value) {
|
|
447
|
-
this[key] = value;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
if (inputParameters.experimental) {
|
|
451
|
-
this.experimental = inputParameters.experimental;
|
|
452
|
-
}
|
|
453
|
-
if (inputParameters.appServer) {
|
|
454
|
-
this.appServer = SharedLib2.addTrailingSlash(inputParameters.appServer);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
400
|
// Set resize event listener
|
|
458
401
|
connectedCallback() {
|
|
459
402
|
super.connectedCallback();
|
|
@@ -472,7 +415,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
472
415
|
this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
|
|
473
416
|
this._loaderStyles();
|
|
474
417
|
luzmo_service_default._components.push(this);
|
|
475
|
-
this.initComponent();
|
|
476
418
|
if (this.luzmoEmbedContainer) {
|
|
477
419
|
this._resizeObserver.observe(this.luzmoEmbedContainer);
|
|
478
420
|
}
|
|
@@ -480,7 +422,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
480
422
|
initComponent() {
|
|
481
423
|
this.params = this._setOptions();
|
|
482
424
|
if (this.getIsViewMode()) {
|
|
483
|
-
|
|
425
|
+
SharedLib2.loadLibrary(this.params.appServer).then(async () => {
|
|
484
426
|
this.isLibraryLoaded = true;
|
|
485
427
|
await this.updateComplete;
|
|
486
428
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -552,11 +494,21 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
552
494
|
"timezoneId",
|
|
553
495
|
"itemDimensions"
|
|
554
496
|
]);
|
|
497
|
+
const conditionsToCheck = ["dashboardId", "dashboardSlug", "itemId"];
|
|
498
|
+
let callInitComponent = false;
|
|
499
|
+
for (const condition of conditionsToCheck) {
|
|
500
|
+
callInitComponent = callInitComponent || changedProperties.get(condition) === void 0 && this[condition];
|
|
501
|
+
}
|
|
502
|
+
if (callInitComponent && !this.isInitCalled) {
|
|
503
|
+
this.initComponent();
|
|
504
|
+
this.isInitCalled = true;
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
555
507
|
if (this.getIsViewMode()) {
|
|
556
508
|
if (this.dashboardReference) {
|
|
557
509
|
for (const [propertyName] of changedProperties.entries()) {
|
|
558
510
|
if (propertyName === "appSever") {
|
|
559
|
-
|
|
511
|
+
SharedLib2.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
560
512
|
this.isLibraryLoaded = true;
|
|
561
513
|
await this.updateComplete;
|
|
562
514
|
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -1055,7 +1007,7 @@ __decorateClass([
|
|
|
1055
1007
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
1056
1008
|
__decorateClass([
|
|
1057
1009
|
property()
|
|
1058
|
-
], LuzmoDashboard.prototype, "
|
|
1010
|
+
], LuzmoDashboard.prototype, "version", 2);
|
|
1059
1011
|
__decorateClass([
|
|
1060
1012
|
state()
|
|
1061
1013
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
@@ -1068,6 +1020,9 @@ __decorateClass([
|
|
|
1068
1020
|
__decorateClass([
|
|
1069
1021
|
state()
|
|
1070
1022
|
], LuzmoDashboard.prototype, "currentAuthToken", 2);
|
|
1023
|
+
__decorateClass([
|
|
1024
|
+
state()
|
|
1025
|
+
], LuzmoDashboard.prototype, "isInitCalled", 2);
|
|
1071
1026
|
|
|
1072
1027
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-web-component.ts
|
|
1073
1028
|
var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
|
|
@@ -1075,6 +1030,134 @@ var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
|
|
|
1075
1030
|
LuzmoDashboardWebComponent = __decorateClass([
|
|
1076
1031
|
customElement("luzmo-dashboard-web-component")
|
|
1077
1032
|
], LuzmoDashboardWebComponent);
|
|
1033
|
+
|
|
1034
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item-web-component.ts
|
|
1035
|
+
import { customElement as customElement3 } from "lit/decorators.js";
|
|
1036
|
+
|
|
1037
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
|
|
1038
|
+
import { property as property2 } from "lit/decorators.js";
|
|
1039
|
+
import { LitElement as LitElement2, html as html2, css as css2 } from "lit";
|
|
1040
|
+
import * as SharedLib3 from "@luzmo/shared-embed";
|
|
1041
|
+
var LuzmoBaseVizItem = class extends LitElement2 {
|
|
1042
|
+
constructor() {
|
|
1043
|
+
super();
|
|
1044
|
+
this.appServer = "https://app.luzmo.com";
|
|
1045
|
+
this.apiHost = "https://api.luzmo.com";
|
|
1046
|
+
this.slots = [];
|
|
1047
|
+
this.options = {
|
|
1048
|
+
title: {
|
|
1049
|
+
en: ""
|
|
1050
|
+
},
|
|
1051
|
+
theme: "default"
|
|
1052
|
+
};
|
|
1053
|
+
this.version = version + "-wc-luzmo";
|
|
1054
|
+
}
|
|
1055
|
+
static {
|
|
1056
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1057
|
+
this.styles = css2`
|
|
1058
|
+
:host {
|
|
1059
|
+
display: block;
|
|
1060
|
+
width: 100%;
|
|
1061
|
+
height: 100%;
|
|
1062
|
+
}
|
|
1063
|
+
`;
|
|
1064
|
+
}
|
|
1065
|
+
async firstUpdated(_changedProperties) {
|
|
1066
|
+
super.firstUpdated(_changedProperties);
|
|
1067
|
+
if (this.type) {
|
|
1068
|
+
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1069
|
+
this.createAndAppendElement();
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
createAndAppendElement() {
|
|
1073
|
+
if (!this.chartElement) {
|
|
1074
|
+
this.chartElement = document.createElement("chart-component");
|
|
1075
|
+
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
1076
|
+
this.updateVizItemProperties();
|
|
1077
|
+
this.renderRoot.append(this.chartElement);
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
updateVizItemProperties() {
|
|
1081
|
+
if (this.chartElement) {
|
|
1082
|
+
for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
|
|
1083
|
+
const value = this[key];
|
|
1084
|
+
if (value) {
|
|
1085
|
+
const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
|
|
1086
|
+
this.chartElement.setAttribute(
|
|
1087
|
+
SharedLib3.libraryTypeToWebComponentTypeMapping[key],
|
|
1088
|
+
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
1089
|
+
);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
async updated(changedProperties) {
|
|
1095
|
+
if (this.chartElement) {
|
|
1096
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
1097
|
+
const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
1098
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
1099
|
+
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1100
|
+
}
|
|
1101
|
+
} else {
|
|
1102
|
+
if (this.type) {
|
|
1103
|
+
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1104
|
+
this.createAndAppendElement();
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
render() {
|
|
1109
|
+
return html2` `;
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
__decorateClass([
|
|
1113
|
+
property2()
|
|
1114
|
+
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1115
|
+
__decorateClass([
|
|
1116
|
+
property2()
|
|
1117
|
+
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1118
|
+
__decorateClass([
|
|
1119
|
+
property2({ type: Array })
|
|
1120
|
+
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1121
|
+
__decorateClass([
|
|
1122
|
+
property2({ type: Object })
|
|
1123
|
+
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1124
|
+
__decorateClass([
|
|
1125
|
+
property2()
|
|
1126
|
+
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1127
|
+
__decorateClass([
|
|
1128
|
+
property2()
|
|
1129
|
+
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1130
|
+
__decorateClass([
|
|
1131
|
+
property2()
|
|
1132
|
+
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1133
|
+
__decorateClass([
|
|
1134
|
+
property2()
|
|
1135
|
+
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1136
|
+
__decorateClass([
|
|
1137
|
+
property2()
|
|
1138
|
+
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1139
|
+
__decorateClass([
|
|
1140
|
+
property2({
|
|
1141
|
+
converter: (value) => {
|
|
1142
|
+
try {
|
|
1143
|
+
return JSON.parse(value);
|
|
1144
|
+
} catch (exc) {
|
|
1145
|
+
return value;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
})
|
|
1149
|
+
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1150
|
+
__decorateClass([
|
|
1151
|
+
property2({ type: Array })
|
|
1152
|
+
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1153
|
+
|
|
1154
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item-web-component.ts
|
|
1155
|
+
var LuzmoVizItemWebComponent = class extends LuzmoBaseVizItem {
|
|
1156
|
+
};
|
|
1157
|
+
LuzmoVizItemWebComponent = __decorateClass([
|
|
1158
|
+
customElement3("luzmo-viz-item-web-component")
|
|
1159
|
+
], LuzmoVizItemWebComponent);
|
|
1078
1160
|
export {
|
|
1079
|
-
LuzmoDashboardWebComponent
|
|
1161
|
+
LuzmoDashboardWebComponent,
|
|
1162
|
+
LuzmoVizItemWebComponent
|
|
1080
1163
|
};
|
|
@@ -51,11 +51,12 @@ export declare class LuzmoDashboard extends LitElement implements SharedLib.ES6L
|
|
|
51
51
|
browserErrorMsg: string;
|
|
52
52
|
dashboardError: boolean;
|
|
53
53
|
browserNotSupported: any[];
|
|
54
|
-
|
|
54
|
+
version: string;
|
|
55
55
|
protected isLibraryLoaded: boolean;
|
|
56
56
|
protected dashboardReference: SharedLib.LuzmoElement;
|
|
57
57
|
currentAuthKey: string;
|
|
58
58
|
currentAuthToken: string;
|
|
59
|
+
isInitCalled: boolean;
|
|
59
60
|
private attributesMap;
|
|
60
61
|
_loadTimeoutHandle?: number;
|
|
61
62
|
_onResize: () => void;
|
|
@@ -65,9 +66,7 @@ export declare class LuzmoDashboard extends LitElement implements SharedLib.ES6L
|
|
|
65
66
|
iframeHeight?: string;
|
|
66
67
|
iframeWidth?: string;
|
|
67
68
|
_resizeObserver: ResizeObserver;
|
|
68
|
-
constructor(
|
|
69
|
-
private loadLibrary;
|
|
70
|
-
private setInputParameters;
|
|
69
|
+
constructor();
|
|
71
70
|
connectedCallback(): void;
|
|
72
71
|
disconnectedCallback(): void;
|
|
73
72
|
firstUpdated(): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import * as SharedLib from '@luzmo/shared-embed';
|
|
3
|
+
export declare class LuzmoBaseVizItem extends LitElement {
|
|
4
|
+
appServer: string;
|
|
5
|
+
apiHost: string;
|
|
6
|
+
slots: SharedLib.Slots;
|
|
7
|
+
options: SharedLib.VizItemOptions;
|
|
8
|
+
type?: SharedLib.ItemType;
|
|
9
|
+
authKey?: string;
|
|
10
|
+
authToken?: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
contextId?: string;
|
|
13
|
+
canFilter?: SharedLib.CanFilter;
|
|
14
|
+
filters?: SharedLib.FilterGroup[];
|
|
15
|
+
chartElement: HTMLElement;
|
|
16
|
+
static styles: import("lit").CSSResult;
|
|
17
|
+
constructor();
|
|
18
|
+
protected firstUpdated(_changedProperties: PropertyValues): Promise<void>;
|
|
19
|
+
private createAndAppendElement;
|
|
20
|
+
private updateVizItemProperties;
|
|
21
|
+
updated(changedProperties: PropertyValues): Promise<void>;
|
|
22
|
+
protected render(): unknown;
|
|
23
|
+
}
|