@luzmo/embed 5.1.5 → 6.0.0-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/CHANGELOG.md +7 -0
- package/MIGRATIONS.md +6 -0
- package/index.cjs +209 -31
- package/index.d.ts +1 -0
- package/index.js +207 -32
- package/lib/dashboard-component/dashboard-base.d.ts +1 -2
- package/lib/dashboard-component/dashboard-component.d.ts +2 -10
- package/lib/viz-item/viz-item-component.d.ts +3 -0
- package/lib/viz-item/viz-item.base.d.ts +41 -0
- package/luzmo-embed.min.js +4440 -40
- package/package.json +3 -2
- package/src/index.d.ts +1 -0
- package/src/lib/dashboard-component/dashboard-base.d.ts +1 -2
- package/src/lib/dashboard-component/dashboard-component.d.ts +2 -10
- package/src/lib/viz-item/viz-item-component.d.ts +3 -0
- package/src/lib/viz-item/viz-item.base.d.ts +41 -0
- package/index.libs.cjs +0 -1078
- package/index.libs.d.ts +0 -1
- package/index.libs.js +0 -1058
- package/lib/dashboard-component/dashboard-web-component.d.ts +0 -3
- package/luzmo-embed.libs.js +0 -3062
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [6.0.0] - 2024-05-31
|
|
5
|
+
|
|
6
|
+
### Breaking changes
|
|
7
|
+
|
|
8
|
+
- Removed `<luzmo-dashboard>` web component, It has been replaced with `<luzmo-embed-dashboard>`.
|
|
9
|
+
- `LuzmoDashboard` has been replaced with `LuzmoEmbedDashboard`
|
|
10
|
+
|
|
4
11
|
## [5.1.5] - 2024-05-03
|
|
5
12
|
|
|
6
13
|
### Bugfixes
|
package/MIGRATIONS.md
CHANGED
package/index.cjs
CHANGED
|
@@ -39,8 +39,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
39
39
|
// libs/embed-libs/embed/src/index.ts
|
|
40
40
|
var src_exports = {};
|
|
41
41
|
__export(src_exports, {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
|
|
43
|
+
LuzmoEmbedVizItem: () => LuzmoEmbedVizItem
|
|
44
44
|
});
|
|
45
45
|
module.exports = __toCommonJS(src_exports);
|
|
46
46
|
|
|
@@ -55,7 +55,7 @@ var import_style_map = require("lit/directives/style-map.js");
|
|
|
55
55
|
var import_shared_embed = require("@luzmo/shared-embed");
|
|
56
56
|
|
|
57
57
|
// libs/embed-libs/embed/package.json
|
|
58
|
-
var version = "
|
|
58
|
+
var version = "6.0.0-beta.0";
|
|
59
59
|
|
|
60
60
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
61
61
|
var LuzmoService = class {
|
|
@@ -100,7 +100,7 @@ var _setEventHandler = () => {
|
|
|
100
100
|
}
|
|
101
101
|
dashboardComponent.iframeLoaded = true;
|
|
102
102
|
dashboardComponent._displayError();
|
|
103
|
-
console.error("Dashboard error: ", event.data.errorMsg);
|
|
103
|
+
console.error("Dashboard error: ", event.data.errorMsg ?? event.data.error?.msg);
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
106
|
case "data": {
|
|
@@ -360,7 +360,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
360
360
|
this.browserErrorMsg = "";
|
|
361
361
|
this.dashboardError = false;
|
|
362
362
|
this.browserNotSupported = [];
|
|
363
|
-
this.
|
|
363
|
+
this.libVersion = version + "-wc-luzmo";
|
|
364
364
|
this.isLibraryLoaded = false;
|
|
365
365
|
this.currentAuthKey = null;
|
|
366
366
|
this.currentAuthToken = null;
|
|
@@ -424,22 +424,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
424
424
|
});
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
|
-
loadLibrary(appServer) {
|
|
428
|
-
if (import_shared_embed.remotesMap[appServer]) {
|
|
429
|
-
return Promise.resolve(import_shared_embed.remotesMap[appServer].module);
|
|
430
|
-
}
|
|
431
|
-
import_shared_embed.remotesMap[appServer] = {
|
|
432
|
-
url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
|
|
433
|
-
format: "esm",
|
|
434
|
-
from: "vite",
|
|
435
|
-
module: void 0
|
|
436
|
-
};
|
|
437
|
-
return (0, import_shared_embed.__federationMethodGetRemote)(appServer, "./DashboardApp").then((module2) => {
|
|
438
|
-
const wrappedModule = (0, import_shared_embed.__federationMethodWrapDefault)(module2, true);
|
|
439
|
-
import_shared_embed.remotesMap[appServer].module = wrappedModule;
|
|
440
|
-
return wrappedModule;
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
427
|
// Set resize event listener
|
|
444
428
|
connectedCallback() {
|
|
445
429
|
super.connectedCallback();
|
|
@@ -465,7 +449,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
465
449
|
initComponent() {
|
|
466
450
|
this.params = this._setOptions();
|
|
467
451
|
if (this.getIsViewMode()) {
|
|
468
|
-
|
|
452
|
+
SharedLib2.loadLibrary(this.params.appServer).then(async () => {
|
|
469
453
|
this.isLibraryLoaded = true;
|
|
470
454
|
await this.updateComplete;
|
|
471
455
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -551,7 +535,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
551
535
|
if (this.dashboardReference) {
|
|
552
536
|
for (const [propertyName] of changedProperties.entries()) {
|
|
553
537
|
if (propertyName === "appSever") {
|
|
554
|
-
|
|
538
|
+
SharedLib2.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
555
539
|
this.isLibraryLoaded = true;
|
|
556
540
|
await this.updateComplete;
|
|
557
541
|
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -1050,7 +1034,7 @@ __decorateClass([
|
|
|
1050
1034
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
1051
1035
|
__decorateClass([
|
|
1052
1036
|
(0, import_decorators.property)()
|
|
1053
|
-
], LuzmoDashboard.prototype, "
|
|
1037
|
+
], LuzmoDashboard.prototype, "libVersion", 2);
|
|
1054
1038
|
__decorateClass([
|
|
1055
1039
|
(0, import_decorators.state)()
|
|
1056
1040
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
@@ -1068,18 +1052,212 @@ __decorateClass([
|
|
|
1068
1052
|
], LuzmoDashboard.prototype, "isInitCalled", 2);
|
|
1069
1053
|
|
|
1070
1054
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
1071
|
-
var LuzmoDashboard2 = class extends LuzmoDashboard {
|
|
1072
|
-
};
|
|
1073
|
-
LuzmoDashboard2 = __decorateClass([
|
|
1074
|
-
(0, import_decorators2.customElement)("luzmo-dashboard")
|
|
1075
|
-
], LuzmoDashboard2);
|
|
1076
1055
|
var LuzmoEmbedDashboard = class extends LuzmoDashboard {
|
|
1077
1056
|
};
|
|
1078
1057
|
LuzmoEmbedDashboard = __decorateClass([
|
|
1079
1058
|
(0, import_decorators2.customElement)("luzmo-embed-dashboard")
|
|
1080
1059
|
], LuzmoEmbedDashboard);
|
|
1060
|
+
|
|
1061
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1062
|
+
var import_decorators4 = require("lit/decorators.js");
|
|
1063
|
+
|
|
1064
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
|
|
1065
|
+
var import_decorators3 = require("lit/decorators.js");
|
|
1066
|
+
var import_lit3 = require("lit");
|
|
1067
|
+
var SharedLib3 = __toESM(require("@luzmo/shared-embed"), 1);
|
|
1068
|
+
var import_zod_validation_error = require("zod-validation-error");
|
|
1069
|
+
var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
1070
|
+
constructor() {
|
|
1071
|
+
super();
|
|
1072
|
+
this.appServer = "https://app.luzmo.com";
|
|
1073
|
+
this.apiHost = "https://api.luzmo.com";
|
|
1074
|
+
this.slots = [];
|
|
1075
|
+
this.version = version + "-wc-luzmo";
|
|
1076
|
+
this.libVersion = version + "-wc-luzmo";
|
|
1077
|
+
this.postInitCallQueue = [];
|
|
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
|
+
canInitializeVizItem() {
|
|
1090
|
+
return !!(this.type || this.dashboardId && this.itemId);
|
|
1091
|
+
}
|
|
1092
|
+
getFilters() {
|
|
1093
|
+
return this.chartElement.getFilters();
|
|
1094
|
+
}
|
|
1095
|
+
export() {
|
|
1096
|
+
return this.chartElement.export();
|
|
1097
|
+
}
|
|
1098
|
+
getData() {
|
|
1099
|
+
return this.chartElement.getData();
|
|
1100
|
+
}
|
|
1101
|
+
refreshData() {
|
|
1102
|
+
return this.chartElement.refreshData();
|
|
1103
|
+
}
|
|
1104
|
+
setFilters(filterInput) {
|
|
1105
|
+
return this.chartElement.setFilters(void 0, filterInput);
|
|
1106
|
+
}
|
|
1107
|
+
setAuthorization(key, token) {
|
|
1108
|
+
return this.chartElement.setAuthorization(key, token);
|
|
1109
|
+
}
|
|
1110
|
+
attributeChangedCallback(name, _old, value) {
|
|
1111
|
+
super.attributeChangedCallback(name, _old, value);
|
|
1112
|
+
if (name === "selecteddata") {
|
|
1113
|
+
if (this.chartElement) {
|
|
1114
|
+
this.setFilters(JSON.parse(value ?? "{}"));
|
|
1115
|
+
} else {
|
|
1116
|
+
this.postInitCallQueue.push([this.setFilters, [JSON.parse(value ?? "{}")]]);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
async firstUpdated(_changedProperties) {
|
|
1121
|
+
super.firstUpdated(_changedProperties);
|
|
1122
|
+
if (this.canInitializeVizItem()) {
|
|
1123
|
+
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1124
|
+
this.createAndAppendElement();
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
createAndAppendElement() {
|
|
1128
|
+
if (!this.chartElement) {
|
|
1129
|
+
this.chartElement = document.createElement("chart-component");
|
|
1130
|
+
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
1131
|
+
this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
|
|
1132
|
+
this.chartElement.addEventListener("rendered", (payload) => {
|
|
1133
|
+
for (const functionToCall of this.postInitCallQueue) {
|
|
1134
|
+
functionToCall[0].bind(this)(...functionToCall[1]);
|
|
1135
|
+
}
|
|
1136
|
+
this.dispatchEvent(new CustomEvent("rendered", payload));
|
|
1137
|
+
});
|
|
1138
|
+
this.chartElement.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
1139
|
+
this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
1140
|
+
this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
1141
|
+
this.updateVizItemProperties();
|
|
1142
|
+
this.renderRoot.append(this.chartElement);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
updateVizItemProperties() {
|
|
1146
|
+
if (this.chartElement) {
|
|
1147
|
+
for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
|
|
1148
|
+
const value = this[key];
|
|
1149
|
+
if (value) {
|
|
1150
|
+
this.parseAndValidate(key);
|
|
1151
|
+
const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
|
|
1152
|
+
this.chartElement.setAttribute(
|
|
1153
|
+
SharedLib3.libraryTypeToWebComponentTypeMapping[key],
|
|
1154
|
+
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
async updated(changedProperties) {
|
|
1161
|
+
if (this.chartElement) {
|
|
1162
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
1163
|
+
const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
1164
|
+
this.parseAndValidate(propertyName);
|
|
1165
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
1166
|
+
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1167
|
+
}
|
|
1168
|
+
} else {
|
|
1169
|
+
if (this.canInitializeVizItem()) {
|
|
1170
|
+
if (this.type) {
|
|
1171
|
+
this.parseAndValidate("type");
|
|
1172
|
+
}
|
|
1173
|
+
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1174
|
+
this.createAndAppendElement();
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
parseAndValidate(key) {
|
|
1179
|
+
try {
|
|
1180
|
+
if (key === "slots") {
|
|
1181
|
+
SharedLib3.slotsParser.parse(this.slots);
|
|
1182
|
+
} else if (key === "options") {
|
|
1183
|
+
SharedLib3.vizItemOptionsParser.parse(this.options);
|
|
1184
|
+
} else if (key === "canFilter") {
|
|
1185
|
+
SharedLib3.canFilterParser.parse(this.canFilter);
|
|
1186
|
+
} else if (key === "type") {
|
|
1187
|
+
SharedLib3.itemTypeParser.parse(this.type);
|
|
1188
|
+
}
|
|
1189
|
+
} catch (err) {
|
|
1190
|
+
const validationError = (0, import_zod_validation_error.fromError)(err);
|
|
1191
|
+
console.warn(err);
|
|
1192
|
+
console.warn(validationError.toString());
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
render() {
|
|
1196
|
+
return import_lit3.html` `;
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1199
|
+
__decorateClass([
|
|
1200
|
+
(0, import_decorators3.property)()
|
|
1201
|
+
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1202
|
+
__decorateClass([
|
|
1203
|
+
(0, import_decorators3.property)()
|
|
1204
|
+
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1205
|
+
__decorateClass([
|
|
1206
|
+
(0, import_decorators3.property)({ type: Array })
|
|
1207
|
+
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1208
|
+
__decorateClass([
|
|
1209
|
+
(0, import_decorators3.property)({ type: Object })
|
|
1210
|
+
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1211
|
+
__decorateClass([
|
|
1212
|
+
(0, import_decorators3.property)()
|
|
1213
|
+
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1214
|
+
__decorateClass([
|
|
1215
|
+
(0, import_decorators3.property)()
|
|
1216
|
+
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1217
|
+
__decorateClass([
|
|
1218
|
+
(0, import_decorators3.property)()
|
|
1219
|
+
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1220
|
+
__decorateClass([
|
|
1221
|
+
(0, import_decorators3.property)()
|
|
1222
|
+
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1223
|
+
__decorateClass([
|
|
1224
|
+
(0, import_decorators3.property)()
|
|
1225
|
+
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1226
|
+
__decorateClass([
|
|
1227
|
+
(0, import_decorators3.property)({
|
|
1228
|
+
converter: (value) => {
|
|
1229
|
+
try {
|
|
1230
|
+
return JSON.parse(value);
|
|
1231
|
+
} catch (exc) {
|
|
1232
|
+
return value;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
})
|
|
1236
|
+
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1237
|
+
__decorateClass([
|
|
1238
|
+
(0, import_decorators3.property)({ type: Array })
|
|
1239
|
+
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1240
|
+
__decorateClass([
|
|
1241
|
+
(0, import_decorators3.property)()
|
|
1242
|
+
], LuzmoBaseVizItem.prototype, "dashboardId", 2);
|
|
1243
|
+
__decorateClass([
|
|
1244
|
+
(0, import_decorators3.property)()
|
|
1245
|
+
], LuzmoBaseVizItem.prototype, "itemId", 2);
|
|
1246
|
+
__decorateClass([
|
|
1247
|
+
(0, import_decorators3.property)({ type: Object })
|
|
1248
|
+
], LuzmoBaseVizItem.prototype, "selectedData", 2);
|
|
1249
|
+
__decorateClass([
|
|
1250
|
+
(0, import_decorators3.property)()
|
|
1251
|
+
], LuzmoBaseVizItem.prototype, "libVersion", 2);
|
|
1252
|
+
|
|
1253
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1254
|
+
var LuzmoEmbedVizItem = class extends LuzmoBaseVizItem {
|
|
1255
|
+
};
|
|
1256
|
+
LuzmoEmbedVizItem = __decorateClass([
|
|
1257
|
+
(0, import_decorators4.customElement)("luzmo-embed-viz-item")
|
|
1258
|
+
], LuzmoEmbedVizItem);
|
|
1081
1259
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1082
1260
|
0 && (module.exports = {
|
|
1083
|
-
|
|
1084
|
-
|
|
1261
|
+
LuzmoEmbedDashboard,
|
|
1262
|
+
LuzmoEmbedVizItem
|
|
1085
1263
|
});
|
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 = "
|
|
37
|
+
var version = "6.0.0-beta.0";
|
|
41
38
|
|
|
42
39
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
43
40
|
var LuzmoService = class {
|
|
@@ -82,7 +79,7 @@ var _setEventHandler = () => {
|
|
|
82
79
|
}
|
|
83
80
|
dashboardComponent.iframeLoaded = true;
|
|
84
81
|
dashboardComponent._displayError();
|
|
85
|
-
console.error("Dashboard error: ", event.data.errorMsg);
|
|
82
|
+
console.error("Dashboard error: ", event.data.errorMsg ?? event.data.error?.msg);
|
|
86
83
|
break;
|
|
87
84
|
}
|
|
88
85
|
case "data": {
|
|
@@ -342,7 +339,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
342
339
|
this.browserErrorMsg = "";
|
|
343
340
|
this.dashboardError = false;
|
|
344
341
|
this.browserNotSupported = [];
|
|
345
|
-
this.
|
|
342
|
+
this.libVersion = version + "-wc-luzmo";
|
|
346
343
|
this.isLibraryLoaded = false;
|
|
347
344
|
this.currentAuthKey = null;
|
|
348
345
|
this.currentAuthToken = null;
|
|
@@ -406,22 +403,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
406
403
|
});
|
|
407
404
|
});
|
|
408
405
|
}
|
|
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
406
|
// Set resize event listener
|
|
426
407
|
connectedCallback() {
|
|
427
408
|
super.connectedCallback();
|
|
@@ -447,7 +428,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
447
428
|
initComponent() {
|
|
448
429
|
this.params = this._setOptions();
|
|
449
430
|
if (this.getIsViewMode()) {
|
|
450
|
-
|
|
431
|
+
SharedLib2.loadLibrary(this.params.appServer).then(async () => {
|
|
451
432
|
this.isLibraryLoaded = true;
|
|
452
433
|
await this.updateComplete;
|
|
453
434
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -533,7 +514,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
533
514
|
if (this.dashboardReference) {
|
|
534
515
|
for (const [propertyName] of changedProperties.entries()) {
|
|
535
516
|
if (propertyName === "appSever") {
|
|
536
|
-
|
|
517
|
+
SharedLib2.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
537
518
|
this.isLibraryLoaded = true;
|
|
538
519
|
await this.updateComplete;
|
|
539
520
|
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -1032,7 +1013,7 @@ __decorateClass([
|
|
|
1032
1013
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
1033
1014
|
__decorateClass([
|
|
1034
1015
|
property()
|
|
1035
|
-
], LuzmoDashboard.prototype, "
|
|
1016
|
+
], LuzmoDashboard.prototype, "libVersion", 2);
|
|
1036
1017
|
__decorateClass([
|
|
1037
1018
|
state()
|
|
1038
1019
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
@@ -1050,17 +1031,211 @@ __decorateClass([
|
|
|
1050
1031
|
], LuzmoDashboard.prototype, "isInitCalled", 2);
|
|
1051
1032
|
|
|
1052
1033
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
1053
|
-
var LuzmoDashboard2 = class extends LuzmoDashboard {
|
|
1054
|
-
};
|
|
1055
|
-
LuzmoDashboard2 = __decorateClass([
|
|
1056
|
-
customElement("luzmo-dashboard")
|
|
1057
|
-
], LuzmoDashboard2);
|
|
1058
1034
|
var LuzmoEmbedDashboard = class extends LuzmoDashboard {
|
|
1059
1035
|
};
|
|
1060
1036
|
LuzmoEmbedDashboard = __decorateClass([
|
|
1061
1037
|
customElement("luzmo-embed-dashboard")
|
|
1062
1038
|
], LuzmoEmbedDashboard);
|
|
1039
|
+
|
|
1040
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1041
|
+
import { customElement as customElement2 } from "lit/decorators.js";
|
|
1042
|
+
|
|
1043
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
|
|
1044
|
+
import { property as property2 } from "lit/decorators.js";
|
|
1045
|
+
import { LitElement as LitElement2, html as html2, css as css2 } from "lit";
|
|
1046
|
+
import * as SharedLib3 from "@luzmo/shared-embed";
|
|
1047
|
+
import { fromError } from "zod-validation-error";
|
|
1048
|
+
var LuzmoBaseVizItem = class extends LitElement2 {
|
|
1049
|
+
constructor() {
|
|
1050
|
+
super();
|
|
1051
|
+
this.appServer = "https://app.luzmo.com";
|
|
1052
|
+
this.apiHost = "https://api.luzmo.com";
|
|
1053
|
+
this.slots = [];
|
|
1054
|
+
this.version = version + "-wc-luzmo";
|
|
1055
|
+
this.libVersion = version + "-wc-luzmo";
|
|
1056
|
+
this.postInitCallQueue = [];
|
|
1057
|
+
}
|
|
1058
|
+
static {
|
|
1059
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1060
|
+
this.styles = css2`
|
|
1061
|
+
:host {
|
|
1062
|
+
display: block;
|
|
1063
|
+
width: 100%;
|
|
1064
|
+
height: 100%;
|
|
1065
|
+
}
|
|
1066
|
+
`;
|
|
1067
|
+
}
|
|
1068
|
+
canInitializeVizItem() {
|
|
1069
|
+
return !!(this.type || this.dashboardId && this.itemId);
|
|
1070
|
+
}
|
|
1071
|
+
getFilters() {
|
|
1072
|
+
return this.chartElement.getFilters();
|
|
1073
|
+
}
|
|
1074
|
+
export() {
|
|
1075
|
+
return this.chartElement.export();
|
|
1076
|
+
}
|
|
1077
|
+
getData() {
|
|
1078
|
+
return this.chartElement.getData();
|
|
1079
|
+
}
|
|
1080
|
+
refreshData() {
|
|
1081
|
+
return this.chartElement.refreshData();
|
|
1082
|
+
}
|
|
1083
|
+
setFilters(filterInput) {
|
|
1084
|
+
return this.chartElement.setFilters(void 0, filterInput);
|
|
1085
|
+
}
|
|
1086
|
+
setAuthorization(key, token) {
|
|
1087
|
+
return this.chartElement.setAuthorization(key, token);
|
|
1088
|
+
}
|
|
1089
|
+
attributeChangedCallback(name, _old, value) {
|
|
1090
|
+
super.attributeChangedCallback(name, _old, value);
|
|
1091
|
+
if (name === "selecteddata") {
|
|
1092
|
+
if (this.chartElement) {
|
|
1093
|
+
this.setFilters(JSON.parse(value ?? "{}"));
|
|
1094
|
+
} else {
|
|
1095
|
+
this.postInitCallQueue.push([this.setFilters, [JSON.parse(value ?? "{}")]]);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
async firstUpdated(_changedProperties) {
|
|
1100
|
+
super.firstUpdated(_changedProperties);
|
|
1101
|
+
if (this.canInitializeVizItem()) {
|
|
1102
|
+
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1103
|
+
this.createAndAppendElement();
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
createAndAppendElement() {
|
|
1107
|
+
if (!this.chartElement) {
|
|
1108
|
+
this.chartElement = document.createElement("chart-component");
|
|
1109
|
+
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
1110
|
+
this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
|
|
1111
|
+
this.chartElement.addEventListener("rendered", (payload) => {
|
|
1112
|
+
for (const functionToCall of this.postInitCallQueue) {
|
|
1113
|
+
functionToCall[0].bind(this)(...functionToCall[1]);
|
|
1114
|
+
}
|
|
1115
|
+
this.dispatchEvent(new CustomEvent("rendered", payload));
|
|
1116
|
+
});
|
|
1117
|
+
this.chartElement.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
1118
|
+
this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
1119
|
+
this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
1120
|
+
this.updateVizItemProperties();
|
|
1121
|
+
this.renderRoot.append(this.chartElement);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
updateVizItemProperties() {
|
|
1125
|
+
if (this.chartElement) {
|
|
1126
|
+
for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
|
|
1127
|
+
const value = this[key];
|
|
1128
|
+
if (value) {
|
|
1129
|
+
this.parseAndValidate(key);
|
|
1130
|
+
const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
|
|
1131
|
+
this.chartElement.setAttribute(
|
|
1132
|
+
SharedLib3.libraryTypeToWebComponentTypeMapping[key],
|
|
1133
|
+
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
async updated(changedProperties) {
|
|
1140
|
+
if (this.chartElement) {
|
|
1141
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
1142
|
+
const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
1143
|
+
this.parseAndValidate(propertyName);
|
|
1144
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
1145
|
+
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1146
|
+
}
|
|
1147
|
+
} else {
|
|
1148
|
+
if (this.canInitializeVizItem()) {
|
|
1149
|
+
if (this.type) {
|
|
1150
|
+
this.parseAndValidate("type");
|
|
1151
|
+
}
|
|
1152
|
+
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1153
|
+
this.createAndAppendElement();
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
parseAndValidate(key) {
|
|
1158
|
+
try {
|
|
1159
|
+
if (key === "slots") {
|
|
1160
|
+
SharedLib3.slotsParser.parse(this.slots);
|
|
1161
|
+
} else if (key === "options") {
|
|
1162
|
+
SharedLib3.vizItemOptionsParser.parse(this.options);
|
|
1163
|
+
} else if (key === "canFilter") {
|
|
1164
|
+
SharedLib3.canFilterParser.parse(this.canFilter);
|
|
1165
|
+
} else if (key === "type") {
|
|
1166
|
+
SharedLib3.itemTypeParser.parse(this.type);
|
|
1167
|
+
}
|
|
1168
|
+
} catch (err) {
|
|
1169
|
+
const validationError = fromError(err);
|
|
1170
|
+
console.warn(err);
|
|
1171
|
+
console.warn(validationError.toString());
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
render() {
|
|
1175
|
+
return html2` `;
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
__decorateClass([
|
|
1179
|
+
property2()
|
|
1180
|
+
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1181
|
+
__decorateClass([
|
|
1182
|
+
property2()
|
|
1183
|
+
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1184
|
+
__decorateClass([
|
|
1185
|
+
property2({ type: Array })
|
|
1186
|
+
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1187
|
+
__decorateClass([
|
|
1188
|
+
property2({ type: Object })
|
|
1189
|
+
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1190
|
+
__decorateClass([
|
|
1191
|
+
property2()
|
|
1192
|
+
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1193
|
+
__decorateClass([
|
|
1194
|
+
property2()
|
|
1195
|
+
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1196
|
+
__decorateClass([
|
|
1197
|
+
property2()
|
|
1198
|
+
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1199
|
+
__decorateClass([
|
|
1200
|
+
property2()
|
|
1201
|
+
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1202
|
+
__decorateClass([
|
|
1203
|
+
property2()
|
|
1204
|
+
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1205
|
+
__decorateClass([
|
|
1206
|
+
property2({
|
|
1207
|
+
converter: (value) => {
|
|
1208
|
+
try {
|
|
1209
|
+
return JSON.parse(value);
|
|
1210
|
+
} catch (exc) {
|
|
1211
|
+
return value;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
})
|
|
1215
|
+
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1216
|
+
__decorateClass([
|
|
1217
|
+
property2({ type: Array })
|
|
1218
|
+
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1219
|
+
__decorateClass([
|
|
1220
|
+
property2()
|
|
1221
|
+
], LuzmoBaseVizItem.prototype, "dashboardId", 2);
|
|
1222
|
+
__decorateClass([
|
|
1223
|
+
property2()
|
|
1224
|
+
], LuzmoBaseVizItem.prototype, "itemId", 2);
|
|
1225
|
+
__decorateClass([
|
|
1226
|
+
property2({ type: Object })
|
|
1227
|
+
], LuzmoBaseVizItem.prototype, "selectedData", 2);
|
|
1228
|
+
__decorateClass([
|
|
1229
|
+
property2()
|
|
1230
|
+
], LuzmoBaseVizItem.prototype, "libVersion", 2);
|
|
1231
|
+
|
|
1232
|
+
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1233
|
+
var LuzmoEmbedVizItem = class extends LuzmoBaseVizItem {
|
|
1234
|
+
};
|
|
1235
|
+
LuzmoEmbedVizItem = __decorateClass([
|
|
1236
|
+
customElement2("luzmo-embed-viz-item")
|
|
1237
|
+
], LuzmoEmbedVizItem);
|
|
1063
1238
|
export {
|
|
1064
|
-
|
|
1065
|
-
|
|
1239
|
+
LuzmoEmbedDashboard,
|
|
1240
|
+
LuzmoEmbedVizItem
|
|
1066
1241
|
};
|
|
@@ -51,7 +51,7 @@ export declare class LuzmoDashboard extends LitElement implements SharedLib.ES6L
|
|
|
51
51
|
browserErrorMsg: string;
|
|
52
52
|
dashboardError: boolean;
|
|
53
53
|
browserNotSupported: any[];
|
|
54
|
-
|
|
54
|
+
libVersion: string;
|
|
55
55
|
protected isLibraryLoaded: boolean;
|
|
56
56
|
protected dashboardReference: SharedLib.LuzmoElement;
|
|
57
57
|
currentAuthKey: string;
|
|
@@ -67,7 +67,6 @@ export declare class LuzmoDashboard extends LitElement implements SharedLib.ES6L
|
|
|
67
67
|
iframeWidth?: string;
|
|
68
68
|
_resizeObserver: ResizeObserver;
|
|
69
69
|
constructor();
|
|
70
|
-
private loadLibrary;
|
|
71
70
|
connectedCallback(): void;
|
|
72
71
|
disconnectedCallback(): void;
|
|
73
72
|
firstUpdated(): void;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import { LuzmoDashboard
|
|
2
|
-
/**!
|
|
3
|
-
* @element luzmo-dashboard
|
|
4
|
-
* @description Exposed by @luzmo/embed lib to everyone.
|
|
5
|
-
*
|
|
6
|
-
* @deprecated Will be removed in next major release. Switch to <luzmo-embed-dashboard> instead.
|
|
7
|
-
*/
|
|
8
|
-
export declare class LuzmoDashboard extends LuzmoBaseDashboard {
|
|
9
|
-
}
|
|
1
|
+
import { LuzmoDashboard } from './dashboard-base';
|
|
10
2
|
/**!
|
|
11
3
|
* @element luzmo-embed-dashboard
|
|
12
4
|
* @description Exposed by @luzmo/embed lib to everyone.
|
|
13
5
|
*
|
|
14
6
|
*/
|
|
15
|
-
export declare class LuzmoEmbedDashboard extends
|
|
7
|
+
export declare class LuzmoEmbedDashboard extends LuzmoDashboard {
|
|
16
8
|
}
|