diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d8e7fb7..59cac3e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. -## [Unreleased: 8.0.0-rc.3] +## 8.0.0-rc.5 +### Fixed + - Adding a way to reset the resource provider cache. + +## 8.0.0-rc.3 ### Changed - FIO-8667 fixed location of download PDF button - FIO-8638 fixed saving components after changing form display diff --git a/package.json b/package.json index 023c1816..0ade230c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@formio/angular", - "version": "8.0.0-rc.3", + "version": "8.0.0-rc.6", "scripts": { "ng": "ng", "build": "ng build angular-formio", diff --git a/projects/angular-formio/package.json b/projects/angular-formio/package.json index 1eb553ef..a5d17b11 100644 --- a/projects/angular-formio/package.json +++ b/projects/angular-formio/package.json @@ -1,6 +1,6 @@ { "name": "@formio/angular", - "version": "8.0.0-rc.3", + "version": "8.0.0-rc.6", "repository": { "type": "git", "url": "https://github.com/formio/angular-formio" diff --git a/projects/angular-formio/resource/src/resource.component.ts b/projects/angular-formio/resource/src/resource.component.ts index 42122bf9..4d53cd3f 100644 --- a/projects/angular-formio/resource/src/resource.component.ts +++ b/projects/angular-formio/resource/src/resource.component.ts @@ -32,7 +32,7 @@ export class FormioResourceComponent implements OnInit, OnDestroy { } init() { - return this.service.init(this.route).then(() => + return this.service.init(this.route, this.router).then(() => this.auth.ready.then(() => this.service.formFormio.userPermissions( this.auth.user, diff --git a/projects/angular-formio/resource/src/resource.service.ts b/projects/angular-formio/resource/src/resource.service.ts index 518cd1ad..00322804 100644 --- a/projects/angular-formio/resource/src/resource.service.ts +++ b/projects/angular-formio/resource/src/resource.service.ts @@ -1,5 +1,5 @@ import { EventEmitter, Injectable, Optional } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { FormioResourceConfig } from './resource.config'; import { FormioResources } from './resources.service'; import { FormioPromiseService } from '@formio/angular'; @@ -84,9 +84,18 @@ export class FormioResourceService { this.resource = { data: {} }; } - init(route: ActivatedRoute) { + init(route: ActivatedRoute, router: Router = null) { const snapshot = route.snapshot; - const reset = snapshot.queryParams?.hasOwnProperty('reset') ? snapshot.queryParams.reset : false; + let reset = false; + if (snapshot.queryParams?.hasOwnProperty('reset')) { + reset = snapshot.queryParams.reset; + } + else if (router) { + const navigation = router.getCurrentNavigation(); + if (navigation?.extras.state && navigation.extras.state.hasOwnProperty('reset')) { + reset = navigation.extras.state['reset']; + } + } const resourceId = snapshot.params['id']; if (resourceId && (resourceId === this.resourceId) && !reset) { return this.ready; diff --git a/projects/angular-formio/src/formio.config.ts b/projects/angular-formio/src/formio.config.ts index 66f2f3ee..1a8b8507 100644 --- a/projects/angular-formio/src/formio.config.ts +++ b/projects/angular-formio/src/formio.config.ts @@ -1,23 +1,17 @@ -import { Inject, Injectable, InjectionToken } from '@angular/core'; -export const FORMIO_CONFIG = new InjectionToken('formio-config'); +import { Injectable, OnInit } from '@angular/core'; import { Formio } from '@formio/js'; -@Injectable() -export class FormioAppConfig { +@Injectable({ + providedIn: 'root' +}) +export class FormioAppConfig implements OnInit { [x: string]: any; appUrl = ''; apiUrl = ''; icons?: string; formOnly?: boolean; formio?: Formio; - constructor(@Inject(FORMIO_CONFIG) config: { - apiUrl?: string, - baseUrl?: string, - appUrl?: string, - projectUrl?: string - } = {}) { - this.apiUrl = config.apiUrl || config.baseUrl; - this.appUrl = config.appUrl || config.projectUrl; + ngOnInit(): void { if (this.apiUrl) { Formio.setBaseUrl(this.apiUrl); Formio.setProjectUrl(this.appUrl);