@luzmo/embed 6.0.0-beta.6 → 6.0.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 +9 -1
- package/MIGRATIONS.md +1 -1
- package/README.md +14 -118
- package/index.cjs +37 -223
- package/index.d.ts +1 -3
- package/index.js +39 -222
- package/lib/dashboard-component/dashboard-base.d.ts +2 -1
- package/luzmo-embed.min.js +1372 -5918
- package/package.json +2 -3
- package/src/index.d.ts +1 -3
- package/src/lib/dashboard-component/dashboard-base.d.ts +2 -1
- package/lib/viz-item/viz-item-component.d.ts +0 -3
- package/lib/viz-item/viz-item.base.d.ts +0 -41
- package/src/lib/viz-item/viz-item-component.d.ts +0 -3
- package/src/lib/viz-item/viz-item.base.d.ts +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
-
## [6.0.
|
|
4
|
+
## [6.0.1] - 2024-07-11
|
|
5
|
+
|
|
6
|
+
- Fix for loader color when embedding dashboard as a web component, and other bug fixes
|
|
7
|
+
|
|
8
|
+
## [6.0.0] - 2024-07-11
|
|
5
9
|
|
|
6
10
|
### Breaking changes
|
|
7
11
|
|
|
8
12
|
- Removed `<luzmo-dashboard>` web component, It has been replaced with `<luzmo-embed-dashboard>`.
|
|
9
13
|
- `LuzmoDashboard` has been replaced with `LuzmoEmbedDashboard`
|
|
10
14
|
|
|
15
|
+
### Bugfixes
|
|
16
|
+
|
|
17
|
+
- Fix for loader color when embedding dashboard as a web component, and other bug fixes
|
|
18
|
+
|
|
11
19
|
## [5.1.5] - 2024-05-03
|
|
12
20
|
|
|
13
21
|
### Bugfixes
|
package/MIGRATIONS.md
CHANGED
package/README.md
CHANGED
|
@@ -5,11 +5,13 @@ A modern [Web Component](https://developer.mozilla.org/en-US/docs/Web/Web_Compon
|
|
|
5
5
|
## Table of contents
|
|
6
6
|
|
|
7
7
|
1. [Installation instructions](#installation-instructions)
|
|
8
|
-
2. [
|
|
9
|
-
3. [
|
|
10
|
-
4. [
|
|
11
|
-
5. [
|
|
12
|
-
6. [
|
|
8
|
+
2. [Usage](#usage)
|
|
9
|
+
3. [Events](#events)
|
|
10
|
+
4. [Public Methods](#public-methods)
|
|
11
|
+
5. [Examples](#examples)
|
|
12
|
+
6. [Changelog](#changelog)
|
|
13
|
+
7. [Migration](#migration)
|
|
14
|
+
8. [Quick links](#quick-links)
|
|
13
15
|
|
|
14
16
|
## Installation instructions
|
|
15
17
|
|
|
@@ -41,113 +43,7 @@ OR
|
|
|
41
43
|
<script type="module" src="./node_modules/@luzmo/embed/index.js"></script>
|
|
42
44
|
```
|
|
43
45
|
|
|
44
|
-
##
|
|
45
|
-
|
|
46
|
-
### Usage luzmo-embed-viz-item
|
|
47
|
-
|
|
48
|
-
Use the viz-item components as if they were native HTML tags.
|
|
49
|
-
|
|
50
|
-
**In your HTML template.**
|
|
51
|
-
```html
|
|
52
|
-
<luzmo-embed-viz-item type="bar-chart" slots="slotsArray[]" options="optionsObject"></luzmo-embed-viz-item>
|
|
53
|
-
|
|
54
|
-
OR
|
|
55
|
-
|
|
56
|
-
<luzmo-embed-viz-item type="bar-chart" dashboardId="dashboardId" itemId="itemId" options="optionsObject"></luzmo-embed-viz-item>
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
<br/>
|
|
60
|
-
|
|
61
|
-
### Properties: luzmo-embed-viz-item
|
|
62
|
-
|
|
63
|
-
Below a list of available properties on the viz item web component
|
|
64
|
-
|
|
65
|
-
| Property | Type | Description |
|
|
66
|
-
|----------------------------|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
67
|
-
| `type` | string | The type of viz item to embed. |
|
|
68
|
-
| `options` | object | The options object to be passed on to viz item |
|
|
69
|
-
| `slots` | array | The slots array to specify which columns to use to fetch data. depends on the type of chart. |
|
|
70
|
-
| `contextId` | string | contextId is a unique id that can be assigned to viz item which will be used in filtering with `canFilter`. |
|
|
71
|
-
| `authKey` | string | Authorization key generated via Luzmo API |
|
|
72
|
-
| `authToken` | string | Authorization token generated via Luzmo API |
|
|
73
|
-
| `canFilter` | string \| array | `canFilter` can be either set to `all` or an array of `contextId`'s. |
|
|
74
|
-
| `filters` | object | `filters` object is used to set initial filters. |
|
|
75
|
-
| `appServer` | string | Tenancy of luzmo.com to connect to (Default: 'https://app.luzmo.com/' for US set appServer to 'https://app.us.luzmo.com/') |
|
|
76
|
-
| `apiHost` | string | API server to connect to (Default: 'https://api.luzmo.com/' , for US set apiHost to 'https://api.us.luzmo.com/') |
|
|
77
|
-
|
|
78
|
-
<br/>
|
|
79
|
-
|
|
80
|
-
### Events luzmo-embed-viz-item
|
|
81
|
-
|
|
82
|
-
| Name | Description |
|
|
83
|
-
|----------------|----------------------------------------|
|
|
84
|
-
| changedFilters | Emitted when filters are changed |
|
|
85
|
-
| customEvent | Emitted when a custom event is fired |
|
|
86
|
-
| exported | Emitted when export completes or fails |
|
|
87
|
-
| rendered | Emitted when the item is rendered |
|
|
88
|
-
| load | Emitted when dashboard is loaded |
|
|
89
|
-
|
|
90
|
-
<br/>
|
|
91
|
-
|
|
92
|
-
### Public methods luzmo-embed-viz-item
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
getData(): any
|
|
96
|
-
// Return an array of the data of the viz item that's embedded.
|
|
97
|
-
|
|
98
|
-
getFilters(): FilterGroup[];
|
|
99
|
-
// Return an array of active filters on the viz item.
|
|
100
|
-
|
|
101
|
-
refreshData(): void
|
|
102
|
-
// Refresh the data of the viz item.
|
|
103
|
-
|
|
104
|
-
setAuthorization(key: string, token: string): void
|
|
105
|
-
// Changes the authorization of the viz item. To fetch data based on new authorization parameters, refreshData() needs to be called.
|
|
106
|
-
|
|
107
|
-
export(): void
|
|
108
|
-
// Export the viz item as png.
|
|
109
|
-
```
|
|
110
|
-
<br/>
|
|
111
|
-
|
|
112
|
-
### Examples luzmo-embed-viz-item
|
|
113
|
-
|
|
114
|
-
A Bar chart with display hidden.
|
|
115
|
-
|
|
116
|
-
```html
|
|
117
|
-
<luzmo-embed-viz-item id="vizItem" type="bar-chart" options='{ "display": { "title": false } }'></luzmo-embed-viz-item>
|
|
118
|
-
```
|
|
119
|
-
Add an event listener to the viz item.
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
// get the component, here we query the component that has an id 'dashboard'
|
|
123
|
-
const vizItemComponent = document.getElementById('vizItem');
|
|
124
|
-
vizItemComponent.addEventListener('rendered', (event) => {
|
|
125
|
-
// do something after all items are rendered
|
|
126
|
-
console.log(event);
|
|
127
|
-
});
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Get data from the viz item
|
|
131
|
-
|
|
132
|
-
```typescript
|
|
133
|
-
const data = vizItemComponent.getData()
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Get Active filters in the viz item
|
|
137
|
-
|
|
138
|
-
```typescript
|
|
139
|
-
const filters = vizItemComponent.getFilters();
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
Export the viz item
|
|
143
|
-
|
|
144
|
-
```typescript
|
|
145
|
-
vizItemComponent.export();
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Luzmo Embed Dashboard
|
|
149
|
-
|
|
150
|
-
### Usage luzmo-embed-dashboard
|
|
46
|
+
## Usage
|
|
151
47
|
|
|
152
48
|
Use the dashboard components as if they were native HTML tags. Use the id of the dashboard you wish to embed.
|
|
153
49
|
**In your HTML template.**
|
|
@@ -161,7 +57,7 @@ OR
|
|
|
161
57
|
<luzmo-embed-dashboard dashboardId="55cfb99c-d602-492b-b192-6c15277fdb9a" itemId="59fe5bd7-5070-42f5-98f4-da7f931e316c"> </luzmo-embed-dashboard>
|
|
162
58
|
```
|
|
163
59
|
|
|
164
|
-
|
|
60
|
+
**Properties:**
|
|
165
61
|
|
|
166
62
|
Below a list of available properties on the dashboard web component
|
|
167
63
|
|
|
@@ -187,9 +83,9 @@ Below a list of available properties on the dashboard web component
|
|
|
187
83
|
| `mainColor` | string | Optional override of the main color used in the whitelabeling of the embedded dashboard editor. If not provided, the main color of the whitelabeling colors set on the organization will be used. Should be specified as a string of rgb values (i.e. "rgb(50,50,50)"). |
|
|
188
84
|
| `accentColor` | string | Optional override of the accent color used in the whitelabeling of the embedded dashboard editor. If not provided, the accent color of the whitelabeling colors set on the organization will be used. Should be specified as a string of rgb values (i.e. "rgb(50,50,50)"). |
|
|
189
85
|
|
|
190
|
-
<br/>
|
|
86
|
+
<br/><br/>
|
|
191
87
|
|
|
192
|
-
|
|
88
|
+
## Events
|
|
193
89
|
|
|
194
90
|
| Name | Description | Event Arguments |
|
|
195
91
|
| -------------- | -------------------------------------- | --------------------- |
|
|
@@ -201,7 +97,7 @@ Below a list of available properties on the dashboard web component
|
|
|
201
97
|
|
|
202
98
|
<br/>
|
|
203
99
|
|
|
204
|
-
|
|
100
|
+
## Public methods
|
|
205
101
|
|
|
206
102
|
```typescript
|
|
207
103
|
getDashboards(): Promise<LuzmoDashboard[]>
|
|
@@ -234,7 +130,7 @@ setEditMode(editMode: DashboardEditMode): Promise<SetEditMode>
|
|
|
234
130
|
|
|
235
131
|
<br/>
|
|
236
132
|
|
|
237
|
-
|
|
133
|
+
## Examples
|
|
238
134
|
|
|
239
135
|
A dashboard with a gray loader background
|
|
240
136
|
|
|
@@ -310,7 +206,7 @@ dashboardComponent.getAccessibleDashboards().then((dashboards) => {
|
|
|
310
206
|
### Migrating from cumul.io to luzmo.
|
|
311
207
|
|
|
312
208
|
* Change `import '@cumul.io/cumulio-dashboard` to `import @luzmo/embed`.
|
|
313
|
-
* Replace all references of `cumulio-dashboard` to `luzmo-
|
|
209
|
+
* Replace all references of `cumulio-dashboard` to `luzmo-dashboard`
|
|
314
210
|
|
|
315
211
|
## Quick links
|
|
316
212
|
|
package/index.cjs
CHANGED
|
@@ -39,12 +39,9 @@ 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
|
-
LuzmoEmbedDashboard: () => LuzmoEmbedDashboard
|
|
43
|
-
LuzmoEmbedVizItem: () => LuzmoEmbedVizItem,
|
|
44
|
-
filterUtils: () => import_shared_embed2.filterUtils
|
|
42
|
+
LuzmoEmbedDashboard: () => LuzmoEmbedDashboard
|
|
45
43
|
});
|
|
46
44
|
module.exports = __toCommonJS(src_exports);
|
|
47
|
-
var import_shared_embed2 = require("@luzmo/shared-embed");
|
|
48
45
|
|
|
49
46
|
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
50
47
|
var import_decorators2 = require("lit/decorators.js");
|
|
@@ -57,7 +54,7 @@ var import_style_map = require("lit/directives/style-map.js");
|
|
|
57
54
|
var import_shared_embed = require("@luzmo/shared-embed");
|
|
58
55
|
|
|
59
56
|
// libs/embed-libs/embed/package.json
|
|
60
|
-
var version = "6.0.0
|
|
57
|
+
var version = "6.0.0";
|
|
61
58
|
|
|
62
59
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
63
60
|
var LuzmoService = class {
|
|
@@ -362,7 +359,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
362
359
|
this.browserErrorMsg = "";
|
|
363
360
|
this.dashboardError = false;
|
|
364
361
|
this.browserNotSupported = [];
|
|
365
|
-
this.
|
|
362
|
+
this.VERSION = version + "-wc-luzmo";
|
|
366
363
|
this.isLibraryLoaded = false;
|
|
367
364
|
this.currentAuthKey = null;
|
|
368
365
|
this.currentAuthToken = null;
|
|
@@ -426,6 +423,22 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
426
423
|
});
|
|
427
424
|
});
|
|
428
425
|
}
|
|
426
|
+
loadLibrary(appServer) {
|
|
427
|
+
if (import_shared_embed.remotesMap[appServer]) {
|
|
428
|
+
return Promise.resolve(import_shared_embed.remotesMap[appServer].module);
|
|
429
|
+
}
|
|
430
|
+
import_shared_embed.remotesMap[appServer] = {
|
|
431
|
+
url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
|
|
432
|
+
format: "esm",
|
|
433
|
+
from: "vite",
|
|
434
|
+
module: void 0
|
|
435
|
+
};
|
|
436
|
+
return (0, import_shared_embed.__federationMethodGetRemote)(appServer, "./DashboardApp").then((module2) => {
|
|
437
|
+
const wrappedModule = (0, import_shared_embed.__federationMethodWrapDefault)(module2, true);
|
|
438
|
+
import_shared_embed.remotesMap[appServer].module = wrappedModule;
|
|
439
|
+
return wrappedModule;
|
|
440
|
+
});
|
|
441
|
+
}
|
|
429
442
|
// Set resize event listener
|
|
430
443
|
connectedCallback() {
|
|
431
444
|
super.connectedCallback();
|
|
@@ -451,7 +464,9 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
451
464
|
initComponent() {
|
|
452
465
|
this.params = this._setOptions();
|
|
453
466
|
if (this.getIsViewMode()) {
|
|
454
|
-
|
|
467
|
+
this._setupLoader();
|
|
468
|
+
this._loaderStyles();
|
|
469
|
+
this.loadLibrary(this.params.appServer).then(async () => {
|
|
455
470
|
this.isLibraryLoaded = true;
|
|
456
471
|
await this.updateComplete;
|
|
457
472
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -491,18 +506,18 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
491
506
|
if (!["authKey", "authToken", "apiHost", "itemDimensions"].includes(key) && this.params[key]) {
|
|
492
507
|
this.dashboardReference.setAttribute(this.attributesMap[key], this.params[key]);
|
|
493
508
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
509
|
+
}
|
|
510
|
+
if (this.params.itemDimensions) {
|
|
511
|
+
this.dashboardReference.setAttribute("item-dimensions", JSON.stringify(this.params.itemDimensions));
|
|
512
|
+
}
|
|
513
|
+
if (this.params.apiHost) {
|
|
514
|
+
this.dashboardReference.setAttribute("api-host", SharedLib2.removeTrailingSlash(this.params.apiHost));
|
|
515
|
+
}
|
|
516
|
+
if (this.params.key) {
|
|
517
|
+
this.dashboardReference.setAttribute("auth-key", this.params.key);
|
|
518
|
+
}
|
|
519
|
+
if (this.params.token) {
|
|
520
|
+
this.dashboardReference.setAttribute("auth-token", this.params.token);
|
|
506
521
|
}
|
|
507
522
|
}
|
|
508
523
|
}
|
|
@@ -537,7 +552,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
537
552
|
if (this.dashboardReference) {
|
|
538
553
|
for (const [propertyName] of changedProperties.entries()) {
|
|
539
554
|
if (propertyName === "appSever") {
|
|
540
|
-
|
|
555
|
+
this.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
541
556
|
this.isLibraryLoaded = true;
|
|
542
557
|
await this.updateComplete;
|
|
543
558
|
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
@@ -1036,7 +1051,7 @@ __decorateClass([
|
|
|
1036
1051
|
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
1037
1052
|
__decorateClass([
|
|
1038
1053
|
(0, import_decorators.property)()
|
|
1039
|
-
], LuzmoDashboard.prototype, "
|
|
1054
|
+
], LuzmoDashboard.prototype, "VERSION", 2);
|
|
1040
1055
|
__decorateClass([
|
|
1041
1056
|
(0, import_decorators.state)()
|
|
1042
1057
|
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
@@ -1059,208 +1074,7 @@ var LuzmoEmbedDashboard = class extends LuzmoDashboard {
|
|
|
1059
1074
|
LuzmoEmbedDashboard = __decorateClass([
|
|
1060
1075
|
(0, import_decorators2.customElement)("luzmo-embed-dashboard")
|
|
1061
1076
|
], 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.version = version + "-wc-luzmo";
|
|
1078
|
-
this.libVersion = version + "-wc-luzmo";
|
|
1079
|
-
this.postInitCallQueue = [];
|
|
1080
|
-
}
|
|
1081
|
-
static {
|
|
1082
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1083
|
-
this.styles = import_lit3.css`
|
|
1084
|
-
:host {
|
|
1085
|
-
display: block;
|
|
1086
|
-
width: 100%;
|
|
1087
|
-
height: 100%;
|
|
1088
|
-
}
|
|
1089
|
-
`;
|
|
1090
|
-
}
|
|
1091
|
-
canInitializeVizItem() {
|
|
1092
|
-
return !!(this.type || this.dashboardId && this.itemId);
|
|
1093
|
-
}
|
|
1094
|
-
getFilters() {
|
|
1095
|
-
return this.chartElement.getFilters();
|
|
1096
|
-
}
|
|
1097
|
-
export() {
|
|
1098
|
-
return this.chartElement.export();
|
|
1099
|
-
}
|
|
1100
|
-
getData() {
|
|
1101
|
-
return this.chartElement.getData();
|
|
1102
|
-
}
|
|
1103
|
-
refreshData() {
|
|
1104
|
-
return this.chartElement.refreshData();
|
|
1105
|
-
}
|
|
1106
|
-
setFilters(filterInput) {
|
|
1107
|
-
return this.chartElement.setFilters(void 0, filterInput);
|
|
1108
|
-
}
|
|
1109
|
-
setAuthorization(key, token) {
|
|
1110
|
-
return this.chartElement.setAuthorization(key, token);
|
|
1111
|
-
}
|
|
1112
|
-
attributeChangedCallback(name, _old, value) {
|
|
1113
|
-
super.attributeChangedCallback(name, _old, value);
|
|
1114
|
-
if (name === "selecteddata") {
|
|
1115
|
-
if (this.chartElement) {
|
|
1116
|
-
this.setFilters(JSON.parse(value ?? "{}"));
|
|
1117
|
-
} else {
|
|
1118
|
-
this.postInitCallQueue.push([this.setFilters, [JSON.parse(value ?? "{}")]]);
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
async firstUpdated(_changedProperties) {
|
|
1123
|
-
super.firstUpdated(_changedProperties);
|
|
1124
|
-
if (this.canInitializeVizItem()) {
|
|
1125
|
-
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1126
|
-
this.createAndAppendElement();
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
createAndAppendElement() {
|
|
1130
|
-
if (!this.chartElement) {
|
|
1131
|
-
this.chartElement = document.createElement("chart-component");
|
|
1132
|
-
this.chartElement.setAttribute("embedding-mode", "chart");
|
|
1133
|
-
this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
|
|
1134
|
-
this.chartElement.addEventListener("rendered", (payload) => {
|
|
1135
|
-
for (const functionToCall of this.postInitCallQueue) {
|
|
1136
|
-
functionToCall[0].bind(this)(...functionToCall[1]);
|
|
1137
|
-
}
|
|
1138
|
-
this.dispatchEvent(new CustomEvent("rendered", payload));
|
|
1139
|
-
});
|
|
1140
|
-
this.chartElement.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
1141
|
-
this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
1142
|
-
this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
1143
|
-
this.updateVizItemProperties();
|
|
1144
|
-
this.renderRoot.append(this.chartElement);
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
updateVizItemProperties() {
|
|
1148
|
-
if (this.chartElement) {
|
|
1149
|
-
for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
|
|
1150
|
-
const value = this[key];
|
|
1151
|
-
if (value) {
|
|
1152
|
-
this.parseAndValidate(key);
|
|
1153
|
-
const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
|
|
1154
|
-
this.chartElement.setAttribute(
|
|
1155
|
-
SharedLib3.libraryTypeToWebComponentTypeMapping[key],
|
|
1156
|
-
typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
|
|
1157
|
-
);
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
async updated(changedProperties) {
|
|
1163
|
-
if (this.chartElement) {
|
|
1164
|
-
for (const [propertyName] of changedProperties.entries()) {
|
|
1165
|
-
const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
1166
|
-
this.parseAndValidate(propertyName);
|
|
1167
|
-
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
|
|
1168
|
-
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
1169
|
-
}
|
|
1170
|
-
} else {
|
|
1171
|
-
if (this.canInitializeVizItem()) {
|
|
1172
|
-
if (this.type) {
|
|
1173
|
-
this.parseAndValidate("type");
|
|
1174
|
-
}
|
|
1175
|
-
await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
|
|
1176
|
-
this.createAndAppendElement();
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
parseAndValidate(key) {
|
|
1181
|
-
try {
|
|
1182
|
-
if (key === "slots") {
|
|
1183
|
-
SharedLib3.slotsParser.parse(this.slots);
|
|
1184
|
-
} else if (key === "options") {
|
|
1185
|
-
SharedLib3.vizItemOptionsParser.parse(this.options);
|
|
1186
|
-
} else if (key === "canFilter") {
|
|
1187
|
-
SharedLib3.canFilterParser.parse(this.canFilter);
|
|
1188
|
-
} else if (key === "type") {
|
|
1189
|
-
SharedLib3.itemTypeParser.parse(this.type);
|
|
1190
|
-
}
|
|
1191
|
-
} catch (err) {
|
|
1192
|
-
const validationError = (0, import_zod_validation_error.fromError)(err);
|
|
1193
|
-
console.warn(err);
|
|
1194
|
-
console.warn(validationError.toString());
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
render() {
|
|
1198
|
-
return import_lit3.html` `;
|
|
1199
|
-
}
|
|
1200
|
-
};
|
|
1201
|
-
__decorateClass([
|
|
1202
|
-
(0, import_decorators3.property)()
|
|
1203
|
-
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
1204
|
-
__decorateClass([
|
|
1205
|
-
(0, import_decorators3.property)()
|
|
1206
|
-
], LuzmoBaseVizItem.prototype, "apiHost", 2);
|
|
1207
|
-
__decorateClass([
|
|
1208
|
-
(0, import_decorators3.property)({ type: Array })
|
|
1209
|
-
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
1210
|
-
__decorateClass([
|
|
1211
|
-
(0, import_decorators3.property)({ type: Object })
|
|
1212
|
-
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
1213
|
-
__decorateClass([
|
|
1214
|
-
(0, import_decorators3.property)()
|
|
1215
|
-
], LuzmoBaseVizItem.prototype, "type", 2);
|
|
1216
|
-
__decorateClass([
|
|
1217
|
-
(0, import_decorators3.property)()
|
|
1218
|
-
], LuzmoBaseVizItem.prototype, "authKey", 2);
|
|
1219
|
-
__decorateClass([
|
|
1220
|
-
(0, import_decorators3.property)()
|
|
1221
|
-
], LuzmoBaseVizItem.prototype, "authToken", 2);
|
|
1222
|
-
__decorateClass([
|
|
1223
|
-
(0, import_decorators3.property)()
|
|
1224
|
-
], LuzmoBaseVizItem.prototype, "version", 2);
|
|
1225
|
-
__decorateClass([
|
|
1226
|
-
(0, import_decorators3.property)()
|
|
1227
|
-
], LuzmoBaseVizItem.prototype, "contextId", 2);
|
|
1228
|
-
__decorateClass([
|
|
1229
|
-
(0, import_decorators3.property)({
|
|
1230
|
-
converter: (value) => {
|
|
1231
|
-
try {
|
|
1232
|
-
return JSON.parse(value);
|
|
1233
|
-
} catch (exc) {
|
|
1234
|
-
return value;
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
})
|
|
1238
|
-
], LuzmoBaseVizItem.prototype, "canFilter", 2);
|
|
1239
|
-
__decorateClass([
|
|
1240
|
-
(0, import_decorators3.property)({ type: Array })
|
|
1241
|
-
], LuzmoBaseVizItem.prototype, "filters", 2);
|
|
1242
|
-
__decorateClass([
|
|
1243
|
-
(0, import_decorators3.property)()
|
|
1244
|
-
], LuzmoBaseVizItem.prototype, "dashboardId", 2);
|
|
1245
|
-
__decorateClass([
|
|
1246
|
-
(0, import_decorators3.property)()
|
|
1247
|
-
], LuzmoBaseVizItem.prototype, "itemId", 2);
|
|
1248
|
-
__decorateClass([
|
|
1249
|
-
(0, import_decorators3.property)({ type: Object })
|
|
1250
|
-
], LuzmoBaseVizItem.prototype, "selectedData", 2);
|
|
1251
|
-
__decorateClass([
|
|
1252
|
-
(0, import_decorators3.property)()
|
|
1253
|
-
], LuzmoBaseVizItem.prototype, "libVersion", 2);
|
|
1254
|
-
|
|
1255
|
-
// libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
|
|
1256
|
-
var LuzmoEmbedVizItem = class extends LuzmoBaseVizItem {
|
|
1257
|
-
};
|
|
1258
|
-
LuzmoEmbedVizItem = __decorateClass([
|
|
1259
|
-
(0, import_decorators4.customElement)("luzmo-embed-viz-item")
|
|
1260
|
-
], LuzmoEmbedVizItem);
|
|
1261
1077
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1262
1078
|
0 && (module.exports = {
|
|
1263
|
-
LuzmoEmbedDashboard
|
|
1264
|
-
LuzmoEmbedVizItem,
|
|
1265
|
-
filterUtils
|
|
1079
|
+
LuzmoEmbedDashboard
|
|
1266
1080
|
});
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export type { LoadEvent, ChangedFiltersEvent, CustomEvent, ItemsRenderedEvent, ExportedEvent, DashboardActionEvent, Filter, FilterExpression, FilterOrigin, FilterInput, FilterGroup, ExportType, ItemData, ExportDashboard, AccessibleDashboard, SetEditMode
|
|
2
|
-
export { filterUtils } from '@luzmo/shared-embed';
|
|
1
|
+
export type { LoadEvent, ChangedFiltersEvent, CustomEvent, ItemsRenderedEvent, ExportedEvent, DashboardActionEvent, Filter, FilterExpression, FilterOrigin, FilterInput, FilterGroup, ExportType, ItemData, ExportDashboard, AccessibleDashboard, SetEditMode } from '@luzmo/shared-embed';
|
|
3
2
|
export * from './lib/dashboard-component/dashboard-component';
|
|
4
|
-
export * from './lib/viz-item/viz-item-component';
|