#636 group picker placeholder widget

This commit is contained in:
Denys Vuika
2016-09-06 19:19:44 +01:00
parent c4c67e4b9c
commit 342c4d023b
6 changed files with 65 additions and 1 deletions

View File

@@ -49,6 +49,9 @@
<div *ngSwitchCase="'typeahead'">
<typeahead-widget [field]="field" (fieldChanged)="fieldChanged($event);"></typeahead-widget>
</div>
<div *ngSwitchCase="'functional-group'">
<functional-group-widget [field]="field" (fieldChanged)="fieldChanged($event);"></functional-group-widget>
</div>
<div *ngSwitchDefault>
<span>UNKNOWN WIDGET TYPE: {{field.type}}</span>
</div>

View File

@@ -25,6 +25,8 @@ export class FormFieldTypes {
static READONLY_TEXT: string = 'readonly-text';
static UPLOAD: string = 'upload';
static TYPEAHEAD: string = 'typeahead';
static FUNCTIONAL_GROUP: string = 'functional-group';
static PEOPLE: string = 'people';
static READONLY_TYPES: string[] = [
FormFieldTypes.HYPERLINK,

View File

@@ -0,0 +1,3 @@
.functional-group-widget {
width: 100%;
}

View File

@@ -0,0 +1,9 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label functional-group-widget">
<input class="mdl-textfield__input"
type="text"
[attr.id]="field.id"
[(ngModel)]="value"
(ngModelChange)="checkVisibility(field)"
[disabled]="field.readOnly">
<label class="mdl-textfield__label" [attr.for]="field.id">{{field.name}}</label>
</div>

View File

@@ -0,0 +1,44 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, OnInit } from '@angular/core';
import { WidgetComponent } from './../widget.component';
declare let __moduleName: string;
declare var componentHandler;
@Component({
moduleId: __moduleName,
selector: 'functional-group-widget',
templateUrl: './functional-group.widget.html',
styleUrls: ['./functional-group.widget.css']
})
export class FunctionalGroupWidget extends WidgetComponent implements OnInit {
value: string;
constructor() {
super();
}
ngOnInit() {
let group = this.field.value;
if (group) {
this.value = group.name;
}
}
}

View File

@@ -29,6 +29,7 @@ import { DisplayValueWidget } from './display-value/display-value.widget';
import { DisplayTextWidget } from './display-text/display-text.widget';
import { UploadWidget } from './upload/upload.widget';
import { TypeaheadWidget } from './typeahead/typeahead.widget';
import { FunctionalGroupWidget } from './functional-group/functional-group.widget';
// core
export * from './widget.component';
@@ -50,6 +51,7 @@ export * from './display-value/display-value.widget';
export * from './display-text/display-text.widget';
export * from './upload/upload.widget';
export * from './typeahead/typeahead.widget';
export * from './functional-group/functional-group.widget';
export const CONTAINER_WIDGET_DIRECTIVES: [any] = [
TabsWidget,
@@ -67,7 +69,8 @@ export const PRIMITIVE_WIDGET_DIRECTIVES: [any] = [
DisplayValueWidget,
DisplayTextWidget,
UploadWidget,
TypeaheadWidget
TypeaheadWidget,
FunctionalGroupWidget
];