@formio/js 5.0.0-rc.38 → 5.0.0-rc.39
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +2 -2
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.js +9 -6
- package/lib/mjs/Embed.js +9 -6
- package/package.json +1 -1
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */
|
16
16
|
|
17
|
-
/*! formiojs v5.0.0-rc.
|
17
|
+
/*! formiojs v5.0.0-rc.39 | https://unpkg.com/formiojs@5.0.0-rc.39/LICENSE.txt */
|
18
18
|
|
19
19
|
/**
|
20
20
|
* @license
|
package/lib/cjs/Embed.js
CHANGED
@@ -261,7 +261,8 @@ class Formio {
|
|
261
261
|
});
|
262
262
|
element.parentNode.insertBefore(wrapper, element);
|
263
263
|
// If we include the libraries, then we will attempt to run this in shadow dom.
|
264
|
-
|
264
|
+
const useShadowDom = Formio.config.includeLibs && (typeof wrapper.attachShadow === 'function');
|
265
|
+
if (useShadowDom) {
|
265
266
|
wrapper = wrapper.attachShadow({
|
266
267
|
mode: 'open'
|
267
268
|
});
|
@@ -269,13 +270,15 @@ class Formio {
|
|
269
270
|
}
|
270
271
|
element.parentNode.removeChild(element);
|
271
272
|
wrapper.appendChild(element);
|
273
|
+
// If this is inside of shadow dom, then we need to add the styles and scripts to the shadow dom.
|
274
|
+
const libWrapper = useShadowDom ? wrapper : document.body;
|
272
275
|
// Load the renderer styles.
|
273
|
-
yield Formio.addStyles(
|
276
|
+
yield Formio.addStyles(libWrapper, Formio.config.embedCSS || `${Formio.cdn.js}/formio.embed.css`);
|
274
277
|
// Add a loader.
|
275
278
|
Formio.addLoader(wrapper);
|
276
279
|
const formioSrc = Formio.config.full ? 'formio.full' : 'formio.form';
|
277
280
|
const renderer = Formio.config.debug ? formioSrc : `${formioSrc}.min`;
|
278
|
-
Formio.FormioClass = yield Formio.addScript(
|
281
|
+
Formio.FormioClass = yield Formio.addScript(libWrapper, Formio.formioScript(Formio.config.script || `${Formio.cdn.js}/${renderer}.js`, builder), 'Formio', builder ? 'isBuilder' : 'isRenderer');
|
279
282
|
Formio.FormioClass.cdn = Formio.cdn;
|
280
283
|
Formio.FormioClass.setBaseUrl(options.baseUrl || Formio.baseUrl || Formio.config.base);
|
281
284
|
Formio.FormioClass.setProjectUrl(options.projectUrl || Formio.projectUrl || Formio.config.project);
|
@@ -292,7 +295,7 @@ class Formio {
|
|
292
295
|
}
|
293
296
|
// Add libraries if they wish to include the libs.
|
294
297
|
if (Formio.config.template && Formio.config.includeLibs) {
|
295
|
-
yield Formio.addLibrary(
|
298
|
+
yield Formio.addLibrary(libWrapper, Formio.config.libs[Formio.config.template], Formio.config.template);
|
296
299
|
}
|
297
300
|
// Add the premium modules.
|
298
301
|
if (Formio.config.premium) {
|
@@ -303,10 +306,10 @@ class Formio {
|
|
303
306
|
for (const name in Formio.config.modules) {
|
304
307
|
const lib = Formio.config.modules[name];
|
305
308
|
lib.use = lib.use || true;
|
306
|
-
yield Formio.addLibrary(
|
309
|
+
yield Formio.addLibrary(libWrapper, lib, name);
|
307
310
|
}
|
308
311
|
}
|
309
|
-
yield Formio.addStyles(
|
312
|
+
yield Formio.addStyles(libWrapper, Formio.formioScript(Formio.config.style || `${Formio.cdn.js}/${renderer}.css`, builder));
|
310
313
|
if (Formio.config.before) {
|
311
314
|
yield Formio.config.before(Formio.FormioClass, element, Formio.config);
|
312
315
|
}
|
package/lib/mjs/Embed.js
CHANGED
@@ -249,7 +249,8 @@ class Formio {
|
|
249
249
|
});
|
250
250
|
element.parentNode.insertBefore(wrapper, element);
|
251
251
|
// If we include the libraries, then we will attempt to run this in shadow dom.
|
252
|
-
|
252
|
+
const useShadowDom = Formio.config.includeLibs && (typeof wrapper.attachShadow === 'function');
|
253
|
+
if (useShadowDom) {
|
253
254
|
wrapper = wrapper.attachShadow({
|
254
255
|
mode: 'open'
|
255
256
|
});
|
@@ -257,13 +258,15 @@ class Formio {
|
|
257
258
|
}
|
258
259
|
element.parentNode.removeChild(element);
|
259
260
|
wrapper.appendChild(element);
|
261
|
+
// If this is inside of shadow dom, then we need to add the styles and scripts to the shadow dom.
|
262
|
+
const libWrapper = useShadowDom ? wrapper : document.body;
|
260
263
|
// Load the renderer styles.
|
261
|
-
await Formio.addStyles(
|
264
|
+
await Formio.addStyles(libWrapper, Formio.config.embedCSS || `${Formio.cdn.js}/formio.embed.css`);
|
262
265
|
// Add a loader.
|
263
266
|
Formio.addLoader(wrapper);
|
264
267
|
const formioSrc = Formio.config.full ? 'formio.full' : 'formio.form';
|
265
268
|
const renderer = Formio.config.debug ? formioSrc : `${formioSrc}.min`;
|
266
|
-
Formio.FormioClass = await Formio.addScript(
|
269
|
+
Formio.FormioClass = await Formio.addScript(libWrapper, Formio.formioScript(Formio.config.script || `${Formio.cdn.js}/${renderer}.js`, builder), 'Formio', builder ? 'isBuilder' : 'isRenderer');
|
267
270
|
Formio.FormioClass.cdn = Formio.cdn;
|
268
271
|
Formio.FormioClass.setBaseUrl(options.baseUrl || Formio.baseUrl || Formio.config.base);
|
269
272
|
Formio.FormioClass.setProjectUrl(options.projectUrl || Formio.projectUrl || Formio.config.project);
|
@@ -280,7 +283,7 @@ class Formio {
|
|
280
283
|
}
|
281
284
|
// Add libraries if they wish to include the libs.
|
282
285
|
if (Formio.config.template && Formio.config.includeLibs) {
|
283
|
-
await Formio.addLibrary(
|
286
|
+
await Formio.addLibrary(libWrapper, Formio.config.libs[Formio.config.template], Formio.config.template);
|
284
287
|
}
|
285
288
|
// Add the premium modules.
|
286
289
|
if (Formio.config.premium) {
|
@@ -291,10 +294,10 @@ class Formio {
|
|
291
294
|
for (const name in Formio.config.modules) {
|
292
295
|
const lib = Formio.config.modules[name];
|
293
296
|
lib.use = lib.use || true;
|
294
|
-
await Formio.addLibrary(
|
297
|
+
await Formio.addLibrary(libWrapper, lib, name);
|
295
298
|
}
|
296
299
|
}
|
297
|
-
await Formio.addStyles(
|
300
|
+
await Formio.addStyles(libWrapper, Formio.formioScript(Formio.config.style || `${Formio.cdn.js}/${renderer}.css`, builder));
|
298
301
|
if (Formio.config.before) {
|
299
302
|
await Formio.config.before(Formio.FormioClass, element, Formio.config);
|
300
303
|
}
|