@luzmo/embed 5.1.2 → 5.1.3-beta.1
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 +0 -9
- package/index.cjs +171 -69
- package/index.d.ts +1 -0
- package/index.js +169 -71
- package/index.libs.cjs +171 -69
- package/index.libs.d.ts +1 -0
- package/index.libs.js +169 -71
- 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 +24 -0
- package/luzmo-embed.libs.js +4393 -79
- package/luzmo-embed.min.js +4393 -79
- package/package.json +3 -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 +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
-
## [5.1.2] - 2024-04-29
|
|
5
|
-
|
|
6
|
-
### Bugfixes
|
|
7
|
-
|
|
8
|
-
- Height in edit mode is set to a minimum of 100vh.
|
|
9
|
-
|
|
10
|
-
|
|
11
4
|
## [5.1.1] - 2024-04-24
|
|
12
5
|
|
|
13
|
-
### Updates
|
|
14
|
-
|
|
15
6
|
- Show actual error messages from luzmo application
|
|
16
7
|
|
|
17
8
|
## [5.1.0] - 2024-04-17
|
package/index.cjs
CHANGED
|
@@ -40,7 +40,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
40
40
|
var src_exports = {};
|
|
41
41
|
__export(src_exports, {
|
|
42
42
|
LuzmoDashboard: () => LuzmoDashboard2,
|
|
43
|
-
LuzmoEmbedDashboard: () => LuzmoEmbedDashboard
|
|
43
|
+
LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
|
|
44
|
+
LuzmoVizItem: () => LuzmoVizItem
|
|
44
45
|
});
|
|
45
46
|
module.exports = __toCommonJS(src_exports);
|
|
46
47
|
|
|
@@ -55,7 +56,7 @@ var import_style_map = require("lit/directives/style-map.js");
|
|
|
55
56
|
var import_shared_embed = require("@luzmo/shared-embed");
|
|
56
57
|
|
|
57
58
|
// libs/embed-libs/embed/package.json
|
|
58
|
-
var version = "5.1.
|
|
59
|
+
var version = "5.1.3-beta.1";
|
|
59
60
|
|
|
60
61
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
61
62
|
var LuzmoService = class {
|
|
@@ -261,10 +262,6 @@ var dashboardStyles = import_lit.css`
|
|
|
261
262
|
border: 0;
|
|
262
263
|
}
|
|
263
264
|
|
|
264
|
-
.luzmo-embed-dashboard-ede {
|
|
265
|
-
min-height: 100vh;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
265
|
.luzmo-embed-container-ede {
|
|
269
266
|
width: 100%;
|
|
270
267
|
height: 100%;
|
|
@@ -341,7 +338,7 @@ var dashboardStyles = import_lit.css`
|
|
|
341
338
|
|
|
342
339
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
|
|
343
340
|
var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
344
|
-
constructor(
|
|
341
|
+
constructor() {
|
|
345
342
|
super();
|
|
346
343
|
this.language = "auto";
|
|
347
344
|
this.screenMode = "auto";
|
|
@@ -360,10 +357,11 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
360
357
|
this.browserErrorMsg = "";
|
|
361
358
|
this.dashboardError = false;
|
|
362
359
|
this.browserNotSupported = [];
|
|
363
|
-
this.
|
|
360
|
+
this.libVersion = version + "-wc-luzmo";
|
|
364
361
|
this.isLibraryLoaded = false;
|
|
365
362
|
this.currentAuthKey = null;
|
|
366
363
|
this.currentAuthToken = null;
|
|
364
|
+
this.isInitCalled = false;
|
|
367
365
|
this.attributesMap = {
|
|
368
366
|
dashboardId: "dashboard-id",
|
|
369
367
|
dashboardSlug: "dashboard-slug",
|
|
@@ -393,7 +391,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
393
391
|
this._iframeId = `luzmo-dashboard-${this._containerId}`;
|
|
394
392
|
this.iframeLoaded = false;
|
|
395
393
|
this.promises = {};
|
|
396
|
-
this.setInputParameters(inputParameters);
|
|
397
394
|
this.params = this._setOptions();
|
|
398
395
|
this._onResize = () => {
|
|
399
396
|
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
@@ -424,60 +421,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
424
421
|
});
|
|
425
422
|
});
|
|
426
423
|
}
|
|
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
|
-
}
|
|
481
424
|
// Set resize event listener
|
|
482
425
|
connectedCallback() {
|
|
483
426
|
super.connectedCallback();
|
|
@@ -496,7 +439,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
496
439
|
this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
|
|
497
440
|
this._loaderStyles();
|
|
498
441
|
luzmo_service_default._components.push(this);
|
|
499
|
-
this.initComponent();
|
|
500
442
|
if (this.luzmoEmbedContainer) {
|
|
501
443
|
this._resizeObserver.observe(this.luzmoEmbedContainer);
|
|
502
444
|
}
|
|
@@ -504,7 +446,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
504
446
|
initComponent() {
|
|
505
447
|
this.params = this._setOptions();
|
|
506
448
|
if (this.getIsViewMode()) {
|
|
507
|
-
|
|
449
|
+
SharedLib2.loadLibrary(this.params.appServer).then(async () => {
|
|
508
450
|
this.isLibraryLoaded = true;
|
|
509
451
|
await this.updateComplete;
|
|
510
452
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -576,11 +518,21 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
576
518
|
"timezoneId",
|
|
577
519
|
"itemDimensions"
|
|
578
520
|
]);
|
|
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
|
+
}
|
|
579
531
|
if (this.getIsViewMode()) {
|
|
580
532
|
if (this.dashboardReference) {
|
|
581
533
|
for (const [propertyName] of changedProperties.entries()) {
|
|
582
534
|
if (propertyName === "appSever") {
|
|
583
|
-
|
|
535
|
+
SharedLib2.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
584
536
|
this.isLibraryLoaded = true;
|
|
585
537
|
await this.updateComplete;
|
|
586
538
|
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -788,7 +740,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
788
740
|
${this.dashboardId || this.dashboardSlug ? import_lit2.html`
|
|
789
741
|
${loader}
|
|
790
742
|
<iframe
|
|
791
|
-
class="luzmo-embed-dashboard
|
|
743
|
+
class="luzmo-embed-dashboard"
|
|
792
744
|
id="${this._iframeId}"
|
|
793
745
|
name="${this._iframeId}"
|
|
794
746
|
style=${(0, import_style_map.styleMap)(this.iframeStyle)}
|
|
@@ -1079,7 +1031,7 @@ __decorateClass([
|
|
|
1079
1031
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
1080
1032
|
__decorateClass([
|
|
1081
1033
|
(0, import_decorators.property)()
|
|
1082
|
-
], LuzmoDashboard.prototype, "
|
|
1034
|
+
], LuzmoDashboard.prototype, "libVersion", 2);
|
|
1083
1035
|
__decorateClass([
|
|
1084
1036
|
(0, import_decorators.state)()
|
|
1085
1037
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
@@ -1092,6 +1044,9 @@ __decorateClass([
|
|
|
1092
1044
|
__decorateClass([
|
|
1093
1045
|
(0, import_decorators.state)()
|
|
1094
1046
|
], LuzmoDashboard.prototype, "currentAuthToken", 2);
|
|
1047
|
+
__decorateClass([
|
|
1048
|
+
(0, import_decorators.state)()
|
|
1049
|
+
], LuzmoDashboard.prototype, "isInitCalled", 2);
|
|
1095
1050
|
|
|
1096
1051
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
1097
1052
|
var LuzmoDashboard2 = class extends LuzmoDashboard {
|
|
@@ -1104,8 +1059,155 @@ var LuzmoEmbedDashboard = class extends LuzmoDashboard {
|
|
|
1104
1059
|
LuzmoEmbedDashboard = __decorateClass([
|
|
1105
1060
|
(0, import_decorators2.customElement)("luzmo-embed-dashboard")
|
|
1106
1061
|
], 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 import_zod_validation_error = require("zod-validation-error");
|
|
1071
|
+
var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
1072
|
+
constructor() {
|
|
1073
|
+
super();
|
|
1074
|
+
this.appServer = "https://app.luzmo.com";
|
|
1075
|
+
this.apiHost = "https://api.luzmo.com";
|
|
1076
|
+
this.slots = [];
|
|
1077
|
+
this.options = {
|
|
1078
|
+
title: {
|
|
1079
|
+
en: ""
|
|
1080
|
+
},
|
|
1081
|
+
theme: "default"
|
|
1082
|
+
};
|
|
1083
|
+
this.version = version + "-wc-luzmo";
|
|
1084
|
+
}
|
|
1085
|
+
static {
|
|
1086
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1087
|
+
this.styles = import_lit3.css`
|
|
1088
|
+
:host {
|
|
1089
|
+
display: block;
|
|
1090
|
+
width: 100%;
|
|
1091
|
+
height: 100%;
|
|
1092
|
+
}
|
|
1093
|
+
`;
|
|
1094
|
+
}
|
|
1095
|
+
async firstUpdated(_changedProperties) {
|
|
1096
|
+
super.firstUpdated(_changedProperties);
|
|
1097
|
+
if (this.type) {
|
|
1098
|
+
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1099
|
+
this.createAndAppendElement();
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
createAndAppendElement() {
|
|
1103
|
+
if (!this.chartElement) {
|
|
1104
|
+
this.chartElement = document.createElement("chart-component");
|
|
1105
|
+
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
1106
|
+
this.updateVizItemProperties();
|
|
1107
|
+
this.renderRoot.append(this.chartElement);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
updateVizItemProperties() {
|
|
1111
|
+
if (this.chartElement) {
|
|
1112
|
+
for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
|
|
1113
|
+
const value = this[key];
|
|
1114
|
+
if (value) {
|
|
1115
|
+
this.parseAndValidate(key);
|
|
1116
|
+
const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
|
|
1117
|
+
this.chartElement.setAttribute(
|
|
1118
|
+
SharedLib3.libraryTypeToWebComponentTypeMapping[key],
|
|
1119
|
+
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
async updated(changedProperties) {
|
|
1126
|
+
if (this.chartElement) {
|
|
1127
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
1128
|
+
const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
1129
|
+
this.parseAndValidate(propertyName);
|
|
1130
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
1131
|
+
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1132
|
+
}
|
|
1133
|
+
} else {
|
|
1134
|
+
if (this.type) {
|
|
1135
|
+
SharedLib3.itemTypeParser.parse(this.type);
|
|
1136
|
+
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1137
|
+
this.createAndAppendElement();
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
parseAndValidate(key) {
|
|
1142
|
+
try {
|
|
1143
|
+
if (key === "slots") {
|
|
1144
|
+
SharedLib3.slotsParser.parse(this.slots);
|
|
1145
|
+
} else if (key === "options") {
|
|
1146
|
+
SharedLib3.vizItemOptionsParser.parse(this.options);
|
|
1147
|
+
} else if (key === "canFilter") {
|
|
1148
|
+
SharedLib3.canFilterParser.parse(this.canFilter);
|
|
1149
|
+
}
|
|
1150
|
+
} catch (err) {
|
|
1151
|
+
const validationError = (0, import_zod_validation_error.fromError)(err);
|
|
1152
|
+
console.error(err);
|
|
1153
|
+
console.error(validationError.toString());
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
render() {
|
|
1157
|
+
return import_lit3.html` `;
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
__decorateClass([
|
|
1161
|
+
(0, import_decorators3.property)()
|
|
1162
|
+
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1163
|
+
__decorateClass([
|
|
1164
|
+
(0, import_decorators3.property)()
|
|
1165
|
+
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1166
|
+
__decorateClass([
|
|
1167
|
+
(0, import_decorators3.property)({ type: Array })
|
|
1168
|
+
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1169
|
+
__decorateClass([
|
|
1170
|
+
(0, import_decorators3.property)({ type: Object })
|
|
1171
|
+
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1172
|
+
__decorateClass([
|
|
1173
|
+
(0, import_decorators3.property)()
|
|
1174
|
+
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1175
|
+
__decorateClass([
|
|
1176
|
+
(0, import_decorators3.property)()
|
|
1177
|
+
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1178
|
+
__decorateClass([
|
|
1179
|
+
(0, import_decorators3.property)()
|
|
1180
|
+
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1181
|
+
__decorateClass([
|
|
1182
|
+
(0, import_decorators3.property)()
|
|
1183
|
+
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1184
|
+
__decorateClass([
|
|
1185
|
+
(0, import_decorators3.property)()
|
|
1186
|
+
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1187
|
+
__decorateClass([
|
|
1188
|
+
(0, import_decorators3.property)({
|
|
1189
|
+
converter: (value) => {
|
|
1190
|
+
try {
|
|
1191
|
+
return JSON.parse(value);
|
|
1192
|
+
} catch (exc) {
|
|
1193
|
+
return value;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
})
|
|
1197
|
+
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1198
|
+
__decorateClass([
|
|
1199
|
+
(0, import_decorators3.property)({ type: Array })
|
|
1200
|
+
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1201
|
+
|
|
1202
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1203
|
+
var LuzmoVizItem = class extends LuzmoBaseVizItem {
|
|
1204
|
+
};
|
|
1205
|
+
LuzmoVizItem = __decorateClass([
|
|
1206
|
+
(0, import_decorators4.customElement)("luzmo-viz-item")
|
|
1207
|
+
], LuzmoVizItem);
|
|
1107
1208
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1108
1209
|
0 && (module.exports = {
|
|
1109
1210
|
LuzmoDashboard,
|
|
1110
|
-
LuzmoEmbedDashboard
|
|
1211
|
+
LuzmoEmbedDashboard,
|
|
1212
|
+
LuzmoVizItem
|
|
1111
1213
|
});
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
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,14 +30,11 @@ import {
|
|
|
30
30
|
styleMap
|
|
31
31
|
} from "lit/directives/style-map.js";
|
|
32
32
|
import {
|
|
33
|
-
__federationMethodGetRemote,
|
|
34
|
-
__federationMethodWrapDefault,
|
|
35
|
-
remotesMap,
|
|
36
33
|
luzmoEmbedContainerClass
|
|
37
34
|
} from "@luzmo/shared-embed";
|
|
38
35
|
|
|
39
36
|
// libs/embed-libs/embed/package.json
|
|
40
|
-
var version = "5.1.
|
|
37
|
+
var version = "5.1.3-beta.1";
|
|
41
38
|
|
|
42
39
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
43
40
|
var LuzmoService = class {
|
|
@@ -243,10 +240,6 @@ var dashboardStyles = css`
|
|
|
243
240
|
border: 0;
|
|
244
241
|
}
|
|
245
242
|
|
|
246
|
-
.luzmo-embed-dashboard-ede {
|
|
247
|
-
min-height: 100vh;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
243
|
.luzmo-embed-container-ede {
|
|
251
244
|
width: 100%;
|
|
252
245
|
height: 100%;
|
|
@@ -323,7 +316,7 @@ var dashboardStyles = css`
|
|
|
323
316
|
|
|
324
317
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
|
|
325
318
|
var LuzmoDashboard = class extends LitElement {
|
|
326
|
-
constructor(
|
|
319
|
+
constructor() {
|
|
327
320
|
super();
|
|
328
321
|
this.language = "auto";
|
|
329
322
|
this.screenMode = "auto";
|
|
@@ -342,10 +335,11 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
342
335
|
this.browserErrorMsg = "";
|
|
343
336
|
this.dashboardError = false;
|
|
344
337
|
this.browserNotSupported = [];
|
|
345
|
-
this.
|
|
338
|
+
this.libVersion = version + "-wc-luzmo";
|
|
346
339
|
this.isLibraryLoaded = false;
|
|
347
340
|
this.currentAuthKey = null;
|
|
348
341
|
this.currentAuthToken = null;
|
|
342
|
+
this.isInitCalled = false;
|
|
349
343
|
this.attributesMap = {
|
|
350
344
|
dashboardId: "dashboard-id",
|
|
351
345
|
dashboardSlug: "dashboard-slug",
|
|
@@ -375,7 +369,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
375
369
|
this._iframeId = `luzmo-dashboard-${this._containerId}`;
|
|
376
370
|
this.iframeLoaded = false;
|
|
377
371
|
this.promises = {};
|
|
378
|
-
this.setInputParameters(inputParameters);
|
|
379
372
|
this.params = this._setOptions();
|
|
380
373
|
this._onResize = () => {
|
|
381
374
|
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
@@ -406,60 +399,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
406
399
|
});
|
|
407
400
|
});
|
|
408
401
|
}
|
|
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
|
-
}
|
|
463
402
|
// Set resize event listener
|
|
464
403
|
connectedCallback() {
|
|
465
404
|
super.connectedCallback();
|
|
@@ -478,7 +417,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
478
417
|
this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
|
|
479
418
|
this._loaderStyles();
|
|
480
419
|
luzmo_service_default._components.push(this);
|
|
481
|
-
this.initComponent();
|
|
482
420
|
if (this.luzmoEmbedContainer) {
|
|
483
421
|
this._resizeObserver.observe(this.luzmoEmbedContainer);
|
|
484
422
|
}
|
|
@@ -486,7 +424,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
486
424
|
initComponent() {
|
|
487
425
|
this.params = this._setOptions();
|
|
488
426
|
if (this.getIsViewMode()) {
|
|
489
|
-
|
|
427
|
+
SharedLib2.loadLibrary(this.params.appServer).then(async () => {
|
|
490
428
|
this.isLibraryLoaded = true;
|
|
491
429
|
await this.updateComplete;
|
|
492
430
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -558,11 +496,21 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
558
496
|
"timezoneId",
|
|
559
497
|
"itemDimensions"
|
|
560
498
|
]);
|
|
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
|
+
}
|
|
561
509
|
if (this.getIsViewMode()) {
|
|
562
510
|
if (this.dashboardReference) {
|
|
563
511
|
for (const [propertyName] of changedProperties.entries()) {
|
|
564
512
|
if (propertyName === "appSever") {
|
|
565
|
-
|
|
513
|
+
SharedLib2.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
566
514
|
this.isLibraryLoaded = true;
|
|
567
515
|
await this.updateComplete;
|
|
568
516
|
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -770,7 +718,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
770
718
|
${this.dashboardId || this.dashboardSlug ? html`
|
|
771
719
|
${loader}
|
|
772
720
|
<iframe
|
|
773
|
-
class="luzmo-embed-dashboard
|
|
721
|
+
class="luzmo-embed-dashboard"
|
|
774
722
|
id="${this._iframeId}"
|
|
775
723
|
name="${this._iframeId}"
|
|
776
724
|
style=${styleMap(this.iframeStyle)}
|
|
@@ -1061,7 +1009,7 @@ __decorateClass([
|
|
|
1061
1009
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
1062
1010
|
__decorateClass([
|
|
1063
1011
|
property()
|
|
1064
|
-
], LuzmoDashboard.prototype, "
|
|
1012
|
+
], LuzmoDashboard.prototype, "libVersion", 2);
|
|
1065
1013
|
__decorateClass([
|
|
1066
1014
|
state()
|
|
1067
1015
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
@@ -1074,6 +1022,9 @@ __decorateClass([
|
|
|
1074
1022
|
__decorateClass([
|
|
1075
1023
|
state()
|
|
1076
1024
|
], LuzmoDashboard.prototype, "currentAuthToken", 2);
|
|
1025
|
+
__decorateClass([
|
|
1026
|
+
state()
|
|
1027
|
+
], LuzmoDashboard.prototype, "isInitCalled", 2);
|
|
1077
1028
|
|
|
1078
1029
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
1079
1030
|
var LuzmoDashboard2 = class extends LuzmoDashboard {
|
|
@@ -1086,7 +1037,154 @@ var LuzmoEmbedDashboard = class extends LuzmoDashboard {
|
|
|
1086
1037
|
LuzmoEmbedDashboard = __decorateClass([
|
|
1087
1038
|
customElement("luzmo-embed-dashboard")
|
|
1088
1039
|
], 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
|
+
SharedLib3.itemTypeParser.parse(this.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
|
+
}
|
|
1128
|
+
} catch (err) {
|
|
1129
|
+
const validationError = fromError(err);
|
|
1130
|
+
console.error(err);
|
|
1131
|
+
console.error(validationError.toString());
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
render() {
|
|
1135
|
+
return html2` `;
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
__decorateClass([
|
|
1139
|
+
property2()
|
|
1140
|
+
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1141
|
+
__decorateClass([
|
|
1142
|
+
property2()
|
|
1143
|
+
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1144
|
+
__decorateClass([
|
|
1145
|
+
property2({ type: Array })
|
|
1146
|
+
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1147
|
+
__decorateClass([
|
|
1148
|
+
property2({ type: Object })
|
|
1149
|
+
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1150
|
+
__decorateClass([
|
|
1151
|
+
property2()
|
|
1152
|
+
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1153
|
+
__decorateClass([
|
|
1154
|
+
property2()
|
|
1155
|
+
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1156
|
+
__decorateClass([
|
|
1157
|
+
property2()
|
|
1158
|
+
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1159
|
+
__decorateClass([
|
|
1160
|
+
property2()
|
|
1161
|
+
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1162
|
+
__decorateClass([
|
|
1163
|
+
property2()
|
|
1164
|
+
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1165
|
+
__decorateClass([
|
|
1166
|
+
property2({
|
|
1167
|
+
converter: (value) => {
|
|
1168
|
+
try {
|
|
1169
|
+
return JSON.parse(value);
|
|
1170
|
+
} catch (exc) {
|
|
1171
|
+
return value;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
})
|
|
1175
|
+
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1176
|
+
__decorateClass([
|
|
1177
|
+
property2({ type: Array })
|
|
1178
|
+
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1179
|
+
|
|
1180
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1181
|
+
var LuzmoVizItem = class extends LuzmoBaseVizItem {
|
|
1182
|
+
};
|
|
1183
|
+
LuzmoVizItem = __decorateClass([
|
|
1184
|
+
customElement2("luzmo-viz-item")
|
|
1185
|
+
], LuzmoVizItem);
|
|
1089
1186
|
export {
|
|
1090
1187
|
LuzmoDashboard2 as LuzmoDashboard,
|
|
1091
|
-
LuzmoEmbedDashboard
|
|
1188
|
+
LuzmoEmbedDashboard,
|
|
1189
|
+
LuzmoVizItem
|
|
1092
1190
|
};
|