@formio/js 5.0.0-rc.31 → 5.0.0-rc.33
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/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 +5 -5
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +6 -6
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +3 -3
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.js +31 -3
- package/lib/cjs/WizardBuilder.js +4 -1
- package/lib/cjs/components/_classes/component/Component.js +1 -1
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
- package/lib/mjs/Embed.js +32 -3
- package/lib/mjs/WizardBuilder.js +4 -1
- package/lib/mjs/components/_classes/component/Component.js +1 -1
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
- package/lib/mjs/components/editgrid/EditGrid.js +1 -1
- package/package.json +1 -1
- package/types/formio.d.ts +11 -1
| @@ -12,7 +12,7 @@ | |
| 12 12 |  | 
| 13 13 | 
             
            /*! @license DOMPurify 3.0.6 | (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.6/LICENSE */
         | 
| 14 14 |  | 
| 15 | 
            -
            /*! formiojs v5.0.0-rc. | 
| 15 | 
            +
            /*! formiojs v5.0.0-rc.33 | https://unpkg.com/formiojs@5.0.0-rc.33/LICENSE.txt */
         | 
| 16 16 |  | 
| 17 17 | 
             
            /**
         | 
| 18 18 | 
             
             * @license
         | 
    
        package/lib/cjs/Embed.js
    CHANGED
    
    | @@ -268,7 +268,8 @@ class Formio { | |
| 268 268 | 
             
                                        }
         | 
| 269 269 | 
             
                                    }]
         | 
| 270 270 | 
             
                            }]));
         | 
| 271 | 
            -
                        const  | 
| 271 | 
            +
                        const formioSrc = Formio.config.full ? 'formio.full' : 'formio.form';
         | 
| 272 | 
            +
                        const renderer = Formio.config.debug ? formioSrc : `${formioSrc}.min`;
         | 
| 272 273 | 
             
                        Formio.FormioClass = yield Formio.addScript(wrapper, Formio.formioScript(Formio.config.script || `${Formio.cdn.js}/${renderer}.js`, builder), 'Formio', builder ? 'isBuilder' : 'isRenderer');
         | 
| 273 274 | 
             
                        Formio.FormioClass.cdn = Formio.cdn;
         | 
| 274 275 | 
             
                        Formio.FormioClass.setBaseUrl(options.baseUrl || Formio.baseUrl || Formio.config.base);
         | 
| @@ -312,7 +313,10 @@ class Formio { | |
| 312 313 | 
             
                // Called after an instance has been created.
         | 
| 313 314 | 
             
                static afterCreate(instance, wrapper, readyEvent) {
         | 
| 314 315 | 
             
                    return __awaiter(this, void 0, void 0, function* () {
         | 
| 315 | 
            -
                        wrapper. | 
| 316 | 
            +
                        const loader = wrapper.querySelector('.formio-loader');
         | 
| 317 | 
            +
                        if (loader) {
         | 
| 318 | 
            +
                            wrapper.removeChild(loader);
         | 
| 319 | 
            +
                        }
         | 
| 316 320 | 
             
                        Formio.FormioClass.events.emit(readyEvent, instance);
         | 
| 317 321 | 
             
                        if (Formio.config.after) {
         | 
| 318 322 | 
             
                            Formio.debug('Calling ready callback');
         | 
| @@ -324,6 +328,9 @@ class Formio { | |
| 324 328 | 
             
                // Create a new form.
         | 
| 325 329 | 
             
                static createForm(element, form, options = {}) {
         | 
| 326 330 | 
             
                    return __awaiter(this, void 0, void 0, function* () {
         | 
| 331 | 
            +
                        if (Formio.FormioClass) {
         | 
| 332 | 
            +
                            return Formio.FormioClass.createForm(element, form, Object.assign(Object.assign({}, options), { noLoader: true }));
         | 
| 333 | 
            +
                        }
         | 
| 327 334 | 
             
                        const wrapper = yield Formio.init(element, options);
         | 
| 328 335 | 
             
                        return Formio.FormioClass.createForm(element, form, Object.assign(Object.assign({}, options), { noLoader: true })).then((instance) => {
         | 
| 329 336 | 
             
                            // Set the default submission data.
         | 
| @@ -339,7 +346,11 @@ class Formio { | |
| 339 346 | 
             
                }
         | 
| 340 347 | 
             
                // Create a form builder.
         | 
| 341 348 | 
             
                static builder(element, form, options = {}) {
         | 
| 349 | 
            +
                    var _b;
         | 
| 342 350 | 
             
                    return __awaiter(this, void 0, void 0, function* () {
         | 
| 351 | 
            +
                        if ((_b = Formio.FormioClass) === null || _b === void 0 ? void 0 : _b.builder) {
         | 
| 352 | 
            +
                            return Formio.FormioClass.builder(element, form, options);
         | 
| 353 | 
            +
                        }
         | 
| 343 354 | 
             
                        const wrapper = yield Formio.init(element, options, true);
         | 
| 344 355 | 
             
                        return Formio.FormioClass.builder(element, form, options).then((instance) => {
         | 
| 345 356 | 
             
                            Formio.afterCreate(instance, wrapper, 'builderEmbedded');
         | 
| @@ -362,6 +373,10 @@ Formio.version = 'FORMIO_VERSION'; | |
| 362 373 | 
             
            // Create a report.
         | 
| 363 374 | 
             
            Formio.Report = {
         | 
| 364 375 | 
             
                create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
         | 
| 376 | 
            +
                    var _b;
         | 
| 377 | 
            +
                    if ((_b = Formio.FormioClass) === null || _b === void 0 ? void 0 : _b.Report) {
         | 
| 378 | 
            +
                        return Formio.FormioClass.Report.create(element, submission, options);
         | 
| 379 | 
            +
                    }
         | 
| 365 380 | 
             
                    const wrapper = yield Formio.init(element, options, true);
         | 
| 366 381 | 
             
                    return Formio.FormioClass.Report.create(element, submission, options).then((instance) => {
         | 
| 367 382 | 
             
                        Formio.afterCreate(instance, wrapper, 'reportEmbedded');
         | 
| @@ -384,6 +399,9 @@ class Form { | |
| 384 399 | 
             
                    };
         | 
| 385 400 | 
             
                }
         | 
| 386 401 | 
             
                init() {
         | 
| 402 | 
            +
                    if (this.instance && !this.instance.proxy) {
         | 
| 403 | 
            +
                        this.instance.destroy();
         | 
| 404 | 
            +
                    }
         | 
| 387 405 | 
             
                    this.element.innerHTML = '';
         | 
| 388 406 | 
             
                    this.ready = this.create().then((instance) => {
         | 
| 389 407 | 
             
                        this.instance = instance;
         | 
| @@ -394,12 +412,22 @@ class Form { | |
| 394 412 | 
             
                create() {
         | 
| 395 413 | 
             
                    return Formio.createForm(this.element, this.form, this.options);
         | 
| 396 414 | 
             
                }
         | 
| 415 | 
            +
                setForm(form) {
         | 
| 416 | 
            +
                    this.form = form;
         | 
| 417 | 
            +
                    if (this.instance) {
         | 
| 418 | 
            +
                        this.instance.setForm(form);
         | 
| 419 | 
            +
                    }
         | 
| 420 | 
            +
                }
         | 
| 397 421 | 
             
                setDisplay(display) {
         | 
| 398 422 | 
             
                    if (this.instance.proxy) {
         | 
| 399 423 | 
             
                        return this.ready;
         | 
| 400 424 | 
             
                    }
         | 
| 401 425 | 
             
                    this.form.display = display;
         | 
| 402 | 
            -
                    this. | 
| 426 | 
            +
                    this.instance.destroy();
         | 
| 427 | 
            +
                    this.ready = this.create().then((instance) => {
         | 
| 428 | 
            +
                        this.instance = instance;
         | 
| 429 | 
            +
                        this.setForm(this.form);
         | 
| 430 | 
            +
                    });
         | 
| 403 431 | 
             
                    return this.ready;
         | 
| 404 432 | 
             
                }
         | 
| 405 433 | 
             
            }
         | 
    
        package/lib/cjs/WizardBuilder.js
    CHANGED
    
    | @@ -97,7 +97,7 @@ class WizardBuilder extends WebformBuilder_1.default { | |
| 97 97 | 
             
                    const pages = this.pages;
         | 
| 98 98 | 
             
                    return (pages && (pages.length >= this.page)) ? pages[this.page] : null;
         | 
| 99 99 | 
             
                }
         | 
| 100 | 
            -
                 | 
| 100 | 
            +
                setForm(value) {
         | 
| 101 101 | 
             
                    this._form = value;
         | 
| 102 102 | 
             
                    if (!this._form.components || !Array.isArray(this._form.components)) {
         | 
| 103 103 | 
             
                        this._form.components = [];
         | 
| @@ -113,6 +113,9 @@ class WizardBuilder extends WebformBuilder_1.default { | |
| 113 113 | 
             
                    }
         | 
| 114 114 | 
             
                    this.rebuild();
         | 
| 115 115 | 
             
                }
         | 
| 116 | 
            +
                set form(value) {
         | 
| 117 | 
            +
                    this.setForm(value);
         | 
| 118 | 
            +
                }
         | 
| 116 119 | 
             
                get form() {
         | 
| 117 120 | 
             
                    return this._form;
         | 
| 118 121 | 
             
                }
         | 
| @@ -1891,7 +1891,7 @@ class Component extends Element_1.default { | |
| 1891 1891 | 
             
                    if (this.options.onChange) {
         | 
| 1892 1892 | 
             
                        this.options.onChange(...args);
         | 
| 1893 1893 | 
             
                    }
         | 
| 1894 | 
            -
                    else if (this.root) {
         | 
| 1894 | 
            +
                    else if (this.root && this.root.triggerChange) {
         | 
| 1895 1895 | 
             
                        this.root.triggerChange(...args);
         | 
| 1896 1896 | 
             
                    }
         | 
| 1897 1897 | 
             
                }
         | 
| @@ -60,6 +60,10 @@ class NestedArrayComponent extends NestedDataComponent_1.default { | |
| 60 60 | 
             
                    data = data || this.data;
         | 
| 61 61 | 
             
                    return this.validateComponents([this.component], data, flags);
         | 
| 62 62 | 
             
                }
         | 
| 63 | 
            +
                checkRow(...args) {
         | 
| 64 | 
            +
                    console.log('Deprecation Warning: checkRow method has been replaced with processRow');
         | 
| 65 | 
            +
                    return this.processRow.call(this, ...args);
         | 
| 66 | 
            +
                }
         | 
| 63 67 | 
             
                processRow(method, data, opts, row, components, silentCheck) {
         | 
| 64 68 | 
             
                    if (opts === null || opts === void 0 ? void 0 : opts.isolateRow) {
         | 
| 65 69 | 
             
                        silentCheck = true;
         | 
    
        package/lib/mjs/Embed.js
    CHANGED
    
    | @@ -258,7 +258,8 @@ class Formio { | |
| 258 258 | 
             
                                    }
         | 
| 259 259 | 
             
                                }]
         | 
| 260 260 | 
             
                        }]));
         | 
| 261 | 
            -
                    const  | 
| 261 | 
            +
                    const formioSrc = Formio.config.full ? 'formio.full' : 'formio.form';
         | 
| 262 | 
            +
                    const renderer = Formio.config.debug ? formioSrc : `${formioSrc}.min`;
         | 
| 262 263 | 
             
                    Formio.FormioClass = await Formio.addScript(wrapper, Formio.formioScript(Formio.config.script || `${Formio.cdn.js}/${renderer}.js`, builder), 'Formio', builder ? 'isBuilder' : 'isRenderer');
         | 
| 263 264 | 
             
                    Formio.FormioClass.cdn = Formio.cdn;
         | 
| 264 265 | 
             
                    Formio.FormioClass.setBaseUrl(options.baseUrl || Formio.baseUrl || Formio.config.base);
         | 
| @@ -300,7 +301,10 @@ class Formio { | |
| 300 301 | 
             
                }
         | 
| 301 302 | 
             
                // Called after an instance has been created.
         | 
| 302 303 | 
             
                static async afterCreate(instance, wrapper, readyEvent) {
         | 
| 303 | 
            -
                    wrapper. | 
| 304 | 
            +
                    const loader = wrapper.querySelector('.formio-loader');
         | 
| 305 | 
            +
                    if (loader) {
         | 
| 306 | 
            +
                        wrapper.removeChild(loader);
         | 
| 307 | 
            +
                    }
         | 
| 304 308 | 
             
                    Formio.FormioClass.events.emit(readyEvent, instance);
         | 
| 305 309 | 
             
                    if (Formio.config.after) {
         | 
| 306 310 | 
             
                        Formio.debug('Calling ready callback');
         | 
| @@ -310,6 +314,12 @@ class Formio { | |
| 310 314 | 
             
                }
         | 
| 311 315 | 
             
                // Create a new form.
         | 
| 312 316 | 
             
                static async createForm(element, form, options = {}) {
         | 
| 317 | 
            +
                    if (Formio.FormioClass) {
         | 
| 318 | 
            +
                        return Formio.FormioClass.createForm(element, form, {
         | 
| 319 | 
            +
                            ...options,
         | 
| 320 | 
            +
                            ...{ noLoader: true }
         | 
| 321 | 
            +
                        });
         | 
| 322 | 
            +
                    }
         | 
| 313 323 | 
             
                    const wrapper = await Formio.init(element, options);
         | 
| 314 324 | 
             
                    return Formio.FormioClass.createForm(element, form, {
         | 
| 315 325 | 
             
                        ...options,
         | 
| @@ -327,6 +337,9 @@ class Formio { | |
| 327 337 | 
             
                }
         | 
| 328 338 | 
             
                // Create a form builder.
         | 
| 329 339 | 
             
                static async builder(element, form, options = {}) {
         | 
| 340 | 
            +
                    if (Formio.FormioClass?.builder) {
         | 
| 341 | 
            +
                        return Formio.FormioClass.builder(element, form, options);
         | 
| 342 | 
            +
                    }
         | 
| 330 343 | 
             
                    const wrapper = await Formio.init(element, options, true);
         | 
| 331 344 | 
             
                    return Formio.FormioClass.builder(element, form, options).then((instance) => {
         | 
| 332 345 | 
             
                        Formio.afterCreate(instance, wrapper, 'builderEmbedded');
         | 
| @@ -336,6 +349,9 @@ class Formio { | |
| 336 349 | 
             
                // Create a report.
         | 
| 337 350 | 
             
                static Report = {
         | 
| 338 351 | 
             
                    create: async (element, submission, options = {}) => {
         | 
| 352 | 
            +
                        if (Formio.FormioClass?.Report) {
         | 
| 353 | 
            +
                            return Formio.FormioClass.Report.create(element, submission, options);
         | 
| 354 | 
            +
                        }
         | 
| 339 355 | 
             
                        const wrapper = await Formio.init(element, options, true);
         | 
| 340 356 | 
             
                        return Formio.FormioClass.Report.create(element, submission, options).then((instance) => {
         | 
| 341 357 | 
             
                            Formio.afterCreate(instance, wrapper, 'reportEmbedded');
         | 
| @@ -359,6 +375,9 @@ export class Form { | |
| 359 375 | 
             
                    };
         | 
| 360 376 | 
             
                }
         | 
| 361 377 | 
             
                init() {
         | 
| 378 | 
            +
                    if (this.instance && !this.instance.proxy) {
         | 
| 379 | 
            +
                        this.instance.destroy();
         | 
| 380 | 
            +
                    }
         | 
| 362 381 | 
             
                    this.element.innerHTML = '';
         | 
| 363 382 | 
             
                    this.ready = this.create().then((instance) => {
         | 
| 364 383 | 
             
                        this.instance = instance;
         | 
| @@ -369,12 +388,22 @@ export class Form { | |
| 369 388 | 
             
                create() {
         | 
| 370 389 | 
             
                    return Formio.createForm(this.element, this.form, this.options);
         | 
| 371 390 | 
             
                }
         | 
| 391 | 
            +
                setForm(form) {
         | 
| 392 | 
            +
                    this.form = form;
         | 
| 393 | 
            +
                    if (this.instance) {
         | 
| 394 | 
            +
                        this.instance.setForm(form);
         | 
| 395 | 
            +
                    }
         | 
| 396 | 
            +
                }
         | 
| 372 397 | 
             
                setDisplay(display) {
         | 
| 373 398 | 
             
                    if (this.instance.proxy) {
         | 
| 374 399 | 
             
                        return this.ready;
         | 
| 375 400 | 
             
                    }
         | 
| 376 401 | 
             
                    this.form.display = display;
         | 
| 377 | 
            -
                    this. | 
| 402 | 
            +
                    this.instance.destroy();
         | 
| 403 | 
            +
                    this.ready = this.create().then((instance) => {
         | 
| 404 | 
            +
                        this.instance = instance;
         | 
| 405 | 
            +
                        this.setForm(this.form);
         | 
| 406 | 
            +
                    });
         | 
| 378 407 | 
             
                    return this.ready;
         | 
| 379 408 | 
             
                }
         | 
| 380 409 | 
             
            }
         | 
    
        package/lib/mjs/WizardBuilder.js
    CHANGED
    
    | @@ -92,7 +92,7 @@ export default class WizardBuilder extends WebformBuilder { | |
| 92 92 | 
             
                    const pages = this.pages;
         | 
| 93 93 | 
             
                    return (pages && (pages.length >= this.page)) ? pages[this.page] : null;
         | 
| 94 94 | 
             
                }
         | 
| 95 | 
            -
                 | 
| 95 | 
            +
                setForm(value) {
         | 
| 96 96 | 
             
                    this._form = value;
         | 
| 97 97 | 
             
                    if (!this._form.components || !Array.isArray(this._form.components)) {
         | 
| 98 98 | 
             
                        this._form.components = [];
         | 
| @@ -108,6 +108,9 @@ export default class WizardBuilder extends WebformBuilder { | |
| 108 108 | 
             
                    }
         | 
| 109 109 | 
             
                    this.rebuild();
         | 
| 110 110 | 
             
                }
         | 
| 111 | 
            +
                set form(value) {
         | 
| 112 | 
            +
                    this.setForm(value);
         | 
| 113 | 
            +
                }
         | 
| 111 114 | 
             
                get form() {
         | 
| 112 115 | 
             
                    return this._form;
         | 
| 113 116 | 
             
                }
         | 
| @@ -1855,7 +1855,7 @@ export default class Component extends Element { | |
| 1855 1855 | 
             
                    if (this.options.onChange) {
         | 
| 1856 1856 | 
             
                        this.options.onChange(...args);
         | 
| 1857 1857 | 
             
                    }
         | 
| 1858 | 
            -
                    else if (this.root) {
         | 
| 1858 | 
            +
                    else if (this.root && this.root.triggerChange) {
         | 
| 1859 1859 | 
             
                        this.root.triggerChange(...args);
         | 
| 1860 1860 | 
             
                    }
         | 
| 1861 1861 | 
             
                }
         | 
| @@ -56,6 +56,10 @@ export default class NestedArrayComponent extends NestedDataComponent { | |
| 56 56 | 
             
                    data = data || this.data;
         | 
| 57 57 | 
             
                    return this.validateComponents([this.component], data, flags);
         | 
| 58 58 | 
             
                }
         | 
| 59 | 
            +
                checkRow(...args) {
         | 
| 60 | 
            +
                    console.log('Deprecation Warning: checkRow method has been replaced with processRow');
         | 
| 61 | 
            +
                    return this.processRow.call(this, ...args);
         | 
| 62 | 
            +
                }
         | 
| 59 63 | 
             
                processRow(method, data, opts, row, components, silentCheck) {
         | 
| 60 64 | 
             
                    if (opts?.isolateRow) {
         | 
| 61 65 | 
             
                        silentCheck = true;
         | 
| @@ -4,7 +4,7 @@ import { editgrid as templates } from '@formio/bootstrap/components'; | |
| 4 4 | 
             
            import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
         | 
| 5 5 | 
             
            import Component from '../_classes/component/Component';
         | 
| 6 6 | 
             
            import Alert from '../alert/Alert';
         | 
| 7 | 
            -
            import { fastCloneDeep, Evaluator, getArrayFromComponentPath, eachComponent | 
| 7 | 
            +
            import { fastCloneDeep, Evaluator, getArrayFromComponentPath, eachComponent } from '../../utils/utils';
         | 
| 8 8 | 
             
            const EditRowState = {
         | 
| 9 9 | 
             
                New: 'new',
         | 
| 10 10 | 
             
                Editing: 'editing',
         | 
    
        package/package.json
    CHANGED
    
    
    
        package/types/formio.d.ts
    CHANGED
    
    | @@ -1,5 +1,11 @@ | |
| 1 1 | 
             
            import EventEmitter from 'eventemitter3';
         | 
| 2 2 | 
             
            import Plugins from './Plugins';
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            export interface FormioLibrarySource {
         | 
| 5 | 
            +
                type: string;
         | 
| 6 | 
            +
                src: string;
         | 
| 7 | 
            +
            }
         | 
| 8 | 
            +
             | 
| 3 9 | 
             
            /**
         | 
| 4 10 | 
             
             * The Formio class options interface.
         | 
| 5 11 | 
             
             */
         | 
| @@ -160,6 +166,10 @@ export declare class Formio { | |
| 160 166 | 
             
                 * A direct interface to the Form.io fetch Headers polyfill.
         | 
| 161 167 | 
             
                 */
         | 
| 162 168 | 
             
                static Headers: any;
         | 
| 169 | 
            +
                /**
         | 
| 170 | 
            +
                 * The rules definitions.
         | 
| 171 | 
            +
                 */
         | 
| 172 | 
            +
                static rulesEntities: any;
         | 
| 163 173 | 
             
                /**
         | 
| 164 174 | 
             
                 * All of the auth tokens for this session.
         | 
| 165 175 | 
             
                 */
         | 
| @@ -1173,7 +1183,7 @@ export declare class Formio { | |
| 1173 1183 | 
             
                 * @param {boolean} polling - Determines if polling should be used to determine if they library is ready to use. If set to false, then it will rely on a global callback called ${name}Callback where "name" is the first property passed to this method. When this is called, that will indicate when the library is ready. In most cases, you will want to pass true to this parameter to initiate a polling method to check for the library availability in the global context.
         | 
| 1174 1184 | 
             
                 * @return {Promise<object>} - A promise that will resolve when the plugin is ready to be used.
         | 
| 1175 1185 | 
             
                 */
         | 
| 1176 | 
            -
                static requireLibrary(name: string, property: string, src: string | Array<string>, polling?: boolean, onload?: (ready: Promise<any>) => void): any;
         | 
| 1186 | 
            +
                static requireLibrary(name: string, property: string, src: string | Array<string> | FormioLibrarySource | Array<FormioLibrarySource>, polling?: boolean, onload?: (ready: Promise<any>) => void): any;
         | 
| 1177 1187 | 
             
                /**
         | 
| 1178 1188 | 
             
                 * Determines if a lazy loaded library is ready to be used.
         | 
| 1179 1189 | 
             
                 *
         |