#814 fix MDL issues

- additional workarounds for Material Design Lite problems
- validation fixes

fixes #814
This commit is contained in:
Denys Vuika
2016-09-26 15:20:33 +01:00
parent dea16dabe6
commit 433d192b70
10 changed files with 113 additions and 20 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ElementRef } from '@angular/core';
import { WidgetComponent } from './../widget.component';
import { FormService } from '../../../services/form.service';
import { GroupModel } from './../core/group.model';
@@ -36,7 +36,8 @@ export class FunctionalGroupWidget extends WidgetComponent implements OnInit {
minTermLength: number = 1;
groupId: string;
constructor(private formService: FormService) {
constructor(private formService: FormService,
private elementRef: ElementRef) {
super();
}
@@ -108,4 +109,19 @@ export class FunctionalGroupWidget extends WidgetComponent implements OnInit {
event.preventDefault();
}
}
setupMaterialComponents(handler: any): boolean {
// workaround for MDL issues with dynamic components
if (handler) {
handler.upgradeAllRegistered();
if (this.elementRef && this.value) {
let container = this.elementRef.nativeElement.querySelector('.mdl-textfield');
if (container) {
container.MaterialTextfield.change(this.value);
}
}
return true;
}
return false;
}
}