@schukai/monster 3.80.5 → 3.82.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +19 -0
- package/package.json +1 -1
- package/source/components/constants.mjs +0 -13
- package/source/components/datatable/change-button.mjs +0 -1
- package/source/components/datatable/columnbar.mjs +0 -1
- package/source/components/datatable/constants.mjs +0 -12
- package/source/components/datatable/dataset.mjs +0 -1
- package/source/components/datatable/datasource/dom.mjs +0 -1
- package/source/components/datatable/datasource/rest.mjs +0 -1
- package/source/components/datatable/datasource.mjs +0 -1
- package/source/components/datatable/datatable/header.mjs +0 -1
- package/source/components/datatable/datatable.mjs +0 -1
- package/source/components/datatable/embedded-pagination.mjs +0 -1
- package/source/components/datatable/filter/abstract-base.mjs +0 -1
- package/source/components/datatable/filter/date-range.mjs +0 -1
- package/source/components/datatable/filter/input.mjs +0 -1
- package/source/components/datatable/filter/range.mjs +0 -1
- package/source/components/datatable/filter/select.mjs +0 -1
- package/source/components/datatable/filter/settings.mjs +0 -2
- package/source/components/datatable/filter-button.mjs +0 -1
- package/source/components/datatable/filter.mjs +0 -1
- package/source/components/datatable/pagination.mjs +0 -1
- package/source/components/datatable/status.mjs +0 -1
- package/source/components/datatable/stylesheet/change-button.mjs +1 -1
- package/source/components/datatable/stylesheet/column-bar.mjs +1 -1
- package/source/components/datatable/stylesheet/dataset.mjs +1 -1
- package/source/components/datatable/stylesheet/datatable.mjs +1 -1
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-button.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-select.mjs +1 -1
- package/source/components/datatable/stylesheet/filter.mjs +1 -1
- package/source/components/datatable/stylesheet/pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/save-button.mjs +1 -1
- package/source/components/datatable/stylesheet/status.mjs +1 -1
- package/source/components/form/action-button.mjs +0 -1
- package/source/components/form/api-button.mjs +0 -1
- package/source/components/form/button-bar.mjs +0 -1
- package/source/components/form/confirm-button.mjs +0 -2
- package/source/components/form/constants.mjs +0 -10
- package/source/components/form/context-error.mjs +0 -1
- package/source/components/form/message-state-button.mjs +0 -35
- package/source/components/form/popper-button.mjs +0 -2
- package/source/components/form/select.mjs +2 -4
- package/source/components/form/stylesheet/action-button.mjs +1 -1
- package/source/components/form/stylesheet/button-bar.mjs +1 -1
- package/source/components/form/stylesheet/context-error.mjs +1 -1
- package/source/components/form/stylesheet/context-help.mjs +1 -1
- package/source/components/form/stylesheet/select.mjs +1 -1
- package/source/components/form/template.mjs +0 -1
- package/source/components/form/tree-select.mjs +0 -2
- package/source/components/form/types/state.mjs +0 -2
- package/source/components/host/call-button.mjs +0 -3
- package/source/components/host/collapse.mjs +0 -1
- package/source/components/host/config-manager.mjs +0 -1
- package/source/components/host/constants.mjs +0 -1
- package/source/components/host/host.mjs +0 -1
- package/source/components/host/overlay.mjs +0 -1
- package/source/components/host/stylesheet/call-button.mjs +1 -1
- package/source/components/host/stylesheet/host.mjs +1 -1
- package/source/components/host/stylesheet/overlay.mjs +1 -1
- package/source/components/host/stylesheet/toggle-button.mjs +1 -1
- package/source/components/host/stylesheet/viewer.mjs +1 -1
- package/source/components/host/toggle-button.mjs +0 -1
- package/source/components/host/viewer.mjs +0 -1
- package/source/components/layout/iframe.mjs +264 -250
- package/source/components/layout/stylesheet/collapse.mjs +1 -1
- package/source/components/layout/stylesheet/details.mjs +1 -1
- package/source/components/layout/stylesheet/panel.mjs +1 -1
- package/source/components/layout/stylesheet/slider.mjs +1 -1
- package/source/components/layout/stylesheet/split-panel.mjs +1 -1
- package/source/components/layout/stylesheet/tabs.mjs +1 -1
- package/source/components/layout/stylesheet/width-toggle.mjs +1 -1
- package/source/components/navigation/stylesheet/table-of-content.mjs +1 -1
- package/source/components/notify/constants.mjs +0 -1
- package/source/components/notify/message.mjs +0 -1
- package/source/components/notify/notify.mjs +0 -1
- package/source/components/notify/stylesheet/message.mjs +1 -1
- package/source/components/state/log/entry.mjs +0 -1
- package/source/components/state/state.mjs +0 -6
- package/source/components/style/badge.css +2 -0
- package/source/components/style/border.css +2 -0
- package/source/components/style/button.css +2 -0
- package/source/components/style/card.css +2 -0
- package/source/components/style/color.css +2 -0
- package/source/components/style/common.css +2 -0
- package/source/components/style/control.css +2 -0
- package/source/components/style/data-grid.css +2 -0
- package/source/components/style/display.css +2 -0
- package/source/components/style/floating-ui.css +2 -0
- package/source/components/style/form.css +2 -0
- package/source/components/style/host.css +2 -0
- package/source/components/style/icons.css +2 -0
- package/source/components/style/link.css +2 -0
- package/source/components/style/normalize.css +2 -0
- package/source/components/style/popper.css +2 -0
- package/source/components/style/property.css +2 -0
- package/source/components/style/ripple.css +2 -0
- package/source/components/style/skeleton.css +2 -0
- package/source/components/style/space.css +2 -0
- package/source/components/style/spinner.css +2 -0
- package/source/components/style/table.css +2 -0
- package/source/components/style/theme.css +2 -0
- package/source/components/style/typography.css +2 -0
- package/source/components/stylesheet/card.mjs +1 -1
- package/source/components/stylesheet/icons.mjs +1 -1
- package/source/components/stylesheet/property.mjs +1 -1
- package/source/components/stylesheet/space.mjs +1 -1
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +1 -1
- package/source/constants.mjs +0 -2
- package/source/constraints/abstract.mjs +0 -1
- package/source/constraints/abstractoperator.mjs +0 -1
- package/source/data/buildmap.mjs +0 -5
- package/source/data/buildtree.mjs +0 -1
- package/source/data/datasource/dom.mjs +0 -1
- package/source/data/datasource/server/restapi/data-fetch-error.mjs +0 -1
- package/source/data/datasource/server/restapi/writeerror.mjs +0 -1
- package/source/data/datasource/server/restapi.mjs +0 -2
- package/source/data/datasource/server/webconnect.mjs +0 -1
- package/source/data/datasource/server.mjs +0 -1
- package/source/data/datasource/storage/localstorage.mjs +0 -1
- package/source/data/datasource/storage/sessionstorage.mjs +0 -1
- package/source/data/datasource/storage.mjs +0 -1
- package/source/data/datasource.mjs +0 -2
- package/source/data/diff.mjs +0 -1
- package/source/data/extend.mjs +0 -1
- package/source/dom/assembler.mjs +0 -2
- package/source/dom/attributes.mjs +0 -13
- package/source/dom/constants.mjs +0 -59
- package/source/dom/customelement.mjs +0 -7
- package/source/dom/dimension.mjs +0 -2
- package/source/dom/events.mjs +0 -3
- package/source/dom/focusmanager.mjs +0 -1
- package/source/dom/locale.mjs +0 -1
- package/source/dom/ready.mjs +0 -2
- package/source/dom/resource/data.mjs +0 -1
- package/source/dom/resource/link/stylesheet.mjs +0 -1
- package/source/dom/resource/link.mjs +0 -1
- package/source/dom/resource/script.mjs +0 -1
- package/source/dom/resource.mjs +0 -1
- package/source/dom/resourcemanager.mjs +0 -1
- package/source/dom/template.mjs +0 -2
- package/source/dom/theme.mjs +0 -2
- package/source/dom/updater.mjs +0 -1
- package/source/dom/util.mjs +0 -7
- package/source/dom/worker/factory.mjs +0 -1
- package/source/i18n/locale.mjs +0 -3
- package/source/i18n/providers/fetch.mjs +0 -1
- package/source/logging/logentry.mjs +0 -1
- package/source/math/random.mjs +0 -1
- package/source/monster.mjs +0 -1
- package/source/net/webconnect.mjs +0 -1
- package/source/text/formatter.mjs +0 -1
- package/source/text/generate-range-comparison-expression.mjs +0 -1
- package/source/types/binary.mjs +0 -2
- package/source/types/global.mjs +0 -3
- package/source/types/id.mjs +0 -1
- package/source/types/internal.mjs +0 -1
- package/source/types/mediatype.mjs +0 -4
- package/source/types/node.mjs +0 -1
- package/source/types/validate.mjs +0 -10
- package/source/util/clone.mjs +0 -1
- package/source/util/comparator.mjs +0 -1
- package/source/util/freeze.mjs +0 -1
- package/source/util/runtime.mjs +0 -8
- package/source/util/trimspaces.mjs +0 -1
- package/source/components/stylesheet/mixin/form.mjs +0 -38
@@ -10,25 +10,20 @@
|
|
10
10
|
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
11
11
|
*/
|
12
12
|
|
13
|
-
import {
|
14
|
-
import {
|
13
|
+
import {instanceSymbol} from "../../constants.mjs";
|
14
|
+
import {ATTRIBUTE_ROLE} from "../../dom/constants.mjs";
|
15
|
+
import {CustomElement} from "../../dom/customelement.mjs";
|
15
16
|
import {
|
16
|
-
|
17
|
-
|
18
|
-
} from "../../dom/constants.mjs";
|
19
|
-
import { CustomControl } from "../../dom/customcontrol.mjs";
|
20
|
-
import { CustomElement } from "../../dom/customelement.mjs";
|
21
|
-
import {
|
22
|
-
assembleMethodSymbol,
|
23
|
-
registerCustomElement,
|
17
|
+
assembleMethodSymbol,
|
18
|
+
registerCustomElement,
|
24
19
|
} from "../../dom/customelement.mjs";
|
25
|
-
import {
|
26
|
-
import {
|
27
|
-
import {
|
28
|
-
import {
|
29
|
-
import {
|
20
|
+
import {findTargetElementFromEvent} from "../../dom/events.mjs";
|
21
|
+
import {isFunction} from "../../types/is.mjs";
|
22
|
+
import {DeadMansSwitch} from "../../util/deadmansswitch.mjs";
|
23
|
+
import {IframeStyleSheet} from "./stylesheet/iframe.mjs";
|
24
|
+
import {fireCustomEvent} from "../../dom/events.mjs";
|
30
25
|
|
31
|
-
export {
|
26
|
+
export {Iframe};
|
32
27
|
|
33
28
|
/**
|
34
29
|
* @private
|
@@ -67,125 +62,133 @@ const timerCallbackSymbol = Symbol("timerCallback");
|
|
67
62
|
* @summary A cool and fancy Iframe that can make your life easier and also looks good.
|
68
63
|
*/
|
69
64
|
class Iframe extends CustomElement {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
65
|
+
/**
|
66
|
+
* This method is called by the `instanceof` operator.
|
67
|
+
* @return {symbol}
|
68
|
+
*/
|
69
|
+
static get [instanceSymbol]() {
|
70
|
+
return Symbol.for("@schukai/monster/components/layout/iframe@@instance");
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
*
|
75
|
+
* @return {Components.Layout.Iframe
|
76
|
+
*/
|
77
|
+
[assembleMethodSymbol]() {
|
78
|
+
super[assembleMethodSymbol]();
|
79
|
+
initControlReferences.call(this);
|
80
|
+
initEventHandler.call(this);
|
81
|
+
calcHeight.call(this);
|
82
|
+
return this;
|
83
|
+
}
|
84
|
+
|
85
|
+
/**
|
86
|
+
* This method is called by the dom and should not be called directly.
|
87
|
+
*
|
88
|
+
* @return {void}
|
89
|
+
*/
|
90
|
+
connectedCallback() {
|
91
|
+
super.connectedCallback();
|
92
|
+
attachResizeObserver.call(this);
|
93
|
+
|
94
|
+
// disable scrolling in parent node
|
95
|
+
if (this.parentNode && this.parentNode instanceof HTMLElement) {
|
96
|
+
this.parentNode.style.overflow = "hidden";
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* This method is called by the dom and should not be called directly.
|
102
|
+
*
|
103
|
+
* @return {void}
|
104
|
+
*/
|
105
|
+
disconnectedCallback() {
|
106
|
+
super.disconnectedCallback();
|
107
|
+
disconnectResizeObserver.call(this);
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
112
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
113
|
+
*
|
114
|
+
* The individual configuration values can be found in the table.
|
115
|
+
*
|
116
|
+
* @property {Object} templates Template definitions
|
117
|
+
* @property {string} templates.main Main template
|
118
|
+
* @property {Object} labels Label definitions
|
119
|
+
* @property {Object} actions Callbacks
|
120
|
+
* @property {string} actions.click="throw Error" Callback when clicked
|
121
|
+
* @property {Object} features Features
|
122
|
+
* @property {boolean} features.allowFullScreen=true Allow fullscreen
|
123
|
+
* @property {boolean} features.allowPaymentRequest=true Allow payment request
|
124
|
+
* @property {boolean} features.replaceTargets=true Replace parent target in iframe
|
125
|
+
* @property {string} loading="eager" Loading state
|
126
|
+
* @property {string} referrerPolicy="no-referrer" Referrer policy
|
127
|
+
* @property {string} src Source
|
128
|
+
* @property {Object} classes CSS classes
|
129
|
+
* @property {boolean} disabled=false Disabled state
|
130
|
+
*/
|
131
|
+
get defaults() {
|
132
|
+
return Object.assign({}, super.defaults, {
|
133
|
+
templates: {
|
134
|
+
main: getTemplate(),
|
135
|
+
},
|
136
|
+
src: null,
|
137
|
+
|
138
|
+
/* "allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation"*/
|
139
|
+
sandbox: null,
|
140
|
+
|
141
|
+
labels: {},
|
142
|
+
classes: {},
|
143
|
+
|
144
|
+
name: "",
|
145
|
+
|
146
|
+
referrerPolicy: "no-referrer",
|
147
|
+
|
148
|
+
disabled: false,
|
149
|
+
features: {
|
150
|
+
allowFullScreen: true,
|
151
|
+
allowPaymentRequest: true,
|
152
|
+
replaceTargets: true,
|
153
|
+
},
|
154
|
+
|
155
|
+
loading: "eager",
|
156
|
+
|
157
|
+
actions: {
|
158
|
+
click: () => {
|
159
|
+
throw new Error("the click action is not defined");
|
160
|
+
},
|
161
|
+
},
|
162
|
+
});
|
163
|
+
}
|
164
|
+
|
165
|
+
/**
|
166
|
+
* @return {string}
|
167
|
+
*/
|
168
|
+
static getTag() {
|
169
|
+
return "monster-iframe";
|
170
|
+
}
|
171
|
+
|
172
|
+
/**
|
173
|
+
* @return {CSSStyleSheet[]}
|
174
|
+
*/
|
175
|
+
static getCSSStyleSheet() {
|
176
|
+
return [IframeStyleSheet];
|
177
|
+
}
|
174
178
|
}
|
175
179
|
|
176
180
|
/**
|
177
181
|
* @private
|
178
182
|
*/
|
179
183
|
function calcHeight() {
|
180
|
-
|
184
|
+
this.style.boxSizing = "border-box";
|
181
185
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
}
|
186
|
+
const height = calculateMaximumHeight.call(this, this.parentNode);
|
187
|
+
if (height < 0 || isNaN(height)) {
|
188
|
+
return;
|
189
|
+
}
|
187
190
|
|
188
|
-
|
191
|
+
this[iframeElementSymbol].style.height = `${height}px`;
|
189
192
|
}
|
190
193
|
|
191
194
|
/**
|
@@ -194,90 +197,90 @@ function calcHeight() {
|
|
194
197
|
* @return {*}
|
195
198
|
*/
|
196
199
|
function calculateMaximumHeight(element) {
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
200
|
+
let totalBottomBorder = 0;
|
201
|
+
let totalBottomPadding = 0;
|
202
|
+
let totalBottomMargin = 0;
|
203
|
+
let totalOutlineHeight = 0;
|
204
|
+
let totalBoxShadowHeight = 0;
|
205
|
+
let currentElement = element;
|
206
|
+
|
207
|
+
while (currentElement && currentElement !== document.body) {
|
208
|
+
const style = window.getComputedStyle(currentElement);
|
209
|
+
const boxSizing = style.boxSizing;
|
210
|
+
|
211
|
+
const elementHeight = currentElement.getBoundingClientRect().height;
|
212
|
+
|
213
|
+
const borderBottomWidth = parseFloat(style.borderBottomWidth);
|
214
|
+
const paddingBottom = parseFloat(style.paddingBottom);
|
215
|
+
const marginBottom = parseFloat(style.marginBottom);
|
216
|
+
|
217
|
+
const outlineHeight = parseFloat(style.outlineWidth);
|
218
|
+
|
219
|
+
totalBottomBorder += isNaN(borderBottomWidth) ? 0 : borderBottomWidth;
|
220
|
+
totalBottomPadding +=
|
221
|
+
isNaN(paddingBottom) || boxSizing === "border-box" ? 0 : paddingBottom;
|
222
|
+
totalBottomMargin += isNaN(marginBottom) ? 0 : marginBottom;
|
223
|
+
totalOutlineHeight += isNaN(outlineHeight) ? 0 : outlineHeight;
|
224
|
+
|
225
|
+
const boxShadow = style.boxShadow;
|
226
|
+
let boxShadowVerticalTotal = 0;
|
227
|
+
|
228
|
+
if (boxShadow !== "none") {
|
229
|
+
const boxShadowValues = boxShadow.split(" ");
|
230
|
+
const verticalOffset = parseFloat(boxShadowValues[3]);
|
231
|
+
const blurRadius = parseFloat(boxShadowValues[4]);
|
232
|
+
const spreadRadius = parseFloat(boxShadowValues[5]);
|
233
|
+
|
234
|
+
boxShadowVerticalTotal = verticalOffset + blurRadius + spreadRadius;
|
235
|
+
}
|
236
|
+
|
237
|
+
totalBoxShadowHeight += isNaN(boxShadowVerticalTotal)
|
238
|
+
? 0
|
239
|
+
: boxShadowVerticalTotal;
|
240
|
+
|
241
|
+
if (elementHeight > 200) {
|
242
|
+
return (
|
243
|
+
elementHeight -
|
244
|
+
totalBottomBorder -
|
245
|
+
totalBottomPadding -
|
246
|
+
totalBottomMargin -
|
247
|
+
totalOutlineHeight -
|
248
|
+
totalBoxShadowHeight
|
249
|
+
);
|
250
|
+
}
|
251
|
+
|
252
|
+
currentElement = currentElement.parentNode || currentElement.host;
|
253
|
+
}
|
251
254
|
}
|
252
255
|
|
253
256
|
/**
|
254
257
|
* @private
|
255
258
|
*/
|
256
259
|
function attachResizeObserver() {
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
260
|
+
// against flickering
|
261
|
+
this[resizeObserverSymbol] = new ResizeObserver(() => {
|
262
|
+
if (this[timerCallbackSymbol] instanceof DeadMansSwitch) {
|
263
|
+
try {
|
264
|
+
this[timerCallbackSymbol].touch();
|
265
|
+
return;
|
266
|
+
} catch (e) {
|
267
|
+
delete this[timerCallbackSymbol];
|
268
|
+
}
|
269
|
+
}
|
270
|
+
|
271
|
+
this[timerCallbackSymbol] = new DeadMansSwitch(200, () => {
|
272
|
+
calcHeight.call(this);
|
273
|
+
});
|
274
|
+
});
|
275
|
+
|
276
|
+
this[resizeObserverSymbol].observe(this.ownerDocument.body);
|
277
|
+
this[resizeObserverSymbol].observe(document.scrollingElement);
|
275
278
|
}
|
276
279
|
|
277
280
|
function disconnectResizeObserver() {
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
+
if (this[resizeObserverSymbol] instanceof ResizeObserver) {
|
282
|
+
this[resizeObserverSymbol].disconnect();
|
283
|
+
}
|
281
284
|
}
|
282
285
|
|
283
286
|
/**
|
@@ -286,36 +289,46 @@ function disconnectResizeObserver() {
|
|
286
289
|
* @fires monster-iframe-clicked
|
287
290
|
*/
|
288
291
|
function initEventHandler() {
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
292
|
+
const self = this;
|
293
|
+
const element = this[iframeElementSymbol];
|
294
|
+
|
295
|
+
const type = "click";
|
296
|
+
|
297
|
+
element.addEventListener(type, function (event) {
|
298
|
+
const callback = self.getOption("actions.click");
|
299
|
+
|
300
|
+
fireCustomEvent(self, "monster-iframe-clicked", {
|
301
|
+
element: self,
|
302
|
+
});
|
303
|
+
|
304
|
+
if (!isFunction(callback)) {
|
305
|
+
return;
|
306
|
+
}
|
307
|
+
|
308
|
+
const element = findTargetElementFromEvent(
|
309
|
+
event,
|
310
|
+
ATTRIBUTE_ROLE,
|
311
|
+
"control",
|
312
|
+
);
|
313
|
+
|
314
|
+
if (!(element instanceof Node && self.hasNode(element))) {
|
315
|
+
return;
|
316
|
+
}
|
317
|
+
|
318
|
+
callback.call(self, event);
|
319
|
+
});
|
320
|
+
|
321
|
+
this[iframeElementSymbol].addEventListener("load", () => {
|
322
|
+
calcHeight.call(this);
|
323
|
+
if (this.getOption("features.replaceParentTarget")) {
|
324
|
+
var links = this[iframeElementSymbol].contentDocument.querySelectorAll('a[target="_parent"], form[target="_parent"], a[target="_top"], form[target="_top"]');
|
325
|
+
links.forEach(function(link) {
|
326
|
+
link.target = '_self';
|
327
|
+
});
|
328
|
+
}
|
329
|
+
});
|
330
|
+
|
331
|
+
return this;
|
319
332
|
}
|
320
333
|
|
321
334
|
/**
|
@@ -323,17 +336,17 @@ function initEventHandler() {
|
|
323
336
|
* @return {void}
|
324
337
|
*/
|
325
338
|
function initControlReferences() {
|
326
|
-
|
327
|
-
|
328
|
-
|
339
|
+
if (!this.shadowRoot) {
|
340
|
+
throw new Error("no shadow-root is defined");
|
341
|
+
}
|
329
342
|
|
330
|
-
|
331
|
-
|
332
|
-
|
343
|
+
this[PanelElementSymbol] = this.shadowRoot.querySelector(
|
344
|
+
"[data-monster-role=control]",
|
345
|
+
);
|
333
346
|
|
334
|
-
|
335
|
-
|
336
|
-
|
347
|
+
this[iframeElementSymbol] = this.shadowRoot.querySelector(
|
348
|
+
`[${ATTRIBUTE_ROLE}="control"] iframe`,
|
349
|
+
);
|
337
350
|
}
|
338
351
|
|
339
352
|
/**
|
@@ -341,18 +354,19 @@ function initControlReferences() {
|
|
341
354
|
* @return {string}
|
342
355
|
*/
|
343
356
|
function getTemplate() {
|
344
|
-
|
345
|
-
|
357
|
+
// language=HTML
|
358
|
+
return `
|
346
359
|
<div data-monster-role="control" part="control">
|
347
|
-
|
348
|
-
|
360
|
+
<iframe data-monster-role="iframe"
|
361
|
+
data-monster-attributes="sandbox path:sandbox,
|
349
362
|
name path:name,
|
350
|
-
referrerpolicy path:
|
351
|
-
loading path:
|
352
|
-
allowpaymentrequest path:features.
|
353
|
-
allowfullscreen path:features.
|
363
|
+
referrerpolicy path:referrerPolicy,
|
364
|
+
loading path:loading,
|
365
|
+
allowpaymentrequest path:features.allowPaymentRequest,
|
366
|
+
allowfullscreen path:features.allowFullScreen,
|
354
367
|
src path:src"
|
355
|
-
|
368
|
+
></iframe>
|
369
|
+
</div>`;
|
356
370
|
}
|
357
371
|
|
358
372
|
registerCustomElement(Iframe);
|