[ADF-1487] ADF checklist - fix mdl issue (#2274)

* fix mdl issue in the next release we should redesign this component

* Implement the correct interface
This commit is contained in:
Maurizio Vitale 2017-09-01 16:50:02 +01:00 committed by Mario Romano
parent 7f720fda3a
commit cbe7db7ed2

View File

@ -15,12 +15,13 @@
* limitations under the License. * limitations under the License.
*/ */
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; import { AfterViewInit, Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';
import { Observable, Observer } from 'rxjs/Rx'; import { Observable, Observer } from 'rxjs/Rx';
import { TaskDetailsModel } from '../models/task-details.model'; import { TaskDetailsModel } from '../models/task-details.model';
import { TaskListService } from './../services/tasklist.service'; import { TaskListService } from './../services/tasklist.service';
declare let dialogPolyfill: any; declare let dialogPolyfill: any;
let componentHandler: any;
@Component({ @Component({
selector: 'adf-checklist, activiti-checklist', selector: 'adf-checklist, activiti-checklist',
@ -28,7 +29,7 @@ declare let dialogPolyfill: any;
styleUrls: ['./checklist.component.css'], styleUrls: ['./checklist.component.css'],
providers: [TaskListService] providers: [TaskListService]
}) })
export class ChecklistComponent implements OnInit, OnChanges { export class ChecklistComponent implements OnInit, OnChanges, AfterViewInit {
@Input() @Input()
taskId: string; taskId: string;
@ -81,6 +82,19 @@ export class ChecklistComponent implements OnInit, OnChanges {
} }
} }
ngAfterViewInit() {
this.setupMaterialComponents(componentHandler);
}
setupMaterialComponents(handler?: any): boolean {
// workaround for MDL issues with dynamic components
if (handler) {
handler.upgradeAllRegistered();
return true;
}
return false;
}
public getTaskChecklist(taskId: string) { public getTaskChecklist(taskId: string) {
this.checklist = []; this.checklist = [];
if (this.taskId) { if (this.taskId) {