UNPKG

angular-formio

Version:

Form.io Angular JSON Form Renderer ========================== This library serves as a Dynamic JSON Powered Form rendering library for [Angular](https://angular.io). This works by providing a JSON schema to a ```<formio>``` Angular component, where that f

1,206 lines (1,195 loc) 142 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('formiojs'), require('@angular/router'), require('lodash'), require('formiojs/utils/Evaluator'), require('@angular/common'), require('@angular/elements')) : typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'rxjs', 'formiojs', '@angular/router', 'lodash', 'formiojs/utils/Evaluator', '@angular/common', '@angular/elements'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['angular-formio'] = {}, global.core, global.rxjs, global.formiojs, global.router, global.lodash, global.Evaluator, global.common, global.elements)); }(this, (function (exports, core, rxjs, formiojs, router, lodash, Evaluator, common, elements) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var Evaluator__default = /*#__PURE__*/_interopDefaultLegacy(Evaluator); /** * @fileoverview added by tsickle * Generated from: formio.config.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FormioAppConfig = /** @class */ (function () { function FormioAppConfig() { this.appUrl = ''; this.apiUrl = ''; } FormioAppConfig.decorators = [ { type: core.Injectable }, ]; return FormioAppConfig; }()); /** * @fileoverview added by tsickle * Generated from: formio.common.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FormioError = /** @class */ (function () { function FormioError(message, component, silent) { this.message = message; this.component = component; this.silent = silent; } return FormioError; }()); /** * @fileoverview added by tsickle * Generated from: formio.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FormioService = /** @class */ (function () { function FormioService(url, options) { this.url = url; this.options = options; this.formio = new formiojs.Formio(this.url, this.options); } /** * @param {?} fn * @return {?} */ FormioService.prototype.requestWrapper = /** * @param {?} fn * @return {?} */ function (fn) { /** @type {?} */ var record; /** @type {?} */ var called = false; return rxjs.Observable.create((/** * @param {?} observer * @return {?} */ function (observer) { try { if (!called) { called = true; fn() .then((/** * @param {?} _record * @return {?} */ function (_record) { record = _record; observer.next(record); observer.complete(); })) .catch((/** * @param {?} err * @return {?} */ function (err) { return observer.error(err); })); } else if (record) { observer.next(record); observer.complete(); } } catch (err) { observer.error(err); } })); }; /** * @param {?} form * @param {?=} options * @return {?} */ FormioService.prototype.saveForm = /** * @param {?} form * @param {?=} options * @return {?} */ function (form, options) { var _this = this; return this.requestWrapper((/** * @return {?} */ function () { return _this.formio.saveForm(form, options); })); }; /** * @param {?=} query * @param {?=} options * @return {?} */ FormioService.prototype.loadForm = /** * @param {?=} query * @param {?=} options * @return {?} */ function (query, options) { var _this = this; return this.requestWrapper((/** * @return {?} */ function () { return _this.formio.loadForm(query, options); })); }; /** * @param {?} query * @param {?=} options * @return {?} */ FormioService.prototype.loadForms = /** * @param {?} query * @param {?=} options * @return {?} */ function (query, options) { var _this = this; return this.requestWrapper((/** * @return {?} */ function () { return _this.formio.loadForms(query, options); })); }; /** * @param {?=} query * @param {?=} options * @return {?} */ FormioService.prototype.loadSubmission = /** * @param {?=} query * @param {?=} options * @return {?} */ function (query, options) { var _this = this; return this.requestWrapper((/** * @return {?} */ function () { return _this.formio.loadSubmission(query, options); })); }; /** * @param {?} user * @param {?} form * @param {?} submission * @return {?} */ FormioService.prototype.userPermissions = /** * @param {?} user * @param {?} form * @param {?} submission * @return {?} */ function (user, form, submission) { var _this = this; return this.requestWrapper((/** * @return {?} */ function () { return _this.formio.userPermissions(user, form, submission); })); }; /** * @param {?=} data * @param {?=} options * @return {?} */ FormioService.prototype.deleteSubmission = /** * @param {?=} data * @param {?=} options * @return {?} */ function (data, options) { var _this = this; return this.requestWrapper((/** * @return {?} */ function () { return _this.formio.deleteSubmission(data, options); })); }; /** * @param {?} submission * @param {?=} options * @return {?} */ FormioService.prototype.saveSubmission = /** * @param {?} submission * @param {?=} options * @return {?} */ function (submission, options) { var _this = this; return this.requestWrapper((/** * @return {?} */ function () { return _this.formio.saveSubmission(submission, options); })); }; /** * @param {?=} query * @param {?=} options * @return {?} */ FormioService.prototype.loadSubmissions = /** * @param {?=} query * @param {?=} options * @return {?} */ function (query, options) { var _this = this; return this.requestWrapper((/** * @return {?} */ function () { return _this.formio.loadSubmissions(query, options); })); }; return FormioService; }()); /** * @fileoverview added by tsickle * Generated from: formio.utils.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} Class * @param {?} config * @param {?} ClassRoutes * @return {?} */ function extendRouter(Class, config, ClassRoutes) { lodash.each(Class.decorators, (/** * @param {?} decorator * @return {?} */ function (decorator) { lodash.each(decorator.args, (/** * @param {?} arg * @return {?} */ function (arg) { if (arg.declarations) { lodash.each(config, (/** * @param {?} component * @return {?} */ function (component) { return arg.declarations.push(component); })); } if (arg.imports) { lodash.each(arg.imports, (/** * @param {?} _import * @param {?} index * @return {?} */ function (_import, index) { if ((_import.ngModule && (_import.ngModule.name === 'RouterModule')) || (_import.name === 'RouterModule')) { arg.imports[index] = router.RouterModule.forChild(ClassRoutes(config)); } })); } })); })); return Class; } /** * @fileoverview added by tsickle * Generated from: components/alerts/formio.alerts.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FormioAlerts = /** @class */ (function () { function FormioAlerts() { this.alerts = []; } /** * @param {?} alert * @return {?} */ FormioAlerts.prototype.setAlert = /** * @param {?} alert * @return {?} */ function (alert) { this.alerts = [alert]; }; /** * @param {?} alert * @return {?} */ FormioAlerts.prototype.addAlert = /** * @param {?} alert * @return {?} */ function (alert) { this.alerts.push(alert); }; /** * @param {?} alerts * @return {?} */ FormioAlerts.prototype.setAlerts = /** * @param {?} alerts * @return {?} */ function (alerts) { this.alerts = alerts; }; return FormioAlerts; }()); /** * @fileoverview added by tsickle * Generated from: custom-component/custom-tags.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CustomTagsService = /** @class */ (function () { function CustomTagsService() { this.tags = []; } /** * @param {?} tag * @return {?} */ CustomTagsService.prototype.addCustomTag = /** * @param {?} tag * @return {?} */ function (tag) { this.tags.push(tag); }; CustomTagsService.decorators = [ { type: core.Injectable }, ]; return CustomTagsService; }()); /** * @fileoverview added by tsickle * Generated from: types/alerts-position.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ var AlertsPosition = { none: 0, top: 1, bottom: 2, both: 3, }; AlertsPosition[AlertsPosition.none] = 'none'; AlertsPosition[AlertsPosition.top] = 'top'; AlertsPosition[AlertsPosition.bottom] = 'bottom'; AlertsPosition[AlertsPosition.both] = 'both'; var __assign$1 = (undefined && undefined.__assign) || function () { __assign$1 = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign$1.apply(this, arguments); }; var FormioBaseComponent = /** @class */ (function () { function FormioBaseComponent(ngZone, config, customTags) { var _this = this; this.ngZone = ngZone; this.config = config; this.customTags = customTags; this.submission = {}; this.noeval = false; this.readOnly = false; this.viewOnly = false; this.hooks = {}; this.watchSubmissionErrors = false; this.render = new core.EventEmitter(); this.customEvent = new core.EventEmitter(); this.fileUploadingStatus = new core.EventEmitter(); this.submit = new core.EventEmitter(); this.prevPage = new core.EventEmitter(); this.nextPage = new core.EventEmitter(); this.beforeSubmit = new core.EventEmitter(); this.change = new core.EventEmitter(); this.invalid = new core.EventEmitter(); this.errorChange = new core.EventEmitter(); this.formLoad = new core.EventEmitter(); this.submissionLoad = new core.EventEmitter(); this.ready = new core.EventEmitter(); this.AlertsPosition = AlertsPosition; this.initialized = false; this.alerts = new FormioAlerts(); this.submitting = false; this.submissionSuccess = false; this.isLoading = true; this.formioReady = new Promise((/** * @param {?} ready * @return {?} */ function (ready) { _this.formioReadyResolve = ready; })); } /** * @return {?} */ FormioBaseComponent.prototype.getRenderer = /** * @return {?} */ function () { return this.renderer; }; /** * @return {?} */ FormioBaseComponent.prototype.getRendererOptions = /** * @return {?} */ function () { /** @type {?} */ var extraTags = this.customTags ? this.customTags.tags : []; return lodash.assign({}, { icons: lodash.get(this.config, 'icons', 'fontawesome'), noAlerts: lodash.get(this.options, 'noAlerts', true), readOnly: this.readOnly, viewAsHtml: this.viewOnly, i18n: lodash.get(this.options, 'i18n', null), fileService: lodash.get(this.options, 'fileService', null), hooks: this.hooks, sanitizeConfig: { addTags: extraTags } }, this.renderOptions || {}); }; /** * @return {?} */ FormioBaseComponent.prototype.createRenderer = /** * @return {?} */ function () { /** @type {?} */ var Renderer = this.getRenderer(); /** @type {?} */ var form = (new Renderer(this.formioElement ? this.formioElement.nativeElement : null, this.form, this.getRendererOptions())); return form.instance; }; /** * @param {?} form * @return {?} */ FormioBaseComponent.prototype.setForm = /** * @param {?} form * @return {?} */ function (form) { var _this = this; this.form = form; if (this.formio) { this.formio.destroy(); } // Clear out the element to render the new form. if (this.formioElement && this.formioElement.nativeElement) { this.formioElement.nativeElement.innerHTML = ''; } this.formio = this.createRenderer(); this.formio.submission = this.submission; if (this.renderOptions && this.renderOptions.validateOnInit) { this.formio.setValue(this.submission, { validateOnInit: true }); } if (this.url) { this.formio.setUrl(this.url, this.formioOptions || {}); } if (this.src) { this.formio.setUrl(this.src, this.formioOptions || {}); } this.formio.nosubmit = true; this.formio.on('prevPage', (/** * @param {?} data * @return {?} */ function (data) { return _this.ngZone.run((/** * @return {?} */ function () { return _this.onPrevPage(data); })); })); this.formio.on('nextPage', (/** * @param {?} data * @return {?} */ function (data) { return _this.ngZone.run((/** * @return {?} */ function () { return _this.onNextPage(data); })); })); this.formio.on('change', (/** * @param {?} value * @param {?} flags * @param {?} isModified * @return {?} */ function (value, flags, isModified) { return _this.ngZone.run((/** * @return {?} */ function () { return _this.onChange(value, flags, isModified); })); })); this.formio.on('customEvent', (/** * @param {?} event * @return {?} */ function (event) { return _this.ngZone.run((/** * @return {?} */ function () { return _this.customEvent.emit(event); })); })); ['fileUploadingStart', 'fileUploadingEnd'].forEach((/** * @param {?} eventName * @param {?} index * @return {?} */ function (eventName, index) { /** @type {?} */ var status = !!index ? 'end' : 'start'; _this.formio.on(eventName, (/** * @return {?} */ function () { return _this.ngZone.run((/** * @return {?} */ function () { return _this.fileUploadingStatus.emit(status); })); })); })); this.formio.on('submit', (/** * @param {?} submission * @param {?} saved * @return {?} */ function (submission, saved) { return _this.ngZone.run((/** * @return {?} */ function () { return _this.submitForm(submission, saved); })); })); this.formio.on('error', (/** * @param {?} err * @return {?} */ function (err) { return _this.ngZone.run((/** * @return {?} */ function () { _this.submissionSuccess = false; return _this.onError(err); })); })); this.formio.on('render', (/** * @return {?} */ function () { return _this.ngZone.run((/** * @return {?} */ function () { return _this.render.emit(); })); })); this.formio.on('formLoad', (/** * @param {?} loadedForm * @return {?} */ function (loadedForm) { return _this.ngZone.run((/** * @return {?} */ function () { return _this.formLoad.emit(loadedForm); })); })); return this.formio.ready.then((/** * @return {?} */ function () { _this.ngZone.run((/** * @return {?} */ function () { _this.isLoading = false; _this.ready.emit(_this); _this.formioReadyResolve(_this.formio); if (_this.formio.submissionReady) { _this.formio.submissionReady.then((/** * @param {?} submission * @return {?} */ function (submission) { _this.submissionLoad.emit(submission); })); } })); return _this.formio; })); }; /** * @return {?} */ FormioBaseComponent.prototype.initialize = /** * @return {?} */ function () { if (this.initialized) { return; } /** @type {?} */ var extraTags = this.customTags ? this.customTags.tags : []; /** @type {?} */ var defaultOptions = { errors: { message: 'Please fix the following errors before submitting.' }, alerts: { submitMessage: 'Submission Complete.' }, disableAlerts: false, hooks: { beforeSubmit: null }, sanitizeConfig: { addTags: extraTags }, alertsPosition: AlertsPosition.top, }; this.options = Object.assign(defaultOptions, this.options); if (this.options.disableAlerts) { this.options.alertsPosition = AlertsPosition.none; } this.initialized = true; }; /** * @return {?} */ FormioBaseComponent.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; Evaluator__default['default'].noeval = this.noeval; this.initialize(); if (this.language) { if (typeof this.language === 'string') { this.formio.language = this.language; } else { this.language.subscribe((/** * @param {?} lang * @return {?} */ function (lang) { _this.formio.language = lang; })); } } if (this.refresh) { this.refresh.subscribe((/** * @param {?} refresh * @return {?} */ function (refresh) { return _this.onRefresh(refresh); })); } if (this.error) { this.error.subscribe((/** * @param {?} err * @return {?} */ function (err) { return _this.onError(err); })); } if (this.success) { this.success.subscribe((/** * @param {?} message * @return {?} */ function (message) { _this.alerts.setAlert({ type: 'success', message: message || lodash.get(_this.options, 'alerts.submitMessage') }); })); } if (this.src) { if (!this.service) { this.service = new FormioService(this.src); } this.isLoading = true; this.service.loadForm({ params: { live: 1 } }).subscribe((/** * @param {?} form * @return {?} */ function (form) { if (form && form.components) { _this.ngZone.runOutsideAngular((/** * @return {?} */ function () { _this.setForm(form); })); } // if a submission is also provided. if (lodash.isEmpty(_this.submission) && _this.service && _this.service.formio.submissionId) { _this.service.loadSubmission().subscribe((/** * @param {?} submission * @return {?} */ function (submission) { if (_this.readOnly) { _this.formio.options.readOnly = true; } _this.submission = _this.formio.submission = submission; }), (/** * @param {?} err * @return {?} */ function (err) { return _this.onError(err); })); } }), (/** * @param {?} err * @return {?} */ function (err) { return _this.onError(err); })); } if (this.url && !this.service) { this.service = new FormioService(this.url); } }; /** * @return {?} */ FormioBaseComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this.formio) { this.formio.destroy(); } }; /** * @param {?} refresh * @return {?} */ FormioBaseComponent.prototype.onRefresh = /** * @param {?} refresh * @return {?} */ function (refresh) { var _this = this; this.formioReady.then((/** * @return {?} */ function () { if (refresh.form) { _this.formio.setForm(refresh.form).then((/** * @return {?} */ function () { if (refresh.submission) { _this.formio.setSubmission(refresh.submission); } })); } else if (refresh.submission) { _this.formio.setSubmission(refresh.submission); } else { switch (refresh.property) { case 'submission': _this.formio.submission = refresh.value; break; case 'form': _this.formio.form = refresh.value; break; } } })); }; /** * @param {?} changes * @return {?} */ FormioBaseComponent.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { var _this = this; Evaluator__default['default'].noeval = this.noeval; this.initialize(); if (changes.form && changes.form.currentValue) { this.ngZone.runOutsideAngular((/** * @return {?} */ function () { _this.setForm(changes.form.currentValue); })); } this.formioReady.then((/** * @return {?} */ function () { if (changes.submission && changes.submission.currentValue) { _this.formio.setSubmission(changes.submission.currentValue, { fromSubmission: false, }); } if (changes.hideComponents && changes.hideComponents.currentValue) { /** @type {?} */ var hiddenComponents_1 = changes.hideComponents.currentValue; _this.formio.options.hide = hiddenComponents_1; _this.formio.everyComponent((/** * @param {?} component * @return {?} */ function (component) { component.options.hide = hiddenComponents_1; if (hiddenComponents_1.includes(component.component.key)) { component.visible = false; } })); } })); }; /** * @param {?} data * @return {?} */ FormioBaseComponent.prototype.onPrevPage = /** * @param {?} data * @return {?} */ function (data) { this.alerts.setAlerts([]); this.prevPage.emit(data); }; /** * @param {?} data * @return {?} */ FormioBaseComponent.prototype.onNextPage = /** * @param {?} data * @return {?} */ function (data) { this.alerts.setAlerts([]); this.nextPage.emit(data); }; /** * @param {?} submission * @param {?} saved * @param {?=} noemit * @return {?} */ FormioBaseComponent.prototype.onSubmit = /** * @param {?} submission * @param {?} saved * @param {?=} noemit * @return {?} */ function (submission, saved, noemit) { this.submitting = false; this.submissionSuccess = true; if (saved) { this.formio.emit('submitDone', submission); } if (!noemit) { this.submit.emit(submission); } if (!this.success) { this.alerts.setAlert({ type: 'success', message: lodash.get(this.options, 'alerts.submitMessage') }); } }; /** * @param {?} err * @return {?} */ FormioBaseComponent.prototype.onError = /** * @param {?} err * @return {?} */ function (err) { var _this = this; this.alerts.setAlerts([]); this.submitting = false; this.isLoading = false; if (!err) { return; } // Make sure it is an array. /** @type {?} */ var errors = Array.isArray(err) ? err : [err]; // Emit these errors again. this.errorChange.emit(errors); if (err.silent) { return; } if (this.formio && errors.length) { this.formio.emit('submitError', errors); } // Iterate through each one and set the alerts array. errors.forEach((/** * @param {?} error * @return {?} */ function (error) { var _a = error ? error.details ? { message: error.details.map((/** * @param {?} detail * @return {?} */ function (detail) { return detail.message; })), paths: error.details.map((/** * @param {?} detail * @return {?} */ function (detail) { return detail.path; })), } : { message: error.message || error.toString(), paths: error.path ? [error.path] : [], } : { message: '', paths: [], }, message = _a.message, paths = _a.paths; /** @type {?} */ var shouldErrorDisplay = true; if (_this.formio) { paths.forEach((/** * @param {?} path * @param {?} index * @return {?} */ function (path, index) { /** @type {?} */ var component = _this.formio.getComponent(path); if (component) { /** @type {?} */ var components = Array.isArray(component) ? component : [component]; /** @type {?} */ var messageText_1 = Array.isArray(message) ? message[index] : message; components.forEach((/** * @param {?} comp * @return {?} */ function (comp) { return comp.setCustomValidity(messageText_1, true); })); _this.alerts.addAlert({ type: 'danger', message: message[index], component: component, }); shouldErrorDisplay = false; } })); if (((/** @type {?} */ (window))).VPAT_ENABLED) { if (typeof error === 'string' && _this.formio.components) { _this.formio.components.forEach((/** * @param {?} comp * @return {?} */ function (comp) { if (comp && comp.type !== 'button') { comp.setCustomValidity(message, true); } })); } } if (!_this.noAlerts) { _this.formio.showErrors(); } } if (shouldErrorDisplay) { _this.alerts.addAlert({ type: 'danger', message: message, component: error.component, }); } })); }; /** * @param {?} key * @return {?} */ FormioBaseComponent.prototype.focusOnComponet = /** * @param {?} key * @return {?} */ function (key) { if (this.formio) { this.formio.focusOnComponent(key); } }; /** * @param {?} submission * @param {?=} saved * @return {?} */ FormioBaseComponent.prototype.submitExecute = /** * @param {?} submission * @param {?=} saved * @return {?} */ function (submission, saved) { var _this = this; if (saved === void 0) { saved = false; } if (this.service && !this.url && !saved) { this.service .saveSubmission(submission) .subscribe((/** * @param {?} sub * @return {?} */ function (sub) { return _this.onSubmit(sub, true); }), (/** * @param {?} err * @return {?} */ function (err) { return _this.onError(err); })); } else { this.onSubmit(submission, false); } }; /** * @param {?} submission * @param {?=} saved * @return {?} */ FormioBaseComponent.prototype.submitForm = /** * @param {?} submission * @param {?=} saved * @return {?} */ function (submission, saved) { var _this = this; if (saved === void 0) { saved = false; } // Keep double submits from occurring... if (this.submitting) { return; } this.submissionSuccess = false; this.submitting = true; this.beforeSubmit.emit(submission); // if they provide a beforeSubmit hook, then allow them to alter the submission asynchronously // or even provide a custom Error method. /** @type {?} */ var beforeSubmit = lodash.get(this.options, 'hooks.beforeSubmit'); if (beforeSubmit) { beforeSubmit(submission, (/** * @param {?} err * @param {?} sub * @return {?} */ function (err, sub) { if (err) { _this.onError(err); return; } _this.submitExecute(sub, saved); })); } else { this.submitExecute(submission, saved); } }; /** * @param {?} value * @param {?} flags * @param {?} isModified * @return {?} */ FormioBaseComponent.prototype.onChange = /** * @param {?} value * @param {?} flags * @param {?} isModified * @return {?} */ function (value, flags, isModified) { if (this.watchSubmissionErrors && !this.submissionSuccess) { /** @type {?} */ var errors = lodash.get(this, 'formio.errors', []); /** @type {?} */ var alerts = lodash.get(this, 'alerts.alerts', []); /** @type {?} */ var submitted = lodash.get(this, 'formio.submitted', false); if (submitted && (errors.length || alerts.length)) { this.onError(errors); } } return this.change.emit(__assign$1(__assign$1({}, value), { flags: flags, isModified: isModified })); }; /** @nocollapse */ FormioBaseComponent.ctorParameters = function () { return [ { type: core.NgZone }, { type: FormioAppConfig, decorators: [{ type: core.Optional }] }, { type: CustomTagsService, decorators: [{ type: core.Optional }] } ]; }; FormioBaseComponent.propDecorators = { form: [{ type: core.Input }], submission: [{ type: core.Input }], src: [{ type: core.Input }], url: [{ type: core.Input }], service: [{ type: core.Input }], options: [{ type: core.Input }], noeval: [{ type: core.Input }], formioOptions: [{ type: core.Input }], renderOptions: [{ type: core.Input }], readOnly: [{ type: core.Input }], viewOnly: [{ type: core.Input }], hideComponents: [{ type: core.Input }], refresh: [{ type: core.Input }], error: [{ type: core.Input }], success: [{ type: core.Input }], language: [{ type: core.Input }], hooks: [{ type: core.Input }], renderer: [{ type: core.Input }], watchSubmissionErrors: [{ type: core.Input }], render: [{ type: core.Output }], customEvent: [{ type: core.Output }], fileUploadingStatus: [{ type: core.Output }], submit: [{ type: core.Output }], prevPage: [{ type: core.Output }], nextPage: [{ type: core.Output }], beforeSubmit: [{ type: core.Output }], change: [{ type: core.Output }], invalid: [{ type: core.Output }], errorChange: [{ type: core.Output }], formLoad: [{ type: core.Output }], submissionLoad: [{ type: core.Output }], ready: [{ type: core.Output }], formioElement: [{ type: core.ViewChild, args: ['formio', { static: true },] }] }; return FormioBaseComponent; }()); var __extends$1 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:disable */ var FormioComponent = /** @class */ (function (_super) { __extends$1(FormioComponent, _super); function FormioComponent(ngZone, config, customTags) { var _this = _super.call(this, ngZone, config, customTags) || this; _this.ngZone = ngZone; _this.config = config; _this.customTags = customTags; if (_this.config) { formiojs.Formio.setBaseUrl(_this.config.apiUrl); formiojs.Formio.setProjectUrl(_this.config.appUrl); } else { console.warn('You must provide an AppConfig within your application!'); } return _this; } /** * @return {?} */ FormioComponent.prototype.getRenderer = /** * @return {?} */ function () { return this.renderer || formiojs.Form; }; FormioComponent.decorators = [ { type: core.Component, args: [{ selector: 'formio', template: "<div> <div *ngIf=\"isLoading\" style=\"position:relative;height:200px\"> <formio-loader [isLoading]=\"isLoading\"></formio-loader> </div> <formio-alerts *ngIf=\"this.options.alertsPosition === AlertsPosition.top || this.options.alertsPosition === AlertsPosition.both\" (focusComponent)=\"focusOnComponet($event)\" [alerts]=\"alerts\"></formio-alerts> <div #formio></div> <formio-alerts *ngIf=\"this.options.alertsPosition === AlertsPosition.bottom || this.options.alertsPosition === AlertsPosition.both\" (focusComponent)=\"focusOnComponet($event)\" [alerts]=\"alerts\"></formio-alerts> </div> ", styles: ["@charset \"UTF-8\";.choices{position:relative;margin-bottom:24px;font-size:16px}.choices:focus{outline:0}.choices:last-child{margin-bottom:0}.choices.is-disabled .choices__inner,.choices.is-disabled .choices__input{background-color:#eaeaea;cursor:not-allowed;-webkit-user-select:none;-ms-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed}.choices [hidden]{display:none!important}.choices[data-type*=select-one]{cursor:pointer}.choices[data-type*=select-one] .choices__inner{padding-bottom:7.5px}.choices[data-type*=select-one] .choices__input{display:block;width:100%;padding:10px;border-bottom:1px solid #ddd;background-color:#fff;margin:0}.choices[data-type*=select-one] .choices__button{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);padding:0;background-size:8px;position:absolute;top:50%;right:0;margin-top:-10px;margin-right:25px;height:20px;width:20px;border-radius:10em;opacity:.5}.choices[data-type*=select-one] .choices__button:focus,.choices[data-type*=select-one] .choices__button:hover{opacity:1}.choices[data-type*=select-one] .choices__button:focus{box-shadow:0 0 0 2px #00bcd4}.choices[data-type*=select-one] .choices__item[data-value=''] .choices__button{display:none}.choices[data-type*=select-one]:after{content:'';height:0;width:0;border-style:solid;border-color:#333 transparent transparent;border-width:5px;position:absolute;right:11.5px;top:50%;margin-top:-2.5px;pointer-events:none}.choices[data-type*=select-one].is-open:after{border-color:transparent transparent #333;margin-top:-7.5px}.choices[data-type*=select-one][dir=rtl]:after{left:11.5px;right:auto}.choices[data-type*=select-one][dir=rtl] .choices__button{right:auto;left:0;margin-left:25px;margin-right:0}.choices[data-type*=select-multiple] .choices__inner,.choices[data-type*=text] .choices__inner{cursor:text}.choices[data-type*=select-multiple] .choices__button,.choices[data-type*=text] .choices__button{position:relative;display:inline-block;margin:0 -4px 0 8px;padding-left:16px;border-left:1px solid #008fa1;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);background-size:8px;width:8px;line-height:1;opacity:.75;border-radius:0}.choices[data-type*=select-multiple] .choices__button:focus,.choices[data-type*=select-multiple] .choices__button:hover,.choices[data-type*=text] .choices__button:focus,.choices[data-type*=text] .choices__button:hover{opacity:1}.choices__inner{display:inline-block;vertical-align:top;width:100%;background-color:#f9f9f9;padding:7.5px 7.5px 3.75px;border:1px solid #ddd;border-radius:2.5px;font-size:14px;min-height:44px;overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:#b7b7b7}.is-open .choices__inner{border-radius:2.5px 2.5px 0 0}.is-flipped.is-open .choices__inner{border-radius:0 0 2.5px 2.5px}.choices__list{margin:0;padding-left:0;list-style:none}.choices__list--single{display:inline-block;padding:4px 16px 4px 4px;width:100%}[dir=rtl] .choices__list--single{padding-right:4px;padding-left:16px}.choices__list--single .choices__item{width:100%}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:20px;padding:4px 10px;font-size:12px;font-weight:500;margin-right:3.75px;margin-bottom:3.75px;background-color:#00bcd4;border:1px solid #00a5bb;color:#fff;word-break:break-all;box-sizing:border-box}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}[dir=rtl] .choices__list--multiple .choices__item{margin-right:0;margin-left:3.75px}.choices__list--multiple .choices__item.is-highlighted{background-color:#00a5bb;border:1px solid #008fa1}.is-disabled .choices__list--multiple .choices__item{background-color:#aaa;border:1px solid #919191}.choices__list--dropdown{visibility:hidden;z-index:1;position:absolute;width:100%;background-color:#fff;border:1px solid #ddd;top:100%;margin-top:-1px;border-bottom-left-radius:2.5px;border-bottom-right-radius:2.5px;overflow:hidden;word-break:break-all;will-change:visibility}.choices__list--dropdown.is-active{visibility:visible}.is-open .choices__list--dropdown{border-color:#b7b7b7}.is-flipped .choices__list--dropdown{top:auto;bottom:100%;margin-top:0;margin-bottom:-1px;border-radius:.25rem .25rem 0 0}.choices__list--dropdown .choices__list{position:relative;max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;will-change:scroll-position}.choices__list--dropdown .choices__item{position:relative;padding:10px;font-size:14px}[dir=rtl] .choices__list--dropdown .choices__item{text-align:right}@media (min-width:640px){.choices__list--dropdown .choices__item--selectable{padding-right:100px}.choices__list--dropdown .choices__item--selectable:after{content:attr(data-select-text);font-size:12px;opacity:0;position:absolute;right:10px;top:50%;transform:translateY(-50%)}[dir=rtl] .choices__list--dropdown .choices__item--selectable{text-align:right;padding-left:100px;padding-right:10px}[dir=rtl] .choices__list--dropdown .choices__item--selectable:after{right:auto;left:10px}}.choices__list--dropdown .choices__item--selectable.is-highlighted{background-color:#f2f2f2}.choices__list--dropdown .choices__item--selectable.is-highlighted:after{opacity:.5}.choices__item{cursor:default}.choices__item--selectable{cursor:pointer}.choices__item--disabled{cursor:not-allowed;-webkit-user-select:none;-ms-user-select:none;user-select:none;opacity:.5}.choices__heading{font-weight:600;font-size:12px;padding:10px;border-bottom:1px solid #f7f7f7;color:gray}.choices__button{text-indent:-9999px;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;background-color:transparent;background-repeat:no-repeat;background-position:center;cursor:pointer}.choices__button:focus,.c