@luzmo/embed 5.0.4 → 5.0.6
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 +41 -0
- package/MIGRATIONS.md +1 -0
- package/README.md +25 -0
- package/index.cjs +1051 -0
- package/index.js +274 -2091
- package/lib/dashboard-component/dashboard-component.d.ts +5 -3
- package/lib/models/filters.model.d.ts +6 -0
- package/luzmo-embed.min.js +159 -2716
- package/package.json +4 -3
- package/src/index.d.ts +1 -0
- package/src/lib/dashboard-component/dashboard-component.d.ts +91 -0
- package/src/lib/dashboard-component/dashboard-styles.d.ts +1 -0
- package/src/lib/helper/event-bus-handler.d.ts +1 -0
- package/src/lib/luzmo-service.d.ts +6 -0
- package/index.mjs +0 -2849
- package/index.umd.js +0 -2852
package/index.js
CHANGED
|
@@ -1,1883 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
if (typeof (parameters == null ? void 0 : parameters.container) === "string") {
|
|
13
|
-
message += ` in container ${parameters.container}`;
|
|
14
|
-
}
|
|
15
|
-
if (errorMessage) {
|
|
16
|
-
message += `:
|
|
17
|
-
${errorMessage}`;
|
|
18
|
-
console.error(message);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const _browserCheck = (dashboardComponent) => {
|
|
22
|
-
let hasError = false;
|
|
23
|
-
let errorMessage = "";
|
|
24
|
-
const document_ = document.body || document.documentElement;
|
|
25
|
-
const style = document_.style;
|
|
26
|
-
const browserCheck = {
|
|
27
|
-
svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
|
|
28
|
-
flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
|
|
29
|
-
postMessage: !!window.postMessage
|
|
30
|
-
};
|
|
31
|
-
const browserCheckKeys = ["svg", "flexbox", "postMessage"];
|
|
32
|
-
for (const key of browserCheckKeys) {
|
|
33
|
-
if (!browserCheck[key]) {
|
|
34
|
-
hasError = true;
|
|
35
|
-
dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
|
|
36
|
-
dashboardComponent.browserNotSupported.push(key);
|
|
37
|
-
errorMessage += `Your browser does not support: ${key}
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const ua = window.navigator.userAgent;
|
|
42
|
-
const msie = ua.includes("MSIE");
|
|
43
|
-
const trident = ua.includes("Trident/");
|
|
44
|
-
if (msie || trident) {
|
|
45
|
-
hasError = true;
|
|
46
|
-
errorMessage = "IE is not supported.";
|
|
47
|
-
}
|
|
48
|
-
if (hasError) {
|
|
49
|
-
_handleError(errorMessage);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const DEFAULT_PARAMETERS = {
|
|
53
|
-
appServer: "https://app.luzmo.com/",
|
|
54
|
-
apiHost: "https://api.luzmo.com/",
|
|
55
|
-
dashboardId: null,
|
|
56
|
-
dashboardSlug: null,
|
|
57
|
-
container: null,
|
|
58
|
-
key: null,
|
|
59
|
-
token: null,
|
|
60
|
-
language: "auto",
|
|
61
|
-
qeVersion: null,
|
|
62
|
-
editMode: null,
|
|
63
|
-
screenMode: null,
|
|
64
|
-
switchScreenModeOnResize: true,
|
|
65
|
-
itemId: null,
|
|
66
|
-
mainColor: "",
|
|
67
|
-
accentColor: "",
|
|
68
|
-
itemDimensions: {
|
|
69
|
-
width: "auto",
|
|
70
|
-
height: "auto"
|
|
71
|
-
},
|
|
72
|
-
loaderBackground: "#f9f9f9",
|
|
73
|
-
loaderFontColor: "#5a5a5a",
|
|
74
|
-
loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
|
|
75
|
-
loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
|
|
76
|
-
timezoneId: null
|
|
77
|
-
};
|
|
78
|
-
const EXTENTS = [
|
|
79
|
-
{ mode: "mobile", width: [150, 767] },
|
|
80
|
-
{ mode: "tablet", width: [768, 1199] },
|
|
81
|
-
{ mode: "desktop", width: [1200, 1599] },
|
|
82
|
-
{ mode: "largeScreen", width: [1600, 9999] },
|
|
83
|
-
{ mode: "fixed", width: [] }
|
|
84
|
-
];
|
|
85
|
-
const TRANSLATIONS = {
|
|
86
|
-
initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
|
|
87
|
-
errorDashboard: {
|
|
88
|
-
en: "Oops, we could not load this dashboard!",
|
|
89
|
-
nl: "Oeps, we konden het dashboard niet laden.",
|
|
90
|
-
fr: "Le chargement a echoué."
|
|
91
|
-
},
|
|
92
|
-
errorItem: {
|
|
93
|
-
en: "Oops, we could not load this item!",
|
|
94
|
-
nl: "Oeps, we konden de grafiek niet laden.",
|
|
95
|
-
fr: "Le chargement a echoué."
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const addTrailingSlash = (serverUrl) => {
|
|
99
|
-
if (!serverUrl) {
|
|
100
|
-
return "";
|
|
101
|
-
}
|
|
102
|
-
return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
|
|
103
|
-
};
|
|
104
|
-
const removeTrailingSlash = (serverUrl) => {
|
|
105
|
-
if (!serverUrl) {
|
|
106
|
-
return "";
|
|
107
|
-
}
|
|
108
|
-
return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
|
|
109
|
-
};
|
|
110
|
-
const formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
|
|
111
|
-
var _a2;
|
|
112
|
-
const combineRights = (securable, user2) => {
|
|
113
|
-
var _a3;
|
|
114
|
-
const matchingUser = securable.users.find((u2) => u2.id === user2.id);
|
|
115
|
-
const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
|
|
116
|
-
flagRead: matchingUser.userAccessRight.flagRead,
|
|
117
|
-
flagUse: matchingUser.userAccessRight.flagUse,
|
|
118
|
-
flagModify: matchingUser.userAccessRight.flagModify,
|
|
119
|
-
flagOwn: matchingUser.userAccessRight.flagOwn
|
|
120
|
-
} : {
|
|
121
|
-
flagRead: false,
|
|
122
|
-
flagUse: false,
|
|
123
|
-
flagModify: false,
|
|
124
|
-
flagOwn: false
|
|
125
|
-
};
|
|
126
|
-
const groups = securable.groups.filter(
|
|
127
|
-
(group) => user2.userGroups.includes(group.id) || group.public === true
|
|
128
|
-
);
|
|
129
|
-
const groupsAccess = groups.map((group) => {
|
|
130
|
-
if (group.groupAccessRight) {
|
|
131
|
-
return group.groupAccessRight;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
for (const groupAccess of groupsAccess) {
|
|
135
|
-
if (!securableAccessRights.flagRead && groupAccess.flagRead) {
|
|
136
|
-
securableAccessRights.flagRead = groupAccess.flagRead;
|
|
137
|
-
}
|
|
138
|
-
if (!securableAccessRights.flagUse && groupAccess.flagUse) {
|
|
139
|
-
securableAccessRights.flagUse = groupAccess.flagUse;
|
|
140
|
-
}
|
|
141
|
-
if (!securableAccessRights.flagModify && groupAccess.flagModify) {
|
|
142
|
-
securableAccessRights.flagModify = groupAccess.flagModify;
|
|
143
|
-
}
|
|
144
|
-
if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
|
|
145
|
-
securableAccessRights.flagOwn = groupAccess.flagOwn;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const integrationsAccess = ((_a3 = securable.integrations) == null ? void 0 : _a3.length) > 0 ? securable.integrations.map((integration) => {
|
|
149
|
-
if (integration.integrationAccessRight) {
|
|
150
|
-
return integration.integrationAccessRight;
|
|
151
|
-
}
|
|
152
|
-
}) : [];
|
|
153
|
-
for (const integrationAccess of integrationsAccess) {
|
|
154
|
-
if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
|
|
155
|
-
securableAccessRights.flagRead = integrationAccess.flagRead;
|
|
156
|
-
}
|
|
157
|
-
if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
|
|
158
|
-
securableAccessRights.flagUse = integrationAccess.flagUse;
|
|
159
|
-
}
|
|
160
|
-
if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
|
|
161
|
-
securableAccessRights.flagModify = integrationAccess.flagModify;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return securableAccessRights;
|
|
165
|
-
};
|
|
166
|
-
const localize = (item, locale) => {
|
|
167
|
-
if (item === null || item === void 0) {
|
|
168
|
-
return "";
|
|
169
|
-
}
|
|
170
|
-
if (typeof item !== "object" || Object.keys(item).length === 0) {
|
|
171
|
-
if (typeof item === "object" && Object.keys(item).length === 0) {
|
|
172
|
-
return "";
|
|
173
|
-
}
|
|
174
|
-
return item;
|
|
175
|
-
}
|
|
176
|
-
let localizedItem;
|
|
177
|
-
localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
|
|
178
|
-
if (localizedItem === void 0 || localizedItem === null) {
|
|
179
|
-
localizedItem = "";
|
|
180
|
-
}
|
|
181
|
-
return localizedItem;
|
|
182
|
-
};
|
|
183
|
-
const treatedDashboards = [];
|
|
184
|
-
for (const dashboard of dashboards) {
|
|
185
|
-
const treatedDashboard = {
|
|
186
|
-
accessibleBy: [],
|
|
187
|
-
accessRights: combineRights(dashboard, user),
|
|
188
|
-
id: dashboard.id,
|
|
189
|
-
modifiedAt: dashboard.modified_at,
|
|
190
|
-
name: localize(dashboard.name, dashboardComponent.language),
|
|
191
|
-
slug: null,
|
|
192
|
-
tags: dashboard.tags.map((t2) => t2.tag).sort((t1, t2) => t1.localeCompare(t2))
|
|
193
|
-
};
|
|
194
|
-
const currentIntegration = dashboard.integrations.find(
|
|
195
|
-
(i3) => i3.id === integrationId
|
|
196
|
-
);
|
|
197
|
-
if ((_a2 = currentIntegration == null ? void 0 : currentIntegration.integrationAccessRight) == null ? void 0 : _a2.slug) {
|
|
198
|
-
treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
|
|
199
|
-
}
|
|
200
|
-
const users = dashboard.users.map((u2) => ({
|
|
201
|
-
model: "User",
|
|
202
|
-
id: u2.id,
|
|
203
|
-
name: localize(u2.name, user.locale_id)
|
|
204
|
-
}));
|
|
205
|
-
const groups = dashboard.groups.map((g2) => ({
|
|
206
|
-
model: "Group",
|
|
207
|
-
id: g2.id,
|
|
208
|
-
name: localize(g2.name, user.locale_id) || {}
|
|
209
|
-
}));
|
|
210
|
-
const integrations = dashboard.integrations.map((i3) => ({
|
|
211
|
-
model: "Integration",
|
|
212
|
-
id: i3.id,
|
|
213
|
-
name: localize(i3.name, user.locale_id) || {}
|
|
214
|
-
}));
|
|
215
|
-
treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
|
|
216
|
-
treatedDashboards.push(treatedDashboard);
|
|
217
|
-
}
|
|
218
|
-
return treatedDashboards;
|
|
219
|
-
};
|
|
220
|
-
const VERSION = "0.0.0-shared-luzmo";
|
|
221
|
-
const sanitizeUrl = (url) => {
|
|
222
|
-
const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
|
|
223
|
-
const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
|
|
224
|
-
const urlSchemeRegex = /^([^:]+):/gm;
|
|
225
|
-
const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
|
|
226
|
-
const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
|
|
227
|
-
if (!url) {
|
|
228
|
-
return "about:blank";
|
|
229
|
-
}
|
|
230
|
-
const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
|
|
231
|
-
if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
|
|
232
|
-
return sanitizedUrl;
|
|
233
|
-
}
|
|
234
|
-
const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
|
|
235
|
-
if (!urlSchemeParseResults) {
|
|
236
|
-
return sanitizedUrl;
|
|
237
|
-
}
|
|
238
|
-
const urlScheme = urlSchemeParseResults[0];
|
|
239
|
-
if (invalidPrototcolRegex.test(urlScheme)) {
|
|
240
|
-
return "about:blank";
|
|
241
|
-
}
|
|
242
|
-
return sanitizedUrl;
|
|
243
|
-
};
|
|
244
|
-
const cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
|
|
245
|
-
const isObject = (o2) => o2 && typeof o2 === "object";
|
|
246
|
-
const defaultsDeep = (target, defaults) => {
|
|
247
|
-
Object.entries(defaults).forEach(([k2, v2]) => {
|
|
248
|
-
if (k2 in target) {
|
|
249
|
-
if (target[k2] === void 0) {
|
|
250
|
-
target[k2] = v2;
|
|
251
|
-
} else {
|
|
252
|
-
target[k2] = isObject(v2) ? defaultsDeep(
|
|
253
|
-
target[k2],
|
|
254
|
-
v2
|
|
255
|
-
) : target[k2];
|
|
256
|
-
}
|
|
257
|
-
} else {
|
|
258
|
-
target[k2] = v2;
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
return target;
|
|
262
|
-
};
|
|
263
|
-
const uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c2) {
|
|
264
|
-
const r2 = Math.random() * 16 | 0;
|
|
265
|
-
const v2 = c2 == "x" ? r2 : r2 & 3 | 8;
|
|
266
|
-
return v2.toString(16);
|
|
267
|
-
});
|
|
268
|
-
const createIframeUrl = (dashboardContent) => {
|
|
269
|
-
const searchString = [];
|
|
270
|
-
const {
|
|
271
|
-
appServer,
|
|
272
|
-
language,
|
|
273
|
-
qeVersion,
|
|
274
|
-
loaderBackground,
|
|
275
|
-
loaderSpinnerColor,
|
|
276
|
-
loaderSpinnerBackground,
|
|
277
|
-
loaderFontColor,
|
|
278
|
-
screenMode,
|
|
279
|
-
key,
|
|
280
|
-
token,
|
|
281
|
-
timezoneId,
|
|
282
|
-
itemEmbedding,
|
|
283
|
-
itemDimensions,
|
|
284
|
-
dashboardId,
|
|
285
|
-
dashboardSlug,
|
|
286
|
-
itemId,
|
|
287
|
-
mainColor,
|
|
288
|
-
accentColor,
|
|
289
|
-
editMode
|
|
290
|
-
} = dashboardContent.params;
|
|
291
|
-
if (language && language !== "auto") {
|
|
292
|
-
searchString.push("language=" + language);
|
|
293
|
-
}
|
|
294
|
-
if (qeVersion) {
|
|
295
|
-
searchString.push(`qe_version=${qeVersion}`);
|
|
296
|
-
}
|
|
297
|
-
if (loaderBackground) {
|
|
298
|
-
searchString.push(`ldrbg=${loaderBackground}`);
|
|
299
|
-
}
|
|
300
|
-
if (loaderFontColor) {
|
|
301
|
-
searchString.push(`ldrftclr=${loaderFontColor}`);
|
|
302
|
-
}
|
|
303
|
-
if (loaderSpinnerColor) {
|
|
304
|
-
searchString.push(`ldrspclr=${loaderSpinnerColor}`);
|
|
305
|
-
}
|
|
306
|
-
if (loaderSpinnerBackground) {
|
|
307
|
-
searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
|
|
308
|
-
}
|
|
309
|
-
if (mainColor) {
|
|
310
|
-
searchString.push(`mainColor=${mainColor}`);
|
|
311
|
-
}
|
|
312
|
-
if (accentColor) {
|
|
313
|
-
searchString.push(`accentColor=${accentColor}`);
|
|
314
|
-
}
|
|
315
|
-
if (screenMode && screenMode !== "auto") {
|
|
316
|
-
searchString.push("screenMode=" + screenMode);
|
|
317
|
-
}
|
|
318
|
-
if (timezoneId) {
|
|
319
|
-
searchString.push("timezoneId=" + timezoneId);
|
|
320
|
-
}
|
|
321
|
-
if (itemEmbedding && itemDimensions && itemDimensions.width) {
|
|
322
|
-
searchString.push("width=" + itemDimensions.width);
|
|
323
|
-
}
|
|
324
|
-
if (itemEmbedding && itemDimensions && itemDimensions.height) {
|
|
325
|
-
searchString.push("height=" + itemDimensions.height);
|
|
326
|
-
}
|
|
327
|
-
if (editMode) {
|
|
328
|
-
searchString.push("editMode=" + editMode);
|
|
329
|
-
}
|
|
330
|
-
const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
|
|
331
|
-
searchString.push("version=" + (dashboardContent.VERSION || VERSION));
|
|
332
|
-
const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
|
|
333
|
-
searchString.join("&")
|
|
334
|
-
)}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
|
|
335
|
-
searchString.join("&")
|
|
336
|
-
)}${keyTokenUrlAnchor}`;
|
|
337
|
-
return sanitizeUrl(iframeUrl);
|
|
338
|
-
};
|
|
339
|
-
const getLoader = (dashboardComponent) => {
|
|
340
|
-
let errorMsg;
|
|
341
|
-
if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
|
|
342
|
-
dashboardComponent.params.error = true;
|
|
343
|
-
if (dashboardComponent.browserNotSupported) {
|
|
344
|
-
errorMsg = "Browser is not supported.";
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
const loadingMsg = TRANSLATIONS.initializing[dashboardComponent.params.language] || TRANSLATIONS.initializing.en;
|
|
348
|
-
return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
|
|
349
|
-
};
|
|
350
|
-
function resolvePromise(dashboardComponent, requestId, data) {
|
|
351
|
-
if (dashboardComponent.promises[requestId]) {
|
|
352
|
-
dashboardComponent.promises[requestId].resolve(data);
|
|
353
|
-
delete dashboardComponent.promises[requestId];
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
function rejectPromise(dashboardComponent, requestId, data) {
|
|
357
|
-
if (dashboardComponent.promises[requestId]) {
|
|
358
|
-
dashboardComponent.promises[requestId].reject(data);
|
|
359
|
-
delete dashboardComponent.promises[requestId];
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
function containerStyles(dashboardComponent) {
|
|
363
|
-
const styles = {
|
|
364
|
-
width: "100%",
|
|
365
|
-
height: "100%"
|
|
366
|
-
};
|
|
367
|
-
if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
|
|
368
|
-
styles.background = dashboardComponent.params.loaderBackground;
|
|
369
|
-
}
|
|
370
|
-
return styles;
|
|
371
|
-
}
|
|
372
|
-
function containerLoaderStyles(dashboardComponent) {
|
|
373
|
-
var _a2;
|
|
374
|
-
const height = ((_a2 = dashboardComponent.params.itemDimensions) == null ? void 0 : _a2.height) || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
375
|
-
const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
|
|
376
|
-
const display = dashboardComponent.iframeLoaded ? "none" : "";
|
|
377
|
-
return {
|
|
378
|
-
display,
|
|
379
|
-
height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
function loaderStyles(dashboardComponent) {
|
|
383
|
-
var _a2, _b;
|
|
384
|
-
const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
|
|
385
|
-
if (dashboardComponent.params.itemEmbedding) {
|
|
386
|
-
dashboardComponent.loaderSize = 24;
|
|
387
|
-
dashboardComponent.borderWidth = 4;
|
|
388
|
-
dashboardComponent.minHeight = 200;
|
|
389
|
-
const width = ((_a2 = dashboardComponent.params.itemDimensions) == null ? void 0 : _a2.width) || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
390
|
-
const height = ((_b = dashboardComponent.params.itemDimensions) == null ? void 0 : _b.height) || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
391
|
-
const chartWidthDefined = width !== "auto";
|
|
392
|
-
const chartHeightDefined = height !== "auto";
|
|
393
|
-
return {
|
|
394
|
-
background,
|
|
395
|
-
width: chartWidthDefined ? `${width}px` : "100%",
|
|
396
|
-
height: `${chartHeightDefined ? height : "200"}px`,
|
|
397
|
-
"min-height": chartHeightDefined ? "" : "200px"
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
return {
|
|
401
|
-
background
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
function plStyles(dashboardComponent) {
|
|
405
|
-
const {
|
|
406
|
-
loaderSpinnerColor: defaultSpinnerColor,
|
|
407
|
-
loaderSpinnerBackground: defaultSpinnerBackground
|
|
408
|
-
} = DEFAULT_PARAMETERS;
|
|
409
|
-
const spinnerColorBorder = generateBorderStyle(
|
|
410
|
-
dashboardComponent.borderWidth,
|
|
411
|
-
dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
|
|
412
|
-
);
|
|
413
|
-
const spinnerBackgroundBorder = generateBorderStyle(
|
|
414
|
-
dashboardComponent.borderWidth,
|
|
415
|
-
dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
|
|
416
|
-
);
|
|
417
|
-
const size = `${dashboardComponent.loaderSize}px`;
|
|
418
|
-
return {
|
|
419
|
-
"border-top": spinnerColorBorder,
|
|
420
|
-
"border-right": spinnerColorBorder,
|
|
421
|
-
"border-bottom": spinnerBackgroundBorder,
|
|
422
|
-
"border-left": spinnerBackgroundBorder,
|
|
423
|
-
width: size,
|
|
424
|
-
height: size
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
function lcStyles(dashboardComponent) {
|
|
428
|
-
var _a2;
|
|
429
|
-
const height = ((_a2 = dashboardComponent.params.itemDimensions) == null ? void 0 : _a2.height) || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
430
|
-
const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
|
|
431
|
-
const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
|
|
432
|
-
const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
|
|
433
|
-
return {
|
|
434
|
-
padding: `${verticalPadding} 16px`
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
function calculateIframeStyles(dashboardComponent) {
|
|
438
|
-
var _a2, _b;
|
|
439
|
-
const height = ((_a2 = dashboardComponent.params.itemDimensions) == null ? void 0 : _a2.height) || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
440
|
-
const width = ((_b = dashboardComponent.params.itemDimensions) == null ? void 0 : _b.width) || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
441
|
-
if (dashboardComponent.params.itemEmbedding && height !== "auto") {
|
|
442
|
-
dashboardComponent.iframeHeight = `${height}px`;
|
|
443
|
-
} else if (dashboardComponent.params.itemEmbedding) {
|
|
444
|
-
dashboardComponent.iframeHeight = "200px";
|
|
445
|
-
} else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
|
|
446
|
-
dashboardComponent.iframeHeight = "100%";
|
|
447
|
-
} else {
|
|
448
|
-
dashboardComponent.iframeHeight = "400px";
|
|
449
|
-
}
|
|
450
|
-
dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
|
|
451
|
-
const styles = {
|
|
452
|
-
height: dashboardComponent.iframeHeight,
|
|
453
|
-
width: dashboardComponent.iframeWidth
|
|
454
|
-
};
|
|
455
|
-
if (dashboardComponent.iframeLoaded) {
|
|
456
|
-
styles.opacity = 1;
|
|
457
|
-
} else if (dashboardComponent.error) {
|
|
458
|
-
styles.opacity = 1;
|
|
459
|
-
styles.width = "100%";
|
|
460
|
-
styles.height = "400px";
|
|
461
|
-
} else {
|
|
462
|
-
styles.opacity = 0;
|
|
463
|
-
}
|
|
464
|
-
return styles;
|
|
465
|
-
}
|
|
466
|
-
function generateBorderStyle(borderWidth, color) {
|
|
467
|
-
return `${borderWidth}px solid ${color}`;
|
|
468
|
-
}
|
|
469
|
-
const updateIframeUrl = (iframe, iframeUrl) => {
|
|
470
|
-
if (iframe == null ? void 0 : iframe.contentWindow) {
|
|
471
|
-
iframe.contentWindow.location.replace(iframeUrl);
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
const remotesMap = {
|
|
475
|
-
// "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
|
|
476
|
-
};
|
|
477
|
-
const loadJS = async (url, fn) => {
|
|
478
|
-
const resolvedUrl = typeof url === "function" ? await url() : url;
|
|
479
|
-
const script = document.createElement("script");
|
|
480
|
-
script.type = "text/javascript";
|
|
481
|
-
script.onload = fn;
|
|
482
|
-
script.src = resolvedUrl;
|
|
483
|
-
document.getElementsByTagName("head")[0].appendChild(script);
|
|
484
|
-
};
|
|
485
|
-
const wrapShareModule = (remoteFrom) => {
|
|
486
|
-
return {};
|
|
487
|
-
};
|
|
488
|
-
async function __federation_method_ensure(remoteId) {
|
|
489
|
-
const remote = remotesMap[remoteId];
|
|
490
|
-
if (!remote.inited) {
|
|
491
|
-
if ("var" === remote.format) {
|
|
492
|
-
return new Promise((resolve) => {
|
|
493
|
-
const callback = () => {
|
|
494
|
-
if (!remote.inited) {
|
|
495
|
-
remote.lib = window[remoteId];
|
|
496
|
-
remote.lib.init(wrapShareModule(remote.from));
|
|
497
|
-
remote.inited = true;
|
|
498
|
-
}
|
|
499
|
-
resolve(remote.lib);
|
|
500
|
-
};
|
|
501
|
-
return loadJS(remote.url, callback);
|
|
502
|
-
});
|
|
503
|
-
} else if (["esm", "systemjs"].includes(remote.format)) {
|
|
504
|
-
return new Promise((resolve, reject) => {
|
|
505
|
-
const getUrl = typeof remote.url === "function" ? remote.url : () => Promise.resolve(remote.url);
|
|
506
|
-
getUrl().then((url) => {
|
|
507
|
-
import(
|
|
508
|
-
/* @vite-ignore */
|
|
509
|
-
url
|
|
510
|
-
).then((lib) => {
|
|
511
|
-
if (!remote.inited) {
|
|
512
|
-
const shareScope = wrapShareModule(remote.from);
|
|
513
|
-
lib.init(shareScope);
|
|
514
|
-
remote.lib = lib;
|
|
515
|
-
remote.lib.init(shareScope);
|
|
516
|
-
remote.inited = true;
|
|
517
|
-
}
|
|
518
|
-
resolve(remote.lib);
|
|
519
|
-
}).catch(reject);
|
|
520
|
-
});
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
} else {
|
|
524
|
-
return remote.lib;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
function __federation_method_wrapDefault(module2, need) {
|
|
528
|
-
if (!(module2 == null ? void 0 : module2.default) && need) {
|
|
529
|
-
let obj = /* @__PURE__ */ Object.create(null);
|
|
530
|
-
obj.default = module2;
|
|
531
|
-
obj.__esModule = true;
|
|
532
|
-
return obj;
|
|
533
|
-
}
|
|
534
|
-
return module2;
|
|
535
|
-
}
|
|
536
|
-
function __federation_method_getRemote(remoteName, componentName) {
|
|
537
|
-
return __federation_method_ensure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
|
|
538
|
-
}
|
|
539
|
-
const exportDashboard = (dashboardComponent, iframe, format) => {
|
|
540
|
-
const requestId = uuidv4();
|
|
541
|
-
if (iframe == null ? void 0 : iframe.contentWindow) {
|
|
542
|
-
iframe.contentWindow.postMessage(
|
|
543
|
-
{
|
|
544
|
-
action: "exportDashboard",
|
|
545
|
-
format: format || "png",
|
|
546
|
-
_version: dashboardComponent.VERSION,
|
|
547
|
-
requestId
|
|
548
|
-
},
|
|
549
|
-
"*"
|
|
550
|
-
);
|
|
551
|
-
return new Promise((resolve, reject) => {
|
|
552
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
553
|
-
setTimeout(() => {
|
|
554
|
-
if (dashboardComponent.promises[requestId]) {
|
|
555
|
-
const errorMessage = "exportDashboard request timed out.";
|
|
556
|
-
dashboardComponent.promises[requestId].reject(
|
|
557
|
-
new Error(errorMessage)
|
|
558
|
-
);
|
|
559
|
-
delete dashboardComponent.promises[requestId];
|
|
560
|
-
}
|
|
561
|
-
}, 12e5);
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
565
|
-
};
|
|
566
|
-
const getAccessibleDashboards = (dashboardComponent, iframe) => {
|
|
567
|
-
if ((dashboardComponent.dashboardId || dashboardComponent.dashboardSlug) && (iframe == null ? void 0 : iframe.contentWindow)) {
|
|
568
|
-
const requestId = uuidv4();
|
|
569
|
-
iframe.contentWindow.postMessage(
|
|
570
|
-
{
|
|
571
|
-
action: "getAccessibleDashboards",
|
|
572
|
-
_version: dashboardComponent.VERSION,
|
|
573
|
-
requestId
|
|
574
|
-
},
|
|
575
|
-
"*"
|
|
576
|
-
);
|
|
577
|
-
return new Promise((resolve, reject) => {
|
|
578
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
579
|
-
setTimeout(() => {
|
|
580
|
-
if (dashboardComponent.promises[requestId]) {
|
|
581
|
-
const errorMessage = "getAccessibleDashboards request timed out.";
|
|
582
|
-
dashboardComponent.promises[requestId].reject(
|
|
583
|
-
new Error(errorMessage)
|
|
584
|
-
);
|
|
585
|
-
delete dashboardComponent.promises[requestId];
|
|
586
|
-
}
|
|
587
|
-
}, 2e3);
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
const fetchUser = new Promise((resolve, reject) => {
|
|
591
|
-
void (() => {
|
|
592
|
-
try {
|
|
593
|
-
const responsePromise = window.fetch(
|
|
594
|
-
`${String(dashboardComponent.params.apiHost)}0.1.0/authorization`,
|
|
595
|
-
{
|
|
596
|
-
method: "POST",
|
|
597
|
-
mode: "cors",
|
|
598
|
-
cache: "no-cache",
|
|
599
|
-
headers: { "Content-Type": "application/json" },
|
|
600
|
-
redirect: "follow",
|
|
601
|
-
body: JSON.stringify({
|
|
602
|
-
action: "get",
|
|
603
|
-
version: "0.1.0",
|
|
604
|
-
key: dashboardComponent.authKey,
|
|
605
|
-
token: dashboardComponent.authToken,
|
|
606
|
-
find: {
|
|
607
|
-
where: { id: dashboardComponent.authKey },
|
|
608
|
-
attributes: ["id", "integration_id"],
|
|
609
|
-
include: [
|
|
610
|
-
{
|
|
611
|
-
model: "User",
|
|
612
|
-
attributes: ["id", "name", "locale_id"],
|
|
613
|
-
include: [{ model: "Group" }]
|
|
614
|
-
}
|
|
615
|
-
]
|
|
616
|
-
}
|
|
617
|
-
})
|
|
618
|
-
}
|
|
619
|
-
);
|
|
620
|
-
responsePromise.then((response) => response.json()).then((data) => {
|
|
621
|
-
if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user || !data.rows[0].integration_id) {
|
|
622
|
-
reject();
|
|
623
|
-
} else {
|
|
624
|
-
data.rows[0].user.userGroups = data.rows[0].user.groups.map(
|
|
625
|
-
(group) => group.id
|
|
626
|
-
);
|
|
627
|
-
delete data.rows[0].user.groups;
|
|
628
|
-
resolve({
|
|
629
|
-
integrationId: data.rows[0].integration_id,
|
|
630
|
-
user: data.rows[0].user
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
} catch (error) {
|
|
635
|
-
reject(error);
|
|
636
|
-
}
|
|
637
|
-
})();
|
|
638
|
-
});
|
|
639
|
-
return new Promise((resolve, reject) => void (() => {
|
|
640
|
-
try {
|
|
641
|
-
fetchUser.then((authorizationData) => {
|
|
642
|
-
const responsePromise = window.fetch(
|
|
643
|
-
`${String(dashboardComponent.params.apiHost)}0.1.0/securable`,
|
|
644
|
-
{
|
|
645
|
-
method: "POST",
|
|
646
|
-
mode: "cors",
|
|
647
|
-
cache: "no-cache",
|
|
648
|
-
headers: { "Content-Type": "application/json" },
|
|
649
|
-
redirect: "follow",
|
|
650
|
-
body: JSON.stringify({
|
|
651
|
-
action: "get",
|
|
652
|
-
version: "0.1.0",
|
|
653
|
-
key: dashboardComponent.authKey,
|
|
654
|
-
token: dashboardComponent.authToken,
|
|
655
|
-
find: {
|
|
656
|
-
where: { type: "dashboard", is_variant: false },
|
|
657
|
-
attributes: ["id", "name", "modified_at"],
|
|
658
|
-
order: [["modified_at", "desc"]],
|
|
659
|
-
include: [
|
|
660
|
-
{ model: "Tag", attributes: ["tag"] },
|
|
661
|
-
{ model: "User", attributes: ["id", "name"] },
|
|
662
|
-
{
|
|
663
|
-
model: "Group",
|
|
664
|
-
attributes: ["id", "name", "public"]
|
|
665
|
-
},
|
|
666
|
-
{ model: "Integration", attributes: ["id", "name"] }
|
|
667
|
-
]
|
|
668
|
-
}
|
|
669
|
-
})
|
|
670
|
-
}
|
|
671
|
-
);
|
|
672
|
-
responsePromise.then((response) => response.json()).then((data) => {
|
|
673
|
-
const dashboardList = data.rows.length > 0 ? formatDashboardList(
|
|
674
|
-
data.rows,
|
|
675
|
-
authorizationData.integrationId,
|
|
676
|
-
authorizationData.user,
|
|
677
|
-
dashboardComponent
|
|
678
|
-
) : [];
|
|
679
|
-
resolve(dashboardList);
|
|
680
|
-
});
|
|
681
|
-
}).catch((error) => {
|
|
682
|
-
reject(error);
|
|
683
|
-
});
|
|
684
|
-
} catch (error) {
|
|
685
|
-
reject(error);
|
|
686
|
-
}
|
|
687
|
-
})());
|
|
688
|
-
};
|
|
689
|
-
const getData = (dashboardComponent, iframe, itemId) => {
|
|
690
|
-
if (iframe == null ? void 0 : iframe.contentWindow) {
|
|
691
|
-
const requestId = uuidv4();
|
|
692
|
-
iframe.contentWindow.postMessage(
|
|
693
|
-
{
|
|
694
|
-
action: "getData",
|
|
695
|
-
id: itemId,
|
|
696
|
-
_version: dashboardComponent.VERSION,
|
|
697
|
-
requestId
|
|
698
|
-
},
|
|
699
|
-
"*"
|
|
700
|
-
);
|
|
701
|
-
return new Promise((resolve, reject) => {
|
|
702
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
703
|
-
setTimeout(() => {
|
|
704
|
-
if (dashboardComponent.promises[requestId]) {
|
|
705
|
-
const errorMessage = "getData request timed out.";
|
|
706
|
-
dashboardComponent.promises[requestId].reject(
|
|
707
|
-
new Error(errorMessage)
|
|
708
|
-
);
|
|
709
|
-
delete dashboardComponent.promises[requestId];
|
|
710
|
-
}
|
|
711
|
-
}, 2e3);
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
715
|
-
};
|
|
716
|
-
const getFilters = (dashboardComponent, iframe) => {
|
|
717
|
-
if (iframe == null ? void 0 : iframe.contentWindow) {
|
|
718
|
-
const requestId = uuidv4();
|
|
719
|
-
iframe.contentWindow.postMessage(
|
|
720
|
-
{ action: "getFilters", _version: dashboardComponent.VERSION, requestId },
|
|
721
|
-
"*"
|
|
722
|
-
);
|
|
723
|
-
return new Promise((resolve, reject) => {
|
|
724
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
725
|
-
setTimeout(() => {
|
|
726
|
-
if (dashboardComponent.promises[requestId]) {
|
|
727
|
-
const errorMessage = "getFilters request timed out.";
|
|
728
|
-
dashboardComponent.promises[requestId].reject(
|
|
729
|
-
new Error(errorMessage)
|
|
730
|
-
);
|
|
731
|
-
delete dashboardComponent.promises[requestId];
|
|
732
|
-
}
|
|
733
|
-
}, 2e3);
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
737
|
-
};
|
|
738
|
-
const refreshData = (dashboardComponent, iframe, itemId) => {
|
|
739
|
-
if (iframe) {
|
|
740
|
-
iframe.contentWindow.postMessage(
|
|
741
|
-
{
|
|
742
|
-
action: "refreshData",
|
|
743
|
-
id: itemId ?? null,
|
|
744
|
-
_version: dashboardComponent.VERSION
|
|
745
|
-
},
|
|
746
|
-
"*"
|
|
747
|
-
);
|
|
748
|
-
return Promise.resolve();
|
|
749
|
-
}
|
|
750
|
-
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
751
|
-
};
|
|
752
|
-
const reloadDashboard = (dashboardComponent, iframe) => {
|
|
753
|
-
if (iframe) {
|
|
754
|
-
iframe.contentWindow.postMessage(
|
|
755
|
-
{ action: "reloadDashboard", _version: dashboardComponent.VERSION },
|
|
756
|
-
"*"
|
|
757
|
-
);
|
|
758
|
-
return Promise.resolve();
|
|
759
|
-
}
|
|
760
|
-
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
761
|
-
};
|
|
762
|
-
const setAuthorization = (dashboardComponent, iframe, key, token) => {
|
|
763
|
-
if (iframe) {
|
|
764
|
-
iframe.contentWindow.postMessage(
|
|
765
|
-
{
|
|
766
|
-
action: "setAuthorization",
|
|
767
|
-
key,
|
|
768
|
-
token,
|
|
769
|
-
_version: dashboardComponent.VERSION
|
|
770
|
-
},
|
|
771
|
-
"*"
|
|
772
|
-
);
|
|
773
|
-
return Promise.resolve();
|
|
774
|
-
}
|
|
775
|
-
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
776
|
-
};
|
|
777
|
-
const setEditMode = (dashboardComponent, iframe, editMode) => {
|
|
778
|
-
if (iframe && iframe.contentWindow) {
|
|
779
|
-
const requestId = uuidv4();
|
|
780
|
-
if (dashboardComponent.params.editMode === editMode) {
|
|
781
|
-
return Promise.reject(
|
|
782
|
-
new Error("editMode parameter is currently already set to " + editMode)
|
|
783
|
-
);
|
|
784
|
-
} else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
|
|
785
|
-
return Promise.reject(
|
|
786
|
-
new Error(
|
|
787
|
-
"The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
|
|
788
|
-
)
|
|
789
|
-
);
|
|
790
|
-
}
|
|
791
|
-
iframe.contentWindow.postMessage(
|
|
792
|
-
{
|
|
793
|
-
action: "setEditMode",
|
|
794
|
-
editMode,
|
|
795
|
-
_version: dashboardComponent.VERSION,
|
|
796
|
-
requestId
|
|
797
|
-
},
|
|
798
|
-
"*"
|
|
799
|
-
);
|
|
800
|
-
return new Promise((resolve, reject) => {
|
|
801
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
805
|
-
};
|
|
806
|
-
const setFilters = (dashboardComponent, iframe, itemId, filters) => {
|
|
807
|
-
if (iframe) {
|
|
808
|
-
const requestId = uuidv4();
|
|
809
|
-
iframe.contentWindow.postMessage(
|
|
810
|
-
{
|
|
811
|
-
action: "setFilters",
|
|
812
|
-
itemId,
|
|
813
|
-
filters,
|
|
814
|
-
_version: dashboardComponent.VERSION,
|
|
815
|
-
requestId
|
|
816
|
-
},
|
|
817
|
-
"*"
|
|
818
|
-
);
|
|
819
|
-
return new Promise((resolve, reject) => {
|
|
820
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
821
|
-
setTimeout(() => {
|
|
822
|
-
if (dashboardComponent.promises[requestId]) {
|
|
823
|
-
const errorMessage = "setFilters request timed out.";
|
|
824
|
-
dashboardComponent.promises[requestId].reject(
|
|
825
|
-
new Error(errorMessage)
|
|
826
|
-
);
|
|
827
|
-
delete dashboardComponent.promises[requestId];
|
|
828
|
-
}
|
|
829
|
-
}, 2e3);
|
|
830
|
-
});
|
|
831
|
-
}
|
|
832
|
-
return Promise.reject();
|
|
833
|
-
};
|
|
834
|
-
const setPreview = (dashboardComponent, iframe, preview) => {
|
|
835
|
-
if (iframe) {
|
|
836
|
-
const requestId = uuidv4();
|
|
837
|
-
iframe.contentWindow.postMessage(
|
|
838
|
-
{
|
|
839
|
-
action: "setPreview",
|
|
840
|
-
preview,
|
|
841
|
-
requestId,
|
|
842
|
-
_version: dashboardComponent.VERSION
|
|
843
|
-
},
|
|
844
|
-
"*"
|
|
845
|
-
);
|
|
846
|
-
return new Promise((resolve, reject) => {
|
|
847
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
848
|
-
setTimeout(() => {
|
|
849
|
-
if (dashboardComponent.promises[requestId]) {
|
|
850
|
-
const errorMessage = "setPreview request timed out.";
|
|
851
|
-
dashboardComponent.promises[requestId].reject(
|
|
852
|
-
new Error(errorMessage)
|
|
853
|
-
);
|
|
854
|
-
delete dashboardComponent.promises[requestId];
|
|
855
|
-
}
|
|
856
|
-
}, 2e3);
|
|
857
|
-
});
|
|
858
|
-
}
|
|
859
|
-
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
860
|
-
};
|
|
861
|
-
const _setCalculatedDimensions = (dashboardComponent) => {
|
|
862
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
863
|
-
if (!dashboardComponent.dimensions) {
|
|
864
|
-
dashboardComponent.params.error = true;
|
|
865
|
-
_handleError("Got no valid dimensions.", dashboardComponent.params);
|
|
866
|
-
return;
|
|
867
|
-
}
|
|
868
|
-
const dashboardDimensionKeys = Object.keys(
|
|
869
|
-
dashboardComponent.dimensions
|
|
870
|
-
);
|
|
871
|
-
const availableScreenModeExtents = [];
|
|
872
|
-
let currentMode;
|
|
873
|
-
let currentWidth = 0;
|
|
874
|
-
let currentHeight = 0;
|
|
875
|
-
if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
|
|
876
|
-
dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
|
|
877
|
-
}
|
|
878
|
-
if (dashboardComponent.dimensions && (dashboardDimensionKeys == null ? void 0 : dashboardDimensionKeys[0]) === "fixed") {
|
|
879
|
-
currentMode = "fixed";
|
|
880
|
-
currentWidth = dashboardComponent.dimensions.fixed[0];
|
|
881
|
-
currentHeight = dashboardComponent.dimensions.fixed[1];
|
|
882
|
-
} else {
|
|
883
|
-
const screenModes = [
|
|
884
|
-
"mobile",
|
|
885
|
-
"tablet",
|
|
886
|
-
"desktop",
|
|
887
|
-
"largeScreen"
|
|
888
|
-
];
|
|
889
|
-
if (dashboardComponent.params.itemEmbedding) {
|
|
890
|
-
const [firstMatch] = dashboardDimensionKeys;
|
|
891
|
-
let match = cloneDeep(firstMatch);
|
|
892
|
-
for (const screenMode of screenModes) {
|
|
893
|
-
const found = dashboardDimensionKeys.find((key) => key === screenMode);
|
|
894
|
-
if (found) {
|
|
895
|
-
match = cloneDeep(found);
|
|
896
|
-
} else {
|
|
897
|
-
dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
for (const key of dashboardDimensionKeys) {
|
|
902
|
-
if (screenModes.includes(key)) {
|
|
903
|
-
const screenMode = EXTENTS.find((extent) => extent.mode === key);
|
|
904
|
-
availableScreenModeExtents.push({
|
|
905
|
-
...screenMode,
|
|
906
|
-
height: dashboardComponent.dimensions[key][1] || 50
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
|
|
911
|
-
dashboardComponent.params.screenMode = "auto";
|
|
912
|
-
}
|
|
913
|
-
if (dashboardComponent.params.screenMode === "auto") {
|
|
914
|
-
availableScreenModeExtents.sort(
|
|
915
|
-
(a2, b2) => screenModes.indexOf(a2.mode) - screenModes.indexOf(b2.mode)
|
|
916
|
-
);
|
|
917
|
-
for (const screenModeExtent of availableScreenModeExtents) {
|
|
918
|
-
const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
|
|
919
|
-
if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
920
|
-
if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
|
|
921
|
-
currentMode = screenModeExtent.mode;
|
|
922
|
-
currentWidth = Number.parseInt(
|
|
923
|
-
dashboardComponent.params.itemDimensions.width,
|
|
924
|
-
10
|
|
925
|
-
);
|
|
926
|
-
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
927
|
-
}
|
|
928
|
-
} else {
|
|
929
|
-
if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
|
|
930
|
-
currentMode = screenModeExtent.mode;
|
|
931
|
-
if (dashboardComponent.params.itemEmbedding) {
|
|
932
|
-
currentWidth = ((_a2 = dashboardComponent.params.itemDimensions) == null ? void 0 : _a2.width) && ((_b = dashboardComponent.params.itemDimensions) == null ? void 0 : _b.width) !== "auto" ? Number.parseInt(
|
|
933
|
-
dashboardComponent.params.itemDimensions.width,
|
|
934
|
-
10
|
|
935
|
-
) : Math.min(
|
|
936
|
-
dashboardComponent.containerWidth,
|
|
937
|
-
screenModeExtentMaxWidth
|
|
938
|
-
);
|
|
939
|
-
currentHeight = ((_c = dashboardComponent.params.itemDimensions) == null ? void 0 : _c.height) && ((_d = dashboardComponent.params.itemDimensions) == null ? void 0 : _d.height) !== "auto" ? Number.parseInt(
|
|
940
|
-
dashboardComponent.params.itemDimensions.height,
|
|
941
|
-
10
|
|
942
|
-
) : dashboardComponent.dimensions[currentMode][1];
|
|
943
|
-
if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
|
|
944
|
-
currentWidth = Number.parseInt(
|
|
945
|
-
dashboardComponent.params.itemDimensions.width,
|
|
946
|
-
10
|
|
947
|
-
);
|
|
948
|
-
currentHeight = dashboardComponent.dimensions[currentMode][1];
|
|
949
|
-
}
|
|
950
|
-
} else {
|
|
951
|
-
currentWidth = Math.max(
|
|
952
|
-
Math.min(
|
|
953
|
-
screenModeExtentMaxWidth,
|
|
954
|
-
dashboardComponent.containerWidth
|
|
955
|
-
),
|
|
956
|
-
screenModeExtentMinWidth
|
|
957
|
-
);
|
|
958
|
-
currentHeight = screenModeExtent.height;
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
} else {
|
|
964
|
-
const {
|
|
965
|
-
height: chosenModeHeight,
|
|
966
|
-
width: [chosenModeMinWidth, chosenModeMaxWidth]
|
|
967
|
-
} = availableScreenModeExtents.find(
|
|
968
|
-
(d2) => d2.mode === dashboardComponent.params.screenMode
|
|
969
|
-
);
|
|
970
|
-
currentMode = dashboardComponent.params.screenMode;
|
|
971
|
-
currentWidth = Math.max(
|
|
972
|
-
Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
|
|
973
|
-
chosenModeMinWidth
|
|
974
|
-
);
|
|
975
|
-
currentHeight = chosenModeHeight;
|
|
976
|
-
if (dashboardComponent.params.itemEmbedding) {
|
|
977
|
-
if (((_e = dashboardComponent.params.itemDimensions) == null ? void 0 : _e.width) && ((_f = dashboardComponent.params.itemDimensions) == null ? void 0 : _f.width) !== "auto") {
|
|
978
|
-
currentWidth = Number.parseInt(
|
|
979
|
-
dashboardComponent.params.itemDimensions.width,
|
|
980
|
-
10
|
|
981
|
-
);
|
|
982
|
-
}
|
|
983
|
-
if (((_g = dashboardComponent.params.itemDimensions) == null ? void 0 : _g.height) && ((_h = dashboardComponent.params.itemDimensions) == null ? void 0 : _h.height) !== "auto") {
|
|
984
|
-
currentHeight = Number.parseInt(
|
|
985
|
-
dashboardComponent.params.itemDimensions.height,
|
|
986
|
-
10
|
|
987
|
-
);
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
if (!currentMode && availableScreenModeExtents.length > 0) {
|
|
992
|
-
const [lowestModeExtent] = availableScreenModeExtents;
|
|
993
|
-
currentMode = lowestModeExtent.mode;
|
|
994
|
-
currentWidth = lowestModeExtent.width[0];
|
|
995
|
-
currentHeight = lowestModeExtent.height;
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
dashboardComponent.currentScreenMode = currentMode;
|
|
999
|
-
const style = {
|
|
1000
|
-
height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
|
|
1001
|
-
width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
|
|
1002
|
-
opacity: 1
|
|
1003
|
-
};
|
|
1004
|
-
const dashboardEditModes = ["editFull", "editLimited"];
|
|
1005
|
-
if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
|
|
1006
|
-
style.height = "100%";
|
|
1007
|
-
style.width = "100%";
|
|
1008
|
-
} else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
|
|
1009
|
-
style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
|
|
1010
|
-
"px",
|
|
1011
|
-
""
|
|
1012
|
-
)}px`;
|
|
1013
|
-
style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
|
|
1014
|
-
"px",
|
|
1015
|
-
""
|
|
1016
|
-
)}px`;
|
|
1017
|
-
} else {
|
|
1018
|
-
style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
|
|
1019
|
-
style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
|
|
1020
|
-
}
|
|
1021
|
-
dashboardComponent.currentScreenMode = currentMode;
|
|
1022
|
-
dashboardComponent.iframeStyle = style;
|
|
1023
|
-
};
|
|
1024
|
-
const _extendAndValidate = (dashboardContent) => {
|
|
1025
|
-
const defaultKeys = Object.keys(
|
|
1026
|
-
DEFAULT_PARAMETERS
|
|
1027
|
-
);
|
|
1028
|
-
const errorMessages = [];
|
|
1029
|
-
const requiredStringParams = [
|
|
1030
|
-
"appServer",
|
|
1031
|
-
"language",
|
|
1032
|
-
"apiHost"
|
|
1033
|
-
];
|
|
1034
|
-
const requiredStringOrEmptyParams = [
|
|
1035
|
-
"key",
|
|
1036
|
-
"token",
|
|
1037
|
-
"screenMode",
|
|
1038
|
-
"timezoneId",
|
|
1039
|
-
"itemId",
|
|
1040
|
-
"container",
|
|
1041
|
-
"loaderBackground",
|
|
1042
|
-
"loaderFontColor",
|
|
1043
|
-
"loaderSpinnerColor",
|
|
1044
|
-
"loaderSpinnerBackground"
|
|
1045
|
-
];
|
|
1046
|
-
const objectParams = ["itemDimensions"];
|
|
1047
|
-
const screenModes = [
|
|
1048
|
-
"mobile",
|
|
1049
|
-
"tablet",
|
|
1050
|
-
"desktop",
|
|
1051
|
-
"largeScreen",
|
|
1052
|
-
"fixed",
|
|
1053
|
-
"auto"
|
|
1054
|
-
];
|
|
1055
|
-
for (const key of defaultKeys) {
|
|
1056
|
-
if (dashboardContent.params[key] === null) {
|
|
1057
|
-
delete dashboardContent.params[key];
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
dashboardContent.params = defaultsDeep(
|
|
1061
|
-
dashboardContent.params,
|
|
1062
|
-
DEFAULT_PARAMETERS
|
|
1063
|
-
);
|
|
1064
|
-
if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
|
|
1065
|
-
delete dashboardContent.params.dashboardId;
|
|
1066
|
-
delete dashboardContent.params.dashboardSlug;
|
|
1067
|
-
}
|
|
1068
|
-
for (const key of requiredStringParams) {
|
|
1069
|
-
if (typeof dashboardContent.params[key] !== "string") {
|
|
1070
|
-
delete dashboardContent.params[key];
|
|
1071
|
-
errorMessages.push(`${key} needs to be of type string.`);
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
for (const key of requiredStringOrEmptyParams) {
|
|
1075
|
-
if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
|
|
1076
|
-
delete dashboardContent.params[key];
|
|
1077
|
-
errorMessages.push(`${key} needs to be of type string or empty.`);
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
|
|
1081
|
-
const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
|
|
1082
|
-
errorMessages.push(
|
|
1083
|
-
`"screenMode" needs should be one of these types: ${validTypesString}`
|
|
1084
|
-
);
|
|
1085
|
-
dashboardContent.params.screenMode = "auto";
|
|
1086
|
-
}
|
|
1087
|
-
if (dashboardContent.params.itemId) {
|
|
1088
|
-
dashboardContent.params.itemEmbedding = true;
|
|
1089
|
-
}
|
|
1090
|
-
for (const key of objectParams) {
|
|
1091
|
-
if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
|
|
1092
|
-
delete dashboardContent.params[key];
|
|
1093
|
-
errorMessages.push(`${key} needs to be of type object or empty.`);
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
|
|
1097
|
-
errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
|
|
1098
|
-
dashboardContent.params.switchScreenModeOnResize = true;
|
|
1099
|
-
}
|
|
1100
|
-
if (dashboardContent.params.itemDimensions) {
|
|
1101
|
-
const itemDimensionsKeys = [
|
|
1102
|
-
"width",
|
|
1103
|
-
"height"
|
|
1104
|
-
];
|
|
1105
|
-
for (const key of itemDimensionsKeys) {
|
|
1106
|
-
if (!["string", "number"].includes(
|
|
1107
|
-
typeof dashboardContent.params.itemDimensions[key]
|
|
1108
|
-
) && dashboardContent.params.itemDimensions[key] !== null) {
|
|
1109
|
-
errorMessages.push(
|
|
1110
|
-
`itemDimensions ${key} needs to be of type string, number or empty.`
|
|
1111
|
-
);
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
dashboardContent.params = defaultsDeep(
|
|
1116
|
-
dashboardContent.params,
|
|
1117
|
-
DEFAULT_PARAMETERS
|
|
1118
|
-
);
|
|
1119
|
-
if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
|
|
1120
|
-
dashboardContent.params.switchScreenModeOnResize = false;
|
|
1121
|
-
}
|
|
1122
|
-
if (dashboardContent.params.itemDimensions.width !== "auto") {
|
|
1123
|
-
dashboardContent.params.itemDimensions.width = Number.parseInt(
|
|
1124
|
-
`${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
|
|
1125
|
-
10
|
|
1126
|
-
) || "auto";
|
|
1127
|
-
}
|
|
1128
|
-
if (dashboardContent.params.itemDimensions.height !== "auto") {
|
|
1129
|
-
dashboardContent.params.itemDimensions.height = Number.parseInt(
|
|
1130
|
-
`${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
|
|
1131
|
-
10
|
|
1132
|
-
) || "auto";
|
|
1133
|
-
}
|
|
1134
|
-
dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
|
|
1135
|
-
if (dashboardContent.params.error || errorMessages.length > 0) {
|
|
1136
|
-
_handleError(errorMessages.join("\n"), dashboardContent.params);
|
|
1137
|
-
}
|
|
1138
|
-
};
|
|
1139
|
-
/**
|
|
1140
|
-
* @license
|
|
1141
|
-
* Copyright 2019 Google LLC
|
|
1142
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1143
|
-
*/
|
|
1144
|
-
const t$3 = globalThis, e$5 = t$3.ShadowRoot && (void 0 === t$3.ShadyCSS || t$3.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = Symbol(), o$4 = /* @__PURE__ */ new WeakMap();
|
|
1145
|
-
let n$4 = class n {
|
|
1146
|
-
constructor(t2, e2, o2) {
|
|
1147
|
-
if (this._$cssResult$ = true, o2 !== s$2)
|
|
1148
|
-
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
1149
|
-
this.cssText = t2, this.t = e2;
|
|
1150
|
-
}
|
|
1151
|
-
get styleSheet() {
|
|
1152
|
-
let t2 = this.o;
|
|
1153
|
-
const s2 = this.t;
|
|
1154
|
-
if (e$5 && void 0 === t2) {
|
|
1155
|
-
const e2 = void 0 !== s2 && 1 === s2.length;
|
|
1156
|
-
e2 && (t2 = o$4.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$4.set(s2, t2));
|
|
1157
|
-
}
|
|
1158
|
-
return t2;
|
|
1159
|
-
}
|
|
1160
|
-
toString() {
|
|
1161
|
-
return this.cssText;
|
|
1162
|
-
}
|
|
1163
|
-
};
|
|
1164
|
-
const r$5 = (t2) => new n$4("string" == typeof t2 ? t2 : t2 + "", void 0, s$2), i$4 = (t2, ...e2) => {
|
|
1165
|
-
const o2 = 1 === t2.length ? t2[0] : e2.reduce((e3, s2, o3) => e3 + ((t3) => {
|
|
1166
|
-
if (true === t3._$cssResult$)
|
|
1167
|
-
return t3.cssText;
|
|
1168
|
-
if ("number" == typeof t3)
|
|
1169
|
-
return t3;
|
|
1170
|
-
throw Error("Value passed to 'css' function must be a 'css' function result: " + t3 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
1171
|
-
})(s2) + t2[o3 + 1], t2[0]);
|
|
1172
|
-
return new n$4(o2, t2, s$2);
|
|
1173
|
-
}, S$1 = (s2, o2) => {
|
|
1174
|
-
if (e$5)
|
|
1175
|
-
s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet);
|
|
1176
|
-
else
|
|
1177
|
-
for (const e2 of o2) {
|
|
1178
|
-
const o3 = document.createElement("style"), n3 = t$3.litNonce;
|
|
1179
|
-
void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3);
|
|
1180
|
-
}
|
|
1181
|
-
}, c$2 = e$5 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
|
|
1182
|
-
let e2 = "";
|
|
1183
|
-
for (const s2 of t3.cssRules)
|
|
1184
|
-
e2 += s2.cssText;
|
|
1185
|
-
return r$5(e2);
|
|
1186
|
-
})(t2) : t2;
|
|
1187
|
-
/**
|
|
1188
|
-
* @license
|
|
1189
|
-
* Copyright 2017 Google LLC
|
|
1190
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1191
|
-
*/
|
|
1192
|
-
const { is: i$3, defineProperty: e$4, getOwnPropertyDescriptor: r$4, getOwnPropertyNames: h$1, getOwnPropertySymbols: o$3, getPrototypeOf: n$3 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (t2, s2) => t2, u$1 = { toAttribute(t2, s2) {
|
|
1193
|
-
switch (s2) {
|
|
1194
|
-
case Boolean:
|
|
1195
|
-
t2 = t2 ? l$1 : null;
|
|
1196
|
-
break;
|
|
1197
|
-
case Object:
|
|
1198
|
-
case Array:
|
|
1199
|
-
t2 = null == t2 ? t2 : JSON.stringify(t2);
|
|
1200
|
-
}
|
|
1201
|
-
return t2;
|
|
1202
|
-
}, fromAttribute(t2, s2) {
|
|
1203
|
-
let i3 = t2;
|
|
1204
|
-
switch (s2) {
|
|
1205
|
-
case Boolean:
|
|
1206
|
-
i3 = null !== t2;
|
|
1207
|
-
break;
|
|
1208
|
-
case Number:
|
|
1209
|
-
i3 = null === t2 ? null : Number(t2);
|
|
1210
|
-
break;
|
|
1211
|
-
case Object:
|
|
1212
|
-
case Array:
|
|
1213
|
-
try {
|
|
1214
|
-
i3 = JSON.parse(t2);
|
|
1215
|
-
} catch (t3) {
|
|
1216
|
-
i3 = null;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
return i3;
|
|
1220
|
-
} }, f$1 = (t2, s2) => !i$3(t2, s2), y$1 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 };
|
|
1221
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a$1.litPropertyMetadata ?? (a$1.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
1222
|
-
class b extends HTMLElement {
|
|
1223
|
-
static addInitializer(t2) {
|
|
1224
|
-
this._$Ei(), (this.l ?? (this.l = [])).push(t2);
|
|
1225
|
-
}
|
|
1226
|
-
static get observedAttributes() {
|
|
1227
|
-
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
1228
|
-
}
|
|
1229
|
-
static createProperty(t2, s2 = y$1) {
|
|
1230
|
-
if (s2.state && (s2.attribute = false), this._$Ei(), this.elementProperties.set(t2, s2), !s2.noAccessor) {
|
|
1231
|
-
const i3 = Symbol(), r2 = this.getPropertyDescriptor(t2, i3, s2);
|
|
1232
|
-
void 0 !== r2 && e$4(this.prototype, t2, r2);
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
static getPropertyDescriptor(t2, s2, i3) {
|
|
1236
|
-
const { get: e2, set: h2 } = r$4(this.prototype, t2) ?? { get() {
|
|
1237
|
-
return this[s2];
|
|
1238
|
-
}, set(t3) {
|
|
1239
|
-
this[s2] = t3;
|
|
1240
|
-
} };
|
|
1241
|
-
return { get() {
|
|
1242
|
-
return e2 == null ? void 0 : e2.call(this);
|
|
1243
|
-
}, set(s3) {
|
|
1244
|
-
const r2 = e2 == null ? void 0 : e2.call(this);
|
|
1245
|
-
h2.call(this, s3), this.requestUpdate(t2, r2, i3);
|
|
1246
|
-
}, configurable: true, enumerable: true };
|
|
1247
|
-
}
|
|
1248
|
-
static getPropertyOptions(t2) {
|
|
1249
|
-
return this.elementProperties.get(t2) ?? y$1;
|
|
1250
|
-
}
|
|
1251
|
-
static _$Ei() {
|
|
1252
|
-
if (this.hasOwnProperty(d$1("elementProperties")))
|
|
1253
|
-
return;
|
|
1254
|
-
const t2 = n$3(this);
|
|
1255
|
-
t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties);
|
|
1256
|
-
}
|
|
1257
|
-
static finalize() {
|
|
1258
|
-
if (this.hasOwnProperty(d$1("finalized")))
|
|
1259
|
-
return;
|
|
1260
|
-
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
|
|
1261
|
-
const t3 = this.properties, s2 = [...h$1(t3), ...o$3(t3)];
|
|
1262
|
-
for (const i3 of s2)
|
|
1263
|
-
this.createProperty(i3, t3[i3]);
|
|
1264
|
-
}
|
|
1265
|
-
const t2 = this[Symbol.metadata];
|
|
1266
|
-
if (null !== t2) {
|
|
1267
|
-
const s2 = litPropertyMetadata.get(t2);
|
|
1268
|
-
if (void 0 !== s2)
|
|
1269
|
-
for (const [t3, i3] of s2)
|
|
1270
|
-
this.elementProperties.set(t3, i3);
|
|
1271
|
-
}
|
|
1272
|
-
this._$Eh = /* @__PURE__ */ new Map();
|
|
1273
|
-
for (const [t3, s2] of this.elementProperties) {
|
|
1274
|
-
const i3 = this._$Eu(t3, s2);
|
|
1275
|
-
void 0 !== i3 && this._$Eh.set(i3, t3);
|
|
1276
|
-
}
|
|
1277
|
-
this.elementStyles = this.finalizeStyles(this.styles);
|
|
1278
|
-
}
|
|
1279
|
-
static finalizeStyles(s2) {
|
|
1280
|
-
const i3 = [];
|
|
1281
|
-
if (Array.isArray(s2)) {
|
|
1282
|
-
const e2 = new Set(s2.flat(1 / 0).reverse());
|
|
1283
|
-
for (const s3 of e2)
|
|
1284
|
-
i3.unshift(c$2(s3));
|
|
1285
|
-
} else
|
|
1286
|
-
void 0 !== s2 && i3.push(c$2(s2));
|
|
1287
|
-
return i3;
|
|
1288
|
-
}
|
|
1289
|
-
static _$Eu(t2, s2) {
|
|
1290
|
-
const i3 = s2.attribute;
|
|
1291
|
-
return false === i3 ? void 0 : "string" == typeof i3 ? i3 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
|
|
1292
|
-
}
|
|
1293
|
-
constructor() {
|
|
1294
|
-
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
1295
|
-
}
|
|
1296
|
-
_$Ev() {
|
|
1297
|
-
var _a2;
|
|
1298
|
-
this._$Eg = new Promise((t2) => this.enableUpdating = t2), this._$AL = /* @__PURE__ */ new Map(), this._$ES(), this.requestUpdate(), (_a2 = this.constructor.l) == null ? void 0 : _a2.forEach((t2) => t2(this));
|
|
1299
|
-
}
|
|
1300
|
-
addController(t2) {
|
|
1301
|
-
var _a2;
|
|
1302
|
-
(this._$E_ ?? (this._$E_ = /* @__PURE__ */ new Set())).add(t2), void 0 !== this.renderRoot && this.isConnected && ((_a2 = t2.hostConnected) == null ? void 0 : _a2.call(t2));
|
|
1303
|
-
}
|
|
1304
|
-
removeController(t2) {
|
|
1305
|
-
var _a2;
|
|
1306
|
-
(_a2 = this._$E_) == null ? void 0 : _a2.delete(t2);
|
|
1307
|
-
}
|
|
1308
|
-
_$ES() {
|
|
1309
|
-
const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
|
|
1310
|
-
for (const i3 of s2.keys())
|
|
1311
|
-
this.hasOwnProperty(i3) && (t2.set(i3, this[i3]), delete this[i3]);
|
|
1312
|
-
t2.size > 0 && (this._$Ep = t2);
|
|
1313
|
-
}
|
|
1314
|
-
createRenderRoot() {
|
|
1315
|
-
const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
1316
|
-
return S$1(t2, this.constructor.elementStyles), t2;
|
|
1317
|
-
}
|
|
1318
|
-
connectedCallback() {
|
|
1319
|
-
var _a2;
|
|
1320
|
-
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t2) => {
|
|
1321
|
-
var _a3;
|
|
1322
|
-
return (_a3 = t2.hostConnected) == null ? void 0 : _a3.call(t2);
|
|
1323
|
-
});
|
|
1324
|
-
}
|
|
1325
|
-
enableUpdating(t2) {
|
|
1326
|
-
}
|
|
1327
|
-
disconnectedCallback() {
|
|
1328
|
-
var _a2;
|
|
1329
|
-
(_a2 = this._$E_) == null ? void 0 : _a2.forEach((t2) => {
|
|
1330
|
-
var _a3;
|
|
1331
|
-
return (_a3 = t2.hostDisconnected) == null ? void 0 : _a3.call(t2);
|
|
1332
|
-
});
|
|
1333
|
-
}
|
|
1334
|
-
attributeChangedCallback(t2, s2, i3) {
|
|
1335
|
-
this._$AK(t2, i3);
|
|
1336
|
-
}
|
|
1337
|
-
_$EO(t2, s2) {
|
|
1338
|
-
var _a2;
|
|
1339
|
-
const i3 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i3);
|
|
1340
|
-
if (void 0 !== e2 && true === i3.reflect) {
|
|
1341
|
-
const r2 = (void 0 !== ((_a2 = i3.converter) == null ? void 0 : _a2.toAttribute) ? i3.converter : u$1).toAttribute(s2, i3.type);
|
|
1342
|
-
this._$Em = t2, null == r2 ? this.removeAttribute(e2) : this.setAttribute(e2, r2), this._$Em = null;
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
_$AK(t2, s2) {
|
|
1346
|
-
var _a2;
|
|
1347
|
-
const i3 = this.constructor, e2 = i3._$Eh.get(t2);
|
|
1348
|
-
if (void 0 !== e2 && this._$Em !== e2) {
|
|
1349
|
-
const t3 = i3.getPropertyOptions(e2), r2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== ((_a2 = t3.converter) == null ? void 0 : _a2.fromAttribute) ? t3.converter : u$1;
|
|
1350
|
-
this._$Em = e2, this[e2] = r2.fromAttribute(s2, t3.type), this._$Em = null;
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
requestUpdate(t2, s2, i3, e2 = false, r2) {
|
|
1354
|
-
if (void 0 !== t2) {
|
|
1355
|
-
if (i3 ?? (i3 = this.constructor.getPropertyOptions(t2)), !(i3.hasChanged ?? f$1)(e2 ? r2 : this[t2], s2))
|
|
1356
|
-
return;
|
|
1357
|
-
this.C(t2, s2, i3);
|
|
1358
|
-
}
|
|
1359
|
-
false === this.isUpdatePending && (this._$Eg = this._$EP());
|
|
1360
|
-
}
|
|
1361
|
-
C(t2, s2, i3) {
|
|
1362
|
-
this._$AL.has(t2) || this._$AL.set(t2, s2), true === i3.reflect && this._$Em !== t2 && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t2);
|
|
1363
|
-
}
|
|
1364
|
-
async _$EP() {
|
|
1365
|
-
this.isUpdatePending = true;
|
|
1366
|
-
try {
|
|
1367
|
-
await this._$Eg;
|
|
1368
|
-
} catch (t3) {
|
|
1369
|
-
Promise.reject(t3);
|
|
1370
|
-
}
|
|
1371
|
-
const t2 = this.scheduleUpdate();
|
|
1372
|
-
return null != t2 && await t2, !this.isUpdatePending;
|
|
1373
|
-
}
|
|
1374
|
-
scheduleUpdate() {
|
|
1375
|
-
return this.performUpdate();
|
|
1376
|
-
}
|
|
1377
|
-
performUpdate() {
|
|
1378
|
-
var _a2;
|
|
1379
|
-
if (!this.isUpdatePending)
|
|
1380
|
-
return;
|
|
1381
|
-
if (!this.hasUpdated) {
|
|
1382
|
-
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
|
|
1383
|
-
for (const [t4, s3] of this._$Ep)
|
|
1384
|
-
this[t4] = s3;
|
|
1385
|
-
this._$Ep = void 0;
|
|
1386
|
-
}
|
|
1387
|
-
const t3 = this.constructor.elementProperties;
|
|
1388
|
-
if (t3.size > 0)
|
|
1389
|
-
for (const [s3, i3] of t3)
|
|
1390
|
-
true !== i3.wrapped || this._$AL.has(s3) || void 0 === this[s3] || this.C(s3, this[s3], i3);
|
|
1391
|
-
}
|
|
1392
|
-
let t2 = false;
|
|
1393
|
-
const s2 = this._$AL;
|
|
1394
|
-
try {
|
|
1395
|
-
t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t3) => {
|
|
1396
|
-
var _a3;
|
|
1397
|
-
return (_a3 = t3.hostUpdate) == null ? void 0 : _a3.call(t3);
|
|
1398
|
-
}), this.update(s2)) : this._$ET();
|
|
1399
|
-
} catch (s3) {
|
|
1400
|
-
throw t2 = false, this._$ET(), s3;
|
|
1401
|
-
}
|
|
1402
|
-
t2 && this._$AE(s2);
|
|
1403
|
-
}
|
|
1404
|
-
willUpdate(t2) {
|
|
1405
|
-
}
|
|
1406
|
-
_$AE(t2) {
|
|
1407
|
-
var _a2;
|
|
1408
|
-
(_a2 = this._$E_) == null ? void 0 : _a2.forEach((t3) => {
|
|
1409
|
-
var _a3;
|
|
1410
|
-
return (_a3 = t3.hostUpdated) == null ? void 0 : _a3.call(t3);
|
|
1411
|
-
}), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2);
|
|
1412
|
-
}
|
|
1413
|
-
_$ET() {
|
|
1414
|
-
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
|
|
1415
|
-
}
|
|
1416
|
-
get updateComplete() {
|
|
1417
|
-
return this.getUpdateComplete();
|
|
1418
|
-
}
|
|
1419
|
-
getUpdateComplete() {
|
|
1420
|
-
return this._$Eg;
|
|
1421
|
-
}
|
|
1422
|
-
shouldUpdate(t2) {
|
|
1423
|
-
return true;
|
|
1424
|
-
}
|
|
1425
|
-
update(t2) {
|
|
1426
|
-
this._$Ej && (this._$Ej = this._$Ej.forEach((t3) => this._$EO(t3, this[t3]))), this._$ET();
|
|
1427
|
-
}
|
|
1428
|
-
updated(t2) {
|
|
1429
|
-
}
|
|
1430
|
-
firstUpdated(t2) {
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[d$1("elementProperties")] = /* @__PURE__ */ new Map(), b[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1 == null ? void 0 : p$1({ ReactiveElement: b }), (a$1.reactiveElementVersions ?? (a$1.reactiveElementVersions = [])).push("2.0.2");
|
|
1434
|
-
/**
|
|
1435
|
-
* @license
|
|
1436
|
-
* Copyright 2017 Google LLC
|
|
1437
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1438
|
-
*/
|
|
1439
|
-
const t$2 = globalThis, i$2 = t$2.trustedTypes, s$1 = i$2 ? i$2.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e$3 = "$lit$", h = `lit$${(Math.random() + "").slice(9)}$`, o$2 = "?" + h, n$2 = `<${o$2}>`, r$3 = document, l = () => r$3.createComment(""), c = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof (t2 == null ? void 0 : t2[Symbol.iterator]), d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
|
1440
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (t2) => (i3, ...s2) => ({ _$litType$: t2, strings: i3, values: s2 }), x = y(1), w = Symbol.for("lit-noChange"), T = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), E = r$3.createTreeWalker(r$3, 129);
|
|
1441
|
-
function C(t2, i3) {
|
|
1442
|
-
if (!Array.isArray(t2) || !t2.hasOwnProperty("raw"))
|
|
1443
|
-
throw Error("invalid template strings array");
|
|
1444
|
-
return void 0 !== s$1 ? s$1.createHTML(i3) : i3;
|
|
1445
|
-
}
|
|
1446
|
-
const P = (t2, i3) => {
|
|
1447
|
-
const s2 = t2.length - 1, o2 = [];
|
|
1448
|
-
let r2, l2 = 2 === i3 ? "<svg>" : "", c2 = f;
|
|
1449
|
-
for (let i4 = 0; i4 < s2; i4++) {
|
|
1450
|
-
const s3 = t2[i4];
|
|
1451
|
-
let a2, u2, d2 = -1, y2 = 0;
|
|
1452
|
-
for (; y2 < s3.length && (c2.lastIndex = y2, u2 = c2.exec(s3), null !== u2); )
|
|
1453
|
-
y2 = c2.lastIndex, c2 === f ? "!--" === u2[1] ? c2 = v : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($.test(u2[2]) && (r2 = RegExp("</" + u2[2], "g")), c2 = m) : void 0 !== u2[3] && (c2 = m) : c2 === m ? ">" === u2[0] ? (c2 = r2 ?? f, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g : p) : c2 === g || c2 === p ? c2 = m : c2 === v || c2 === _ ? c2 = f : (c2 = m, r2 = void 0);
|
|
1454
|
-
const x2 = c2 === m && t2[i4 + 1].startsWith("/>") ? " " : "";
|
|
1455
|
-
l2 += c2 === f ? s3 + n$2 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$3 + s3.slice(d2) + h + x2) : s3 + h + (-2 === d2 ? i4 : x2);
|
|
1456
|
-
}
|
|
1457
|
-
return [C(t2, l2 + (t2[s2] || "<?>") + (2 === i3 ? "</svg>" : "")), o2];
|
|
1458
|
-
};
|
|
1459
|
-
class V {
|
|
1460
|
-
constructor({ strings: t2, _$litType$: s2 }, n3) {
|
|
1461
|
-
let r2;
|
|
1462
|
-
this.parts = [];
|
|
1463
|
-
let c2 = 0, a2 = 0;
|
|
1464
|
-
const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = P(t2, s2);
|
|
1465
|
-
if (this.el = V.createElement(f2, n3), E.currentNode = this.el.content, 2 === s2) {
|
|
1466
|
-
const t3 = this.el.content.firstChild;
|
|
1467
|
-
t3.replaceWith(...t3.childNodes);
|
|
1468
|
-
}
|
|
1469
|
-
for (; null !== (r2 = E.nextNode()) && d2.length < u2; ) {
|
|
1470
|
-
if (1 === r2.nodeType) {
|
|
1471
|
-
if (r2.hasAttributes())
|
|
1472
|
-
for (const t3 of r2.getAttributeNames())
|
|
1473
|
-
if (t3.endsWith(e$3)) {
|
|
1474
|
-
const i3 = v2[a2++], s3 = r2.getAttribute(t3).split(h), e2 = /([.?@])?(.*)/.exec(i3);
|
|
1475
|
-
d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? k : "?" === e2[1] ? H : "@" === e2[1] ? I : R }), r2.removeAttribute(t3);
|
|
1476
|
-
} else
|
|
1477
|
-
t3.startsWith(h) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3));
|
|
1478
|
-
if ($.test(r2.tagName)) {
|
|
1479
|
-
const t3 = r2.textContent.split(h), s3 = t3.length - 1;
|
|
1480
|
-
if (s3 > 0) {
|
|
1481
|
-
r2.textContent = i$2 ? i$2.emptyScript : "";
|
|
1482
|
-
for (let i3 = 0; i3 < s3; i3++)
|
|
1483
|
-
r2.append(t3[i3], l()), E.nextNode(), d2.push({ type: 2, index: ++c2 });
|
|
1484
|
-
r2.append(t3[s3], l());
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
} else if (8 === r2.nodeType)
|
|
1488
|
-
if (r2.data === o$2)
|
|
1489
|
-
d2.push({ type: 2, index: c2 });
|
|
1490
|
-
else {
|
|
1491
|
-
let t3 = -1;
|
|
1492
|
-
for (; -1 !== (t3 = r2.data.indexOf(h, t3 + 1)); )
|
|
1493
|
-
d2.push({ type: 7, index: c2 }), t3 += h.length - 1;
|
|
1494
|
-
}
|
|
1495
|
-
c2++;
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
static createElement(t2, i3) {
|
|
1499
|
-
const s2 = r$3.createElement("template");
|
|
1500
|
-
return s2.innerHTML = t2, s2;
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
function N(t2, i3, s2 = t2, e2) {
|
|
1504
|
-
var _a2, _b;
|
|
1505
|
-
if (i3 === w)
|
|
1506
|
-
return i3;
|
|
1507
|
-
let h2 = void 0 !== e2 ? (_a2 = s2._$Co) == null ? void 0 : _a2[e2] : s2._$Cl;
|
|
1508
|
-
const o2 = c(i3) ? void 0 : i3._$litDirective$;
|
|
1509
|
-
return (h2 == null ? void 0 : h2.constructor) !== o2 && ((_b = h2 == null ? void 0 : h2._$AO) == null ? void 0 : _b.call(h2, false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ?? (s2._$Co = []))[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i3 = N(t2, h2._$AS(t2, i3.values), h2, e2)), i3;
|
|
1510
|
-
}
|
|
1511
|
-
class S {
|
|
1512
|
-
constructor(t2, i3) {
|
|
1513
|
-
this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i3;
|
|
1514
|
-
}
|
|
1515
|
-
get parentNode() {
|
|
1516
|
-
return this._$AM.parentNode;
|
|
1517
|
-
}
|
|
1518
|
-
get _$AU() {
|
|
1519
|
-
return this._$AM._$AU;
|
|
1520
|
-
}
|
|
1521
|
-
u(t2) {
|
|
1522
|
-
const { el: { content: i3 }, parts: s2 } = this._$AD, e2 = ((t2 == null ? void 0 : t2.creationScope) ?? r$3).importNode(i3, true);
|
|
1523
|
-
E.currentNode = e2;
|
|
1524
|
-
let h2 = E.nextNode(), o2 = 0, n3 = 0, l2 = s2[0];
|
|
1525
|
-
for (; void 0 !== l2; ) {
|
|
1526
|
-
if (o2 === l2.index) {
|
|
1527
|
-
let i4;
|
|
1528
|
-
2 === l2.type ? i4 = new M(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i4 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i4 = new L(h2, this, t2)), this._$AV.push(i4), l2 = s2[++n3];
|
|
1529
|
-
}
|
|
1530
|
-
o2 !== (l2 == null ? void 0 : l2.index) && (h2 = E.nextNode(), o2++);
|
|
1531
|
-
}
|
|
1532
|
-
return E.currentNode = r$3, e2;
|
|
1533
|
-
}
|
|
1534
|
-
p(t2) {
|
|
1535
|
-
let i3 = 0;
|
|
1536
|
-
for (const s2 of this._$AV)
|
|
1537
|
-
void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i3), i3 += s2.strings.length - 2) : s2._$AI(t2[i3])), i3++;
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
class M {
|
|
1541
|
-
get _$AU() {
|
|
1542
|
-
var _a2;
|
|
1543
|
-
return ((_a2 = this._$AM) == null ? void 0 : _a2._$AU) ?? this._$Cv;
|
|
1544
|
-
}
|
|
1545
|
-
constructor(t2, i3, s2, e2) {
|
|
1546
|
-
this.type = 2, this._$AH = T, this._$AN = void 0, this._$AA = t2, this._$AB = i3, this._$AM = s2, this.options = e2, this._$Cv = (e2 == null ? void 0 : e2.isConnected) ?? true;
|
|
1547
|
-
}
|
|
1548
|
-
get parentNode() {
|
|
1549
|
-
let t2 = this._$AA.parentNode;
|
|
1550
|
-
const i3 = this._$AM;
|
|
1551
|
-
return void 0 !== i3 && 11 === (t2 == null ? void 0 : t2.nodeType) && (t2 = i3.parentNode), t2;
|
|
1552
|
-
}
|
|
1553
|
-
get startNode() {
|
|
1554
|
-
return this._$AA;
|
|
1555
|
-
}
|
|
1556
|
-
get endNode() {
|
|
1557
|
-
return this._$AB;
|
|
1558
|
-
}
|
|
1559
|
-
_$AI(t2, i3 = this) {
|
|
1560
|
-
t2 = N(this, t2, i3), c(t2) ? t2 === T || null == t2 || "" === t2 ? (this._$AH !== T && this._$AR(), this._$AH = T) : t2 !== this._$AH && t2 !== w && this._(t2) : void 0 !== t2._$litType$ ? this.g(t2) : void 0 !== t2.nodeType ? this.$(t2) : u(t2) ? this.T(t2) : this._(t2);
|
|
1561
|
-
}
|
|
1562
|
-
k(t2) {
|
|
1563
|
-
return this._$AA.parentNode.insertBefore(t2, this._$AB);
|
|
1564
|
-
}
|
|
1565
|
-
$(t2) {
|
|
1566
|
-
this._$AH !== t2 && (this._$AR(), this._$AH = this.k(t2));
|
|
1567
|
-
}
|
|
1568
|
-
_(t2) {
|
|
1569
|
-
this._$AH !== T && c(this._$AH) ? this._$AA.nextSibling.data = t2 : this.$(r$3.createTextNode(t2)), this._$AH = t2;
|
|
1570
|
-
}
|
|
1571
|
-
g(t2) {
|
|
1572
|
-
var _a2;
|
|
1573
|
-
const { values: i3, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = V.createElement(C(s2.h, s2.h[0]), this.options)), s2);
|
|
1574
|
-
if (((_a2 = this._$AH) == null ? void 0 : _a2._$AD) === e2)
|
|
1575
|
-
this._$AH.p(i3);
|
|
1576
|
-
else {
|
|
1577
|
-
const t3 = new S(e2, this), s3 = t3.u(this.options);
|
|
1578
|
-
t3.p(i3), this.$(s3), this._$AH = t3;
|
|
1579
|
-
}
|
|
1580
|
-
}
|
|
1581
|
-
_$AC(t2) {
|
|
1582
|
-
let i3 = A.get(t2.strings);
|
|
1583
|
-
return void 0 === i3 && A.set(t2.strings, i3 = new V(t2)), i3;
|
|
1584
|
-
}
|
|
1585
|
-
T(t2) {
|
|
1586
|
-
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
1587
|
-
const i3 = this._$AH;
|
|
1588
|
-
let s2, e2 = 0;
|
|
1589
|
-
for (const h2 of t2)
|
|
1590
|
-
e2 === i3.length ? i3.push(s2 = new M(this.k(l()), this.k(l()), this, this.options)) : s2 = i3[e2], s2._$AI(h2), e2++;
|
|
1591
|
-
e2 < i3.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i3.length = e2);
|
|
1592
|
-
}
|
|
1593
|
-
_$AR(t2 = this._$AA.nextSibling, i3) {
|
|
1594
|
-
var _a2;
|
|
1595
|
-
for ((_a2 = this._$AP) == null ? void 0 : _a2.call(this, false, true, i3); t2 && t2 !== this._$AB; ) {
|
|
1596
|
-
const i4 = t2.nextSibling;
|
|
1597
|
-
t2.remove(), t2 = i4;
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
setConnected(t2) {
|
|
1601
|
-
var _a2;
|
|
1602
|
-
void 0 === this._$AM && (this._$Cv = t2, (_a2 = this._$AP) == null ? void 0 : _a2.call(this, t2));
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
class R {
|
|
1606
|
-
get tagName() {
|
|
1607
|
-
return this.element.tagName;
|
|
1608
|
-
}
|
|
1609
|
-
get _$AU() {
|
|
1610
|
-
return this._$AM._$AU;
|
|
1611
|
-
}
|
|
1612
|
-
constructor(t2, i3, s2, e2, h2) {
|
|
1613
|
-
this.type = 1, this._$AH = T, this._$AN = void 0, this.element = t2, this.name = i3, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = T;
|
|
1614
|
-
}
|
|
1615
|
-
_$AI(t2, i3 = this, s2, e2) {
|
|
1616
|
-
const h2 = this.strings;
|
|
1617
|
-
let o2 = false;
|
|
1618
|
-
if (void 0 === h2)
|
|
1619
|
-
t2 = N(this, t2, i3, 0), o2 = !c(t2) || t2 !== this._$AH && t2 !== w, o2 && (this._$AH = t2);
|
|
1620
|
-
else {
|
|
1621
|
-
const e3 = t2;
|
|
1622
|
-
let n3, r2;
|
|
1623
|
-
for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++)
|
|
1624
|
-
r2 = N(this, e3[s2 + n3], i3, n3), r2 === w && (r2 = this._$AH[n3]), o2 || (o2 = !c(r2) || r2 !== this._$AH[n3]), r2 === T ? t2 = T : t2 !== T && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2;
|
|
1625
|
-
}
|
|
1626
|
-
o2 && !e2 && this.O(t2);
|
|
1627
|
-
}
|
|
1628
|
-
O(t2) {
|
|
1629
|
-
t2 === T ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
class k extends R {
|
|
1633
|
-
constructor() {
|
|
1634
|
-
super(...arguments), this.type = 3;
|
|
1635
|
-
}
|
|
1636
|
-
O(t2) {
|
|
1637
|
-
this.element[this.name] = t2 === T ? void 0 : t2;
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
class H extends R {
|
|
1641
|
-
constructor() {
|
|
1642
|
-
super(...arguments), this.type = 4;
|
|
1643
|
-
}
|
|
1644
|
-
O(t2) {
|
|
1645
|
-
this.element.toggleAttribute(this.name, !!t2 && t2 !== T);
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
class I extends R {
|
|
1649
|
-
constructor(t2, i3, s2, e2, h2) {
|
|
1650
|
-
super(t2, i3, s2, e2, h2), this.type = 5;
|
|
1651
|
-
}
|
|
1652
|
-
_$AI(t2, i3 = this) {
|
|
1653
|
-
if ((t2 = N(this, t2, i3, 0) ?? T) === w)
|
|
1654
|
-
return;
|
|
1655
|
-
const s2 = this._$AH, e2 = t2 === T && s2 !== T || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== T && (s2 === T || e2);
|
|
1656
|
-
e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
|
|
1657
|
-
}
|
|
1658
|
-
handleEvent(t2) {
|
|
1659
|
-
var _a2;
|
|
1660
|
-
"function" == typeof this._$AH ? this._$AH.call(((_a2 = this.options) == null ? void 0 : _a2.host) ?? this.element, t2) : this._$AH.handleEvent(t2);
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
class L {
|
|
1664
|
-
constructor(t2, i3, s2) {
|
|
1665
|
-
this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i3, this.options = s2;
|
|
1666
|
-
}
|
|
1667
|
-
get _$AU() {
|
|
1668
|
-
return this._$AM._$AU;
|
|
1669
|
-
}
|
|
1670
|
-
_$AI(t2) {
|
|
1671
|
-
N(this, t2);
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
const Z = t$2.litHtmlPolyfillSupport;
|
|
1675
|
-
Z == null ? void 0 : Z(V, M), (t$2.litHtmlVersions ?? (t$2.litHtmlVersions = [])).push("3.1.0");
|
|
1676
|
-
const j = (t2, i3, s2) => {
|
|
1677
|
-
const e2 = (s2 == null ? void 0 : s2.renderBefore) ?? i3;
|
|
1678
|
-
let h2 = e2._$litPart$;
|
|
1679
|
-
if (void 0 === h2) {
|
|
1680
|
-
const t3 = (s2 == null ? void 0 : s2.renderBefore) ?? null;
|
|
1681
|
-
e2._$litPart$ = h2 = new M(i3.insertBefore(l(), t3), t3, void 0, s2 ?? {});
|
|
1682
|
-
}
|
|
1683
|
-
return h2._$AI(t2), h2;
|
|
1684
|
-
};
|
|
1685
|
-
/**
|
|
1686
|
-
* @license
|
|
1687
|
-
* Copyright 2017 Google LLC
|
|
1688
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1689
|
-
*/
|
|
1690
|
-
class s extends b {
|
|
1691
|
-
constructor() {
|
|
1692
|
-
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
1693
|
-
}
|
|
1694
|
-
createRenderRoot() {
|
|
1695
|
-
var _a2;
|
|
1696
|
-
const t2 = super.createRenderRoot();
|
|
1697
|
-
return (_a2 = this.renderOptions).renderBefore ?? (_a2.renderBefore = t2.firstChild), t2;
|
|
1698
|
-
}
|
|
1699
|
-
update(t2) {
|
|
1700
|
-
const i3 = this.render();
|
|
1701
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this._$Do = j(i3, this.renderRoot, this.renderOptions);
|
|
1702
|
-
}
|
|
1703
|
-
connectedCallback() {
|
|
1704
|
-
var _a2;
|
|
1705
|
-
super.connectedCallback(), (_a2 = this._$Do) == null ? void 0 : _a2.setConnected(true);
|
|
1706
|
-
}
|
|
1707
|
-
disconnectedCallback() {
|
|
1708
|
-
var _a2;
|
|
1709
|
-
super.disconnectedCallback(), (_a2 = this._$Do) == null ? void 0 : _a2.setConnected(false);
|
|
1710
|
-
}
|
|
1711
|
-
render() {
|
|
1712
|
-
return w;
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
s._$litElement$ = true, s["finalized"] = true, (_a = globalThis.litElementHydrateSupport) == null ? void 0 : _a.call(globalThis, { LitElement: s });
|
|
1716
|
-
const r$2 = globalThis.litElementPolyfillSupport;
|
|
1717
|
-
r$2 == null ? void 0 : r$2({ LitElement: s });
|
|
1718
|
-
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.2");
|
|
1719
|
-
/**
|
|
1720
|
-
* @license
|
|
1721
|
-
* Copyright 2017 Google LLC
|
|
1722
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1723
|
-
*/
|
|
1724
|
-
const t$1 = (t2) => (e2, o2) => {
|
|
1725
|
-
void 0 !== o2 ? o2.addInitializer(() => {
|
|
1726
|
-
customElements.define(t2, e2);
|
|
1727
|
-
}) : customElements.define(t2, e2);
|
|
1728
|
-
};
|
|
1729
|
-
/**
|
|
1730
|
-
* @license
|
|
1731
|
-
* Copyright 2017 Google LLC
|
|
1732
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1733
|
-
*/
|
|
1734
|
-
const o$1 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 }, r$1 = (t2 = o$1, e2, r2) => {
|
|
1735
|
-
const { kind: n3, metadata: i3 } = r2;
|
|
1736
|
-
let s2 = globalThis.litPropertyMetadata.get(i3);
|
|
1737
|
-
if (void 0 === s2 && globalThis.litPropertyMetadata.set(i3, s2 = /* @__PURE__ */ new Map()), s2.set(r2.name, t2), "accessor" === n3) {
|
|
1738
|
-
const { name: o2 } = r2;
|
|
1739
|
-
return { set(r3) {
|
|
1740
|
-
const n4 = e2.get.call(this);
|
|
1741
|
-
e2.set.call(this, r3), this.requestUpdate(o2, n4, t2);
|
|
1742
|
-
}, init(e3) {
|
|
1743
|
-
return void 0 !== e3 && this.C(o2, void 0, t2), e3;
|
|
1744
|
-
} };
|
|
1745
|
-
}
|
|
1746
|
-
if ("setter" === n3) {
|
|
1747
|
-
const { name: o2 } = r2;
|
|
1748
|
-
return function(r3) {
|
|
1749
|
-
const n4 = this[o2];
|
|
1750
|
-
e2.call(this, r3), this.requestUpdate(o2, n4, t2);
|
|
1751
|
-
};
|
|
1752
|
-
}
|
|
1753
|
-
throw Error("Unsupported decorator location: " + n3);
|
|
1754
|
-
};
|
|
1755
|
-
function n$1(t2) {
|
|
1756
|
-
return (e2, o2) => "object" == typeof o2 ? r$1(t2, e2, o2) : ((t3, e3, o3) => {
|
|
1757
|
-
const r2 = e3.hasOwnProperty(o3);
|
|
1758
|
-
return e3.constructor.createProperty(o3, r2 ? { ...t3, wrapped: true } : t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0;
|
|
1759
|
-
})(t2, e2, o2);
|
|
1760
|
-
}
|
|
1761
|
-
/**
|
|
1762
|
-
* @license
|
|
1763
|
-
* Copyright 2017 Google LLC
|
|
1764
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1765
|
-
*/
|
|
1766
|
-
function r(r2) {
|
|
1767
|
-
return n$1({ ...r2, state: true, attribute: false });
|
|
1768
|
-
}
|
|
1769
|
-
/**
|
|
1770
|
-
* @license
|
|
1771
|
-
* Copyright 2017 Google LLC
|
|
1772
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1773
|
-
*/
|
|
1774
|
-
const e$2 = (e2, t2, c2) => (c2.configurable = true, c2.enumerable = true, Reflect.decorate && "object" != typeof t2 && Object.defineProperty(e2, t2, c2), c2);
|
|
1775
|
-
/**
|
|
1776
|
-
* @license
|
|
1777
|
-
* Copyright 2017 Google LLC
|
|
1778
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1779
|
-
*/
|
|
1780
|
-
function e$1(e2, r2) {
|
|
1781
|
-
return (n3, s2, i3) => {
|
|
1782
|
-
const o2 = (t2) => {
|
|
1783
|
-
var _a2;
|
|
1784
|
-
return ((_a2 = t2.renderRoot) == null ? void 0 : _a2.querySelector(e2)) ?? null;
|
|
1785
|
-
};
|
|
1786
|
-
if (r2) {
|
|
1787
|
-
const { get: e3, set: r3 } = "object" == typeof s2 ? n3 : i3 ?? (() => {
|
|
1788
|
-
const t2 = Symbol();
|
|
1789
|
-
return { get() {
|
|
1790
|
-
return this[t2];
|
|
1791
|
-
}, set(e4) {
|
|
1792
|
-
this[t2] = e4;
|
|
1793
|
-
} };
|
|
1794
|
-
})();
|
|
1795
|
-
return e$2(n3, s2, { get() {
|
|
1796
|
-
let t2 = e3.call(this);
|
|
1797
|
-
return void 0 === t2 && (t2 = o2(this), (null !== t2 || this.hasUpdated) && r3.call(this, t2)), t2;
|
|
1798
|
-
} });
|
|
1799
|
-
}
|
|
1800
|
-
return e$2(n3, s2, { get() {
|
|
1801
|
-
return o2(this);
|
|
1802
|
-
} });
|
|
1803
|
-
};
|
|
1804
|
-
}
|
|
1805
|
-
/**
|
|
1806
|
-
* @license
|
|
1807
|
-
* Copyright 2017 Google LLC
|
|
1808
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1809
|
-
*/
|
|
1810
|
-
const t = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, e = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
|
|
1811
|
-
let i$1 = class i {
|
|
1812
|
-
constructor(t2) {
|
|
1813
|
-
}
|
|
1814
|
-
get _$AU() {
|
|
1815
|
-
return this._$AM._$AU;
|
|
1816
|
-
}
|
|
1817
|
-
_$AT(t2, e2, i3) {
|
|
1818
|
-
this._$Ct = t2, this._$AM = e2, this._$Ci = i3;
|
|
1819
|
-
}
|
|
1820
|
-
_$AS(t2, e2) {
|
|
1821
|
-
return this.update(t2, e2);
|
|
1822
|
-
}
|
|
1823
|
-
update(t2, e2) {
|
|
1824
|
-
return this.render(...e2);
|
|
1825
|
-
}
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
10
|
+
return result;
|
|
1826
11
|
};
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
*
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
const r3 = "string" == typeof e3 && e3.endsWith(i2);
|
|
1855
|
-
t2.includes("-") || r3 ? s2.setProperty(t2, r3 ? e3.slice(0, -11) : e3, r3 ? n2 : "") : s2[t2] = e3;
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
return w;
|
|
1859
|
-
}
|
|
1860
|
-
});
|
|
1861
|
-
const version = "5.0.3";
|
|
1862
|
-
class LuzmoService {
|
|
12
|
+
|
|
13
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
14
|
+
import * as SharedLib2 from "@luzmo/shared-embed";
|
|
15
|
+
import {
|
|
16
|
+
html,
|
|
17
|
+
LitElement
|
|
18
|
+
} from "lit";
|
|
19
|
+
import {
|
|
20
|
+
customElement,
|
|
21
|
+
property,
|
|
22
|
+
query,
|
|
23
|
+
state
|
|
24
|
+
} from "lit/decorators.js";
|
|
25
|
+
import {
|
|
26
|
+
styleMap
|
|
27
|
+
} from "lit/directives/style-map.js";
|
|
28
|
+
import {
|
|
29
|
+
__federationMethodGetRemote,
|
|
30
|
+
__federationMethodWrapDefault,
|
|
31
|
+
remotesMap
|
|
32
|
+
} from "@luzmo/shared-embed";
|
|
33
|
+
|
|
34
|
+
// libs/embed-libs/embed/package.json
|
|
35
|
+
var version = "5.0.6";
|
|
36
|
+
|
|
37
|
+
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
38
|
+
var LuzmoService = class {
|
|
1863
39
|
constructor() {
|
|
1864
40
|
this._components = [];
|
|
1865
41
|
}
|
|
1866
|
-
}
|
|
1867
|
-
|
|
1868
|
-
|
|
42
|
+
};
|
|
43
|
+
var luzmo_service_default = new LuzmoService();
|
|
44
|
+
|
|
45
|
+
// libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
|
|
46
|
+
import * as SharedLib from "@luzmo/shared-embed";
|
|
47
|
+
var _setEventHandler = () => {
|
|
1869
48
|
if (typeof window.__luzmoMessageHandler === "function") {
|
|
1870
49
|
return;
|
|
1871
50
|
}
|
|
1872
51
|
window.__luzmoMessageHandler = (event) => {
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
(c2) => event.data.name === c2._iframeId
|
|
52
|
+
const dashboardComponent = luzmo_service_default._components.find(
|
|
53
|
+
(c) => event.data.name === c._iframeId
|
|
1876
54
|
);
|
|
1877
55
|
if (!dashboardComponent) {
|
|
1878
56
|
return;
|
|
1879
57
|
}
|
|
1880
|
-
switch (
|
|
58
|
+
switch (event.data?.type) {
|
|
1881
59
|
case "load": {
|
|
1882
60
|
dashboardComponent.dispatchEvent(
|
|
1883
61
|
new CustomEvent("load", { detail: { data: event.data } })
|
|
@@ -1902,7 +80,7 @@ const _setEventHandler = () => {
|
|
|
1902
80
|
break;
|
|
1903
81
|
}
|
|
1904
82
|
case "data": {
|
|
1905
|
-
resolvePromise(
|
|
83
|
+
SharedLib.resolvePromise(
|
|
1906
84
|
dashboardComponent,
|
|
1907
85
|
event.data.requestId,
|
|
1908
86
|
event.data.data
|
|
@@ -1910,7 +88,7 @@ const _setEventHandler = () => {
|
|
|
1910
88
|
break;
|
|
1911
89
|
}
|
|
1912
90
|
case "filters": {
|
|
1913
|
-
resolvePromise(
|
|
91
|
+
SharedLib.resolvePromise(
|
|
1914
92
|
dashboardComponent,
|
|
1915
93
|
event.data.requestId,
|
|
1916
94
|
event.data.filters
|
|
@@ -1918,7 +96,7 @@ const _setEventHandler = () => {
|
|
|
1918
96
|
break;
|
|
1919
97
|
}
|
|
1920
98
|
case "getAccessibleDashboards": {
|
|
1921
|
-
resolvePromise(
|
|
99
|
+
SharedLib.resolvePromise(
|
|
1922
100
|
dashboardComponent,
|
|
1923
101
|
event.data.requestId,
|
|
1924
102
|
event.data.accessibleDashboards
|
|
@@ -1933,7 +111,7 @@ const _setEventHandler = () => {
|
|
|
1933
111
|
}
|
|
1934
112
|
case "export": {
|
|
1935
113
|
if (event.data.error) {
|
|
1936
|
-
rejectPromise(
|
|
114
|
+
SharedLib.rejectPromise(
|
|
1937
115
|
dashboardComponent,
|
|
1938
116
|
event.data.requestId,
|
|
1939
117
|
event.data
|
|
@@ -1942,7 +120,7 @@ const _setEventHandler = () => {
|
|
|
1942
120
|
dashboardComponent.dispatchEvent(
|
|
1943
121
|
new CustomEvent("exported", { detail: { data: event.data } })
|
|
1944
122
|
);
|
|
1945
|
-
resolvePromise(
|
|
123
|
+
SharedLib.resolvePromise(
|
|
1946
124
|
dashboardComponent,
|
|
1947
125
|
event.data.requestId,
|
|
1948
126
|
event.data
|
|
@@ -1972,31 +150,31 @@ const _setEventHandler = () => {
|
|
|
1972
150
|
}
|
|
1973
151
|
case "setEditMode": {
|
|
1974
152
|
if (event.data.error) {
|
|
1975
|
-
rejectPromise(
|
|
153
|
+
SharedLib.rejectPromise(
|
|
1976
154
|
dashboardComponent,
|
|
1977
155
|
event.data.requestId,
|
|
1978
156
|
event.data
|
|
1979
157
|
);
|
|
1980
158
|
} else {
|
|
1981
|
-
resolvePromise(
|
|
159
|
+
SharedLib.resolvePromise(
|
|
1982
160
|
dashboardComponent,
|
|
1983
161
|
event.data.requestId,
|
|
1984
162
|
event.data
|
|
1985
163
|
);
|
|
1986
164
|
dashboardComponent.params.editMode = event.data.editMode;
|
|
1987
|
-
dashboardComponent._containerStyle = containerStyles(dashboardComponent);
|
|
165
|
+
dashboardComponent._containerStyle = SharedLib.containerStyles(dashboardComponent);
|
|
1988
166
|
if (dashboardComponent.dimensions) {
|
|
1989
|
-
_setCalculatedDimensions(dashboardComponent);
|
|
167
|
+
SharedLib._setCalculatedDimensions(dashboardComponent);
|
|
1990
168
|
}
|
|
1991
169
|
}
|
|
1992
170
|
break;
|
|
1993
171
|
}
|
|
1994
172
|
case "setFilters": {
|
|
1995
|
-
event.data.error ? rejectPromise(
|
|
173
|
+
event.data.error ? SharedLib.rejectPromise(
|
|
1996
174
|
dashboardComponent,
|
|
1997
175
|
event.data.requestId,
|
|
1998
176
|
event.data
|
|
1999
|
-
) : resolvePromise(
|
|
177
|
+
) : SharedLib.resolvePromise(
|
|
2000
178
|
dashboardComponent,
|
|
2001
179
|
event.data.requestId,
|
|
2002
180
|
event.data
|
|
@@ -2004,11 +182,11 @@ const _setEventHandler = () => {
|
|
|
2004
182
|
break;
|
|
2005
183
|
}
|
|
2006
184
|
case "setPreview": {
|
|
2007
|
-
event.data.error ? rejectPromise(
|
|
185
|
+
event.data.error ? SharedLib.rejectPromise(
|
|
2008
186
|
dashboardComponent,
|
|
2009
187
|
event.data.requestId,
|
|
2010
188
|
event.data
|
|
2011
|
-
) : resolvePromise(
|
|
189
|
+
) : SharedLib.resolvePromise(
|
|
2012
190
|
dashboardComponent,
|
|
2013
191
|
event.data.requestId,
|
|
2014
192
|
event.data
|
|
@@ -2019,7 +197,10 @@ const _setEventHandler = () => {
|
|
|
2019
197
|
};
|
|
2020
198
|
window.addEventListener("message", window.__luzmoMessageHandler, false);
|
|
2021
199
|
};
|
|
2022
|
-
|
|
200
|
+
|
|
201
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-styles.ts
|
|
202
|
+
import { css } from "lit";
|
|
203
|
+
var dashboardStyles = css`
|
|
2023
204
|
@-webkit-keyframes spin {
|
|
2024
205
|
0% {
|
|
2025
206
|
-webkit-transform: rotate(0deg);
|
|
@@ -2120,25 +301,16 @@ const dashboardStyles = i$4`
|
|
|
2120
301
|
transition-duration: 0.3s;
|
|
2121
302
|
}
|
|
2122
303
|
`;
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
var
|
|
2126
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
2127
|
-
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
2128
|
-
if (decorator = decorators[i3])
|
|
2129
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2130
|
-
if (kind && result)
|
|
2131
|
-
__defProp(target, key, result);
|
|
2132
|
-
return result;
|
|
2133
|
-
};
|
|
2134
|
-
exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
304
|
+
|
|
305
|
+
// libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
|
|
306
|
+
var LuzmoDashboard = class extends LitElement {
|
|
2135
307
|
constructor(inputParameters) {
|
|
2136
308
|
super();
|
|
2137
309
|
this.language = "auto";
|
|
2138
310
|
this.screenMode = "auto";
|
|
2139
311
|
this.switchScreenModeOnResize = true;
|
|
2140
312
|
this.editMode = "view";
|
|
2141
|
-
this.
|
|
313
|
+
this.experimental = false;
|
|
2142
314
|
this.iframeStyle = {};
|
|
2143
315
|
this._containerStyle = {};
|
|
2144
316
|
this._loaderStyle = {};
|
|
@@ -2178,20 +350,19 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2178
350
|
this.loaderSize = 32;
|
|
2179
351
|
this.borderWidth = 3;
|
|
2180
352
|
this.minHeight = 400;
|
|
2181
|
-
this._containerId = uuidv4();
|
|
353
|
+
this._containerId = SharedLib2.uuidv4();
|
|
2182
354
|
this._iframeId = `luzmo-dashboard-${this._containerId}`;
|
|
2183
355
|
this.iframeLoaded = false;
|
|
2184
356
|
this.promises = {};
|
|
2185
357
|
this.setInputParameters(inputParameters);
|
|
2186
358
|
this.params = this._setOptions();
|
|
2187
359
|
this._onResize = () => {
|
|
2188
|
-
|
|
2189
|
-
if ((_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector(".dashboard-container")) {
|
|
360
|
+
if (this.shadowRoot?.querySelector(".dashboard-container")) {
|
|
2190
361
|
this.containerWidth = this.container.clientWidth;
|
|
2191
362
|
if (this.params.switchScreenModeOnResize && this.params.screenMode === "auto") {
|
|
2192
|
-
for (const
|
|
2193
|
-
if (
|
|
2194
|
-
this.currentScreenMode =
|
|
363
|
+
for (const d of SharedLib2.EXTENTS) {
|
|
364
|
+
if (d.width[0] <= window.innerWidth && window.innerWidth <= d.width[1]) {
|
|
365
|
+
this.currentScreenMode = d.mode;
|
|
2195
366
|
}
|
|
2196
367
|
}
|
|
2197
368
|
}
|
|
@@ -2213,9 +384,9 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2213
384
|
if (remotesMap[appServer]) {
|
|
2214
385
|
return Promise.resolve(remotesMap[appServer].module);
|
|
2215
386
|
}
|
|
2216
|
-
remotesMap[appServer] = { url:
|
|
2217
|
-
return
|
|
2218
|
-
const wrappedModule =
|
|
387
|
+
remotesMap[appServer] = { url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`, format: "esm", from: "vite", module: void 0 };
|
|
388
|
+
return __federationMethodGetRemote(appServer, "./DashboardApp").then((module) => {
|
|
389
|
+
const wrappedModule = __federationMethodWrapDefault(module, true);
|
|
2219
390
|
remotesMap[appServer].module = wrappedModule;
|
|
2220
391
|
return wrappedModule;
|
|
2221
392
|
});
|
|
@@ -2251,11 +422,11 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2251
422
|
this[key] = value;
|
|
2252
423
|
}
|
|
2253
424
|
}
|
|
2254
|
-
if (inputParameters.
|
|
2255
|
-
this.
|
|
425
|
+
if (inputParameters.experimental) {
|
|
426
|
+
this.experimental = inputParameters.experimental;
|
|
2256
427
|
}
|
|
2257
428
|
if (inputParameters.appServer) {
|
|
2258
|
-
this.appServer = addTrailingSlash(inputParameters.appServer);
|
|
429
|
+
this.appServer = SharedLib2.addTrailingSlash(inputParameters.appServer);
|
|
2259
430
|
}
|
|
2260
431
|
}
|
|
2261
432
|
// Set resize event listener
|
|
@@ -2273,14 +444,12 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2273
444
|
}
|
|
2274
445
|
}
|
|
2275
446
|
firstUpdated() {
|
|
2276
|
-
|
|
2277
|
-
this._loaderMsg = (_a2 = getLoader(this)) == null ? void 0 : _a2.loadingMsg;
|
|
447
|
+
this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
|
|
2278
448
|
this._loaderStyles();
|
|
2279
|
-
|
|
449
|
+
luzmo_service_default._components.push(this);
|
|
2280
450
|
this.initComponent();
|
|
2281
451
|
}
|
|
2282
452
|
initComponent() {
|
|
2283
|
-
var _a2, _b;
|
|
2284
453
|
this.params = this._setOptions();
|
|
2285
454
|
if (this.getIsViewMode()) {
|
|
2286
455
|
this.loadLibrary(this.params.appServer).then(async () => {
|
|
@@ -2289,25 +458,25 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2289
458
|
const oldReference = this.renderRoot.querySelector("dashboard-component");
|
|
2290
459
|
this.dashboardReference = oldReference.cloneNode(true);
|
|
2291
460
|
oldReference.replaceWith(this.dashboardReference);
|
|
2292
|
-
this.dashboardReference.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
|
|
2293
|
-
this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
|
|
2294
|
-
this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
2295
|
-
this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
2296
|
-
this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
|
|
2297
|
-
this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
461
|
+
this.dashboardReference.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload.detail)));
|
|
462
|
+
this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload.detail)));
|
|
463
|
+
this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload.detail)));
|
|
464
|
+
this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload.detail)));
|
|
465
|
+
this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload.detail)));
|
|
466
|
+
this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload.detail)));
|
|
2298
467
|
this.setAllAttributes();
|
|
2299
468
|
});
|
|
2300
469
|
} else {
|
|
2301
|
-
this.containerWidth =
|
|
2302
|
-
_extendAndValidate(this);
|
|
2303
|
-
_browserCheck(this);
|
|
470
|
+
this.containerWidth = this.container?.clientWidth;
|
|
471
|
+
SharedLib2._extendAndValidate(this);
|
|
472
|
+
SharedLib2._browserCheck(this);
|
|
2304
473
|
this._setupLoader();
|
|
2305
474
|
if (!this.params.error) {
|
|
2306
475
|
this._loaderStyles();
|
|
2307
476
|
_setEventHandler();
|
|
2308
|
-
this._iframeUrl = createIframeUrl(this);
|
|
2309
|
-
|
|
2310
|
-
this.iframeStyle = calculateIframeStyles(this);
|
|
477
|
+
this._iframeUrl = SharedLib2.createIframeUrl(this);
|
|
478
|
+
this.iframe?.setAttribute("src", this._iframeUrl);
|
|
479
|
+
this.iframeStyle = SharedLib2.calculateIframeStyles(this);
|
|
2311
480
|
}
|
|
2312
481
|
if (this.container) {
|
|
2313
482
|
this._resizeObserver.observe(this.container);
|
|
@@ -2317,11 +486,14 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2317
486
|
setAllAttributes() {
|
|
2318
487
|
if (this.dashboardReference) {
|
|
2319
488
|
for (const key in this.attributesMap) {
|
|
2320
|
-
if (!["authKey", "authToken", "apiHost"].includes(key) && this.params[key]) {
|
|
489
|
+
if (!["authKey", "authToken", "apiHost", "itemDimensions"].includes(key) && this.params[key]) {
|
|
2321
490
|
this.dashboardReference.setAttribute(this.attributesMap[key], this.params[key]);
|
|
2322
491
|
}
|
|
492
|
+
if (this.params.itemDimensions) {
|
|
493
|
+
this.dashboardReference.setAttribute("item-dimensions", JSON.stringify(this.params.itemDimensions));
|
|
494
|
+
}
|
|
2323
495
|
if (this.params.apiHost) {
|
|
2324
|
-
this.dashboardReference.setAttribute("api-host", removeTrailingSlash(this.params.apiHost));
|
|
496
|
+
this.dashboardReference.setAttribute("api-host", SharedLib2.removeTrailingSlash(this.params.apiHost));
|
|
2325
497
|
}
|
|
2326
498
|
if (this.params.key) {
|
|
2327
499
|
this.dashboardReference.setAttribute("auth-key", this.params.key);
|
|
@@ -2349,7 +521,24 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2349
521
|
"timezoneId",
|
|
2350
522
|
"itemDimensions"
|
|
2351
523
|
]);
|
|
2352
|
-
if (
|
|
524
|
+
if (this.getIsViewMode()) {
|
|
525
|
+
if (this.dashboardReference) {
|
|
526
|
+
for (const [propertyName] of changedProperties.entries()) {
|
|
527
|
+
if (propertyName === "appSever") {
|
|
528
|
+
this.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
529
|
+
this.isLibraryLoaded = true;
|
|
530
|
+
await this.updateComplete;
|
|
531
|
+
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
532
|
+
this.setAllAttributes();
|
|
533
|
+
});
|
|
534
|
+
} else if (this.attributesMap[propertyName]) {
|
|
535
|
+
const mappedAttributeName = this.attributesMap[propertyName] ?? propertyName;
|
|
536
|
+
const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() || this[propertyName];
|
|
537
|
+
this.dashboardReference.setAttribute(mappedAttributeName, attributeValue);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
} else {
|
|
2353
542
|
for (const [propertyName] of changedProperties.entries()) {
|
|
2354
543
|
if (triggerProperties.has(propertyName) && propertyName !== "editMode") {
|
|
2355
544
|
this.iframeLoaded = false;
|
|
@@ -2362,14 +551,14 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2362
551
|
);
|
|
2363
552
|
}, 15 * 1e3);
|
|
2364
553
|
this.params = this._setOptions();
|
|
2365
|
-
_extendAndValidate(this);
|
|
554
|
+
SharedLib2._extendAndValidate(this);
|
|
2366
555
|
this._setupLoader();
|
|
2367
556
|
this._loaderStyles();
|
|
2368
|
-
this._iframeUrl = createIframeUrl(this);
|
|
557
|
+
this._iframeUrl = SharedLib2.createIframeUrl(this);
|
|
2369
558
|
if (this.iframe) {
|
|
2370
559
|
this._updateIframeUrl();
|
|
2371
560
|
}
|
|
2372
|
-
this.iframeStyle = calculateIframeStyles(this);
|
|
561
|
+
this.iframeStyle = SharedLib2.calculateIframeStyles(this);
|
|
2373
562
|
} else if (triggerProperties.has(propertyName) && propertyName === "editMode") {
|
|
2374
563
|
if (this.iframeLoaded) {
|
|
2375
564
|
this.setEditMode(this.editMode);
|
|
@@ -2377,21 +566,6 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2377
566
|
this.params = this._setOptions();
|
|
2378
567
|
}
|
|
2379
568
|
}
|
|
2380
|
-
} else {
|
|
2381
|
-
if (this.dashboardReference) {
|
|
2382
|
-
for (const [propertyName] of changedProperties.entries()) {
|
|
2383
|
-
if (propertyName === "appSever") {
|
|
2384
|
-
this.loadLibrary(changedProperties[propertyName]).then(async () => {
|
|
2385
|
-
this.isLibraryLoaded = true;
|
|
2386
|
-
await this.updateComplete;
|
|
2387
|
-
this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
|
|
2388
|
-
this.setAllAttributes();
|
|
2389
|
-
});
|
|
2390
|
-
} else if (this.attributesMap[propertyName]) {
|
|
2391
|
-
this.dashboardReference.setAttribute(this.attributesMap[propertyName] ?? propertyName, this[propertyName]);
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
}
|
|
2395
569
|
}
|
|
2396
570
|
}
|
|
2397
571
|
// Set params
|
|
@@ -2450,29 +624,29 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2450
624
|
defaultParameters.itemDimensions = this.itemDimensions;
|
|
2451
625
|
}
|
|
2452
626
|
if (this.appServer) {
|
|
2453
|
-
this.appServer = this.getIsViewMode() ? removeTrailingSlash(this.appServer) : addTrailingSlash(this.appServer);
|
|
627
|
+
this.appServer = this.getIsViewMode() ? SharedLib2.removeTrailingSlash(this.appServer) : SharedLib2.addTrailingSlash(this.appServer);
|
|
2454
628
|
defaultParameters.appServer = this.appServer;
|
|
2455
629
|
} else {
|
|
2456
|
-
this.appServer = addTrailingSlash(
|
|
2457
|
-
DEFAULT_PARAMETERS.appServer
|
|
630
|
+
this.appServer = SharedLib2.addTrailingSlash(
|
|
631
|
+
SharedLib2.DEFAULT_PARAMETERS.appServer
|
|
2458
632
|
);
|
|
2459
633
|
defaultParameters.appServer = this.appServer;
|
|
2460
634
|
}
|
|
2461
635
|
if (this.apiHost) {
|
|
2462
|
-
this.apiHost = this.getIsViewMode() ? removeTrailingSlash(this.apiHost) : addTrailingSlash(this.apiHost);
|
|
636
|
+
this.apiHost = this.getIsViewMode() ? SharedLib2.removeTrailingSlash(this.apiHost) : SharedLib2.addTrailingSlash(this.apiHost);
|
|
2463
637
|
defaultParameters.apiHost = this.apiHost;
|
|
2464
638
|
} else {
|
|
2465
|
-
this.apiHost = this.appServer.
|
|
639
|
+
this.apiHost = this.appServer.includes("luzmo.com") ? this.appServer.replace("app", "api") : this.appServer;
|
|
2466
640
|
defaultParameters.apiHost = this.apiHost;
|
|
2467
641
|
}
|
|
2468
642
|
return defaultParameters;
|
|
2469
643
|
}
|
|
2470
644
|
_updateIframeUrl() {
|
|
2471
|
-
updateIframeUrl(this.iframe, this._iframeUrl);
|
|
645
|
+
SharedLib2.updateIframeUrl(this.iframe, this._iframeUrl);
|
|
2472
646
|
}
|
|
2473
647
|
// Setup loader / browser error
|
|
2474
648
|
_setupLoader() {
|
|
2475
|
-
const data = getLoader(this);
|
|
649
|
+
const data = SharedLib2.getLoader(this);
|
|
2476
650
|
this._loaderMsg = data.loadingMsg;
|
|
2477
651
|
if (data.errorMsg) {
|
|
2478
652
|
this.browserError = true;
|
|
@@ -2492,48 +666,48 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2492
666
|
_calculateDimAfterDashboardLoaded() {
|
|
2493
667
|
this.dashboardError = false;
|
|
2494
668
|
this._loaderStyles();
|
|
2495
|
-
_setCalculatedDimensions(this);
|
|
669
|
+
SharedLib2._setCalculatedDimensions(this);
|
|
2496
670
|
}
|
|
2497
671
|
// Set loader styles
|
|
2498
672
|
_loaderStyles() {
|
|
2499
|
-
this._containerStyle = containerStyles(this);
|
|
2500
|
-
this._loaderStyle = loaderStyles(this);
|
|
2501
|
-
this._loadingCircleStyle = plStyles(this);
|
|
2502
|
-
this._containerLoaderStyle = containerLoaderStyles(this);
|
|
2503
|
-
this._lcStyle = lcStyles(this);
|
|
673
|
+
this._containerStyle = SharedLib2.containerStyles(this);
|
|
674
|
+
this._loaderStyle = SharedLib2.loaderStyles(this);
|
|
675
|
+
this._loadingCircleStyle = SharedLib2.plStyles(this);
|
|
676
|
+
this._containerLoaderStyle = SharedLib2.containerLoaderStyles(this);
|
|
677
|
+
this._lcStyle = SharedLib2.lcStyles(this);
|
|
2504
678
|
}
|
|
2505
679
|
static get styles() {
|
|
2506
680
|
return [dashboardStyles];
|
|
2507
681
|
}
|
|
2508
682
|
render() {
|
|
2509
|
-
let toBeRenderedHTML =
|
|
2510
|
-
const loader =
|
|
683
|
+
let toBeRenderedHTML = html``;
|
|
684
|
+
const loader = html`
|
|
2511
685
|
<div
|
|
2512
686
|
class="luzmo-container-loader"
|
|
2513
687
|
id="luzmo-container-loader-${this._containerId}"
|
|
2514
|
-
style=${
|
|
688
|
+
style=${styleMap(
|
|
2515
689
|
this._containerLoaderStyle
|
|
2516
690
|
)}
|
|
2517
691
|
>
|
|
2518
692
|
<div
|
|
2519
693
|
class="luzmo-loader"
|
|
2520
694
|
id="luzmo-loader-${this._containerId}"
|
|
2521
|
-
style=${
|
|
695
|
+
style=${styleMap(this._loaderStyle)}
|
|
2522
696
|
>
|
|
2523
697
|
<div
|
|
2524
698
|
class="luzmo-lc"
|
|
2525
|
-
style=${
|
|
699
|
+
style=${styleMap(this._lcStyle)}
|
|
2526
700
|
>
|
|
2527
701
|
<div
|
|
2528
702
|
class="luzmo-loading-circle"
|
|
2529
|
-
style=${
|
|
703
|
+
style=${styleMap(
|
|
2530
704
|
this._loadingCircleStyle
|
|
2531
705
|
)}
|
|
2532
706
|
></div>
|
|
2533
|
-
${this._itemEmbedding ? "" :
|
|
707
|
+
${this._itemEmbedding ? "" : html`
|
|
2534
708
|
<div
|
|
2535
709
|
class="luzmo-loading-message"
|
|
2536
|
-
style=${
|
|
710
|
+
style=${styleMap({ color: this.loaderFontColor })}
|
|
2537
711
|
>
|
|
2538
712
|
${this._loaderMsg}
|
|
2539
713
|
</div>
|
|
@@ -2542,38 +716,41 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2542
716
|
</div>
|
|
2543
717
|
</div>
|
|
2544
718
|
`;
|
|
2545
|
-
if (
|
|
2546
|
-
toBeRenderedHTML =
|
|
2547
|
-
${this.dashboardId || this.dashboardSlug ?
|
|
719
|
+
if (this.getIsViewMode()) {
|
|
720
|
+
toBeRenderedHTML = this.isLibraryLoaded ? html`
|
|
721
|
+
${this.dashboardId || this.dashboardSlug ? html`<dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}" api-host="${this.params.apiHost}"></dashboard-component>` : html`
|
|
722
|
+
<div id="luzmo-error-${this._containerId}">
|
|
723
|
+
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
724
|
+
</div>
|
|
725
|
+
`}
|
|
726
|
+
` : html`${loader}`;
|
|
727
|
+
} else {
|
|
728
|
+
toBeRenderedHTML = html`
|
|
729
|
+
${this.dashboardId || this.dashboardSlug ? html`
|
|
2548
730
|
${loader}
|
|
2549
731
|
<iframe
|
|
2550
732
|
class="luzmo-embed-dashboard"
|
|
2551
733
|
id="${this._iframeId}"
|
|
2552
734
|
name="${this._iframeId}"
|
|
2553
|
-
style=${
|
|
735
|
+
style=${styleMap(this.iframeStyle)}
|
|
2554
736
|
src="${this._iframeUrl}"
|
|
2555
737
|
frameborder="0"
|
|
2556
738
|
></iframe>
|
|
2557
|
-
` :
|
|
2558
|
-
${this.browserError ?
|
|
739
|
+
` : html`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
|
|
740
|
+
${this.browserError ? html`
|
|
2559
741
|
<div id="luzmo-error-${this._containerId}">
|
|
2560
742
|
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
2561
743
|
</div>
|
|
2562
744
|
` : ""}
|
|
2563
745
|
`;
|
|
2564
|
-
} else {
|
|
2565
|
-
toBeRenderedHTML = this.isLibraryLoaded ? x`
|
|
2566
|
-
${this.dashboardId || this.dashboardSlug ? x`<dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}" api-host="${this.params.apiHost}"></dashboard-component>` : x`
|
|
2567
|
-
<div id="luzmo-error-${this._containerId}">
|
|
2568
|
-
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
2569
|
-
</div>
|
|
2570
|
-
`}
|
|
2571
|
-
` : x`${loader}`;
|
|
2572
746
|
}
|
|
2573
|
-
return
|
|
747
|
+
return html`
|
|
2574
748
|
<div
|
|
2575
749
|
class="dashboard-container"
|
|
2576
|
-
style=${
|
|
750
|
+
style=${styleMap(Object.assign({}, this._containerStyle, {
|
|
751
|
+
width: this.iframeStyle.width ?? "100%",
|
|
752
|
+
height: this.iframeStyle.height ?? "100%"
|
|
753
|
+
}))}
|
|
2577
754
|
>
|
|
2578
755
|
${toBeRenderedHTML}
|
|
2579
756
|
</div>
|
|
@@ -2581,7 +758,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2581
758
|
}
|
|
2582
759
|
getDashboards() {
|
|
2583
760
|
return new Promise(
|
|
2584
|
-
(resolve) => resolve(
|
|
761
|
+
(resolve) => resolve(luzmo_service_default._components)
|
|
2585
762
|
);
|
|
2586
763
|
}
|
|
2587
764
|
// Public methods
|
|
@@ -2590,7 +767,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2590
767
|
return this.dashboardReference.getData(itemId);
|
|
2591
768
|
}
|
|
2592
769
|
if (!this.getIsViewMode()) {
|
|
2593
|
-
return getData(this, this.iframe, itemId);
|
|
770
|
+
return SharedLib2.getData(this, this.iframe, itemId);
|
|
2594
771
|
}
|
|
2595
772
|
return Promise.reject();
|
|
2596
773
|
}
|
|
@@ -2599,16 +776,16 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2599
776
|
return this.dashboardReference.getFilters();
|
|
2600
777
|
}
|
|
2601
778
|
if (!this.getIsViewMode()) {
|
|
2602
|
-
return getFilters(this, this.iframe);
|
|
779
|
+
return SharedLib2.getFilters(this, this.iframe);
|
|
2603
780
|
}
|
|
2604
781
|
return Promise.reject();
|
|
2605
782
|
}
|
|
2606
783
|
setFilters(itemId, filters) {
|
|
2607
784
|
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2608
|
-
return
|
|
785
|
+
return this.dashboardReference.setFilters(itemId, filters);
|
|
2609
786
|
}
|
|
2610
787
|
if (!this.getIsViewMode()) {
|
|
2611
|
-
return setFilters(this, this.iframe, itemId, filters);
|
|
788
|
+
return SharedLib2.setFilters(this, this.iframe, itemId, filters);
|
|
2612
789
|
}
|
|
2613
790
|
return Promise.reject();
|
|
2614
791
|
}
|
|
@@ -2617,7 +794,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2617
794
|
return this.dashboardReference.setAuthorization(key, token);
|
|
2618
795
|
}
|
|
2619
796
|
if (!this.getIsViewMode()) {
|
|
2620
|
-
return setAuthorization(this, this.iframe, key, token);
|
|
797
|
+
return SharedLib2.setAuthorization(this, this.iframe, key, token);
|
|
2621
798
|
}
|
|
2622
799
|
return Promise.reject();
|
|
2623
800
|
}
|
|
@@ -2626,7 +803,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2626
803
|
return this.dashboardReference.refreshData(itemId);
|
|
2627
804
|
}
|
|
2628
805
|
if (!this.getIsViewMode()) {
|
|
2629
|
-
return itemId ? refreshData(this, this.iframe, itemId) : refreshData(this, this.iframe);
|
|
806
|
+
return itemId ? SharedLib2.refreshData(this, this.iframe, itemId) : SharedLib2.refreshData(this, this.iframe);
|
|
2630
807
|
}
|
|
2631
808
|
return Promise.reject();
|
|
2632
809
|
}
|
|
@@ -2635,7 +812,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2635
812
|
return this.dashboardReference.reloadDashboard();
|
|
2636
813
|
}
|
|
2637
814
|
if (!this.getIsViewMode()) {
|
|
2638
|
-
return reloadDashboard(this, this.iframe);
|
|
815
|
+
return SharedLib2.reloadDashboard(this, this.iframe);
|
|
2639
816
|
}
|
|
2640
817
|
return Promise.reject();
|
|
2641
818
|
}
|
|
@@ -2644,19 +821,22 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2644
821
|
return this.dashboardReference.exportDashboard(format);
|
|
2645
822
|
}
|
|
2646
823
|
if (!this.getIsViewMode()) {
|
|
2647
|
-
return format ? exportDashboard(this, this.iframe, format) : exportDashboard(this, this.iframe);
|
|
824
|
+
return format ? SharedLib2.exportDashboard(this, this.iframe, format) : SharedLib2.exportDashboard(this, this.iframe);
|
|
2648
825
|
}
|
|
2649
826
|
return Promise.reject();
|
|
2650
827
|
}
|
|
2651
828
|
getAccessibleDashboards() {
|
|
2652
829
|
if (!this.getIsViewMode()) {
|
|
2653
|
-
return getAccessibleDashboards(this, this.iframe);
|
|
830
|
+
return SharedLib2.getAccessibleDashboards(this, this.iframe);
|
|
2654
831
|
}
|
|
2655
832
|
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2656
833
|
return this.dashboardReference.getAccessibleDashboards();
|
|
2657
834
|
}
|
|
2658
835
|
return Promise.reject();
|
|
2659
836
|
}
|
|
837
|
+
addFilters(itemId, filters) {
|
|
838
|
+
return this.dashboardReference.addFilters(itemId, filters);
|
|
839
|
+
}
|
|
2660
840
|
setEditMode(editMode) {
|
|
2661
841
|
if (this.dashboardReference && editMode === "view") {
|
|
2662
842
|
this.editMode = "view";
|
|
@@ -2680,7 +860,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2680
860
|
return this.dashboardReference.setEditMode(editMode);
|
|
2681
861
|
}
|
|
2682
862
|
if (!this.getIsViewMode()) {
|
|
2683
|
-
return setEditMode(this, this.iframe, editMode);
|
|
863
|
+
return SharedLib2.setEditMode(this, this.iframe, editMode);
|
|
2684
864
|
}
|
|
2685
865
|
return Promise.reject();
|
|
2686
866
|
}
|
|
@@ -2688,161 +868,164 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
|
|
|
2688
868
|
if (this.getIsViewMode() && this.dashboardReference) {
|
|
2689
869
|
return this.dashboardReference.setPreview(preview);
|
|
2690
870
|
}
|
|
2691
|
-
return setPreview(this, this.iframe, preview);
|
|
871
|
+
return SharedLib2.setPreview(this, this.iframe, preview);
|
|
2692
872
|
}
|
|
2693
873
|
getIsViewMode() {
|
|
2694
|
-
if (this.
|
|
874
|
+
if (this.experimental && this.params.editMode === "view" || this.params.editMode === void 0) {
|
|
2695
875
|
return true;
|
|
2696
876
|
}
|
|
2697
877
|
return false;
|
|
2698
878
|
}
|
|
2699
879
|
};
|
|
2700
880
|
__decorateClass([
|
|
2701
|
-
|
|
2702
|
-
],
|
|
881
|
+
query(".dashboard-container")
|
|
882
|
+
], LuzmoDashboard.prototype, "container", 2);
|
|
2703
883
|
__decorateClass([
|
|
2704
|
-
|
|
2705
|
-
],
|
|
884
|
+
query("iframe")
|
|
885
|
+
], LuzmoDashboard.prototype, "iframe", 2);
|
|
2706
886
|
__decorateClass([
|
|
2707
|
-
|
|
2708
|
-
],
|
|
887
|
+
property()
|
|
888
|
+
], LuzmoDashboard.prototype, "dashboardId", 2);
|
|
2709
889
|
__decorateClass([
|
|
2710
|
-
|
|
2711
|
-
],
|
|
890
|
+
property()
|
|
891
|
+
], LuzmoDashboard.prototype, "dashboardSlug", 2);
|
|
2712
892
|
__decorateClass([
|
|
2713
|
-
|
|
2714
|
-
],
|
|
893
|
+
property()
|
|
894
|
+
], LuzmoDashboard.prototype, "itemId", 2);
|
|
2715
895
|
__decorateClass([
|
|
2716
|
-
|
|
2717
|
-
],
|
|
896
|
+
property()
|
|
897
|
+
], LuzmoDashboard.prototype, "language", 2);
|
|
2718
898
|
__decorateClass([
|
|
2719
|
-
|
|
2720
|
-
],
|
|
899
|
+
property()
|
|
900
|
+
], LuzmoDashboard.prototype, "qeVersion", 2);
|
|
2721
901
|
__decorateClass([
|
|
2722
|
-
|
|
2723
|
-
],
|
|
902
|
+
property()
|
|
903
|
+
], LuzmoDashboard.prototype, "screenMode", 2);
|
|
2724
904
|
__decorateClass([
|
|
2725
|
-
|
|
905
|
+
property({
|
|
2726
906
|
converter: {
|
|
2727
907
|
fromAttribute: (value) => value === "true",
|
|
2728
908
|
toAttribute: String
|
|
2729
909
|
}
|
|
2730
910
|
})
|
|
2731
|
-
],
|
|
911
|
+
], LuzmoDashboard.prototype, "switchScreenModeOnResize", 2);
|
|
2732
912
|
__decorateClass([
|
|
2733
|
-
|
|
2734
|
-
],
|
|
913
|
+
property()
|
|
914
|
+
], LuzmoDashboard.prototype, "editMode", 2);
|
|
2735
915
|
__decorateClass([
|
|
2736
|
-
|
|
2737
|
-
],
|
|
916
|
+
property()
|
|
917
|
+
], LuzmoDashboard.prototype, "mainColor", 2);
|
|
2738
918
|
__decorateClass([
|
|
2739
|
-
|
|
2740
|
-
],
|
|
919
|
+
property()
|
|
920
|
+
], LuzmoDashboard.prototype, "accentColor", 2);
|
|
2741
921
|
__decorateClass([
|
|
2742
|
-
|
|
2743
|
-
],
|
|
922
|
+
property()
|
|
923
|
+
], LuzmoDashboard.prototype, "authToken", 2);
|
|
2744
924
|
__decorateClass([
|
|
2745
|
-
|
|
2746
|
-
],
|
|
925
|
+
property()
|
|
926
|
+
], LuzmoDashboard.prototype, "authKey", 2);
|
|
2747
927
|
__decorateClass([
|
|
2748
|
-
|
|
2749
|
-
],
|
|
928
|
+
property()
|
|
929
|
+
], LuzmoDashboard.prototype, "loaderBackground", 2);
|
|
2750
930
|
__decorateClass([
|
|
2751
|
-
|
|
2752
|
-
],
|
|
931
|
+
property()
|
|
932
|
+
], LuzmoDashboard.prototype, "loaderFontColor", 2);
|
|
2753
933
|
__decorateClass([
|
|
2754
|
-
|
|
2755
|
-
],
|
|
934
|
+
property()
|
|
935
|
+
], LuzmoDashboard.prototype, "loaderSpinnerColor", 2);
|
|
2756
936
|
__decorateClass([
|
|
2757
|
-
|
|
2758
|
-
],
|
|
937
|
+
property()
|
|
938
|
+
], LuzmoDashboard.prototype, "loaderSpinnerBackground", 2);
|
|
2759
939
|
__decorateClass([
|
|
2760
|
-
|
|
2761
|
-
],
|
|
940
|
+
property()
|
|
941
|
+
], LuzmoDashboard.prototype, "appServer", 2);
|
|
2762
942
|
__decorateClass([
|
|
2763
|
-
|
|
2764
|
-
],
|
|
943
|
+
property()
|
|
944
|
+
], LuzmoDashboard.prototype, "timezoneId", 2);
|
|
2765
945
|
__decorateClass([
|
|
2766
|
-
|
|
2767
|
-
],
|
|
946
|
+
property()
|
|
947
|
+
], LuzmoDashboard.prototype, "apiHost", 2);
|
|
2768
948
|
__decorateClass([
|
|
2769
|
-
|
|
2770
|
-
],
|
|
949
|
+
property({ type: Object })
|
|
950
|
+
], LuzmoDashboard.prototype, "itemDimensions", 2);
|
|
2771
951
|
__decorateClass([
|
|
2772
|
-
|
|
2773
|
-
],
|
|
952
|
+
property()
|
|
953
|
+
], LuzmoDashboard.prototype, "experimental", 2);
|
|
2774
954
|
__decorateClass([
|
|
2775
|
-
|
|
2776
|
-
],
|
|
955
|
+
property({ attribute: false })
|
|
956
|
+
], LuzmoDashboard.prototype, "_containerId", 2);
|
|
2777
957
|
__decorateClass([
|
|
2778
|
-
|
|
2779
|
-
],
|
|
958
|
+
property({ attribute: false })
|
|
959
|
+
], LuzmoDashboard.prototype, "_iframeId", 2);
|
|
2780
960
|
__decorateClass([
|
|
2781
|
-
|
|
2782
|
-
],
|
|
961
|
+
property({ attribute: false })
|
|
962
|
+
], LuzmoDashboard.prototype, "params", 2);
|
|
2783
963
|
__decorateClass([
|
|
2784
|
-
|
|
2785
|
-
],
|
|
964
|
+
property({ attribute: false })
|
|
965
|
+
], LuzmoDashboard.prototype, "_iframeUrl", 2);
|
|
2786
966
|
__decorateClass([
|
|
2787
|
-
|
|
2788
|
-
],
|
|
967
|
+
property({ attribute: false })
|
|
968
|
+
], LuzmoDashboard.prototype, "iframeLoaded", 2);
|
|
2789
969
|
__decorateClass([
|
|
2790
|
-
|
|
2791
|
-
],
|
|
970
|
+
property({ attribute: false })
|
|
971
|
+
], LuzmoDashboard.prototype, "promises", 2);
|
|
2792
972
|
__decorateClass([
|
|
2793
|
-
|
|
2794
|
-
],
|
|
973
|
+
property({ attribute: false })
|
|
974
|
+
], LuzmoDashboard.prototype, "iframeStyle", 2);
|
|
2795
975
|
__decorateClass([
|
|
2796
|
-
|
|
2797
|
-
],
|
|
976
|
+
property({ attribute: false })
|
|
977
|
+
], LuzmoDashboard.prototype, "_containerStyle", 2);
|
|
2798
978
|
__decorateClass([
|
|
2799
|
-
|
|
2800
|
-
],
|
|
979
|
+
property({ attribute: false })
|
|
980
|
+
], LuzmoDashboard.prototype, "_loaderStyle", 2);
|
|
2801
981
|
__decorateClass([
|
|
2802
|
-
|
|
2803
|
-
],
|
|
982
|
+
property({ attribute: false })
|
|
983
|
+
], LuzmoDashboard.prototype, "_lcStyle", 2);
|
|
2804
984
|
__decorateClass([
|
|
2805
|
-
|
|
2806
|
-
],
|
|
985
|
+
property({ attribute: false })
|
|
986
|
+
], LuzmoDashboard.prototype, "_loadingCircleStyle", 2);
|
|
2807
987
|
__decorateClass([
|
|
2808
|
-
|
|
2809
|
-
],
|
|
988
|
+
property({ attribute: false })
|
|
989
|
+
], LuzmoDashboard.prototype, "_containerLoaderStyle", 2);
|
|
2810
990
|
__decorateClass([
|
|
2811
|
-
|
|
2812
|
-
],
|
|
991
|
+
property({ attribute: false })
|
|
992
|
+
], LuzmoDashboard.prototype, "_loaderMsg", 2);
|
|
2813
993
|
__decorateClass([
|
|
2814
|
-
|
|
2815
|
-
],
|
|
994
|
+
property({ attribute: false })
|
|
995
|
+
], LuzmoDashboard.prototype, "containerWidth", 2);
|
|
2816
996
|
__decorateClass([
|
|
2817
|
-
|
|
2818
|
-
],
|
|
997
|
+
property({ attribute: false })
|
|
998
|
+
], LuzmoDashboard.prototype, "dimensions", 2);
|
|
2819
999
|
__decorateClass([
|
|
2820
|
-
|
|
2821
|
-
],
|
|
1000
|
+
property({ attribute: false })
|
|
1001
|
+
], LuzmoDashboard.prototype, "currentScreenMode", 2);
|
|
2822
1002
|
__decorateClass([
|
|
2823
|
-
|
|
2824
|
-
],
|
|
1003
|
+
property({ attribute: false })
|
|
1004
|
+
], LuzmoDashboard.prototype, "_itemEmbedding", 2);
|
|
2825
1005
|
__decorateClass([
|
|
2826
|
-
|
|
2827
|
-
],
|
|
1006
|
+
property({ attribute: false })
|
|
1007
|
+
], LuzmoDashboard.prototype, "browserError", 2);
|
|
2828
1008
|
__decorateClass([
|
|
2829
|
-
|
|
2830
|
-
],
|
|
1009
|
+
property({ attribute: false })
|
|
1010
|
+
], LuzmoDashboard.prototype, "browserErrorMsg", 2);
|
|
2831
1011
|
__decorateClass([
|
|
2832
|
-
|
|
2833
|
-
],
|
|
1012
|
+
property({ attribute: false })
|
|
1013
|
+
], LuzmoDashboard.prototype, "dashboardError", 2);
|
|
2834
1014
|
__decorateClass([
|
|
2835
|
-
|
|
2836
|
-
],
|
|
1015
|
+
property({ attribute: false })
|
|
1016
|
+
], LuzmoDashboard.prototype, "browserNotSupported", 2);
|
|
2837
1017
|
__decorateClass([
|
|
2838
|
-
|
|
2839
|
-
],
|
|
1018
|
+
property({ attribute: false })
|
|
1019
|
+
], LuzmoDashboard.prototype, "VERSION", 2);
|
|
2840
1020
|
__decorateClass([
|
|
2841
|
-
|
|
2842
|
-
],
|
|
1021
|
+
state()
|
|
1022
|
+
], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
|
|
2843
1023
|
__decorateClass([
|
|
2844
|
-
|
|
2845
|
-
],
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
],
|
|
1024
|
+
state()
|
|
1025
|
+
], LuzmoDashboard.prototype, "dashboardReference", 2);
|
|
1026
|
+
LuzmoDashboard = __decorateClass([
|
|
1027
|
+
customElement("luzmo-dashboard")
|
|
1028
|
+
], LuzmoDashboard);
|
|
1029
|
+
export {
|
|
1030
|
+
LuzmoDashboard
|
|
1031
|
+
};
|