Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { FormManagerService } from '../../form-manager.service';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
import { NgIf } from '@angular/common';

@Component({
templateUrl: './submission.component.html',
standalone: false
imports: [NgIf, RouterLink, RouterLinkActive, RouterOutlet]
})
export class SubmissionComponent implements OnInit {
public downloadUrl: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component } from '@angular/core';
import { FormManagerService } from '../../form-manager.service';
import { FormioComponent } from '@formio/angular';

@Component({
templateUrl: './view.component.html',
standalone: false
imports: [FormioComponent]
})
export class SubmissionViewComponent {
constructor(public service: FormManagerService) { }
Expand Down
4 changes: 3 additions & 1 deletion projects/angular-formio/manager/src/view/view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { FormManagerService } from '../form-manager.service';
import { ActivatedRoute, Router } from '@angular/router';
import { FormioAuthService } from '@formio/angular/auth';
import { Formio } from '@formio/js';
import { NgIf } from '@angular/common';
import { FormioComponent } from '@formio/angular';

@Component({
templateUrl: './view.component.html',
standalone: false
imports: [NgIf, FormioComponent]
})
export class FormManagerViewComponent implements OnInit {
public submission: any;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Component, EventEmitter, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Router, ActivatedRoute, RouterLink } from '@angular/router';
import { FormioResourceService } from '../resource.service';
import { FormioResourceConfig } from '../resource.config';
import { NgIf } from '@angular/common';
import { FormioComponent } from '@formio/angular';

@Component({
styleUrls: ['./create.component.scss'],
templateUrl: './create.component.html',
standalone: false
imports: [NgIf, RouterLink, FormioComponent]
})
export class FormioResourceCreateComponent implements OnInit {
public onError: EventEmitter<any>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { Component } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { FormioResourceService } from '../resource.service';

@Component({
templateUrl: './delete.component.html',
standalone: false
})
@Component({ templateUrl: './delete.component.html' })
export class FormioResourceDeleteComponent {
constructor(
public service: FormioResourceService,
Expand Down
3 changes: 2 additions & 1 deletion projects/angular-formio/resource/src/edit/edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { Router, ActivatedRoute } from '@angular/router';
import { FormioResourceService } from '../resource.service';
import { FormioResourceConfig } from '../resource.config';
import { Formio } from '@formio/js';
import { FormioComponent } from '@formio/angular';

@Component({
templateUrl: './edit.component.html',
standalone: false
imports: [FormioComponent]
})
export class FormioResourceEditComponent implements OnDestroy {
public triggerError: EventEmitter<any> = new EventEmitter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { Router, ActivatedRoute } from '@angular/router';
import { FormioResourceService } from '../resource.service';
import { FormioResourceConfig } from '../resource.config';
import { each } from 'lodash';
import { FormioAlertsComponent } from '@formio/angular';
import { FormioGridComponent } from '@formio/angular/grid';

@Component({
templateUrl: './index.component.html',
standalone: false
imports: [FormioAlertsComponent, FormioGridComponent]
})
export class FormioResourceIndexComponent implements OnInit {
public gridSrc?: string;
Expand Down
5 changes: 3 additions & 2 deletions projects/angular-formio/resource/src/resource.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router, RouterEvent } from '@angular/router';
import { ActivatedRoute, NavigationEnd, Router, RouterEvent, RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
import { FormioAuthService } from '@formio/angular/auth';
import { FormioResourceService } from './resource.service';
import { Subscription } from 'rxjs';
import { NgIf } from '@angular/common';

@Component({
templateUrl: './resource.component.html',
standalone: false
imports: [RouterLink, RouterLinkActive, NgIf, RouterOutlet]
})
export class FormioResourceComponent implements OnInit, OnDestroy {
public perms = {delete: false, edit: false};
Expand Down
4 changes: 1 addition & 3 deletions projects/angular-formio/resource/src/resource.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import { extendRouter } from '@formio/angular';
CommonModule,
FormioModule,
FormioGrid,
RouterModule
],
declarations: [
RouterModule,
FormioResourceComponent,
FormioResourceCreateComponent,
FormioResourceIndexComponent,
Expand Down
3 changes: 2 additions & 1 deletion projects/angular-formio/resource/src/view/view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import {Component, OnDestroy} from '@angular/core';
import { FormioResourceService } from '../resource.service';
import { FormioResourceConfig } from '../resource.config';
import {Formio} from '@formio/js';
import { FormioComponent } from '@formio/angular';

@Component({
templateUrl: './view.component.html',
standalone: false
imports: [FormioComponent]
})
export class FormioResourceViewComponent implements OnDestroy{
constructor(
Expand Down
32 changes: 19 additions & 13 deletions projects/angular-formio/src/FormioBaseComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import {Form, Utils, Webform} from '@formio/js';
import { AlertsPosition } from './types/alerts-position';
const { Evaluator, fastCloneDeep } = Utils;

@Component({
template: '',
standalone: false
})
@Component({ template: '' })
export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy {
@Input() form?: FormioForm;
@Input() submission?: any = {};
Expand Down Expand Up @@ -289,29 +286,38 @@ export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy {
}

setFormFromSrc() {
this.service.loadForm({ params: { live: 1 } }).subscribe(
(form: FormioForm) => {
if (form && form.components) {
this.ngZone.runOutsideAngular(() => {
this.setForm(form);
});
}

// if a submission is also provided.
// if a submission is provided, load it first to set required form revision.
if (
isEmpty(this.submission) &&
this.service &&
this.service.formio.submissionId
) {
this.service.loadSubmission().subscribe(
(submission: any) => {
this.loadForm(() => {
if (this.readOnly) {
this.formio.options.readOnly = true;
}
this.submission = this.formio.submission = submission;
});
},
err => this.onError(err)
);
} else {
this.loadForm();
}
}

loadForm(done?: () => void) {
this.service.loadForm({ params: { live: 1 } }).subscribe(
(form: FormioForm) => {
if (form && form.components) {
this.ngZone.runOutsideAngular(() => {
this.setForm(form);
});
}
if (done) {
done();
}
},
err => this.onError(err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import { FormioAlerts } from './formio.alerts';
import { NgFor } from '@angular/common';
import { ParseHtmlContentPipe } from './parse-html-content.pipe';

@Component({
selector: 'formio-alerts',
templateUrl: './formio.alerts.component.html',
standalone: false
imports: [NgFor, ParseHtmlContentPipe]
})
export class FormioAlertsComponent implements OnInit {
@Input() alerts: FormioAlerts;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({ name: 'parseHtmlContent', pure: false, standalone: false })
@Pipe({
name: 'parseHtmlContent', pure: false
})
export class ParseHtmlContentPipe implements PipeTransform {

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import { CustomTagsService } from '../../custom-tags.service';
selector: 'form-builder',
templateUrl: './formbuilder.component.html',
styleUrls: ['../../../../../node_modules/@formio/js/dist/formio.builder.min.css'],
encapsulation: ViewEncapsulation.None,
standalone: false
encapsulation: ViewEncapsulation.None
})
/* tslint:enable */
export class FormBuilderComponent implements OnInit, OnChanges, OnDestroy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ import { FormioAppConfig } from '../../formio.config';
import { Formio, Form } from '@formio/js';
import { FormioBaseComponent } from '../../FormioBaseComponent';
import { CustomTagsService } from '../../custom-tags.service';
import { NgIf } from '@angular/common';
import { FormioLoaderComponent } from '../loader/formio.loader.component';
import { FormioAlertsComponent } from '../alerts/formio.alerts.component';

/* tslint:disable */
@Component({
selector: 'formio',
templateUrl: './formio.component.html',
styleUrls: ['../../../../../node_modules/@formio/js/dist/formio.form.min.css'],
encapsulation: ViewEncapsulation.None,
standalone: false
imports: [NgIf, FormioLoaderComponent, FormioAlertsComponent]
})
/* tslint:enable */
export class FormioComponent extends FormioBaseComponent implements OnInit, OnChanges {
Expand All @@ -20,6 +23,7 @@ export class FormioComponent extends FormioBaseComponent implements OnInit, OnCh
@Optional() public customTags?: CustomTagsService,
) {
super(ngZone, config, customTags);
alert('Hello FormioComponent');
if (this.config) {
Formio.setBaseUrl(this.config.apiUrl);
Formio.setProjectUrl(this.config.appUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ import { Component, OnInit, ViewEncapsulation, Input, OnChanges, ViewChild, Elem
import { Formio } from '@formio/js';
import { FormioComponent } from '../formio/formio.component';
import { FormioReport } from '../../formio.common';
import { NgIf } from '@angular/common';
import { FormioLoaderComponent } from '../loader/formio.loader.component';
import { FormioAlertsComponent } from '../alerts/formio.alerts.component';

/* tslint:disable */
@Component({
selector: 'formio-report',
templateUrl: './formioreport.component.html',
styleUrls: ['../../../../../node_modules/@formio/js/dist/formio.form.min.css'],
encapsulation: ViewEncapsulation.None,
standalone: false
imports: [NgIf, FormioLoaderComponent, FormioAlertsComponent]
})
/* tslint:enable */
export class FormioReportComponent extends FormioComponent implements OnInit, OnChanges {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {Component, Input} from '@angular/core';
import { NgIf } from '@angular/common';

@Component({
selector: 'formio-loader',
styleUrls: ['./formio.loader.component.scss'],
templateUrl: './formio.loader.component.html',
standalone: false
imports: [NgIf]
})
export class FormioLoaderComponent {
@Input() isLoading: boolean
Expand Down
6 changes: 2 additions & 4 deletions projects/angular-formio/src/formio.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { CustomTagsService } from './custom-tags.service';
import { FormioBaseComponent } from './FormioBaseComponent';

@NgModule({
declarations: [
imports: [
CommonModule,
FormioComponent,
FormioReportComponent,
FormioBaseComponent,
Expand All @@ -20,9 +21,6 @@ import { FormioBaseComponent } from './FormioBaseComponent';
FormioAlertsComponent,
ParseHtmlContentPipe
],
imports: [
CommonModule
],
exports: [
FormioComponent,
FormioReportComponent,
Expand Down
Loading
Loading