mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-852] Form style Material 2 (#2151)
* mdl2 transition part form 1 * hyperlink * radio buttons * label * people component * [ADF-852] moved textarea to new angular material * number widget * change error multiline * [ADF-852] added md desgin for dropdown * [ADF-852] removed unused css file * functional widget * error dropdown * [ADF-852] - changed to new md date * remove md-date-time-picker dependency in ng2-alfresco-from * [ADF-852] conversion dynamic table phase 1 * container widget * remove test unused * validation change * [ADF-852] convert dynamic table phase 2 * [ADF-852] improving style and fixing bugs * move custom style for form in form.scss * error footer refactor * fix models and test * [ADF-852]- fixed minor twitch on dynamic table * align fields and fix tests dropdown * disabling button in readonly clean mdl form start process form * align dropdown * [ADF-1048] Upload widget can manage multiple files. (#2134) * [ADF-1048] improving upload widget * [ADF-1048] added ability to upload multiple file on upload widget * [ADF-1048] added multiple upload elements on upload widget * [ADF-1048] - show all the files on the completed form * [ADF-1048] fixed wrong selecion on displya upload * [ADF-1048] removed fdescribe from upload widget * date validation and custom moment data adapter * move content widget in the widget folder * add style fields and theming * color primary radio and checkbox * fix amount widget and colors * change ViewEncapsulation and fix date style button issue * empty form customization 1736 * focus label style * [ADF-224] fix the rendering of custom stencils when form is opened in readonly state. (#2161) * [ADF-224] Fixed rendering of custom stencil in readonly mode * [ADF-224] improved variable name * test fix * container filter in form model creation * show display value correctly * fix change date and test * fix date editor and add some test coverage for date * style minor issue * fix new unused local import rule * fix test date * strict date check * fix analytics failing test * restore null as default in model * unify model diagrams and analytics
This commit is contained in:
committed by
Mario Romano
parent
47ea517ffb
commit
083c9da0d4
@@ -15,14 +15,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* tslint:disable:component-selector */
|
||||
/* tslint:disable:component-selector */
|
||||
|
||||
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { AfterViewInit, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
|
||||
import { FormService } from './../../services/form.service';
|
||||
import { FormFieldModel } from './core/index';
|
||||
|
||||
declare let componentHandler: any;
|
||||
|
||||
export const baseHost = {
|
||||
'(click)': 'event($event)',
|
||||
'(blur)': 'event($event)',
|
||||
@@ -41,13 +39,17 @@ export const baseHost = {
|
||||
@Component({
|
||||
selector: 'base-widget',
|
||||
template: '',
|
||||
host: baseHost
|
||||
host: baseHost,
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class WidgetComponent implements AfterViewInit {
|
||||
|
||||
static DEFAULT_HYPERLINK_URL: string = '#';
|
||||
static DEFAULT_HYPERLINK_SCHEME: string = 'http://';
|
||||
|
||||
@Input()
|
||||
readOnly: boolean = false;
|
||||
|
||||
@Input()
|
||||
field: FormFieldModel;
|
||||
|
||||
@@ -71,6 +73,10 @@ export class WidgetComponent implements AfterViewInit {
|
||||
return null;
|
||||
}
|
||||
|
||||
isValid(): boolean {
|
||||
return this.field.validationSummary ? true : false;
|
||||
}
|
||||
|
||||
hasValue(): boolean {
|
||||
return this.field &&
|
||||
this.field.value !== null &&
|
||||
@@ -78,33 +84,9 @@ export class WidgetComponent implements AfterViewInit {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.setupMaterialComponents(componentHandler);
|
||||
this.fieldChanged.emit(this.field);
|
||||
}
|
||||
|
||||
setupMaterialComponents(handler?: any): boolean {
|
||||
// workaround for MDL issues with dynamic components
|
||||
if (handler) {
|
||||
handler.upgradeAllRegistered();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
setupMaterialTextField(elementRef: ElementRef, handler: any, value: string): boolean {
|
||||
if (elementRef && handler) {
|
||||
let el = elementRef.nativeElement;
|
||||
if (el) {
|
||||
let container = el.querySelector('.mdl-textfield');
|
||||
if (container) {
|
||||
container.MaterialTextfield.change(value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @deprecated used only to trigger visibility engine, components should do that internally if needed */
|
||||
checkVisibility(field: FormFieldModel) {
|
||||
console.log('WidgetComponent.checkVisibility was used only to trigger visibility engine, components should do that internally if needed');
|
||||
@@ -136,6 +118,7 @@ export class WidgetComponent implements AfterViewInit {
|
||||
}
|
||||
|
||||
protected event(event: Event): void {
|
||||
console.log(event);
|
||||
this.formService.formEvents.next(event);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user