@openfin/web-utils 0.37.30 → 0.38.1
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/README.md
CHANGED
|
@@ -4,6 +4,7 @@ declare const mixin: (Base: typeof HTMLElement) => {
|
|
|
4
4
|
"__#1@#iframe": HTMLIFrameElement;
|
|
5
5
|
brokerUrl: string | null;
|
|
6
6
|
name: string | null;
|
|
7
|
+
forceFrameName: string | null;
|
|
7
8
|
uuid: string | null;
|
|
8
9
|
src: string | null;
|
|
9
10
|
providerId: string | null;
|
|
@@ -323,14 +324,18 @@ declare const mixin: (Base: typeof HTMLElement) => {
|
|
|
323
324
|
export type OfViewAttributes = {
|
|
324
325
|
'of-context-group'?: string;
|
|
325
326
|
'of-provider-id'?: string;
|
|
326
|
-
'src': string;
|
|
327
327
|
'of-uuid': string;
|
|
328
328
|
'of-name': string;
|
|
329
329
|
'of-broker'?: string;
|
|
330
|
+
'forceFrameName'?: string;
|
|
331
|
+
'src': string;
|
|
330
332
|
};
|
|
331
333
|
type OfViewElementConstructor = ReturnType<typeof mixin>;
|
|
332
334
|
export type OfViewElement = OfViewElementConstructor extends {
|
|
333
335
|
new (): infer T;
|
|
334
336
|
} ? T : never;
|
|
335
337
|
export declare const registerOfViewElement: () => void;
|
|
336
|
-
|
|
338
|
+
declare class OfViewElementFactory {
|
|
339
|
+
static create(attributes: OfViewAttributes): OfViewElement;
|
|
340
|
+
}
|
|
341
|
+
export { OfViewElementFactory };
|
|
@@ -12,13 +12,20 @@ const mixin = (Base) => class _OfViewElement extends Base {
|
|
|
12
12
|
this.#iframe.src = this.src;
|
|
13
13
|
this.#iframe.style.height = '100%';
|
|
14
14
|
this.#iframe.style.width = '100%';
|
|
15
|
-
this.#iframe.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
this.#iframe.style.border = 'none';
|
|
16
|
+
if (this.forceFrameName) {
|
|
17
|
+
// if forceFrameName is set, the consumer is intentionally breaking auto-connection
|
|
18
|
+
this.#iframe.setAttribute('name', this.forceFrameName);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.#iframe.setAttribute('name', encodeOptions({
|
|
22
|
+
brokerUrl: this.brokerUrl,
|
|
23
|
+
name: this.name,
|
|
24
|
+
uuid: this.uuid,
|
|
25
|
+
providerId: this.providerId,
|
|
26
|
+
contextGroup: this.contextGroup
|
|
27
|
+
}, 'of-frame'));
|
|
28
|
+
}
|
|
22
29
|
this.#iframe.setAttribute('id', this.name);
|
|
23
30
|
this.appendChild(this.#iframe);
|
|
24
31
|
}
|
|
@@ -40,6 +47,14 @@ const mixin = (Base) => class _OfViewElement extends Base {
|
|
|
40
47
|
this.setAttribute('of-name', val);
|
|
41
48
|
}
|
|
42
49
|
}
|
|
50
|
+
get forceFrameName() {
|
|
51
|
+
return this.getAttribute('forceFrameName');
|
|
52
|
+
}
|
|
53
|
+
set forceFrameName(val) {
|
|
54
|
+
if (val) {
|
|
55
|
+
this.setAttribute('forceFrameName', val);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
43
58
|
get uuid() {
|
|
44
59
|
return this.getAttribute('of-uuid');
|
|
45
60
|
}
|
|
@@ -77,3 +92,13 @@ const mixin = (Base) => class _OfViewElement extends Base {
|
|
|
77
92
|
}
|
|
78
93
|
};
|
|
79
94
|
export const registerOfViewElement = () => customElements.define('of-view', mixin(HTMLElement));
|
|
95
|
+
class OfViewElementFactory {
|
|
96
|
+
static create(attributes) {
|
|
97
|
+
const ofView = document.createElement('of-view');
|
|
98
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
99
|
+
ofView.setAttribute(key, value);
|
|
100
|
+
});
|
|
101
|
+
return ofView;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export { OfViewElementFactory };
|