mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Base class for 'textfield' widgets
Reduces repetitive code needed to fix MDL problems for textfield-based components
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, ElementRef } from '@angular/core';
|
||||
import { WidgetComponent } from './../widget.component';
|
||||
import { TextFieldWidgetComponent } from './../textfield-widget.component';
|
||||
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
@@ -24,27 +24,10 @@ import { WidgetComponent } from './../widget.component';
|
||||
templateUrl: './date.widget.html',
|
||||
styleUrls: ['./date.widget.css']
|
||||
})
|
||||
export class DateWidget extends WidgetComponent {
|
||||
export class DateWidget extends TextFieldWidgetComponent {
|
||||
|
||||
constructor(private elementRef: ElementRef) {
|
||||
super();
|
||||
}
|
||||
|
||||
setupMaterialComponents(componentHandler: any): boolean {
|
||||
// workaround for MDL issues with dynamic components
|
||||
if (componentHandler) {
|
||||
componentHandler.upgradeAllRegistered();
|
||||
if (this.elementRef && this.hasValue()) {
|
||||
let el = this.elementRef.nativeElement;
|
||||
let container = el.querySelector('.mdl-textfield');
|
||||
if (container) {
|
||||
container.MaterialTextfield.change(this.field.value);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
constructor(elementRef: ElementRef) {
|
||||
super(elementRef);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user