mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#469 Plain Header widget
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
.container-widget {}
|
||||||
|
|
||||||
|
.container-widget__header {}
|
||||||
|
|
||||||
|
.container-widget__header-text {
|
||||||
|
border-bottom: 1px solid rgba(0,0,0,.87);
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
@@ -1,3 +1,7 @@
|
|||||||
|
<div class="container-widget">
|
||||||
|
<div *ngIf="content?.isGroup()" class="container-widget__header">
|
||||||
|
<h3 class="container-widget__header-text">{{content.name}}</h3>
|
||||||
|
</div>
|
||||||
<div class="mdl-grid">
|
<div class="mdl-grid">
|
||||||
<div *ngFor="let col of content.columns" class="mdl-cell mdl-cell--{{col.size}}-col">
|
<div *ngFor="let col of content.columns" class="mdl-cell mdl-cell--{{col.size}}-col">
|
||||||
<div class="mdl-grid" *ngIf="col.hasFields()">
|
<div class="mdl-grid" *ngIf="col.hasFields()">
|
||||||
@@ -26,3 +30,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
@@ -31,6 +31,7 @@ declare var componentHandler;
|
|||||||
moduleId: __moduleName,
|
moduleId: __moduleName,
|
||||||
selector: 'container-widget',
|
selector: 'container-widget',
|
||||||
templateUrl: './container.widget.html',
|
templateUrl: './container.widget.html',
|
||||||
|
styleUrls: ['./container.widget.css'],
|
||||||
directives: [
|
directives: [
|
||||||
TextWidget,
|
TextWidget,
|
||||||
NumberWidget,
|
NumberWidget,
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, NgZone } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
import { ObjectUtils } from 'ng2-alfresco-core';
|
import { ObjectUtils } from 'ng2-alfresco-core';
|
||||||
@@ -32,8 +32,7 @@ declare var componentHandler;
|
|||||||
})
|
})
|
||||||
export class DropdownWidget extends WidgetComponent implements OnInit {
|
export class DropdownWidget extends WidgetComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private http: Http,
|
constructor(private http: Http) {
|
||||||
private zone: NgZone) {
|
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,10 +15,19 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export interface FormValues {
|
export interface FormFieldMetadata {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface FormValues extends FormFieldMetadata {
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FormFieldTypes {
|
||||||
|
static CONTAINER: string = 'container';
|
||||||
|
static GROUP: string = 'group';
|
||||||
|
static DROPDOWN: string = 'dropdown';
|
||||||
|
}
|
||||||
|
|
||||||
export class FormWidgetModel {
|
export class FormWidgetModel {
|
||||||
|
|
||||||
private _form: FormModel;
|
private _form: FormModel;
|
||||||
@@ -64,6 +73,7 @@ export class FormFieldModel extends FormWidgetModel {
|
|||||||
hasEmptyValue: boolean;
|
hasEmptyValue: boolean;
|
||||||
className: string;
|
className: string;
|
||||||
optionType: string;
|
optionType: string;
|
||||||
|
params: FormFieldMetadata = {};
|
||||||
|
|
||||||
get value(): any {
|
get value(): any {
|
||||||
return this._value;
|
return this._value;
|
||||||
@@ -95,6 +105,7 @@ export class FormFieldModel extends FormWidgetModel {
|
|||||||
this.hasEmptyValue = <boolean> json.hasEmptyValue;
|
this.hasEmptyValue = <boolean> json.hasEmptyValue;
|
||||||
this.className = json.className;
|
this.className = json.className;
|
||||||
this.optionType = json.optionType;
|
this.optionType = json.optionType;
|
||||||
|
this.params = <FormFieldMetadata> json.params || {};
|
||||||
|
|
||||||
this._value = this.parseValue(json);
|
this._value = this.parseValue(json);
|
||||||
this.updateForm();
|
this.updateForm();
|
||||||
@@ -109,7 +120,7 @@ export class FormFieldModel extends FormWidgetModel {
|
|||||||
but saving back as object: { id: <id>, name: <name> }
|
but saving back as object: { id: <id>, name: <name> }
|
||||||
*/
|
*/
|
||||||
// TODO: needs review
|
// TODO: needs review
|
||||||
if (json.fieldType === 'RestFieldRepresentation') {
|
if (json.type === FormFieldTypes.DROPDOWN) {
|
||||||
if (value === '') {
|
if (value === '') {
|
||||||
value = 'empty';
|
value = 'empty';
|
||||||
}
|
}
|
||||||
@@ -123,7 +134,7 @@ export class FormFieldModel extends FormWidgetModel {
|
|||||||
This is needed due to Activiti reading dropdown values as string
|
This is needed due to Activiti reading dropdown values as string
|
||||||
but saving back as object: { id: <id>, name: <name> }
|
but saving back as object: { id: <id>, name: <name> }
|
||||||
*/
|
*/
|
||||||
if (this.fieldType === 'RestFieldRepresentation') {
|
if (this.type === FormFieldTypes.DROPDOWN) {
|
||||||
if (this.value === 'empty' || this.value === '') {
|
if (this.value === 'empty' || this.value === '') {
|
||||||
this.form.values[this.id] = {};
|
this.form.values[this.id] = {};
|
||||||
} else {
|
} else {
|
||||||
@@ -159,6 +170,10 @@ export class ContainerModel extends FormWidgetModel {
|
|||||||
|
|
||||||
columns: ContainerColumnModel[] = [];
|
columns: ContainerColumnModel[] = [];
|
||||||
|
|
||||||
|
isGroup(): boolean {
|
||||||
|
return this.type == FormFieldTypes.GROUP;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(form: FormModel, json?: any) {
|
constructor(form: FormModel, json?: any) {
|
||||||
super(form, json);
|
super(form, json);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user