diff --git a/projects/angular-formio/embed/src/builder.component.ts b/projects/angular-formio/embed/src/builder.component.ts index 316cd8eb..1f180069 100644 --- a/projects/angular-formio/embed/src/builder.component.ts +++ b/projects/angular-formio/embed/src/builder.component.ts @@ -1,5 +1,5 @@ import { Component, ElementRef, Input, ViewChild, Output, EventEmitter, AfterViewInit } from '@angular/core'; -import { FormBuilder } from '@formio/js'; +import {Form, FormBuilder, Webform} from '@formio/js'; import WebformBuilder from '@formio/js/lib/cjs/WebformBuilder'; @Component({ @@ -8,8 +8,8 @@ import WebformBuilder from '@formio/js/lib/cjs/WebformBuilder'; }) export class FormioBuilder implements AfterViewInit { @ViewChild('formio') element: ElementRef; - @Input() form?: Object | null; - @Input() options?: Object = {}; + @Input() form?: Form['options'] | null; + @Input() options?: FormBuilder['options'] = {}; @Output() change = new EventEmitter(); @Output() ready = new EventEmitter(); @Output() error = new EventEmitter(); @@ -65,4 +65,4 @@ export class FormioBuilder implements AfterViewInit { this.ready.emit(this.instance); }).catch((err) => this.error.emit(err)); } -} \ No newline at end of file +} diff --git a/projects/angular-formio/embed/src/formio.component.ts b/projects/angular-formio/embed/src/formio.component.ts index cbc773ca..b73f0313 100644 --- a/projects/angular-formio/embed/src/formio.component.ts +++ b/projects/angular-formio/embed/src/formio.component.ts @@ -1,6 +1,6 @@ import { Component, ViewChild, ElementRef, Input, Output, EventEmitter, OnChanges, AfterViewInit } from '@angular/core'; -import { FormioCore as Formio, Webform } from '@formio/js'; -import { Form, Submission } from '@formio/core/types' +import { FormioCore as Formio, Webform, Form } from '@formio/js'; +import { Form as formType, Submission } from '@formio/core/types'; @Component({ selector: 'formio', @@ -8,10 +8,10 @@ import { Form, Submission } from '@formio/core/types' }) export class FormioComponent implements AfterViewInit { @Input() src?: string; - @Input() form?: Form | null; + @Input() form?: formType | null; @Input() submission?: Submission | null; @Input() url?: string; - @Input() options?: Webform["options"] = {}; + @Input() options?: Form['options'] = {}; @Output() ready = new EventEmitter(); @Output() submit = new EventEmitter(); @Output() error = new EventEmitter(); @@ -33,4 +33,4 @@ export class FormioComponent implements AfterViewInit { form.on('change', (event) => this.change.emit(event)); }).catch((err) => this.error.emit(err)); } -} \ No newline at end of file +} diff --git a/projects/angular-formio/src/FormioBaseComponent.ts b/projects/angular-formio/src/FormioBaseComponent.ts index 548d86f3..00d5249d 100644 --- a/projects/angular-formio/src/FormioBaseComponent.ts +++ b/projects/angular-formio/src/FormioBaseComponent.ts @@ -2,10 +2,10 @@ import { Component, ElementRef, EventEmitter, Input, NgZone, OnChanges, OnDestro import { FormioService } from './formio.service'; import { FormioAlerts } from './components/alerts/formio.alerts'; import { FormioAppConfig } from './formio.config'; -import { FormioError, FormioForm, FormioOptions, FormioRefreshValue } from './formio.common'; +import {AngularFormioOptions, FormioError, FormioForm, FormioRefreshValue} from './formio.common'; import { assign, get, isEmpty } from 'lodash'; import { CustomTagsService } from './custom-tags.service'; -import { Utils } from '@formio/js'; +import {Form, Utils, Webform} from '@formio/js'; import { AlertsPosition } from './types/alerts-position'; const { Evaluator, fastCloneDeep } = Utils; @@ -18,7 +18,7 @@ export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy { @Input() src?: string; @Input() url?: string; @Input() service?: FormioService; - @Input() options?: FormioOptions; + @Input() options?: Form['options'] & AngularFormioOptions; @Input() noeval ? = Evaluator.noeval; @Input() formioOptions?: any; @Input() renderOptions?: any; @@ -34,7 +34,7 @@ export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy { @Input() hooks?: any = {}; @Input() renderer?: any; @Input() watchSubmissionErrors ? = false; - @Input() dataTableActions? : any = [] + @Input() dataTableActions?: any = []; @Output() render = new EventEmitter(); @Output() customEvent = new EventEmitter(); @Output() fileUploadingStatus = new EventEmitter(); @@ -213,7 +213,7 @@ export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy { } const extraTags = this.customTags ? this.customTags.tags : []; - const defaultOptions: FormioOptions = { + const defaultOptions: Form['options'] & AngularFormioOptions = { errors: { message: 'Please fix the following errors before submitting.' }, diff --git a/projects/angular-formio/src/components/formbuilder/formbuilder.component.ts b/projects/angular-formio/src/components/formbuilder/formbuilder.component.ts index 9cf56547..90cbb6e6 100644 --- a/projects/angular-formio/src/components/formbuilder/formbuilder.component.ts +++ b/projects/angular-formio/src/components/formbuilder/formbuilder.component.ts @@ -14,8 +14,8 @@ import { } from '@angular/core'; import { FormioAppConfig } from '../../formio.config'; import { + AngularFormioOptions, FormioForm, - FormioOptions } from '../../formio.common'; import { Formio, FormBuilder, Utils } from '@formio/js'; import { assign } from 'lodash'; @@ -38,7 +38,7 @@ export class FormBuilderComponent implements OnInit, OnChanges, OnDestroy { public componentAdding = false; private refreshSubscription: Subscription; @Input() form?: FormioForm; - @Input() options?: FormioOptions; + @Input() options?: FormBuilder['options'] & AngularFormioOptions; @Input() formbuilder?: any; @Input() noeval ? = false; @Input() refresh?: Observable; diff --git a/projects/angular-formio/src/formio.common.ts b/projects/angular-formio/src/formio.common.ts index 13b8f730..99edd233 100644 --- a/projects/angular-formio/src/formio.common.ts +++ b/projects/angular-formio/src/formio.common.ts @@ -18,12 +18,12 @@ export interface AccessSetting { } export interface FormioReport { - form: string, - roles: object, - access: object, - metadata: object, - data: object, - project: string, + form: string; + roles: object; + access: object; + metadata: object; + data: object; + project: string; } export interface FormioForm { @@ -38,7 +38,7 @@ export interface FormioForm { tags?: string[]; access?: AccessSetting[]; submissionAccess?: AccessSetting[]; - report?: FormioReport + report?: FormioReport; } export interface ComponentInstance { @@ -78,13 +78,9 @@ export interface FormioHookOptions { beforeSubmit: FormioBeforeSubmit; } -export interface FormioOptions { +export interface AngularFormioOptions { errors?: ErrorsOptions; alerts?: AlertsOptions; alertsPosition?: AlertsPosition; disableAlerts?: boolean; - i18n?: object; - fileService?: object; - hooks?: FormioHookOptions; - sanitizeConfig?: any; }