@luzmo/embed 5.0.7 → 5.0.8
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 +6 -0
- package/README.md +2 -27
- package/index.cjs +30 -16
- package/index.js +30 -16
- package/lib/dashboard-component/dashboard-component.d.ts +1 -0
- package/luzmo-embed.min.js +2831 -54
- package/package.json +2 -2
- package/src/index.d.ts +0 -1
- package/src/lib/dashboard-component/dashboard-component.d.ts +0 -91
- package/src/lib/dashboard-component/dashboard-styles.d.ts +0 -1
- package/src/lib/helper/event-bus-handler.d.ts +0 -1
- package/src/lib/luzmo-service.d.ts +0 -6
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -33,14 +33,14 @@ OR In an HTML page:
|
|
|
33
33
|
|
|
34
34
|
```html
|
|
35
35
|
<script type="module">
|
|
36
|
-
import './node_modules/@luzmo/embed/index.js';
|
|
36
|
+
import './node_modules/@luzmo/embed/index.umd.js';
|
|
37
37
|
</script>
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
OR
|
|
41
41
|
|
|
42
42
|
```html
|
|
43
|
-
<script type="module" src="./node_modules/@luzmo/embed/index.js"></script>
|
|
43
|
+
<script type="module" src="./node_modules/@luzmo/embed/index.umd.js"></script>
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
## Usage
|
|
@@ -109,9 +109,6 @@ getData(itemId: string): Promise<ItemData>
|
|
|
109
109
|
getFilters(): Promise<FilterGroup[]>
|
|
110
110
|
// Returns an array of active filters.
|
|
111
111
|
|
|
112
|
-
setFilters<K extends CombinedFilterInput>(itemId: string, filters: K): Promise<SetFilters>
|
|
113
|
-
// Sets filters to the dashboard. Accepts an itemId which is an id of the item on the dashboard (e.g. chart) and filters which is an object with filters' settings.
|
|
114
|
-
|
|
115
112
|
setAuthorization(key: string, token: string): Promise<void>
|
|
116
113
|
// Changes the authorization of all or one dashboard. To fetch data based on new authorization parameters, reloadDashboard() or refreshData() needs to be called.
|
|
117
114
|
|
|
@@ -200,28 +197,6 @@ dashboardComponent.getAccessibleDashboards().then((dashboards) => {
|
|
|
200
197
|
});
|
|
201
198
|
```
|
|
202
199
|
|
|
203
|
-
Set filters for the Bar Chart:
|
|
204
|
-
|
|
205
|
-
```typescript
|
|
206
|
-
const barChartId = '04ec1a76-1948-496f-8342-0177272f6695';
|
|
207
|
-
const filters: BarChartFilterInput = {
|
|
208
|
-
and: [
|
|
209
|
-
{
|
|
210
|
-
expression: '? between ?',
|
|
211
|
-
parameters: [
|
|
212
|
-
{ slot: 'y-axis' },
|
|
213
|
-
[
|
|
214
|
-
['2010-01-01T00:00:00.000Z', '2010-01-01T00:00:00.000Z'],
|
|
215
|
-
['2012-01-01T00:00:00.000Z', '2012-01-01T00:00:00.000Z']
|
|
216
|
-
]
|
|
217
|
-
]
|
|
218
|
-
}
|
|
219
|
-
]
|
|
220
|
-
}
|
|
221
|
-
dashboardComponent.setFilters<BarChartFilterInput>(barChartId, filters)
|
|
222
|
-
.then(() => {});
|
|
223
|
-
```
|
|
224
|
-
|
|
225
200
|
## Changelog
|
|
226
201
|
|
|
227
202
|
- [Changelog](https://embed-libs.luzmo.com/changelogs/embed/)
|
package/index.cjs
CHANGED
|
@@ -1141,6 +1141,9 @@ var _extendAndValidate = (dashboardContent) => {
|
|
|
1141
1141
|
}
|
|
1142
1142
|
};
|
|
1143
1143
|
|
|
1144
|
+
// libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
|
|
1145
|
+
var luzmoEmbedContainerClass = "luzmo-embed-container";
|
|
1146
|
+
|
|
1144
1147
|
// libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
|
|
1145
1148
|
var remotesMap = {
|
|
1146
1149
|
// "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
|
|
@@ -1212,7 +1215,7 @@ var import_decorators = require("lit/decorators.js");
|
|
|
1212
1215
|
var import_style_map = require("lit/directives/style-map.js");
|
|
1213
1216
|
|
|
1214
1217
|
// libs/embed-libs/embed/package.json
|
|
1215
|
-
var version = "5.0.
|
|
1218
|
+
var version = "5.0.8";
|
|
1216
1219
|
|
|
1217
1220
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
1218
1221
|
var LuzmoService = class {
|
|
@@ -1537,7 +1540,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
1537
1540
|
this.params = this._setOptions();
|
|
1538
1541
|
this._onResize = () => {
|
|
1539
1542
|
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
1540
|
-
this.containerWidth = this.
|
|
1543
|
+
this.containerWidth = this.luzmoEmbedContainer.offsetWidth;
|
|
1541
1544
|
if (this.params.switchScreenModeOnResize && this.params.screenMode === "auto") {
|
|
1542
1545
|
for (const d of EXTENTS) {
|
|
1543
1546
|
if (d.width[0] <= window.innerWidth && window.innerWidth <= d.width[1]) {
|
|
@@ -1547,6 +1550,11 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
1547
1550
|
}
|
|
1548
1551
|
if (this.iframeLoaded) {
|
|
1549
1552
|
this._calculateDimAfterDashboardLoaded();
|
|
1553
|
+
} else {
|
|
1554
|
+
if (this.dimensions) {
|
|
1555
|
+
this.containerWidth = this.luzmoEmbedContainer.offsetWidth;
|
|
1556
|
+
_setCalculatedDimensions(this);
|
|
1557
|
+
}
|
|
1550
1558
|
}
|
|
1551
1559
|
}
|
|
1552
1560
|
};
|
|
@@ -1627,6 +1635,9 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
1627
1635
|
this._loaderStyles();
|
|
1628
1636
|
luzmo_service_default._components.push(this);
|
|
1629
1637
|
this.initComponent();
|
|
1638
|
+
if (this.luzmoEmbedContainer) {
|
|
1639
|
+
this._resizeObserver.observe(this.luzmoEmbedContainer);
|
|
1640
|
+
}
|
|
1630
1641
|
}
|
|
1631
1642
|
initComponent() {
|
|
1632
1643
|
this.params = this._setOptions();
|
|
@@ -1642,14 +1653,14 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
1642
1653
|
this.containerWidth = this.dashboardReference.offsetWidth;
|
|
1643
1654
|
this.dimensions = payload.detail.dimensions;
|
|
1644
1655
|
_setCalculatedDimensions(this);
|
|
1645
|
-
this.dispatchEvent(new CustomEvent("load", payload.detail));
|
|
1646
1656
|
});
|
|
1657
|
+
this.dispatchEvent(new CustomEvent("load", payload));
|
|
1647
1658
|
});
|
|
1648
|
-
this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload
|
|
1649
|
-
this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload
|
|
1650
|
-
this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload
|
|
1651
|
-
this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload
|
|
1652
|
-
this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload
|
|
1659
|
+
this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
|
|
1660
|
+
this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
1661
|
+
this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
1662
|
+
this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
|
|
1663
|
+
this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
1653
1664
|
this.setAllAttributes();
|
|
1654
1665
|
});
|
|
1655
1666
|
} else {
|
|
@@ -1664,9 +1675,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
1664
1675
|
this.iframe?.setAttribute("src", this._iframeUrl);
|
|
1665
1676
|
this.iframeStyle = calculateIframeStyles(this);
|
|
1666
1677
|
}
|
|
1667
|
-
if (this.container) {
|
|
1668
|
-
this._resizeObserver.observe(this.container);
|
|
1669
|
-
}
|
|
1670
1678
|
}
|
|
1671
1679
|
}
|
|
1672
1680
|
setAllAttributes() {
|
|
@@ -1931,15 +1939,18 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
1931
1939
|
`;
|
|
1932
1940
|
}
|
|
1933
1941
|
return import_lit2.html`
|
|
1934
|
-
<div
|
|
1935
|
-
|
|
1936
|
-
|
|
1942
|
+
<div class="${luzmoEmbedContainerClass}">
|
|
1943
|
+
<div
|
|
1944
|
+
class="dashboard-container"
|
|
1945
|
+
style=${(0, import_style_map.styleMap)(Object.assign({}, this._containerStyle, {
|
|
1937
1946
|
width: this.iframeStyle.width ?? "100%",
|
|
1938
1947
|
height: this.iframeStyle.height ?? "100%"
|
|
1939
1948
|
}))}
|
|
1940
|
-
|
|
1941
|
-
|
|
1949
|
+
>
|
|
1950
|
+
${toBeRenderedHTML}
|
|
1951
|
+
</div>
|
|
1942
1952
|
</div>
|
|
1953
|
+
|
|
1943
1954
|
`;
|
|
1944
1955
|
}
|
|
1945
1956
|
getDashboards() {
|
|
@@ -2066,6 +2077,9 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
2066
2077
|
__decorateClass([
|
|
2067
2078
|
(0, import_decorators.query)(".dashboard-container")
|
|
2068
2079
|
], LuzmoDashboard.prototype, "container", 2);
|
|
2080
|
+
__decorateClass([
|
|
2081
|
+
(0, import_decorators.query)(`.${luzmoEmbedContainerClass}`)
|
|
2082
|
+
], LuzmoDashboard.prototype, "luzmoEmbedContainer", 2);
|
|
2069
2083
|
__decorateClass([
|
|
2070
2084
|
(0, import_decorators.query)("iframe")
|
|
2071
2085
|
], LuzmoDashboard.prototype, "iframe", 2);
|
package/index.js
CHANGED
|
@@ -1118,6 +1118,9 @@ var _extendAndValidate = (dashboardContent) => {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
};
|
|
1120
1120
|
|
|
1121
|
+
// libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
|
|
1122
|
+
var luzmoEmbedContainerClass = "luzmo-embed-container";
|
|
1123
|
+
|
|
1121
1124
|
// libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
|
|
1122
1125
|
var remotesMap = {
|
|
1123
1126
|
// "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
|
|
@@ -1199,7 +1202,7 @@ import {
|
|
|
1199
1202
|
} from "lit/directives/style-map.js";
|
|
1200
1203
|
|
|
1201
1204
|
// libs/embed-libs/embed/package.json
|
|
1202
|
-
var version = "5.0.
|
|
1205
|
+
var version = "5.0.8";
|
|
1203
1206
|
|
|
1204
1207
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
1205
1208
|
var LuzmoService = class {
|
|
@@ -1524,7 +1527,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
1524
1527
|
this.params = this._setOptions();
|
|
1525
1528
|
this._onResize = () => {
|
|
1526
1529
|
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
1527
|
-
this.containerWidth = this.
|
|
1530
|
+
this.containerWidth = this.luzmoEmbedContainer.offsetWidth;
|
|
1528
1531
|
if (this.params.switchScreenModeOnResize && this.params.screenMode === "auto") {
|
|
1529
1532
|
for (const d of EXTENTS) {
|
|
1530
1533
|
if (d.width[0] <= window.innerWidth && window.innerWidth <= d.width[1]) {
|
|
@@ -1534,6 +1537,11 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
1534
1537
|
}
|
|
1535
1538
|
if (this.iframeLoaded) {
|
|
1536
1539
|
this._calculateDimAfterDashboardLoaded();
|
|
1540
|
+
} else {
|
|
1541
|
+
if (this.dimensions) {
|
|
1542
|
+
this.containerWidth = this.luzmoEmbedContainer.offsetWidth;
|
|
1543
|
+
_setCalculatedDimensions(this);
|
|
1544
|
+
}
|
|
1537
1545
|
}
|
|
1538
1546
|
}
|
|
1539
1547
|
};
|
|
@@ -1614,6 +1622,9 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
1614
1622
|
this._loaderStyles();
|
|
1615
1623
|
luzmo_service_default._components.push(this);
|
|
1616
1624
|
this.initComponent();
|
|
1625
|
+
if (this.luzmoEmbedContainer) {
|
|
1626
|
+
this._resizeObserver.observe(this.luzmoEmbedContainer);
|
|
1627
|
+
}
|
|
1617
1628
|
}
|
|
1618
1629
|
initComponent() {
|
|
1619
1630
|
this.params = this._setOptions();
|
|
@@ -1629,14 +1640,14 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
1629
1640
|
this.containerWidth = this.dashboardReference.offsetWidth;
|
|
1630
1641
|
this.dimensions = payload.detail.dimensions;
|
|
1631
1642
|
_setCalculatedDimensions(this);
|
|
1632
|
-
this.dispatchEvent(new CustomEvent("load", payload.detail));
|
|
1633
1643
|
});
|
|
1644
|
+
this.dispatchEvent(new CustomEvent("load", payload));
|
|
1634
1645
|
});
|
|
1635
|
-
this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload
|
|
1636
|
-
this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload
|
|
1637
|
-
this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload
|
|
1638
|
-
this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload
|
|
1639
|
-
this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload
|
|
1646
|
+
this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
|
|
1647
|
+
this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
1648
|
+
this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
1649
|
+
this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
|
|
1650
|
+
this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
1640
1651
|
this.setAllAttributes();
|
|
1641
1652
|
});
|
|
1642
1653
|
} else {
|
|
@@ -1651,9 +1662,6 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
1651
1662
|
this.iframe?.setAttribute("src", this._iframeUrl);
|
|
1652
1663
|
this.iframeStyle = calculateIframeStyles(this);
|
|
1653
1664
|
}
|
|
1654
|
-
if (this.container) {
|
|
1655
|
-
this._resizeObserver.observe(this.container);
|
|
1656
|
-
}
|
|
1657
1665
|
}
|
|
1658
1666
|
}
|
|
1659
1667
|
setAllAttributes() {
|
|
@@ -1918,15 +1926,18 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
1918
1926
|
`;
|
|
1919
1927
|
}
|
|
1920
1928
|
return html`
|
|
1921
|
-
<div
|
|
1922
|
-
|
|
1923
|
-
|
|
1929
|
+
<div class="${luzmoEmbedContainerClass}">
|
|
1930
|
+
<div
|
|
1931
|
+
class="dashboard-container"
|
|
1932
|
+
style=${styleMap(Object.assign({}, this._containerStyle, {
|
|
1924
1933
|
width: this.iframeStyle.width ?? "100%",
|
|
1925
1934
|
height: this.iframeStyle.height ?? "100%"
|
|
1926
1935
|
}))}
|
|
1927
|
-
|
|
1928
|
-
|
|
1936
|
+
>
|
|
1937
|
+
${toBeRenderedHTML}
|
|
1938
|
+
</div>
|
|
1929
1939
|
</div>
|
|
1940
|
+
|
|
1930
1941
|
`;
|
|
1931
1942
|
}
|
|
1932
1943
|
getDashboards() {
|
|
@@ -2053,6 +2064,9 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
2053
2064
|
__decorateClass([
|
|
2054
2065
|
query(".dashboard-container")
|
|
2055
2066
|
], LuzmoDashboard.prototype, "container", 2);
|
|
2067
|
+
__decorateClass([
|
|
2068
|
+
query(`.${luzmoEmbedContainerClass}`)
|
|
2069
|
+
], LuzmoDashboard.prototype, "luzmoEmbedContainer", 2);
|
|
2056
2070
|
__decorateClass([
|
|
2057
2071
|
query("iframe")
|
|
2058
2072
|
], LuzmoDashboard.prototype, "iframe", 2);
|
|
@@ -3,6 +3,7 @@ import { LitElement, PropertyValues, TemplateResult } from 'lit';
|
|
|
3
3
|
import { CombinedFilterInput } from '@luzmo/shared-embed';
|
|
4
4
|
export declare class LuzmoDashboard extends LitElement implements SharedLib.ES6LuzmoDashboard {
|
|
5
5
|
container: HTMLElement;
|
|
6
|
+
luzmoEmbedContainer: HTMLElement;
|
|
6
7
|
iframe: HTMLIFrameElement;
|
|
7
8
|
dashboardId?: SharedLib.DashboardInputs['dashboardId'];
|
|
8
9
|
dashboardSlug?: SharedLib.DashboardInputs['dashboardSlug'];
|