@luzmo/embed 6.13.5 → 7.0.0-es2021
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 +14 -0
- package/README.md +54 -15
- package/index.cjs +109 -55
- package/index.js +109 -55
- package/luzmo-embed.min.js +325 -133
- package/package.json +9 -3
- package/src/lib/dashboard/dashboard-base.d.ts +1 -2
- package/src/lib/iq-components/luzmo-iq-chat.d.ts +10 -11
- package/src/lib/viz-item/viz-item.base.d.ts +7 -0
package/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import { property, query, state } from "lit/decorators.js";
|
|
|
23
23
|
import { styleMap } from "lit/directives/style-map.js";
|
|
24
24
|
|
|
25
25
|
// libs/embed-libs/embed/package.json
|
|
26
|
-
var version = "
|
|
26
|
+
var version = "7.0.0";
|
|
27
27
|
|
|
28
28
|
// libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
|
|
29
29
|
import * as SharedLib from "@luzmo/shared-embed";
|
|
@@ -89,6 +89,14 @@ var _setEventHandler = () => {
|
|
|
89
89
|
);
|
|
90
90
|
break;
|
|
91
91
|
}
|
|
92
|
+
case "dashboardContext": {
|
|
93
|
+
SharedLib.resolvePromise(
|
|
94
|
+
dashboardComponent,
|
|
95
|
+
event.data.requestId,
|
|
96
|
+
event.data.context
|
|
97
|
+
);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
92
100
|
case "getAccessibleDashboards": {
|
|
93
101
|
SharedLib.resolvePromise(
|
|
94
102
|
dashboardComponent,
|
|
@@ -128,6 +136,12 @@ var _setEventHandler = () => {
|
|
|
128
136
|
);
|
|
129
137
|
break;
|
|
130
138
|
}
|
|
139
|
+
case "contextChanged": {
|
|
140
|
+
dashboardComponent.dispatchEvent(
|
|
141
|
+
new CustomEvent("contextChanged", { detail: { data: event.data } })
|
|
142
|
+
);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
131
145
|
case "customEvent": {
|
|
132
146
|
dashboardComponent.dispatchEvent(
|
|
133
147
|
new CustomEvent("customEvent", { detail: { data: event.data } })
|
|
@@ -384,7 +398,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
384
398
|
itemId: "item-id",
|
|
385
399
|
language: "language",
|
|
386
400
|
editorLanguage: "editorLanguage",
|
|
387
|
-
qeVersion: "qe-version",
|
|
388
401
|
screenMode: "screen-mode",
|
|
389
402
|
switchScreenModeOnResize: "switch-screen-mode-on-resize",
|
|
390
403
|
authKey: "auth-key",
|
|
@@ -392,7 +405,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
392
405
|
editMode: "edit-mode",
|
|
393
406
|
theme: "theme",
|
|
394
407
|
mainColor: "main-color",
|
|
395
|
-
accentColor: "accent-color",
|
|
396
408
|
loaderBackground: "loader-background",
|
|
397
409
|
loaderFontColor: "loader-font-color",
|
|
398
410
|
loaderSpinnerColor: "loader-spinner-color",
|
|
@@ -523,6 +535,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
523
535
|
el.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
524
536
|
el.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
|
|
525
537
|
el.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
538
|
+
el.addEventListener("contextChanged", (payload) => this.dispatchEvent(new CustomEvent("contextChanged", payload)));
|
|
526
539
|
const container = this.renderRoot.querySelector("#dashboard-wc-container");
|
|
527
540
|
if (container) {
|
|
528
541
|
container.append(el);
|
|
@@ -584,7 +597,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
584
597
|
"itemId",
|
|
585
598
|
"language",
|
|
586
599
|
"editorLanguage",
|
|
587
|
-
"qeVersion",
|
|
588
600
|
"theme",
|
|
589
601
|
"editMode",
|
|
590
602
|
"screenMode",
|
|
@@ -671,9 +683,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
671
683
|
if (this.editorLanguage) {
|
|
672
684
|
defaultParameters.editorLanguage = this.editorLanguage;
|
|
673
685
|
}
|
|
674
|
-
if (this.qeVersion) {
|
|
675
|
-
defaultParameters.qeVersion = this.qeVersion;
|
|
676
|
-
}
|
|
677
686
|
if (this.screenMode) {
|
|
678
687
|
defaultParameters.screenMode = this.screenMode;
|
|
679
688
|
}
|
|
@@ -693,9 +702,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
693
702
|
if (this.mainColor) {
|
|
694
703
|
defaultParameters.mainColor = this.mainColor;
|
|
695
704
|
}
|
|
696
|
-
if (this.accentColor) {
|
|
697
|
-
defaultParameters.accentColor = this.accentColor;
|
|
698
|
-
}
|
|
699
705
|
if (this.loaderBackground) {
|
|
700
706
|
defaultParameters.loaderBackground = this.loaderBackground;
|
|
701
707
|
}
|
|
@@ -878,6 +884,15 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
878
884
|
}
|
|
879
885
|
return Promise.reject();
|
|
880
886
|
}
|
|
887
|
+
getDashboardContext() {
|
|
888
|
+
if (this.isWebComponentViewMode() && this.dashboardReference) {
|
|
889
|
+
return this.dashboardReference.getDashboardContext();
|
|
890
|
+
}
|
|
891
|
+
if (!this.isWebComponentViewMode()) {
|
|
892
|
+
return SharedLib2.getDashboardContext(this, this.iframe);
|
|
893
|
+
}
|
|
894
|
+
return Promise.reject(new Error("getDashboardContext is not available: dashboard reference is not ready."));
|
|
895
|
+
}
|
|
881
896
|
setSelectedData(itemId, filters) {
|
|
882
897
|
if (this.isWebComponentViewMode() && this.dashboardReference) {
|
|
883
898
|
return this.dashboardReference.setSelectedData(itemId, filters);
|
|
@@ -1000,9 +1015,6 @@ __decorateClass([
|
|
|
1000
1015
|
__decorateClass([
|
|
1001
1016
|
property()
|
|
1002
1017
|
], LuzmoDashboard.prototype, "editorLanguage", 2);
|
|
1003
|
-
__decorateClass([
|
|
1004
|
-
property()
|
|
1005
|
-
], LuzmoDashboard.prototype, "qeVersion", 2);
|
|
1006
1018
|
__decorateClass([
|
|
1007
1019
|
property()
|
|
1008
1020
|
], LuzmoDashboard.prototype, "screenMode", 2);
|
|
@@ -1023,9 +1035,6 @@ __decorateClass([
|
|
|
1023
1035
|
__decorateClass([
|
|
1024
1036
|
property()
|
|
1025
1037
|
], LuzmoDashboard.prototype, "mainColor", 2);
|
|
1026
|
-
__decorateClass([
|
|
1027
|
-
property()
|
|
1028
|
-
], LuzmoDashboard.prototype, "accentColor", 2);
|
|
1029
1038
|
__decorateClass([
|
|
1030
1039
|
property()
|
|
1031
1040
|
], LuzmoDashboard.prototype, "authToken", 2);
|
|
@@ -1155,6 +1164,19 @@ import { css as css2, html as html2, LitElement as LitElement2 } from "lit";
|
|
|
1155
1164
|
import { property as property2 } from "lit/decorators.js";
|
|
1156
1165
|
var dashboardContentsVersion = CONTENTS_VERSION;
|
|
1157
1166
|
var vizItemRemote = "VizItemApp";
|
|
1167
|
+
function collectVizItemDatasetIds(slots) {
|
|
1168
|
+
const ids = /* @__PURE__ */ new Set();
|
|
1169
|
+
for (const slot of slots ?? []) {
|
|
1170
|
+
for (const content of slot?.content ?? []) {
|
|
1171
|
+
const column = content;
|
|
1172
|
+
const datasetId = column.datasetId ?? column.set;
|
|
1173
|
+
if (datasetId) {
|
|
1174
|
+
ids.add(datasetId);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
return [...ids];
|
|
1179
|
+
}
|
|
1158
1180
|
var LuzmoBaseVizItem = class extends LitElement2 {
|
|
1159
1181
|
constructor() {
|
|
1160
1182
|
super(...arguments);
|
|
@@ -1166,22 +1188,6 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
1166
1188
|
this.libVersion = version + "-wc-luzmo";
|
|
1167
1189
|
this.postInitCallQueue = [];
|
|
1168
1190
|
}
|
|
1169
|
-
static {
|
|
1170
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1171
|
-
this.styles = css2`
|
|
1172
|
-
:host {
|
|
1173
|
-
display: block;
|
|
1174
|
-
width: 100%;
|
|
1175
|
-
height: 100%;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
luzmo-embed-viz-item {
|
|
1179
|
-
width: 100%;
|
|
1180
|
-
height: 1000%;
|
|
1181
|
-
display: block;
|
|
1182
|
-
}
|
|
1183
|
-
`;
|
|
1184
|
-
}
|
|
1185
1191
|
createRenderRoot() {
|
|
1186
1192
|
if (!this.style.display) {
|
|
1187
1193
|
this.style.display = "block";
|
|
@@ -1200,6 +1206,22 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
1200
1206
|
getFilters() {
|
|
1201
1207
|
return this.chartElement.getFilters();
|
|
1202
1208
|
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Snapshot of this flex chart's live context: its definition (type, slots,
|
|
1211
|
+
* options), current filters and the datasets it reads. Used by context-aware
|
|
1212
|
+
* embeds such as the Luzmo IQ chat component.
|
|
1213
|
+
*/
|
|
1214
|
+
getVizItemContext() {
|
|
1215
|
+
const slots = this.slots ?? [];
|
|
1216
|
+
return {
|
|
1217
|
+
id: this.contextId ?? this.getAttribute("context-id") ?? this.id ?? this.itemId ?? "",
|
|
1218
|
+
type: this.type,
|
|
1219
|
+
slots,
|
|
1220
|
+
options: this.options,
|
|
1221
|
+
filters: typeof this.chartElement?.getFilters === "function" ? this.getFilters() : this.filters ?? [],
|
|
1222
|
+
datasetIds: collectVizItemDatasetIds(slots)
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1203
1225
|
export(type = "png") {
|
|
1204
1226
|
return this.chartElement.export(type);
|
|
1205
1227
|
}
|
|
@@ -1252,7 +1274,12 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
1252
1274
|
}
|
|
1253
1275
|
this.dispatchEvent(new CustomEvent("rendered", payload));
|
|
1254
1276
|
});
|
|
1255
|
-
this.chartElement.addEventListener("changedFilters", (payload) =>
|
|
1277
|
+
this.chartElement.addEventListener("changedFilters", (payload) => {
|
|
1278
|
+
this.dispatchEvent(new CustomEvent("changedFilters", payload));
|
|
1279
|
+
this.dispatchEvent(new CustomEvent("contextChanged", {
|
|
1280
|
+
detail: { data: { type: "contextChanged", context: this.getVizItemContext() } }
|
|
1281
|
+
}));
|
|
1282
|
+
});
|
|
1256
1283
|
this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
1257
1284
|
this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
1258
1285
|
this.chartElement.addEventListener("authorizationExpired", (payload) => this.dispatchEvent(new CustomEvent("authorizationExpired", payload)));
|
|
@@ -1292,6 +1319,20 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
1292
1319
|
return html2` `;
|
|
1293
1320
|
}
|
|
1294
1321
|
};
|
|
1322
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1323
|
+
LuzmoBaseVizItem.styles = css2`
|
|
1324
|
+
:host {
|
|
1325
|
+
display: block;
|
|
1326
|
+
width: 100%;
|
|
1327
|
+
height: 100%;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
luzmo-embed-viz-item {
|
|
1331
|
+
width: 100%;
|
|
1332
|
+
height: 1000%;
|
|
1333
|
+
display: block;
|
|
1334
|
+
}
|
|
1335
|
+
`;
|
|
1295
1336
|
__decorateClass([
|
|
1296
1337
|
property2()
|
|
1297
1338
|
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
@@ -1375,7 +1416,9 @@ var inputMap = {
|
|
|
1375
1416
|
libVersion: "lib-version",
|
|
1376
1417
|
aydHost: "ayd-host",
|
|
1377
1418
|
availableDatasets: "available-datasets",
|
|
1378
|
-
dashboardContext: "dashboard-context"
|
|
1419
|
+
dashboardContext: "dashboard-context",
|
|
1420
|
+
dashboardId: "dashboard-id",
|
|
1421
|
+
contextIds: "context-ids"
|
|
1379
1422
|
};
|
|
1380
1423
|
var embedChatTag = "luzmo-iq-embed-chat";
|
|
1381
1424
|
var chatComponentTag = "luzmo-iq-chat-component";
|
|
@@ -1389,16 +1432,6 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
|
|
|
1389
1432
|
this.remoteEntryServer = "http://localhost:4202/";
|
|
1390
1433
|
this.aydHost = "https://ayd.luzmo.com/";
|
|
1391
1434
|
}
|
|
1392
|
-
static {
|
|
1393
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1394
|
-
this.styles = css3`
|
|
1395
|
-
:host {
|
|
1396
|
-
display: block;
|
|
1397
|
-
width: 100%;
|
|
1398
|
-
height: 100%;
|
|
1399
|
-
}
|
|
1400
|
-
`;
|
|
1401
|
-
}
|
|
1402
1435
|
createRenderRoot() {
|
|
1403
1436
|
return this;
|
|
1404
1437
|
}
|
|
@@ -1414,6 +1447,10 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
|
|
|
1414
1447
|
if (!this.chartElement) {
|
|
1415
1448
|
this.chartElement = document.createElement(chatComponentTag);
|
|
1416
1449
|
this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
|
|
1450
|
+
this.chartElement.addEventListener(
|
|
1451
|
+
"connectionStatusChanged",
|
|
1452
|
+
(event) => this.dispatchEvent(new CustomEvent("connectionStatusChanged", { detail: event.detail }))
|
|
1453
|
+
);
|
|
1417
1454
|
this.updateVizItemProperties();
|
|
1418
1455
|
this.renderRoot.append(this.chartElement);
|
|
1419
1456
|
}
|
|
@@ -1436,7 +1473,12 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
|
|
|
1436
1473
|
if (this.chartElement) {
|
|
1437
1474
|
for (const [propertyName] of changedProperties.entries()) {
|
|
1438
1475
|
const mappedAttributeName = inputMap[propertyName] ?? propertyName;
|
|
1439
|
-
const
|
|
1476
|
+
const propertyValue = this[propertyName];
|
|
1477
|
+
if (propertyValue == null) {
|
|
1478
|
+
this.chartElement.removeAttribute(mappedAttributeName);
|
|
1479
|
+
continue;
|
|
1480
|
+
}
|
|
1481
|
+
const attributeValue = typeof propertyValue === "object" ? JSON.stringify(propertyValue) : propertyValue.toString();
|
|
1440
1482
|
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1441
1483
|
}
|
|
1442
1484
|
} else {
|
|
@@ -1467,6 +1509,14 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
|
|
|
1467
1509
|
observer.observe(embedChat, { childList: true, subtree: true });
|
|
1468
1510
|
}
|
|
1469
1511
|
};
|
|
1512
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1513
|
+
LuzmoIQEmbedChatComponent.styles = css3`
|
|
1514
|
+
:host {
|
|
1515
|
+
display: block;
|
|
1516
|
+
width: 100%;
|
|
1517
|
+
height: 100%;
|
|
1518
|
+
}
|
|
1519
|
+
`;
|
|
1470
1520
|
__decorateClass([
|
|
1471
1521
|
property3()
|
|
1472
1522
|
], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
|
|
@@ -1506,6 +1556,12 @@ __decorateClass([
|
|
|
1506
1556
|
__decorateClass([
|
|
1507
1557
|
property3({ type: Object })
|
|
1508
1558
|
], LuzmoIQEmbedChatComponent.prototype, "dashboardContext", 2);
|
|
1559
|
+
__decorateClass([
|
|
1560
|
+
property3()
|
|
1561
|
+
], LuzmoIQEmbedChatComponent.prototype, "dashboardId", 2);
|
|
1562
|
+
__decorateClass([
|
|
1563
|
+
property3({ type: Array })
|
|
1564
|
+
], LuzmoIQEmbedChatComponent.prototype, "contextIds", 2);
|
|
1509
1565
|
if (!customElements.get(embedChatTag)) {
|
|
1510
1566
|
customElements.define(embedChatTag, LuzmoIQEmbedChatComponent);
|
|
1511
1567
|
}
|
|
@@ -1535,16 +1591,6 @@ var LuzmoIQEmbedAnswerComponent = class extends LitElement4 {
|
|
|
1535
1591
|
this.libVersion = version + "-wc-luzmo";
|
|
1536
1592
|
this.remoteEntryServer = "http://localhost:4202";
|
|
1537
1593
|
}
|
|
1538
|
-
static {
|
|
1539
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1540
|
-
this.styles = css4`
|
|
1541
|
-
:host {
|
|
1542
|
-
display: block;
|
|
1543
|
-
width: 100%;
|
|
1544
|
-
height: 100%;
|
|
1545
|
-
}
|
|
1546
|
-
`;
|
|
1547
|
-
}
|
|
1548
1594
|
createRenderRoot() {
|
|
1549
1595
|
return this;
|
|
1550
1596
|
}
|
|
@@ -1595,6 +1641,14 @@ var LuzmoIQEmbedAnswerComponent = class extends LitElement4 {
|
|
|
1595
1641
|
return html4` `;
|
|
1596
1642
|
}
|
|
1597
1643
|
};
|
|
1644
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1645
|
+
LuzmoIQEmbedAnswerComponent.styles = css4`
|
|
1646
|
+
:host {
|
|
1647
|
+
display: block;
|
|
1648
|
+
width: 100%;
|
|
1649
|
+
height: 100%;
|
|
1650
|
+
}
|
|
1651
|
+
`;
|
|
1598
1652
|
__decorateClass([
|
|
1599
1653
|
property4()
|
|
1600
1654
|
], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
|