mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#967 container widgets reworked
- moved internals of container widget to corresponding folder - moved internals of dynamic table to corresponding folder
This commit is contained in:
committed by
Mario Romano
parent
084d962230
commit
f81f78d311
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ContainerColumnModel } from './container-column.model';
|
import { ContainerColumnModel } from './container-column.model';
|
||||||
import { FormModel } from './form.model';
|
import { FormModel } from './../core/form.model';
|
||||||
import { FormFieldModel } from './form-field.model';
|
import { FormFieldModel } from './../core/form-field.model';
|
||||||
|
|
||||||
describe('ContainerColumnModel', () => {
|
describe('ContainerColumnModel', () => {
|
||||||
|
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { FormFieldModel } from './form-field.model';
|
import { FormFieldModel } from './../core/form-field.model';
|
||||||
|
|
||||||
export class ContainerColumnModel {
|
export class ContainerColumnModel {
|
||||||
|
|
@@ -0,0 +1,147 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { ContainerWidgetModel } from './container.widget.model';
|
||||||
|
import { FormModel } from './../core/form.model';
|
||||||
|
import { FormFieldTypes } from './../core/form-field-types';
|
||||||
|
|
||||||
|
describe('ContainerWidgetModel', () => {
|
||||||
|
|
||||||
|
it('should store the form reference', () => {
|
||||||
|
let form = new FormModel();
|
||||||
|
let model = new ContainerWidgetModel(form);
|
||||||
|
expect(model.form).toBe(form);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should store original json', () => {
|
||||||
|
let json = {};
|
||||||
|
let model = new ContainerWidgetModel(null, json);
|
||||||
|
expect(model.json).toBe(json);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have 1 column layout by default', () => {
|
||||||
|
let container = new ContainerWidgetModel(null, null);
|
||||||
|
expect(container.numberOfColumns).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be expanded by default', () => {
|
||||||
|
let container = new ContainerWidgetModel(null, null);
|
||||||
|
expect(container.isExpanded).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
it('should setup with json config', () => {
|
||||||
|
let json = {
|
||||||
|
fieldType: '<type>',
|
||||||
|
id: '<id>',
|
||||||
|
name: '<name>',
|
||||||
|
type: '<type>',
|
||||||
|
tab: '<tab>',
|
||||||
|
numberOfColumns: 2,
|
||||||
|
params: {}
|
||||||
|
};
|
||||||
|
let container = new ContainerWidgetModel(null, json);
|
||||||
|
Object.keys(json).forEach(key => {
|
||||||
|
expect(container[key]).toEqual(json[key]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
it('should wrap fields into columns on setup', () => {
|
||||||
|
let form = new FormModel();
|
||||||
|
let json = {
|
||||||
|
fieldType: '<type>',
|
||||||
|
id: '<id>',
|
||||||
|
name: '<name>',
|
||||||
|
type: '<type>',
|
||||||
|
tab: '<tab>',
|
||||||
|
numberOfColumns: 3,
|
||||||
|
params: {},
|
||||||
|
visibilityCondition: {},
|
||||||
|
fields: {
|
||||||
|
'1': [
|
||||||
|
{ id: 'field-1' },
|
||||||
|
{ id: 'field-3' }
|
||||||
|
],
|
||||||
|
'2': [
|
||||||
|
{ id: 'field-2' }
|
||||||
|
],
|
||||||
|
'3': null
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let container = new ContainerWidgetModel(form, json);
|
||||||
|
expect(container.columns.length).toBe(3);
|
||||||
|
|
||||||
|
let col1 = container.columns[0];
|
||||||
|
expect(col1.fields.length).toBe(2);
|
||||||
|
expect(col1.fields[0].id).toBe('field-1');
|
||||||
|
expect(col1.fields[1].id).toBe('field-3');
|
||||||
|
|
||||||
|
let col2 = container.columns[1];
|
||||||
|
expect(col2.fields.length).toBe(1);
|
||||||
|
expect(col2.fields[0].id).toBe('field-2');
|
||||||
|
|
||||||
|
let col3 = container.columns[2];
|
||||||
|
expect(col3.fields.length).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should allow collapsing only when of a group type', () => {
|
||||||
|
let container = new ContainerWidgetModel(new FormModel(), {
|
||||||
|
type: FormFieldTypes.CONTAINER,
|
||||||
|
params: {
|
||||||
|
allowCollapse: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(container.isCollapsible()).toBeFalsy();
|
||||||
|
container = new ContainerWidgetModel(new FormModel(), {
|
||||||
|
type: FormFieldTypes.GROUP,
|
||||||
|
params: {
|
||||||
|
allowCollapse: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expect(container.isCollapsible()).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should allow collapsing only when explicitly defined in params', () => {
|
||||||
|
let container = new ContainerWidgetModel(new FormModel(), {
|
||||||
|
type: FormFieldTypes.GROUP,
|
||||||
|
params: {}
|
||||||
|
});
|
||||||
|
expect(container.isCollapsible()).toBeFalsy();
|
||||||
|
|
||||||
|
container = new ContainerWidgetModel(new FormModel(), {
|
||||||
|
type: FormFieldTypes.GROUP,
|
||||||
|
params: {
|
||||||
|
allowCollapse: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expect(container.isCollapsible()).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be collapsed by default', () => {
|
||||||
|
let container = new ContainerWidgetModel(new FormModel(), {
|
||||||
|
type: FormFieldTypes.GROUP,
|
||||||
|
params: {
|
||||||
|
allowCollapse: true,
|
||||||
|
collapseByDefault: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expect(container.isCollapsedByDefault()).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@@ -0,0 +1,98 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { ContainerModel } from './../core/container.model';
|
||||||
|
import { FormModel } from './../core/form.model';
|
||||||
|
import { ContainerColumnModel } from './container-column.model';
|
||||||
|
import { FormFieldTypes } from './../core/form-field-types';
|
||||||
|
import { FormFieldModel } from './../core/form-field.model';
|
||||||
|
|
||||||
|
export class ContainerWidgetModel extends ContainerModel {
|
||||||
|
|
||||||
|
numberOfColumns: number = 1;
|
||||||
|
columns: ContainerColumnModel[] = [];
|
||||||
|
isExpanded: boolean = true;
|
||||||
|
|
||||||
|
isGroup(): boolean {
|
||||||
|
return this.type === FormFieldTypes.GROUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
isCollapsible(): boolean {
|
||||||
|
let allowCollapse = false;
|
||||||
|
|
||||||
|
if (this.isGroup() && this.field.params['allowCollapse']) {
|
||||||
|
allowCollapse = <boolean> this.field.params['allowCollapse'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return allowCollapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
isCollapsedByDefault(): boolean {
|
||||||
|
let collapseByDefault = false;
|
||||||
|
|
||||||
|
if (this.isCollapsible() && this.field.params['collapseByDefault']) {
|
||||||
|
collapseByDefault = <boolean> this.field.params['collapseByDefault'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return collapseByDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(form: FormModel, json?: any) {
|
||||||
|
super(form, json);
|
||||||
|
|
||||||
|
if (json) {
|
||||||
|
this.numberOfColumns = <number> json.numberOfColumns;
|
||||||
|
|
||||||
|
let columnSize: number = 12;
|
||||||
|
if (this.numberOfColumns > 1) {
|
||||||
|
columnSize = 12 / this.numberOfColumns;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < this.numberOfColumns; i++) {
|
||||||
|
let col = new ContainerColumnModel();
|
||||||
|
col.size = columnSize;
|
||||||
|
this.columns.push(col);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (json.fields) {
|
||||||
|
Object.keys(json.fields).map(key => {
|
||||||
|
let fields = (json.fields[key] || []).map(f => new FormFieldModel(form, f));
|
||||||
|
let col = this.columns[parseInt(key, 10) - 1];
|
||||||
|
col.fields = fields;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isExpanded = !this.isCollapsedByDefault();
|
||||||
|
this.children = this.getFormFields();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getFormFields(): FormFieldModel[] {
|
||||||
|
let result: FormFieldModel[] = [];
|
||||||
|
|
||||||
|
for (let j = 0; j < this.columns.length; j++) {
|
||||||
|
let column = this.columns[j];
|
||||||
|
for (let k = 0; k < column.fields.length; k++) {
|
||||||
|
let field = column.fields[k];
|
||||||
|
result.push(field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ContainerWidget } from './container.widget';
|
import { ContainerWidget } from './container.widget';
|
||||||
|
import { ContainerWidgetModel } from './container.widget.model';
|
||||||
import { FormModel } from './../core/form.model';
|
import { FormModel } from './../core/form.model';
|
||||||
import { ContainerModel } from './../core/container.model';
|
|
||||||
import { FormFieldTypes } from './../core/form-field-types';
|
import { FormFieldTypes } from './../core/form-field-types';
|
||||||
import { FormFieldModel } from './../core/form-field.model';
|
import { FormFieldModel } from './../core/form-field.model';
|
||||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||||
@@ -53,7 +53,7 @@ describe('ContainerWidget', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should toggle underlying group container', () => {
|
it('should toggle underlying group container', () => {
|
||||||
let container = new ContainerModel(new FormModel(), {
|
let container = new ContainerWidgetModel(new FormModel(), {
|
||||||
type: FormFieldTypes.GROUP,
|
type: FormFieldTypes.GROUP,
|
||||||
params: {
|
params: {
|
||||||
allowCollapse: true
|
allowCollapse: true
|
||||||
@@ -71,7 +71,7 @@ describe('ContainerWidget', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should toggle only collapsible container', () => {
|
it('should toggle only collapsible container', () => {
|
||||||
let container = new ContainerModel(new FormModel(), {
|
let container = new ContainerWidgetModel(new FormModel(), {
|
||||||
type: FormFieldTypes.GROUP
|
type: FormFieldTypes.GROUP
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ describe('ContainerWidget', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should toggle only group container', () => {
|
it('should toggle only group container', () => {
|
||||||
let container = new ContainerModel(new FormModel(), {
|
let container = new ContainerWidgetModel(new FormModel(), {
|
||||||
type: FormFieldTypes.CONTAINER,
|
type: FormFieldTypes.CONTAINER,
|
||||||
params: {
|
params: {
|
||||||
allowCollapse: true
|
allowCollapse: true
|
||||||
@@ -117,8 +117,8 @@ describe('ContainerWidget', () => {
|
|||||||
let containerWidgetComponent: ContainerWidget;
|
let containerWidgetComponent: ContainerWidget;
|
||||||
let fixture: ComponentFixture<ContainerWidget>;
|
let fixture: ComponentFixture<ContainerWidget>;
|
||||||
let element: HTMLElement;
|
let element: HTMLElement;
|
||||||
let fakeContainerVisible: ContainerModel;
|
let fakeContainerVisible: ContainerWidgetModel;
|
||||||
let fakeContainerInvisible: ContainerModel;
|
let fakeContainerInvisible: ContainerWidgetModel;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -134,13 +134,13 @@ describe('ContainerWidget', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
componentHandler = jasmine.createSpyObj('componentHandler', ['upgradeAllRegistered', 'upgradeElement']);
|
componentHandler = jasmine.createSpyObj('componentHandler', ['upgradeAllRegistered', 'upgradeElement']);
|
||||||
window['componentHandler'] = componentHandler;
|
window['componentHandler'] = componentHandler;
|
||||||
fakeContainerVisible = new ContainerModel(new FormModel(fakeFormJson), {
|
fakeContainerVisible = new ContainerWidgetModel(new FormModel(fakeFormJson), {
|
||||||
fieldType: FormFieldTypes.GROUP,
|
fieldType: FormFieldTypes.GROUP,
|
||||||
id: 'fake-cont-id-1',
|
id: 'fake-cont-id-1',
|
||||||
name: 'fake-cont-1-name',
|
name: 'fake-cont-1-name',
|
||||||
type: FormFieldTypes.GROUP
|
type: FormFieldTypes.GROUP
|
||||||
});
|
});
|
||||||
fakeContainerInvisible = new ContainerModel(new FormModel(fakeFormJson), {
|
fakeContainerInvisible = new ContainerWidgetModel(new FormModel(fakeFormJson), {
|
||||||
fieldType: FormFieldTypes.GROUP,
|
fieldType: FormFieldTypes.GROUP,
|
||||||
id: 'fake-cont-id-2',
|
id: 'fake-cont-id-2',
|
||||||
name: 'fake-cont-2-name',
|
name: 'fake-cont-2-name',
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, AfterViewInit, OnInit } from '@angular/core';
|
import { Component, AfterViewInit, OnInit } from '@angular/core';
|
||||||
import { ContainerModel } from './../core/index';
|
import { ContainerWidgetModel } from './container.widget.model';
|
||||||
import { WidgetComponent } from './../widget.component';
|
import { WidgetComponent } from './../widget.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -27,7 +27,7 @@ import { WidgetComponent } from './../widget.component';
|
|||||||
})
|
})
|
||||||
export class ContainerWidget extends WidgetComponent implements OnInit, AfterViewInit {
|
export class ContainerWidget extends WidgetComponent implements OnInit, AfterViewInit {
|
||||||
|
|
||||||
content: ContainerModel;
|
content: ContainerWidgetModel;
|
||||||
|
|
||||||
onExpanderClicked() {
|
onExpanderClicked() {
|
||||||
if (this.content && this.content.isCollapsible()) {
|
if (this.content && this.content.isCollapsible()) {
|
||||||
@@ -37,7 +37,7 @@ export class ContainerWidget extends WidgetComponent implements OnInit, AfterVie
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
this.content = new ContainerModel(this.field.form, this.field.json);
|
this.content = new ContainerWidgetModel(this.field.form, this.field.json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
import { ContainerModel } from './container.model';
|
import { ContainerModel } from './container.model';
|
||||||
import { FormModel } from './form.model';
|
import { FormModel } from './form.model';
|
||||||
import { FormFieldTypes } from './form-field-types';
|
|
||||||
|
|
||||||
describe('ContainerModel', () => {
|
describe('ContainerModel', () => {
|
||||||
|
|
||||||
@@ -33,113 +32,4 @@ describe('ContainerModel', () => {
|
|||||||
expect(model.json).toBe(json);
|
expect(model.json).toBe(json);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have 1 column layout by default', () => {
|
|
||||||
let container = new ContainerModel(null, null);
|
|
||||||
expect(container.numberOfColumns).toBe(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be expanded by default', () => {
|
|
||||||
let container = new ContainerModel(null, null);
|
|
||||||
expect(container.isExpanded).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should setup with json config', () => {
|
|
||||||
let json = {
|
|
||||||
fieldType: '<type>',
|
|
||||||
id: '<id>',
|
|
||||||
name: '<name>',
|
|
||||||
type: '<type>',
|
|
||||||
tab: '<tab>',
|
|
||||||
numberOfColumns: 2,
|
|
||||||
params: {}
|
|
||||||
};
|
|
||||||
let container = new ContainerModel(null, json);
|
|
||||||
Object.keys(json).forEach(key => {
|
|
||||||
expect(container[key]).toEqual(json[key]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should wrap fields into columns on setup', () => {
|
|
||||||
let form = new FormModel();
|
|
||||||
let json = {
|
|
||||||
fieldType: '<type>',
|
|
||||||
id: '<id>',
|
|
||||||
name: '<name>',
|
|
||||||
type: '<type>',
|
|
||||||
tab: '<tab>',
|
|
||||||
numberOfColumns: 3,
|
|
||||||
params: {},
|
|
||||||
visibilityCondition: {},
|
|
||||||
fields: {
|
|
||||||
'1': [
|
|
||||||
{ id: 'field-1' },
|
|
||||||
{ id: 'field-3' }
|
|
||||||
],
|
|
||||||
'2': [
|
|
||||||
{ id: 'field-2' }
|
|
||||||
],
|
|
||||||
'3': null
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let container = new ContainerModel(form, json);
|
|
||||||
expect(container.columns.length).toBe(3);
|
|
||||||
|
|
||||||
let col1 = container.columns[0];
|
|
||||||
expect(col1.fields.length).toBe(2);
|
|
||||||
expect(col1.fields[0].id).toBe('field-1');
|
|
||||||
expect(col1.fields[1].id).toBe('field-3');
|
|
||||||
|
|
||||||
let col2 = container.columns[1];
|
|
||||||
expect(col2.fields.length).toBe(1);
|
|
||||||
expect(col2.fields[0].id).toBe('field-2');
|
|
||||||
|
|
||||||
let col3 = container.columns[2];
|
|
||||||
expect(col3.fields.length).toBe(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allow collapsing only when of a group type', () => {
|
|
||||||
let container = new ContainerModel(new FormModel(), {
|
|
||||||
type: FormFieldTypes.CONTAINER,
|
|
||||||
params: {
|
|
||||||
allowCollapse: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(container.isCollapsible()).toBeFalsy();
|
|
||||||
container = new ContainerModel(new FormModel(), {
|
|
||||||
type: FormFieldTypes.GROUP,
|
|
||||||
params: {
|
|
||||||
allowCollapse: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
expect(container.isCollapsible()).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allow collapsing only when explicitly defined in params', () => {
|
|
||||||
let container = new ContainerModel(new FormModel(), {
|
|
||||||
type: FormFieldTypes.GROUP,
|
|
||||||
params: {}
|
|
||||||
});
|
|
||||||
expect(container.isCollapsible()).toBeFalsy();
|
|
||||||
|
|
||||||
container = new ContainerModel(new FormModel(), {
|
|
||||||
type: FormFieldTypes.GROUP,
|
|
||||||
params: {
|
|
||||||
allowCollapse: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
expect(container.isCollapsible()).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be collapsed by default', () => {
|
|
||||||
let container = new ContainerModel(new FormModel(), {
|
|
||||||
type: FormFieldTypes.GROUP,
|
|
||||||
params: {
|
|
||||||
allowCollapse: true,
|
|
||||||
collapseByDefault: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
expect(container.isCollapsedByDefault()).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -16,95 +16,24 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { FormWidgetModel } from './form-widget.model';
|
import { FormWidgetModel } from './form-widget.model';
|
||||||
import { FormFieldMetadata } from './form-field-metadata';
|
|
||||||
import { ContainerColumnModel } from './container-column.model';
|
|
||||||
import { FormFieldTypes } from './form-field-types';
|
|
||||||
import { FormModel } from './form.model';
|
import { FormModel } from './form.model';
|
||||||
import { FormFieldModel } from './form-field.model';
|
import { FormFieldModel } from './form-field.model';
|
||||||
|
|
||||||
export class ContainerModel extends FormWidgetModel {
|
export class ContainerModel extends FormWidgetModel {
|
||||||
|
|
||||||
field: FormFieldModel;
|
field: FormFieldModel;
|
||||||
numberOfColumns: number = 1;
|
children: FormFieldModel[] = [];
|
||||||
params: FormFieldMetadata = {};
|
|
||||||
|
|
||||||
columns: ContainerColumnModel[] = [];
|
|
||||||
isExpanded: boolean = true;
|
|
||||||
|
|
||||||
get isVisible(): boolean {
|
get isVisible(): boolean {
|
||||||
return this.field.isVisible;
|
return this.field.isVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
isGroup(): boolean {
|
|
||||||
return this.type === FormFieldTypes.GROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
isCollapsible(): boolean {
|
|
||||||
let allowCollapse = false;
|
|
||||||
|
|
||||||
if (this.isGroup() && this.params['allowCollapse']) {
|
|
||||||
allowCollapse = <boolean> this.params['allowCollapse'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return allowCollapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
isCollapsedByDefault(): boolean {
|
|
||||||
let collapseByDefault = false;
|
|
||||||
|
|
||||||
if (this.isCollapsible() && this.params['collapseByDefault']) {
|
|
||||||
collapseByDefault = <boolean> this.params['collapseByDefault'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return collapseByDefault;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(form: FormModel, json?: any) {
|
constructor(form: FormModel, json?: any) {
|
||||||
super(form, json);
|
super(form, json);
|
||||||
|
|
||||||
if (json) {
|
if (json) {
|
||||||
this.field = new FormFieldModel(form, json);
|
this.field = new FormFieldModel(form, json);
|
||||||
this.numberOfColumns = <number> json.numberOfColumns;
|
|
||||||
this.params = <FormFieldMetadata> json.params || {};
|
|
||||||
|
|
||||||
let columnSize: number = 12;
|
|
||||||
if (this.numberOfColumns > 1) {
|
|
||||||
columnSize = 12 / this.numberOfColumns;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < this.numberOfColumns; i++) {
|
|
||||||
let col = new ContainerColumnModel();
|
|
||||||
col.size = columnSize;
|
|
||||||
this.columns.push(col);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (json.fields) {
|
|
||||||
Object.keys(json.fields).map(key => {
|
|
||||||
let fields = (json.fields[key] || []).map(f => new FormFieldModel(form, f));
|
|
||||||
let col = this.columns[parseInt(key, 10) - 1];
|
|
||||||
col.fields = fields;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.isExpanded = !this.isCollapsedByDefault();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormFields(): FormFieldModel[] {
|
|
||||||
let result: FormFieldModel[] = [];
|
|
||||||
|
|
||||||
if (this.field) {
|
|
||||||
result.push(this.field);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let j = 0; j < this.columns.length; j++) {
|
|
||||||
let column = this.columns[j];
|
|
||||||
for (let k = 0; k < column.fields.length; k++) {
|
|
||||||
let field = column.fields[k];
|
|
||||||
result.push(field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,48 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// maps to: com.activiti.model.editor.form.ColumnDefinitionRepresentation
|
|
||||||
export interface DynamicTableColumn {
|
|
||||||
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
value: any;
|
|
||||||
optionType: string;
|
|
||||||
options: DynamicTableColumnOption[];
|
|
||||||
restResponsePath: string;
|
|
||||||
restUrl: string;
|
|
||||||
restIdProperty: string;
|
|
||||||
restLabelProperty: string;
|
|
||||||
amountCurrency: string;
|
|
||||||
amountEnableFractions: boolean;
|
|
||||||
required: boolean;
|
|
||||||
editable: boolean;
|
|
||||||
sortable: boolean;
|
|
||||||
visible: boolean;
|
|
||||||
|
|
||||||
// TODO: com.activiti.domain.idm.EndpointConfiguration.EndpointConfigurationRepresentation
|
|
||||||
endpoint: any;
|
|
||||||
// TODO: com.activiti.model.editor.form.RequestHeaderRepresentation
|
|
||||||
requestHeaders: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
// maps to: com.activiti.model.editor.form.OptionRepresentation
|
|
||||||
export interface DynamicTableColumnOption {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
@@ -1,24 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface DynamicTableRow {
|
|
||||||
|
|
||||||
isNew: boolean;
|
|
||||||
selected: boolean;
|
|
||||||
value: any;
|
|
||||||
|
|
||||||
}
|
|
@@ -37,6 +37,7 @@ import {
|
|||||||
|
|
||||||
declare var moment: any;
|
declare var moment: any;
|
||||||
|
|
||||||
|
// Maps to FormFieldRepresentation
|
||||||
export class FormFieldModel extends FormWidgetModel {
|
export class FormFieldModel extends FormWidgetModel {
|
||||||
|
|
||||||
private _value: string;
|
private _value: string;
|
||||||
|
@@ -19,7 +19,7 @@ import { FormModel } from './form.model';
|
|||||||
import { TabModel } from './tab.model';
|
import { TabModel } from './tab.model';
|
||||||
import { ContainerModel } from './container.model';
|
import { ContainerModel } from './container.model';
|
||||||
import { FormOutcomeModel } from './form-outcome.model';
|
import { FormOutcomeModel } from './form-outcome.model';
|
||||||
import { FormValues } from './form-values';
|
// import { FormValues } from './form-values';
|
||||||
import { FormFieldTypes } from './form-field-types';
|
import { FormFieldTypes } from './form-field-types';
|
||||||
|
|
||||||
describe('FormModel', () => {
|
describe('FormModel', () => {
|
||||||
@@ -197,6 +197,7 @@ describe('FormModel', () => {
|
|||||||
expect(tab2.fields[0].id).toBe('field2');
|
expect(tab2.fields[0].id).toBe('field2');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
it('should apply external data', () => {
|
it('should apply external data', () => {
|
||||||
let data: FormValues = {
|
let data: FormValues = {
|
||||||
field1: 'one',
|
field1: 'one',
|
||||||
@@ -259,6 +260,7 @@ describe('FormModel', () => {
|
|||||||
expect(field3.id).toBe('field3');
|
expect(field3.id).toBe('field3');
|
||||||
expect(field3.value).toBe('original-value');
|
expect(field3.value).toBe('original-value');
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
it('should create standard form outcomes', () => {
|
it('should create standard form outcomes', () => {
|
||||||
let json = {
|
let json = {
|
||||||
|
@@ -22,7 +22,6 @@ import { TabModel } from './tab.model';
|
|||||||
import { FormOutcomeModel } from './form-outcome.model';
|
import { FormOutcomeModel } from './form-outcome.model';
|
||||||
import { FormFieldModel } from './form-field.model';
|
import { FormFieldModel } from './form-field.model';
|
||||||
import { FormFieldTypes } from './form-field-types';
|
import { FormFieldTypes } from './form-field-types';
|
||||||
import { DynamicTableModel } from './dynamic-table.model';
|
|
||||||
|
|
||||||
export class FormModel {
|
export class FormModel {
|
||||||
|
|
||||||
@@ -123,14 +122,10 @@ export class FormModel {
|
|||||||
for (let i = 0; i < this.fields.length; i++) {
|
for (let i = 0; i < this.fields.length; i++) {
|
||||||
let field = this.fields[i];
|
let field = this.fields[i];
|
||||||
|
|
||||||
if (field.type === FormFieldTypes.CONTAINER || field.type === FormFieldTypes.GROUP) {
|
if (field instanceof ContainerModel) {
|
||||||
let container = <ContainerModel> field;
|
let container = <ContainerModel> field;
|
||||||
result.push(...container.getFormFields());
|
result.push(container.field);
|
||||||
}
|
result.push(...container.children);
|
||||||
|
|
||||||
if (field.type === FormFieldTypes.DYNAMIC_TABLE) {
|
|
||||||
let dynamicTable = <DynamicTableModel> field;
|
|
||||||
result.push(dynamicTable.field);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +154,7 @@ export class FormModel {
|
|||||||
this.validateForm();
|
this.validateForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activiti supports 2 types of root fields: 'container' and 'dynamic-table'.
|
// Activiti supports 3 types of root fields: container|group|dynamic-table
|
||||||
private parseRootFields(json: any): FormWidgetModel[] {
|
private parseRootFields(json: any): FormWidgetModel[] {
|
||||||
let fields = [];
|
let fields = [];
|
||||||
|
|
||||||
@@ -172,18 +167,16 @@ export class FormModel {
|
|||||||
let result: FormWidgetModel[] = [];
|
let result: FormWidgetModel[] = [];
|
||||||
|
|
||||||
for (let field of fields) {
|
for (let field of fields) {
|
||||||
if (field.type === FormFieldTypes.CONTAINER || field.type === FormFieldTypes.GROUP ) {
|
if (field.type === FormFieldTypes.DISPLAY_VALUE) {
|
||||||
result.push(new ContainerModel(this, field));
|
|
||||||
} else if (field.type === FormFieldTypes.DYNAMIC_TABLE) {
|
|
||||||
result.push(new DynamicTableModel(this, field));
|
|
||||||
} else if (field.type === FormFieldTypes.DISPLAY_VALUE) {
|
|
||||||
// workaround for dynamic table on a completed/readonly form
|
// workaround for dynamic table on a completed/readonly form
|
||||||
if (field.params) {
|
if (field.params) {
|
||||||
let originalField = field.params['field'];
|
let originalField = field.params['field'];
|
||||||
if (originalField.type === FormFieldTypes.DYNAMIC_TABLE) {
|
if (originalField.type === FormFieldTypes.DYNAMIC_TABLE) {
|
||||||
result.push(new DynamicTableModel(this, field));
|
result.push(new ContainerModel(this, field));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
result.push(new ContainerModel(this, field));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,12 +22,8 @@ export * from './form-field-option';
|
|||||||
export * from './form-widget.model';
|
export * from './form-widget.model';
|
||||||
export * from './form-field.model';
|
export * from './form-field.model';
|
||||||
export * from './form.model';
|
export * from './form.model';
|
||||||
export * from './container-column.model';
|
|
||||||
export * from './container.model';
|
export * from './container.model';
|
||||||
export * from './tab.model';
|
export * from './tab.model';
|
||||||
export * from './form-outcome.model';
|
export * from './form-outcome.model';
|
||||||
export * from './form-outcome-event.model';
|
export * from './form-outcome-event.model';
|
||||||
export * from './form-field-validator';
|
export * from './form-field-validator';
|
||||||
export * from './dynamic-table.model';
|
|
||||||
export * from './dynamic-table-column';
|
|
||||||
export * from './dynamic-table-row';
|
|
||||||
|
@@ -21,8 +21,7 @@ import { FormService } from '../../../services/form.service';
|
|||||||
import { FormFieldModel } from './../core/form-field.model';
|
import { FormFieldModel } from './../core/form-field.model';
|
||||||
import { FormFieldTypes } from '../core/form-field-types';
|
import { FormFieldTypes } from '../core/form-field-types';
|
||||||
import { FormModel } from '../core/form.model';
|
import { FormModel } from '../core/form.model';
|
||||||
import { DynamicTableRow } from './../core/dynamic-table-row';
|
import { DynamicTableColumn, DynamicTableRow } from './../dynamic-table/dynamic-table.widget.model';
|
||||||
import { DynamicTableColumn } from './../core/dynamic-table-column';
|
|
||||||
|
|
||||||
describe('DisplayValueWidget', () => {
|
describe('DisplayValueWidget', () => {
|
||||||
|
|
||||||
|
@@ -20,8 +20,7 @@ import { WidgetComponent } from './../widget.component';
|
|||||||
import { FormFieldTypes } from '../core/form-field-types';
|
import { FormFieldTypes } from '../core/form-field-types';
|
||||||
import { FormService } from '../../../services/form.service';
|
import { FormService } from '../../../services/form.service';
|
||||||
import { FormFieldOption } from './../core/form-field-option';
|
import { FormFieldOption } from './../core/form-field-option';
|
||||||
import { DynamicTableColumn } from './../core/dynamic-table-column';
|
import { DynamicTableColumn, DynamicTableRow } from './../dynamic-table/dynamic-table.widget.model';
|
||||||
import { DynamicTableRow } from './../core/dynamic-table-row';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
|
@@ -15,11 +15,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { FormWidgetModel } from './form-widget.model';
|
import { FormWidgetModel } from './../core/form-widget.model';
|
||||||
import { FormModel } from './form.model';
|
import { FormModel } from './../core/form.model';
|
||||||
import { FormFieldModel } from './form-field.model';
|
import { FormFieldModel } from './../core/form-field.model';
|
||||||
import { DynamicTableColumn } from './dynamic-table-column';
|
|
||||||
import { DynamicTableRow } from './dynamic-table-row';
|
|
||||||
|
|
||||||
export class DynamicTableModel extends FormWidgetModel {
|
export class DynamicTableModel extends FormWidgetModel {
|
||||||
|
|
||||||
@@ -285,3 +283,41 @@ export class NumberCellValidator implements CellValidator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps to: com.activiti.model.editor.form.ColumnDefinitionRepresentation
|
||||||
|
export interface DynamicTableColumn {
|
||||||
|
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
type: string;
|
||||||
|
value: any;
|
||||||
|
optionType: string;
|
||||||
|
options: DynamicTableColumnOption[];
|
||||||
|
restResponsePath: string;
|
||||||
|
restUrl: string;
|
||||||
|
restIdProperty: string;
|
||||||
|
restLabelProperty: string;
|
||||||
|
amountCurrency: string;
|
||||||
|
amountEnableFractions: boolean;
|
||||||
|
required: boolean;
|
||||||
|
editable: boolean;
|
||||||
|
sortable: boolean;
|
||||||
|
visible: boolean;
|
||||||
|
|
||||||
|
// TODO: com.activiti.domain.idm.EndpointConfiguration.EndpointConfigurationRepresentation
|
||||||
|
endpoint: any;
|
||||||
|
// TODO: com.activiti.model.editor.form.RequestHeaderRepresentation
|
||||||
|
requestHeaders: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps to: com.activiti.model.editor.form.OptionRepresentation
|
||||||
|
export interface DynamicTableColumnOption {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DynamicTableRow {
|
||||||
|
isNew: boolean;
|
||||||
|
selected: boolean;
|
||||||
|
value: any;
|
||||||
|
}
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { DynamicTableWidget } from './dynamic-table.widget';
|
import { DynamicTableWidget } from './dynamic-table.widget';
|
||||||
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn, FormModel, FormFieldTypes } from './../core/index';
|
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './dynamic-table.widget.model';
|
||||||
|
import { FormModel, FormFieldTypes } from './../core/index';
|
||||||
|
|
||||||
describe('DynamicTableWidget', () => {
|
describe('DynamicTableWidget', () => {
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, ElementRef, OnInit } from '@angular/core';
|
import { Component, ElementRef, OnInit } from '@angular/core';
|
||||||
import { WidgetComponent } from './../widget.component';
|
import { WidgetComponent } from './../widget.component';
|
||||||
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './../core/index';
|
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './dynamic-table.widget.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { BooleanEditorComponent } from './boolean.editor';
|
import { BooleanEditorComponent } from './boolean.editor';
|
||||||
import { DynamicTableRow, DynamicTableColumn } from './../../../core/index';
|
import { DynamicTableRow, DynamicTableColumn } from './../../dynamic-table.widget.model';
|
||||||
|
|
||||||
describe('BooleanEditorComponent', () => {
|
describe('BooleanEditorComponent', () => {
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { CellEditorComponent } from './../cell.editor';
|
import { CellEditorComponent } from './../cell.editor';
|
||||||
import { DynamicTableRow, DynamicTableColumn } from './../../../core/index';
|
import { DynamicTableRow, DynamicTableColumn } from './../../dynamic-table.widget.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Input } from '@angular/core';
|
import { Input } from '@angular/core';
|
||||||
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './../../core/index';
|
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './../dynamic-table.widget.model';
|
||||||
|
|
||||||
export abstract class CellEditorComponent {
|
export abstract class CellEditorComponent {
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { ElementRef } from '@angular/core';
|
import { ElementRef } from '@angular/core';
|
||||||
import { DateEditorComponent } from './date.editor';
|
import { DateEditorComponent } from './date.editor';
|
||||||
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './../../../core/index';
|
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './../../dynamic-table.widget.model';
|
||||||
|
|
||||||
describe('DateEditorComponent', () => {
|
describe('DateEditorComponent', () => {
|
||||||
|
|
||||||
|
@@ -17,14 +17,8 @@
|
|||||||
|
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { DropdownEditorComponent } from './dropdown.editor';
|
import { DropdownEditorComponent } from './dropdown.editor';
|
||||||
import {
|
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn, DynamicTableColumnOption } from './../../dynamic-table.widget.model';
|
||||||
DynamicTableModel,
|
import { FormFieldModel, FormModel } from './../../../core/index';
|
||||||
DynamicTableRow,
|
|
||||||
DynamicTableColumn,
|
|
||||||
DynamicTableColumnOption,
|
|
||||||
FormFieldModel,
|
|
||||||
FormModel
|
|
||||||
} from './../../../core/index';
|
|
||||||
import { FormService } from './../../../../../services/form.service';
|
import { FormService } from './../../../../../services/form.service';
|
||||||
|
|
||||||
describe('DropdownEditorComponent', () => {
|
describe('DropdownEditorComponent', () => {
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { CellEditorComponent } from './../cell.editor';
|
import { CellEditorComponent } from './../cell.editor';
|
||||||
import { DynamicTableRow, DynamicTableColumn, DynamicTableColumnOption } from './../../../core/index';
|
import { DynamicTableRow, DynamicTableColumn, DynamicTableColumnOption } from './../../dynamic-table.widget.model';
|
||||||
import { FormService } from './../../../../../services/form.service';
|
import { FormService } from './../../../../../services/form.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { RowEditorComponent } from './row.editor';
|
import { RowEditorComponent } from './row.editor';
|
||||||
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn, DynamicRowValidationSummary } from './../../core/index';
|
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn, DynamicRowValidationSummary } from './../dynamic-table.widget.model';
|
||||||
|
|
||||||
describe('RowEditorComponent', () => {
|
describe('RowEditorComponent', () => {
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn, DynamicRowValidationSummary } from './../../core/index';
|
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn, DynamicRowValidationSummary } from './../dynamic-table.widget.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { TextEditorComponent } from './text.editor';
|
import { TextEditorComponent } from './text.editor';
|
||||||
import { DynamicTableRow, DynamicTableColumn } from './../../../core/index';
|
import { DynamicTableRow, DynamicTableColumn } from './../../dynamic-table.widget.model';
|
||||||
|
|
||||||
describe('TextEditorComponent', () => {
|
describe('TextEditorComponent', () => {
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { CellEditorComponent } from './../cell.editor';
|
import { CellEditorComponent } from './../cell.editor';
|
||||||
import { DynamicTableRow, DynamicTableColumn } from './../../../core/index';
|
import { DynamicTableRow, DynamicTableColumn } from './../../dynamic-table.widget.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
|
@@ -620,6 +620,7 @@ describe('WidgetVisibilityService', () => {
|
|||||||
expect(res).toBe('value_1');
|
expect(res).toBe('value_1');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
it('should refresh the visibility for field', () => {
|
it('should refresh the visibility for field', () => {
|
||||||
visibilityObjTest.leftFormFieldId = 'FIELD_TEST';
|
visibilityObjTest.leftFormFieldId = 'FIELD_TEST';
|
||||||
visibilityObjTest.operator = '!=';
|
visibilityObjTest.operator = '!=';
|
||||||
@@ -637,6 +638,7 @@ describe('WidgetVisibilityService', () => {
|
|||||||
expect(column0.fields[2].isVisible).toBeTruthy();
|
expect(column0.fields[2].isVisible).toBeTruthy();
|
||||||
expect(column1.fields[0].isVisible).toBeTruthy();
|
expect(column1.fields[0].isVisible).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
it('should refresh the visibility for tab in forms', () => {
|
it('should refresh the visibility for tab in forms', () => {
|
||||||
visibilityObjTest.leftFormFieldId = 'FIELD_TEST';
|
visibilityObjTest.leftFormFieldId = 'FIELD_TEST';
|
||||||
|
Reference in New Issue
Block a user