Skip to content

Commit

Permalink
Update the embed libraries config.
Browse files Browse the repository at this point in the history
  • Loading branch information
travist committed Jun 3, 2024
1 parent c46fab6 commit b430785
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@formio/js",
"version": "5.0.0-rc.55",
"version": "5.0.0-rc.56",
"description": "JavaScript powered Forms with JSON Form Builder",
"main": "lib/cjs/index.js",
"exports": {
Expand Down
14 changes: 9 additions & 5 deletions src/Embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,19 @@ export class Formio {
await Formio.addLibrary(libWrapper, Formio.config.libs[Formio.config.template], Formio.config.template);
}

// Add the premium modules.
if (!Formio.config.libraries) {
Formio.config.libraries = Formio.config.modules || {};
}

// Adding premium if it is provided via the config.
if (Formio.config.premium) {
Formio.config.modules.premium = Formio.config.premium;
Formio.config.libraries.premium = Formio.config.premium;
}

// Allow adding dynamic modules.
if (Formio.config.modules) {
for (const name in Formio.config.modules) {
const lib = Formio.config.modules[name];
if (Formio.config.libraries) {
for (const name in Formio.config.libraries) {
const lib = Formio.config.libraries[name];
lib.use = lib.use || true;
await Formio.addLibrary(libWrapper, lib, name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Webform.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ export default class Webform extends NestedDataComponent {
* @param {any} flags - Any flags to apply when setting the form.
* @returns {Promise} - The promise that is triggered when the form is set.
*/
setForm(form, flags) {
setForm(form, flags = {}) {
const isFormAlreadySet = this._form && this._form.components?.length;
try {
// Do not set the form again if it has been already set
Expand Down
2 changes: 1 addition & 1 deletion src/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ export default class Wizard extends Webform {
}
}

setForm(form, flags) {
setForm(form, flags = {}) {
if (!form) {
return;
}
Expand Down

0 comments on commit b430785

Please sign in to comment.