From cbe7db7ed28a7d01e7cd13b979f41a109bb2fe25 Mon Sep 17 00:00:00 2001 From: Maurizio Vitale Date: Fri, 1 Sep 2017 16:50:02 +0100 Subject: [PATCH] [ADF-1487] ADF checklist - fix mdl issue (#2274) * fix mdl issue in the next release we should redesign this component * Implement the correct interface --- .../src/components/checklist.component.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ng2-components/ng2-activiti-tasklist/src/components/checklist.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/checklist.component.ts index 8673040efc..887cd4556a 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/checklist.component.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/checklist.component.ts @@ -15,12 +15,13 @@ * 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 { TaskDetailsModel } from '../models/task-details.model'; import { TaskListService } from './../services/tasklist.service'; declare let dialogPolyfill: any; +let componentHandler: any; @Component({ selector: 'adf-checklist, activiti-checklist', @@ -28,7 +29,7 @@ declare let dialogPolyfill: any; styleUrls: ['./checklist.component.css'], providers: [TaskListService] }) -export class ChecklistComponent implements OnInit, OnChanges { +export class ChecklistComponent implements OnInit, OnChanges, AfterViewInit { @Input() 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) { this.checklist = []; if (this.taskId) {