From 1e67f50346129c7b8c112a21fbdbd80f5433dffc Mon Sep 17 00:00:00 2001 From: Vito Date: Wed, 26 Feb 2020 14:46:01 +0000 Subject: [PATCH] AAE-1938 - added first stack of visibility tests for form (#5489) * AAE-1938 - added first stack of visibility tests for form * AAE-1938 - fixed unit test after form service changes * AAE-1938 - rebased with last development * AAE-1938 - fixed failing e2e * AAE-1938 - fixed mock definition to match updated service behaviour * Fixed failing e2e * AAE-1938 - try to fix cancel uploads --- .../app/services/in-memory-form.service.ts | 15 +- .../upload/cancel-upload.e2e.ts | 4 +- e2e/resources/forms/custom-date-form.ts | 202 +- .../form-renderer.component.spec.ts | 194 + .../mock/form-renderer.component.mock.ts | 422 +++ lib/core/form/services/form.service.spec.ts | 2 +- lib/core/form/services/form.service.ts | 15 +- lib/core/mock/form/demo-form.mock.ts | 3206 +++++++++-------- lib/core/mock/form/form.service.mock.ts | 448 +-- 9 files changed, 2578 insertions(+), 1930 deletions(-) create mode 100644 lib/core/form/components/form-renderer.component.spec.ts create mode 100644 lib/core/form/components/mock/form-renderer.component.mock.ts diff --git a/demo-shell/src/app/services/in-memory-form.service.ts b/demo-shell/src/app/services/in-memory-form.service.ts index fe015bd834..70dbc92d73 100644 --- a/demo-shell/src/app/services/in-memory-form.service.ts +++ b/demo-shell/src/app/services/in-memory-form.service.ts @@ -70,10 +70,21 @@ export class InMemoryFormService extends FormService { parseForm(json: any, data?: FormValues, readOnly: boolean = false): FormModel { if (json) { - const form = new FormModel(json, data, readOnly, this); + const flattenForm = { + ...json.formRepresentation, + ...json.formRepresentation.formDefinition + }; + delete flattenForm.formDefinition; + + const formValues: FormValues = {}; + (data || []).forEach(variable => { + formValues[variable.name] = variable.value; + }); + + const form = new FormModel(flattenForm, formValues, readOnly, this); if (!json.fields) { form.outcomes = [ - new FormOutcomeModel(form, { + new FormOutcomeModel( form, { id: '$save', name: FormOutcomeModel.SAVE_ACTION, isSystem: true diff --git a/e2e/content-services/upload/cancel-upload.e2e.ts b/e2e/content-services/upload/cancel-upload.e2e.ts index 78fbc1c640..ac6872d0fc 100644 --- a/e2e/content-services/upload/cancel-upload.e2e.ts +++ b/e2e/content-services/upload/cancel-upload.e2e.ts @@ -79,7 +79,7 @@ describe('Upload component', async () => { it('[C272793] Should be able to cancel multiple files upload', async () => { await uploadToggles.enableMultipleFileUpload(); await browser.executeScript(' setTimeout(() => {document.querySelector("#adf-upload-dialog-cancel-all").click();' + - 'document.querySelector("#adf-upload-dialog-cancel").click(); }, 4000)'); + 'document.querySelector("#adf-upload-dialog-cancel").click(); }, 2500)'); await contentServicesPage.uploadMultipleFile([pngFileModel.location, largeFile.location]); await expect(await uploadDialog.getTitleText()).toEqual('Upload canceled'); @@ -92,7 +92,7 @@ describe('Upload component', async () => { it('[C315257] Should be able to cancel file in upload queue', async () => { await uploadToggles.enableMultipleFileUpload(); - await browser.executeScript('setTimeout(() => {document.querySelector("button[data-automation-id=\'cancel-upload-queue\']").click();}, 2500)'); + await browser.executeScript('setTimeout(() => {document.querySelector("button[data-automation-id=\'cancel-upload-queue\']").click();}, 3000)'); await contentServicesPage.uploadMultipleFile([largeFile.location, pngFileModel.location]); await uploadDialog.fileIsCancelled(pngFileModel.name); await uploadDialog.clickOnCloseButton(); diff --git a/e2e/resources/forms/custom-date-form.ts b/e2e/resources/forms/custom-date-form.ts index f94423ff75..7d671725ee 100644 --- a/e2e/resources/forms/custom-date-form.ts +++ b/e2e/resources/forms/custom-date-form.ts @@ -17,108 +17,110 @@ /* tslint:disable */ export const customDateFormAPS1 = `{ - "id": 18977, - "name": "APS1customDateFrom", - "description": "", - "version": 1, - "lastUpdatedBy": 1, - "lastUpdatedByFullName": " Administrator", - "lastUpdated": "2019-08-21T09:29:18.042+0000", - "stencilSetId": 0, - "referenceId": null, - "formDefinition": { - "tabs": [], - "fields": [ - { - "fieldType": "ContainerRepresentation", - "id": "1566223482682", - "name": "Label", - "type": "container", - "value": null, - "required": false, - "readOnly": false, - "overrideId": false, - "colspan": 1, - "placeholder": null, - "minLength": 0, - "maxLength": 0, - "minValue": null, - "maxValue": null, - "regexPattern": null, - "optionType": null, - "hasEmptyValue": null, - "options": null, - "restUrl": null, - "restResponsePath": null, - "restIdProperty": null, - "restLabelProperty": null, - "tab": null, - "className": null, - "dateDisplayFormat": null, - "layout": null, - "sizeX": 2, - "sizeY": 1, - "row": -1, - "col": -1, - "visibilityCondition": null, - "numberOfColumns": 2, - "fields": { - "1": [ - { - "fieldType": "FormFieldRepresentation", - "id": "datefield", - "name": "DateField", - "type": "date", - "value": null, - "required": false, - "readOnly": false, - "overrideId": false, - "colspan": 1, - "placeholder": null, - "minLength": 0, - "maxLength": 0, - "minValue": "19-7-2019", - "maxValue": "19-8-2019", - "regexPattern": null, - "optionType": null, - "hasEmptyValue": null, - "options": null, - "restUrl": null, - "restResponsePath": null, - "restIdProperty": null, - "restLabelProperty": null, - "tab": null, - "className": null, - "params": { - "existingColspan": 1, - "maxColspan": 2 - }, - "dateDisplayFormat": "YY-M-D", - "layout": { + "formRepresentation":{ + "id": 18977, + "name": "APS1customDateFrom", + "description": "", + "version": 1, + "lastUpdatedBy": 1, + "lastUpdatedByFullName": " Administrator", + "lastUpdated": "2019-08-21T09:29:18.042+0000", + "stencilSetId": 0, + "referenceId": null, + "formDefinition": { + "tabs": [], + "fields": [ + { + "fieldType": "ContainerRepresentation", + "id": "1566223482682", + "name": "Label", + "type": "container", + "value": null, + "required": false, + "readOnly": false, + "overrideId": false, + "colspan": 1, + "placeholder": null, + "minLength": 0, + "maxLength": 0, + "minValue": null, + "maxValue": null, + "regexPattern": null, + "optionType": null, + "hasEmptyValue": null, + "options": null, + "restUrl": null, + "restResponsePath": null, + "restIdProperty": null, + "restLabelProperty": null, + "tab": null, + "className": null, + "dateDisplayFormat": null, + "layout": null, + "sizeX": 2, + "sizeY": 1, + "row": -1, + "col": -1, + "visibilityCondition": null, + "numberOfColumns": 2, + "fields": { + "1": [ + { + "fieldType": "FormFieldRepresentation", + "id": "datefield", + "name": "DateField", + "type": "date", + "value": null, + "required": false, + "readOnly": false, + "overrideId": false, + "colspan": 1, + "placeholder": null, + "minLength": 0, + "maxLength": 0, + "minValue": "19-7-2019", + "maxValue": "19-8-2019", + "regexPattern": null, + "optionType": null, + "hasEmptyValue": null, + "options": null, + "restUrl": null, + "restResponsePath": null, + "restIdProperty": null, + "restLabelProperty": null, + "tab": null, + "className": null, + "params": { + "existingColspan": 1, + "maxColspan": 2 + }, + "dateDisplayFormat": "YY-M-D", + "layout": { + "row": -1, + "column": -1, + "colspan": 1 + }, + "sizeX": 1, + "sizeY": 1, "row": -1, - "column": -1, - "colspan": 1 - }, - "sizeX": 1, - "sizeY": 1, - "row": -1, - "col": -1, - "visibilityCondition": null - } - ], - "2": [] + "col": -1, + "visibilityCondition": null + } + ], + "2": [] + } } - } - ], - "outcomes": [], - "javascriptEvents": [], - "className": "", - "style": "", - "customFieldTemplates": {}, - "metadata": {}, - "variables": [], - "customFieldsValueInfo": {}, - "gridsterForm": false + ], + "outcomes": [], + "javascriptEvents": [], + "className": "", + "style": "", + "customFieldTemplates": {}, + "metadata": {}, + "variables": [], + "customFieldsValueInfo": {}, + "gridsterForm": false + } } }`; diff --git a/lib/core/form/components/form-renderer.component.spec.ts b/lib/core/form/components/form-renderer.component.spec.ts new file mode 100644 index 0000000000..ba80be3a59 --- /dev/null +++ b/lib/core/form/components/form-renderer.component.spec.ts @@ -0,0 +1,194 @@ +/*! + * @license + * Copyright 2019 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 { TestBed, ComponentFixture } from '@angular/core/testing'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { FormRendererComponent } from './form-renderer.component'; +import { FormBaseModule } from '../form-base.module'; +import { formDisplayValueVisibility, formDisplayValueForm, formDisplayValueCombinedVisibility } from './mock/form-renderer.component.mock'; +import { TranslationService } from 'core/services'; +import { TranslationMock } from 'core/mock'; +import { TranslateStore } from '@ngx-translate/core'; +import { FormService } from '../services/form.service'; +import { setupTestBed } from '../../testing/setup-test-bed'; + +function typeIntoInput(targetInput: HTMLInputElement, message: string ) { + expect(targetInput).not.toBeNull(); + targetInput.value = message; + targetInput.dispatchEvent(new Event('input')); +} + +function expectElementToBeHidden(targetElement: HTMLElement): void { + expect(targetElement).not.toBeNull(); + expect(targetElement).toBeDefined(); + expect(targetElement.hidden).toBe(true); +} + +function expectElementToBeVisible(targetElement: HTMLElement): void { + expect(targetElement).not.toBeNull(); + expect(targetElement).toBeDefined(); + expect(targetElement.hidden).toBe(false); +} + +function expectInputElementValueIs(targetElement: HTMLInputElement, value: string): void { + expect(targetElement).not.toBeNull(); + expect(targetElement).toBeDefined(); + expect(targetElement.value).toBe(value); +} + +describe('Form Renderer Component', () => { + + let formRendererComponent: FormRendererComponent; + let fixture: ComponentFixture; + let formService: FormService; + + setupTestBed({ + imports: [ + NoopAnimationsModule, + FormBaseModule + ], + providers: [ + { provide: TranslationService, useClass: TranslationMock }, + TranslateStore + ] + }); + + beforeEach(() => { + fixture = TestBed.createComponent(FormRendererComponent); + formRendererComponent = fixture.componentInstance; + formService = TestBed.get(FormService); + }); + + it('Should be able to see Display value widget when visibility condition refers to another field with specific value', async () => { + formRendererComponent.formDefinition = formService.parseForm(formDisplayValueVisibility); + fixture.detectChanges(); + await fixture.whenStable(); + + let displayValueElementContainer: HTMLDivElement = fixture.nativeElement.querySelector('#field-Displayvalue0g6092-container'); + const formInputText: HTMLInputElement = fixture.nativeElement.querySelector('#Text0bq3ar'); + expectElementToBeHidden(displayValueElementContainer); + typeIntoInput(formInputText, 'DisplayValue'); + fixture.detectChanges(); + await fixture.whenStable(); + + displayValueElementContainer = fixture.nativeElement.querySelector('#field-Displayvalue0g6092-container'); + expectElementToBeVisible(displayValueElementContainer); + const displayValueElement: HTMLInputElement = fixture.nativeElement.querySelector('#Displayvalue0g6092'); + expectInputElementValueIs(displayValueElement, 'No field selected'); + }); + + it('Should be able to see Display value widget when visibility condition refers to a form variable and a field', async () => { + formRendererComponent.formDefinition = formService.parseForm(formDisplayValueForm); + fixture.detectChanges(); + await fixture.whenStable(); + let displayValueElementContainer: HTMLDivElement = fixture.nativeElement.querySelector('#field-DisplayValueOne-container'); + expectElementToBeHidden(displayValueElementContainer); + + const formInputText: HTMLInputElement = fixture.nativeElement.querySelector('#Text0howrc'); + typeIntoInput(formInputText, 'aaa'); + fixture.detectChanges(); + await fixture.whenStable(); + + displayValueElementContainer = fixture.nativeElement.querySelector('#field-DisplayValueOne-container'); + expectElementToBeVisible(displayValueElementContainer); + const displayValueElement: HTMLInputElement = fixture.nativeElement.querySelector('#DisplayValueOne'); + expectInputElementValueIs(displayValueElement, 'No field selected'); + + typeIntoInput(formInputText, 'aaab'); + fixture.detectChanges(); + await fixture.whenStable(); + displayValueElementContainer = fixture.nativeElement.querySelector('#field-DisplayValueOne-container'); + expectElementToBeHidden(displayValueElementContainer); + }); + + it('Should be able to see Display value widget when visibility condition refers to another field and form variable', async () => { + formRendererComponent.formDefinition = formService.parseForm(formDisplayValueForm); + fixture.detectChanges(); + await fixture.whenStable(); + let displayValueElementContainer: HTMLDivElement = fixture.nativeElement.querySelector('#field-DisplayValueVariableField-container'); + expectElementToBeHidden(displayValueElementContainer); + + const formInputText: HTMLInputElement = fixture.nativeElement.querySelector('#TextOne'); + typeIntoInput(formInputText, 'aaa'); + fixture.detectChanges(); + await fixture.whenStable(); + + displayValueElementContainer = fixture.nativeElement.querySelector('#field-DisplayValueVariableField-container'); + expectElementToBeVisible(displayValueElementContainer); + const displayValueElement: HTMLInputElement = fixture.nativeElement.querySelector('#DisplayValueVariableField'); + expectInputElementValueIs(displayValueElement, 'No field selected'); + + typeIntoInput(formInputText, 'aaab'); + fixture.detectChanges(); + await fixture.whenStable(); + displayValueElementContainer = fixture.nativeElement.querySelector('#field-DisplayValueVariableField-container'); + expectElementToBeHidden(displayValueElementContainer); + }); + + it('Should be able to see Display value widget when has multiple visibility conditions and next condition operators', async () => { + formRendererComponent.formDefinition = formService.parseForm(formDisplayValueCombinedVisibility); + fixture.detectChanges(); + await fixture.whenStable(); + const textInputElement: HTMLInputElement = fixture.nativeElement.querySelector('#Text0bq3ar'); + const textTwoInputElement: HTMLInputElement = fixture.nativeElement.querySelector('#TextTwo'); + let displayValueHiddenContainer: HTMLDivElement = fixture.nativeElement.querySelector('#field-Displayvalue0g6092-container'); + expectElementToBeVisible(textInputElement); + expectElementToBeVisible(textTwoInputElement); + expectElementToBeHidden(displayValueHiddenContainer); + + typeIntoInput(textInputElement, 'aaa'); + fixture.detectChanges(); + await fixture.whenStable(); + displayValueHiddenContainer = fixture.nativeElement.querySelector('#field-Displayvalue0g6092-container'); + expectInputElementValueIs(textInputElement, 'aaa'); + expectInputElementValueIs(textTwoInputElement, ''); + expectElementToBeVisible(displayValueHiddenContainer); + + typeIntoInput(textInputElement, 'bbb'); + fixture.detectChanges(); + await fixture.whenStable(); + displayValueHiddenContainer = fixture.nativeElement.querySelector('#field-Displayvalue0g6092-container'); + expectInputElementValueIs(textInputElement, 'bbb'); + expectInputElementValueIs(textTwoInputElement, ''); + expectElementToBeHidden(displayValueHiddenContainer); + + typeIntoInput(textTwoInputElement, 'aaa'); + fixture.detectChanges(); + await fixture.whenStable(); + displayValueHiddenContainer = fixture.nativeElement.querySelector('#field-Displayvalue0g6092-container'); + expectInputElementValueIs(textInputElement, 'bbb'); + expectInputElementValueIs(textTwoInputElement, 'aaa'); + expectElementToBeHidden(displayValueHiddenContainer); + + typeIntoInput(textInputElement, 'aaa'); + fixture.detectChanges(); + await fixture.whenStable(); + displayValueHiddenContainer = fixture.nativeElement.querySelector('#field-Displayvalue0g6092-container'); + expectInputElementValueIs(textInputElement, 'aaa'); + expectInputElementValueIs(textTwoInputElement, 'aaa'); + expectElementToBeHidden(displayValueHiddenContainer); + + typeIntoInput(textTwoInputElement, 'bbb'); + fixture.detectChanges(); + await fixture.whenStable(); + displayValueHiddenContainer = fixture.nativeElement.querySelector('#field-Displayvalue0g6092-container'); + expectInputElementValueIs(textInputElement, 'aaa'); + expectInputElementValueIs(textTwoInputElement, 'bbb'); + expectElementToBeVisible(displayValueHiddenContainer); + }); + +}); diff --git a/lib/core/form/components/mock/form-renderer.component.mock.ts b/lib/core/form/components/mock/form-renderer.component.mock.ts new file mode 100644 index 0000000000..1bc25660af --- /dev/null +++ b/lib/core/form/components/mock/form-renderer.component.mock.ts @@ -0,0 +1,422 @@ +/*! + * @license + * Copyright 2019 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 const formDisplayValueVisibility = {formRepresentation: { + id: 'form-3175b074-53c6-4b5b-92df-246b62108db3', + name: 'displayValueVisibility', + description: '', + version: 0, + standAlone: true, + formDefinition: { + tabs: [], + fields: [ + { + id: '65ba00e6-a669-4710-9a97-0a6e19b429d8', + name: 'Label', + type: 'container', + tab: null, + numberOfColumns: 2, + fields: { + '1': [ + { + id: 'Text0bq3ar', + name: 'Text', + type: 'text', + required: false, + colspan: 1, + placeholder: null, + minLength: 0, + maxLength: 0, + regexPattern: null, + visibilityCondition: null, + params: { existingColspan: 1, maxColspan: 2 } + } + ], + '2': [ + { + id: 'Displayvalue0g6092', + name: 'Display value', + type: 'readonly', + value: 'No field selected', + colspan: 1, + visibilityCondition: { + leftType: 'field', + leftValue: 'Text0bq3ar', + operator: '==', + rightValue: 'DisplayValue', + rightType: 'value', + nextConditionOperator: '', + nextCondition: null + }, + params: { + existingColspan: 1, + maxColspan: 2, + field: { + id: 'Displayvalue0g6092', + name: 'Display value', + type: 'text' + }, + responseVariable: true + } + } + ] + } + } + ], + outcomes: [], + metadata: {}, + variables: [] + } + }}; + +export const formDisplayValueForm = { formRepresentation : { + id: 'form-3dd0f2a3-c20a-4195-a760-1db42ec7dcd4', + name: 'displayValue', + description: '', + version: 0, + formDefinition: { + 'tabs': [], + 'fields': [ + { + 'id': 'c54f6956-bcf9-4109-a6c1-1daff773936b', + 'name': 'Label', + 'type': 'container', + 'tab': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'id': 'DisplayValueColspan', + 'name': 'DisplayValueColspan', + 'type': 'readonly', + 'value': 'No field selected', + 'colspan': 2, + 'visibilityCondition': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2, + 'field': { + 'id': 'Displayvalue0hwgvb', + 'name': 'Display value', + 'type': 'text' + } + } + }, + { + 'id': 'DisplayValueFieldValue', + 'name': 'DisplayValueFieldValue', + 'type': 'readonly', + 'value': 'No field selected', + 'colspan': 1, + 'visibilityCondition': { + 'leftFormFieldId': 'TextOne', + 'leftRestResponseId': '', + 'operator': '==', + 'rightValue': 'aaa', + 'rightType': null, + 'rightFormFieldId': '', + 'rightRestResponseId': '', + 'nextConditionOperator': '', + 'nextCondition': null + }, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2, + 'field': { + 'id': 'Displayvalue0pjsfi', + 'name': 'Display value', + 'type': 'text' + } + } + }, + { + 'id': 'DisplayValueVariableField', + 'name': 'DisplayValueVariableField', + 'type': 'readonly', + 'value': 'No field selected', + 'colspan': 1, + 'visibilityCondition': { + 'leftFormFieldId': '', + 'leftRestResponseId': 'bcdfe3af-d635-40ee-b9fd-4f9d3655d77b', + 'operator': '==', + 'rightValue': '', + 'rightType': null, + 'rightFormFieldId': 'TextOne', + 'rightRestResponseId': '', + 'nextConditionOperator': '', + 'nextCondition': null + }, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2, + 'field': { + 'id': 'Displayvalue0sss8o', + 'name': 'Display value', + 'type': 'text' + } + } + }, + { + 'id': 'DisplayValueFieldVariable', + 'name': 'DisplayValueFieldVariable', + 'type': 'readonly', + 'value': 'No field selected', + 'colspan': 1, + 'visibilityCondition': { + 'leftFormFieldId': 'TextOne', + 'leftRestResponseId': '', + 'operator': '==', + 'rightValue': '', + 'rightType': null, + 'rightFormFieldId': '', + 'rightRestResponseId': 'bcdfe3af-d635-40ee-b9fd-4f9d3655d77b', + 'nextConditionOperator': '', + 'nextCondition': null + }, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2, + 'field': { + 'id': 'Displayvalue0mkrml', + 'name': 'Display value', + 'type': 'text' + } + } + }, + { + 'id': 'DisplayValueOne', + 'name': 'DisplayValueOne', + 'type': 'readonly', + 'value': 'No field selected', + 'colspan': 1, + 'visibilityCondition': { + 'leftFormFieldId': 'Text0howrc', + 'leftRestResponseId': '', + 'operator': '==', + 'rightValue': 'aaa', + 'rightType': null, + 'rightFormFieldId': '', + 'rightRestResponseId': '', + 'nextConditionOperator': 'and', + 'nextCondition': { + 'leftFormFieldId': 'TextTwo', + 'leftRestResponseId': '', + 'operator': '!=', + 'rightValue': 'aaa', + 'rightType': null, + 'rightFormFieldId': '', + 'rightRestResponseId': '', + 'nextConditionOperator': '', + 'nextCondition': null + } + }, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2, + 'field': { + 'id': 'Displayvalue00ldqe', + 'name': 'Display value', + 'type': 'text' + } + } + } + ], + '2': [ + { + 'id': 'Text0howrc', + 'name': 'Text', + 'type': 'text', + 'required': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'regexPattern': null, + 'visibilityCondition': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + } + }, + { + 'id': 'TextOne', + 'name': 'TextOne', + 'type': 'text', + 'required': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'regexPattern': null, + 'visibilityCondition': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + } + }, + { + 'id': 'TextTwo', + 'name': 'TextTwo', + 'type': 'text', + 'required': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'regexPattern': null, + 'visibilityCondition': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + } + }, + { + 'id': 'bcdfe3af-d635-40ee-b9fd-4f9d3655d77b', + 'name': 'vstring', + 'type': 'readonly', + 'value': 'Show value of vstring', + 'colspan': 1, + 'visibilityCondition': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2, + 'field': { + 'id': 'bcdfe3af-d635-40ee-b9fd-4f9d3655d77b', + 'name': 'vstring', + 'type': 'string' + } + } + } + ] + } + } + ], + 'outcomes': [], + 'metadata': {}, + 'variables': [ + { + 'id': 'bcdfe3af-d635-40ee-b9fd-4f9d3655d77b', + 'name': 'vstring', + 'type': 'string', + 'value': 'aaa' + } + ] + } + }}; + +export const formDisplayValueCombinedVisibility = { + formRepresentation: { + id: 'form-3175b074-53c6-4b5b-92df-246b62108db3', + name: 'displayValueVisibility', + description: '', + version: 0, + standAlone: true, + formDefinition: { + tabs: [], + fields: [ + { + id: '65ba00e6-a669-4710-9a97-0a6e19b429d8', + name: 'Label', + type: 'container', + tab: null, + numberOfColumns: 2, + fields: { + '1': [ + { + id: 'Text0bq3ar', + name: 'Text', + type: 'text', + required: false, + colspan: 1, + placeholder: null, + minLength: 0, + maxLength: 0, + regexPattern: null, + visibilityCondition: null, + params: { existingColspan: 1, maxColspan: 2 } + } + ], + '2': [ + { + id: 'Displayvalue0g6092', + name: 'Display value', + type: 'readonly', + value: 'No field selected', + colspan: 1, + visibilityCondition: { + leftType: 'field', + leftValue: 'Text0bq3ar', + operator: '==', + rightValue: 'aaa', + rightType: 'value', + nextConditionOperator: 'and', + nextCondition: { + leftType: 'field', + leftValue: 'TextTwo', + operator: '!=', + rightValue: 'aaa', + rightType: 'value', + nextConditionOperator: '', + nextCondition: null + } + }, + params: { + existingColspan: 1, + maxColspan: 2, + field: { + id: 'Displayvalue0g6092', + name: 'Display value', + type: 'text' + }, + responseVariable: true + } + } + ] + } + }, + { + id: 'b2162507-2204-4fda-a8cb-003dd5d032ef', + name: 'Label', + type: 'container', + tab: null, + numberOfColumns: 2, + fields: { + '1': [ + { + id: 'TextTwo', + name: 'TextTwo', + type: 'text', + required: false, + colspan: 1, + placeholder: null, + minLength: 0, + maxLength: 0, + regexPattern: null, + visibilityCondition: null, + params: { existingColspan: 1, maxColspan: 2 } + } + ], + '2': [] + } + } + ], + outcomes: [], + metadata: {}, + variables: [] + } + } + }; diff --git a/lib/core/form/services/form.service.spec.ts b/lib/core/form/services/form.service.spec.ts index 9dcf3f4dee..27a217a120 100644 --- a/lib/core/form/services/form.service.spec.ts +++ b/lib/core/form/services/form.service.spec.ts @@ -396,7 +396,7 @@ describe('Form service', () => { }); it('should parse a Form Definition with tabs', () => { - expect(formModelTabs.formDefinition).toBeDefined(); + expect(formModelTabs.formRepresentation.formDefinition).toBeDefined(); const formParsed = service.parseForm(formModelTabs); expect(formParsed).toBeDefined(); }); diff --git a/lib/core/form/services/form.service.ts b/lib/core/form/services/form.service.ts index 7dcb5b4254..4480421b25 100644 --- a/lib/core/form/services/form.service.ts +++ b/lib/core/form/services/form.service.ts @@ -102,10 +102,21 @@ export class FormService { */ parseForm(json: any, data?: FormValues, readOnly: boolean = false): FormModel { if (json) { - const form = new FormModel(json, data, readOnly, this); + const flattenForm = { + ...json.formRepresentation, + ...json.formRepresentation.formDefinition + }; + delete flattenForm.formDefinition; + + const formValues: FormValues = {}; + (data || []).forEach(variable => { + formValues[variable.name] = variable.value; + }); + + const form = new FormModel(flattenForm, formValues, readOnly); if (!json.fields) { form.outcomes = [ - new FormOutcomeModel(form, { + new FormOutcomeModel( form, { id: '$save', name: FormOutcomeModel.SAVE_ACTION, isSystem: true diff --git a/lib/core/mock/form/demo-form.mock.ts b/lib/core/mock/form/demo-form.mock.ts index 86c77e7506..43cb763464 100644 --- a/lib/core/mock/form/demo-form.mock.ts +++ b/lib/core/mock/form/demo-form.mock.ts @@ -18,1487 +18,14 @@ export class DemoForm { easyForm: any = { - 'id': 1001, - 'name': 'ISSUE_FORM', - 'tabs': [], - 'fields': [ - { - 'fieldType': 'ContainerRepresentation', - 'id': '1498212398417', - 'name': 'Label', - 'type': 'container', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': false, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': null, - 'className': null, - 'dateDisplayFormat': null, - 'sizeX': 2, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'numberOfColumns': 2, - 'fields': { - '1': [ - { - 'fieldType': 'RestFieldRepresentation', - 'id': 'label', - 'name': 'Label', - 'type': 'dropdown', - 'value': 'Choose one...', - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': true, - 'options': [ - { - 'id': 'empty', - 'name': 'Choose one...' - }, - { - 'id': 'option_1', - 'name': 'test1' - }, - { - 'id': 'option_2', - 'name': 'test2' - }, - { - 'id': 'option_3', - 'name': 'test3' - } - ], - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': null, - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'endpoint': null, - 'requestHeaders': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'Date', - 'name': 'Date', - 'type': 'date', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label5', - 'name': 'Label5', - 'type': 'boolean', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label6', - 'name': 'Label6', - 'type': 'boolean', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label4', - 'name': 'Label4', - 'type': 'integer', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'RestFieldRepresentation', - 'id': 'label12', - 'name': 'Label12', - 'type': 'radio-buttons', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': [ - { - 'id': 'option_1', - 'name': 'Option 1' - }, - { - 'id': 'option_2', - 'name': 'Option 2' - } - ], - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'endpoint': null, - 'requestHeaders': null - } - ] - } - } - ], - 'outcomes': [], - 'javascriptEvents': [], - 'className': '', - 'style': '', - 'customFieldTemplates': {}, - 'metadata': {}, - 'variables': [ - { - 'id': 'bfca9766-7bc1-45cc-8ecf-cdad551e36e2', - 'name': 'name1', - 'type': 'string', - 'value': '' - }, - { - 'id': '3ed9f28a-dbae-463f-b991-47ef06658bb6', - 'name': 'name2', - 'type': 'string', - 'value': '' - }, - { - 'id': 'a7710978-1e9c-4b54-a19c-c6267d2b19a2', - 'name': 'input02', - 'type': 'integer' - } - ], - 'customFieldsValueInfo': {}, - 'gridsterForm': false, - 'globalDateFormat': 'D-M-YYYY' - }; - - formDefinition: any = { - 'id': 3003, - 'name': 'demo-01', - 'taskId': '7501', - 'taskName': 'Demo Form 01', - 'tabs': [ - { - 'id': 'tab1', - 'title': 'Text', - 'visibilityCondition': null - }, - { - 'id': 'tab2', - 'title': 'Misc', - 'visibilityCondition': null - } - ], - 'fields': [ - { - 'fieldType': 'ContainerRepresentation', - 'id': '1488274019966', - 'name': 'Label', - 'type': 'container', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': null, - 'className': null, - 'dateDisplayFormat': null, - 'layout': null, - 'sizeX': 2, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'numberOfColumns': 2, - 'fields': { - '1': [], - '2': [] - } - }, - { - 'fieldType': 'ContainerRepresentation', - 'id': 'section4', - 'name': 'Section 4', - 'type': 'group', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab2', - 'className': null, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 2 - }, - 'sizeX': 2, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'numberOfColumns': 2, - 'fields': { - '1': [ - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label8', - 'name': 'Label8', - 'type': 'people', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab2', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label13', - 'name': 'Label13', - 'type': 'functional-group', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab2', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label18', - 'name': 'Label18', - 'type': 'readonly', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab2', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label19', - 'name': 'Label19', - 'type': 'readonly-text', - 'value': 'Display text as part of the form', - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab2', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - } - ], - '2': [ - { - 'fieldType': 'HyperlinkRepresentation', - 'id': 'label15', - 'name': 'Label15', - 'type': 'hyperlink', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab2', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'hyperlinkUrl': 'www.google.com', - 'displayText': null - }, - { - 'fieldType': 'AttachFileFieldRepresentation', - 'id': 'label16', - 'name': 'Label16', - 'type': 'upload', - 'value': [], - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab2', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1, - 'fileSource': { - 'serviceId': 'all-file-sources', - 'name': 'All file sources' - } - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'metaDataColumnDefinitions': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label17', - 'name': 'Label17', - 'type': 'select-folder', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab2', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1, - 'folderSource': { - 'serviceId': 'alfresco-1', - 'name': 'Alfresco 5.2 Local', - 'metaDataAllowed': true - } - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - } - ] - } - }, - { - 'fieldType': 'DynamicTableRepresentation', - 'id': 'label14', - 'name': 'Label14', - 'type': 'dynamic-table', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab2', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 2 - }, - 'sizeX': 2, - 'sizeY': 2, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'columnDefinitions': [ - { - 'id': 'id', - 'name': 'id', - 'type': 'String', - 'value': null, - 'optionType': null, - 'options': null, - 'restResponsePath': null, - 'restUrl': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'amountCurrency': null, - 'amountEnableFractions': false, - 'required': true, - 'editable': true, - 'sortable': true, - 'visible': true, - 'endpoint': null, - 'requestHeaders': null - }, - { - 'id': 'name', - 'name': 'name', - 'type': 'String', - 'value': null, - 'optionType': null, - 'options': null, - 'restResponsePath': null, - 'restUrl': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'amountCurrency': null, - 'amountEnableFractions': false, - 'required': true, - 'editable': true, - 'sortable': true, - 'visible': true, - 'endpoint': null, - 'requestHeaders': null - } - ] - }, - { - 'fieldType': 'ContainerRepresentation', - 'id': 'section1', - 'name': 'Section 1', - 'type': 'group', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 2 - }, - 'sizeX': 2, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'numberOfColumns': 2, - 'fields': { - '1': [ - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label1', - 'name': 'Label1', - 'type': 'text', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label3', - 'name': 'Label3', - 'type': 'text', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - } - ], - '2': [ - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label2', - 'name': 'Label2', - 'type': 'multi-line-text', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 2, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - } - ] - } - }, - { - 'fieldType': 'ContainerRepresentation', - 'id': 'section2', - 'name': 'Section 2', - 'type': 'group', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 2 - }, - 'sizeX': 2, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'numberOfColumns': 2, - 'fields': { - '1': [ - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label4', - 'name': 'Label4', - 'type': 'integer', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label7', - 'name': 'Label7', - 'type': 'date', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - } - ], - '2': [ - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label5', - 'name': 'Label5', - 'type': 'boolean', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'FormFieldRepresentation', - 'id': 'label6', - 'name': 'Label6', - 'type': 'boolean', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null - }, - { - 'fieldType': 'AmountFieldRepresentation', - 'id': 'label11', - 'name': 'Label11', - 'type': 'amount', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': '10', - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'enableFractions': false, - 'currency': null - } - ] - } - }, - { - 'fieldType': 'ContainerRepresentation', - 'id': 'section3', - 'name': 'Section 3', - 'type': 'group', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 2 - }, - 'sizeX': 2, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'numberOfColumns': 2, - 'fields': { - '1': [ - { - 'fieldType': 'RestFieldRepresentation', - 'id': 'label9', - 'name': 'Label9', - 'type': 'dropdown', - 'value': 'Choose one...', - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': true, - 'options': [ - { - 'id': 'empty', - 'name': 'Choose one...' - } - ], - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'endpoint': null, - 'requestHeaders': null - }, - { - 'fieldType': 'RestFieldRepresentation', - 'id': 'label12', - 'name': 'Label12', - 'type': 'radio-buttons', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': [ - { - 'id': 'option_1', - 'name': 'Option 1' - }, - { - 'id': 'option_2', - 'name': 'Option 2' - } - ], - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 2 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'endpoint': null, - 'requestHeaders': null - } - ], - '2': [ - { - 'fieldType': 'RestFieldRepresentation', - 'id': 'label10', - 'name': 'Label10', - 'type': 'typeahead', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': 'tab1', - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'endpoint': null, - 'requestHeaders': null - } - ] - } - } - ], - 'outcomes': [], - 'javascriptEvents': [], - 'className': '', - 'style': '', - 'customFieldTemplates': {}, - 'metadata': {}, - 'variables': [ - { - 'id': 'bfca9766-7bc1-45cc-8ecf-cdad551e36e2', - 'name': 'name1', - 'type': 'string', - 'value': '' - }, - { - 'id': '3ed9f28a-dbae-463f-b991-47ef06658bb6', - 'name': 'name2', - 'type': 'string', - 'value': '' - }, - { - 'id': 'a7710978-1e9c-4b54-a19c-c6267d2b19a2', - 'name': 'input02', - 'type': 'integer' - } - ], - 'gridsterForm': false, - 'globalDateFormat': 'D-M-YYYY' - }; - - simpleFormDefinition: any = { - 'id': 1001, - 'name': 'SIMPLE_FORM_EXAMPLE', - 'description': '', - 'version': 1, - 'lastUpdatedBy': 2, - 'lastUpdatedByFullName': 'Test01 01Test', - 'lastUpdated': '2018-02-26T17:44:04.543+0000', - 'stencilSetId': 0, - 'referenceId': null, - 'taskId': '9999', - 'formDefinition': { + 'formRepresentation': { + 'id': 1001, + 'name': 'ISSUE_FORM', 'tabs': [], 'fields': [ { 'fieldType': 'ContainerRepresentation', - 'id': '1519666726245', + 'id': '1498212398417', 'name': 'Label', 'type': 'container', 'value': null, @@ -1513,7 +40,7 @@ export class DemoForm { 'maxValue': null, 'regexPattern': null, 'optionType': null, - 'hasEmptyValue': null, + 'hasEmptyValue': false, 'options': null, 'restUrl': null, 'restResponsePath': null, @@ -1522,21 +49,19 @@ export class DemoForm { 'tab': null, 'className': null, 'dateDisplayFormat': null, - 'layout': null, 'sizeX': 2, 'sizeY': 1, 'row': -1, 'col': -1, - 'visibilityCondition': null, 'numberOfColumns': 2, 'fields': { '1': [ { 'fieldType': 'RestFieldRepresentation', - 'id': 'typeaheadField', - 'name': 'TypeaheadField', - 'type': 'typeahead', - 'value': null, + 'id': 'label', + 'name': 'Label', + 'type': 'dropdown', + 'value': 'Choose one...', 'required': false, 'readOnly': false, 'overrideId': false, @@ -1548,12 +73,29 @@ export class DemoForm { 'maxValue': null, 'regexPattern': null, 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': 'https://jsonplaceholder.typicode.com/users', + 'hasEmptyValue': true, + 'options': [ + { + 'id': 'empty', + 'name': 'Choose one...' + }, + { + 'id': 'option_1', + 'name': 'test1' + }, + { + 'id': 'option_2', + 'name': 'test2' + }, + { + 'id': 'option_3', + 'name': 'test3' + } + ], + 'restUrl': null, 'restResponsePath': null, - 'restIdProperty': 'id', - 'restLabelProperty': 'name', + 'restIdProperty': null, + 'restLabelProperty': null, 'tab': null, 'className': null, 'params': { @@ -1573,13 +115,175 @@ export class DemoForm { 'visibilityCondition': null, 'endpoint': null, 'requestHeaders': null - } - ], - '2': [ + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'Date', + 'name': 'Date', + 'type': 'date', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label5', + 'name': 'Label5', + 'type': 'boolean', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label6', + 'name': 'Label6', + 'type': 'boolean', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label4', + 'name': 'Label4', + 'type': 'integer', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, { 'fieldType': 'RestFieldRepresentation', - 'id': 'radioButton', - 'name': 'RadioButtons', + 'id': 'label12', + 'name': 'Label12', 'type': 'radio-buttons', 'value': null, 'required': false, @@ -1602,115 +306,13 @@ export class DemoForm { { 'id': 'option_2', 'name': 'Option 2' - }, - { - 'id': 'option_3', - 'name': 'Option 3' } ], 'restUrl': null, 'restResponsePath': null, 'restIdProperty': null, 'restLabelProperty': null, - 'tab': null, - 'className': null, - 'params': { - 'existingColspan': 1, - 'maxColspan': 1 - }, - 'dateDisplayFormat': null, - 'layout': { - 'row': -1, - 'column': -1, - 'colspan': 1 - }, - 'sizeX': 1, - 'sizeY': 2, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'endpoint': null, - 'requestHeaders': null - } - ] - } - }, - { - 'fieldType': 'ContainerRepresentation', - 'id': '1519666735185', - 'name': 'Label', - 'type': 'container', - 'value': null, - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': null, - 'hasEmptyValue': null, - 'options': null, - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': null, - 'className': null, - 'dateDisplayFormat': null, - 'layout': null, - 'sizeX': 2, - 'sizeY': 1, - 'row': -1, - 'col': -1, - 'visibilityCondition': null, - 'numberOfColumns': 2, - 'fields': { - '1': [ - { - 'fieldType': 'RestFieldRepresentation', - 'id': 'selectBox', - 'name': 'SelectBox', - 'type': 'dropdown', - 'value': 'Choose one...', - 'required': false, - 'readOnly': false, - 'overrideId': false, - 'colspan': 1, - 'placeholder': null, - 'minLength': 0, - 'maxLength': 0, - 'minValue': null, - 'maxValue': null, - 'regexPattern': null, - 'optionType': 'manual', - 'hasEmptyValue': true, - 'options': [ - { - 'id': 'empty', - 'name': 'Choose one...' - }, - { - 'id': 'option_1', - 'name': '1' - }, - { - 'id': 'option_2', - 'name': '2' - }, - { - 'id': 'option_3', - 'name': '3' - } - ], - 'restUrl': null, - 'restResponsePath': null, - 'restIdProperty': null, - 'restLabelProperty': null, - 'tab': null, + 'tab': 'tab1', 'className': null, 'params': { 'existingColspan': 1, @@ -1730,8 +332,7 @@ export class DemoForm { 'endpoint': null, 'requestHeaders': null } - ], - '2': [] + ] } } ], @@ -1761,7 +362,1412 @@ export class DemoForm { } ], 'customFieldsValueInfo': {}, - 'gridsterForm': false + 'gridsterForm': false, + 'globalDateFormat': 'D-M-YYYY' + } + }; + + formDefinition: any = { + 'formRepresentation': { + 'id': 3003, + 'name': 'demo-01', + 'taskId': '7501', + 'taskName': 'Demo Form 01', + 'tabs': [ + { + 'id': 'tab1', + 'title': 'Text', + 'visibilityCondition': null + }, + { + 'id': 'tab2', + 'title': 'Misc', + 'visibilityCondition': null + } + ], + 'fields': [ + { + 'fieldType': 'ContainerRepresentation', + 'id': '1488274019966', + 'name': 'Label', + 'type': 'container', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'dateDisplayFormat': null, + 'layout': null, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [], + '2': [] + } + }, + { + 'fieldType': 'ContainerRepresentation', + 'id': 'section4', + 'name': 'Section 4', + 'type': 'group', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 2 + }, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label8', + 'name': 'Label8', + 'type': 'people', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label13', + 'name': 'Label13', + 'type': 'functional-group', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label18', + 'name': 'Label18', + 'type': 'readonly', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label19', + 'name': 'Label19', + 'type': 'readonly-text', + 'value': 'Display text as part of the form', + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + } + ], + '2': [ + { + 'fieldType': 'HyperlinkRepresentation', + 'id': 'label15', + 'name': 'Label15', + 'type': 'hyperlink', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'hyperlinkUrl': 'www.google.com', + 'displayText': null + }, + { + 'fieldType': 'AttachFileFieldRepresentation', + 'id': 'label16', + 'name': 'Label16', + 'type': 'upload', + 'value': [], + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1, + 'fileSource': { + 'serviceId': 'all-file-sources', + 'name': 'All file sources' + } + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'metaDataColumnDefinitions': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label17', + 'name': 'Label17', + 'type': 'select-folder', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1, + 'folderSource': { + 'serviceId': 'alfresco-1', + 'name': 'Alfresco 5.2 Local', + 'metaDataAllowed': true + } + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + } + ] + } + }, + { + 'fieldType': 'DynamicTableRepresentation', + 'id': 'label14', + 'name': 'Label14', + 'type': 'dynamic-table', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab2', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 2 + }, + 'sizeX': 2, + 'sizeY': 2, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'columnDefinitions': [ + { + 'id': 'id', + 'name': 'id', + 'type': 'String', + 'value': null, + 'optionType': null, + 'options': null, + 'restResponsePath': null, + 'restUrl': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'amountCurrency': null, + 'amountEnableFractions': false, + 'required': true, + 'editable': true, + 'sortable': true, + 'visible': true, + 'endpoint': null, + 'requestHeaders': null + }, + { + 'id': 'name', + 'name': 'name', + 'type': 'String', + 'value': null, + 'optionType': null, + 'options': null, + 'restResponsePath': null, + 'restUrl': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'amountCurrency': null, + 'amountEnableFractions': false, + 'required': true, + 'editable': true, + 'sortable': true, + 'visible': true, + 'endpoint': null, + 'requestHeaders': null + } + ] + }, + { + 'fieldType': 'ContainerRepresentation', + 'id': 'section1', + 'name': 'Section 1', + 'type': 'group', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 2 + }, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label1', + 'name': 'Label1', + 'type': 'text', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label3', + 'name': 'Label3', + 'type': 'text', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + } + ], + '2': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label2', + 'name': 'Label2', + 'type': 'multi-line-text', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 2, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + } + ] + } + }, + { + 'fieldType': 'ContainerRepresentation', + 'id': 'section2', + 'name': 'Section 2', + 'type': 'group', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 2 + }, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label4', + 'name': 'Label4', + 'type': 'integer', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label7', + 'name': 'Label7', + 'type': 'date', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + } + ], + '2': [ + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label5', + 'name': 'Label5', + 'type': 'boolean', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'FormFieldRepresentation', + 'id': 'label6', + 'name': 'Label6', + 'type': 'boolean', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null + }, + { + 'fieldType': 'AmountFieldRepresentation', + 'id': 'label11', + 'name': 'Label11', + 'type': 'amount', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': '10', + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'enableFractions': false, + 'currency': null + } + ] + } + }, + { + 'fieldType': 'ContainerRepresentation', + 'id': 'section3', + 'name': 'Section 3', + 'type': 'group', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 2 + }, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'label9', + 'name': 'Label9', + 'type': 'dropdown', + 'value': 'Choose one...', + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': true, + 'options': [ + { + 'id': 'empty', + 'name': 'Choose one...' + } + ], + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + }, + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'label12', + 'name': 'Label12', + 'type': 'radio-buttons', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': [ + { + 'id': 'option_1', + 'name': 'Option 1' + }, + { + 'id': 'option_2', + 'name': 'Option 2' + } + ], + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ], + '2': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'label10', + 'name': 'Label10', + 'type': 'typeahead', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': 'tab1', + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ] + } + } + ], + 'outcomes': [], + 'javascriptEvents': [], + 'className': '', + 'style': '', + 'customFieldTemplates': {}, + 'metadata': {}, + 'variables': [ + { + 'id': 'bfca9766-7bc1-45cc-8ecf-cdad551e36e2', + 'name': 'name1', + 'type': 'string', + 'value': '' + }, + { + 'id': '3ed9f28a-dbae-463f-b991-47ef06658bb6', + 'name': 'name2', + 'type': 'string', + 'value': '' + }, + { + 'id': 'a7710978-1e9c-4b54-a19c-c6267d2b19a2', + 'name': 'input02', + 'type': 'integer' + } + ], + 'gridsterForm': false, + 'globalDateFormat': 'D-M-YYYY' + } + }; + + simpleFormDefinition: any = { + 'formRepresentation': { + 'id': 1001, + 'name': 'SIMPLE_FORM_EXAMPLE', + 'description': '', + 'version': 1, + 'lastUpdatedBy': 2, + 'lastUpdatedByFullName': 'Test01 01Test', + 'lastUpdated': '2018-02-26T17:44:04.543+0000', + 'stencilSetId': 0, + 'referenceId': null, + 'taskId': '9999', + 'formDefinition': { + 'tabs': [], + 'fields': [ + { + 'fieldType': 'ContainerRepresentation', + 'id': '1519666726245', + 'name': 'Label', + 'type': 'container', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'dateDisplayFormat': null, + 'layout': null, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'typeaheadField', + 'name': 'TypeaheadField', + 'type': 'typeahead', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': 'https://jsonplaceholder.typicode.com/users', + 'restResponsePath': null, + 'restIdProperty': 'id', + 'restLabelProperty': 'name', + 'tab': null, + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ], + '2': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'radioButton', + 'name': 'RadioButtons', + 'type': 'radio-buttons', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': [ + { + 'id': 'option_1', + 'name': 'Option 1' + }, + { + 'id': 'option_2', + 'name': 'Option 2' + }, + { + 'id': 'option_3', + 'name': 'Option 3' + } + ], + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 1 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 2, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ] + } + }, + { + 'fieldType': 'ContainerRepresentation', + 'id': '1519666735185', + 'name': 'Label', + 'type': 'container', + 'value': null, + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': null, + 'hasEmptyValue': null, + 'options': null, + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'dateDisplayFormat': null, + 'layout': null, + 'sizeX': 2, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'numberOfColumns': 2, + 'fields': { + '1': [ + { + 'fieldType': 'RestFieldRepresentation', + 'id': 'selectBox', + 'name': 'SelectBox', + 'type': 'dropdown', + 'value': 'Choose one...', + 'required': false, + 'readOnly': false, + 'overrideId': false, + 'colspan': 1, + 'placeholder': null, + 'minLength': 0, + 'maxLength': 0, + 'minValue': null, + 'maxValue': null, + 'regexPattern': null, + 'optionType': 'manual', + 'hasEmptyValue': true, + 'options': [ + { + 'id': 'empty', + 'name': 'Choose one...' + }, + { + 'id': 'option_1', + 'name': '1' + }, + { + 'id': 'option_2', + 'name': '2' + }, + { + 'id': 'option_3', + 'name': '3' + } + ], + 'restUrl': null, + 'restResponsePath': null, + 'restIdProperty': null, + 'restLabelProperty': null, + 'tab': null, + 'className': null, + 'params': { + 'existingColspan': 1, + 'maxColspan': 2 + }, + 'dateDisplayFormat': null, + 'layout': { + 'row': -1, + 'column': -1, + 'colspan': 1 + }, + 'sizeX': 1, + 'sizeY': 1, + 'row': -1, + 'col': -1, + 'visibilityCondition': null, + 'endpoint': null, + 'requestHeaders': null + } + ], + '2': [] + } + } + ], + 'outcomes': [], + 'javascriptEvents': [], + 'className': '', + 'style': '', + 'customFieldTemplates': {}, + 'metadata': {}, + 'variables': [ + { + 'id': 'bfca9766-7bc1-45cc-8ecf-cdad551e36e2', + 'name': 'name1', + 'type': 'string', + 'value': '' + }, + { + 'id': '3ed9f28a-dbae-463f-b991-47ef06658bb6', + 'name': 'name2', + 'type': 'string', + 'value': '' + }, + { + 'id': 'a7710978-1e9c-4b54-a19c-c6267d2b19a2', + 'name': 'input02', + 'type': 'integer' + } + ], + 'customFieldsValueInfo': {}, + 'gridsterForm': false + } } }; diff --git a/lib/core/mock/form/form.service.mock.ts b/lib/core/mock/form/form.service.mock.ts index 48bf954b2a..b3a18cf18c 100644 --- a/lib/core/mock/form/form.service.mock.ts +++ b/lib/core/mock/form/form.service.mock.ts @@ -16,231 +16,233 @@ */ export const formModelTabs: any = { - id: 16, - name: 'start event', - description: '', - version: 2, - lastUpdatedBy: 4, - lastUpdatedByFullName: 'User Test', - lastUpdated: '2017-10-04T13:00:03.030+0000', - stencilSetId: null, - referenceId: null, - formDefinition: { - tabs: [], - fields: [ - { - fieldType: 'ContainerRepresentation', - id: '1507037668653', - name: 'Label', - type: 'container', - value: null, - required: false, - readOnly: false, - overrideId: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - minValue: null, - maxValue: null, - regexPattern: null, - optionType: null, - hasEmptyValue: null, - options: null, - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null, - tab: null, - className: null, - dateDisplayFormat: null, - layout: null, - sizeX: 2, - sizeY: 1, - row: -1, - col: -1, - visibilityCondition: null, - numberOfColumns: 2, - fields: { - '1': [ - { - fieldType: 'AmountFieldRepresentation', - id: 'label', - name: 'Label', - type: 'amount', - value: null, - required: false, - readOnly: false, - overrideId: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - minValue: null, - maxValue: null, - regexPattern: null, - optionType: null, - hasEmptyValue: null, - options: null, - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null, - tab: null, - className: null, - params: { - existingColspan: 1, - maxColspan: 2 - }, - dateDisplayFormat: null, - layout: { - row: -1, - column: -1, - colspan: 1 - }, - sizeX: 1, - sizeY: 1, - row: -1, - col: -1, - visibilityCondition: null, - enableFractions: false, - currency: null + formRepresentation: { + id: 16, + name: 'start event', + description: '', + version: 2, + lastUpdatedBy: 4, + lastUpdatedByFullName: 'User Test', + lastUpdated: '2017-10-04T13:00:03.030+0000', + stencilSetId: null, + referenceId: null, + formDefinition: { + tabs: [], + fields: [ + { + fieldType: 'ContainerRepresentation', + id: '1507037668653', + name: 'Label', + type: 'container', + value: null, + required: false, + readOnly: false, + overrideId: false, + colspan: 1, + placeholder: null, + minLength: 0, + maxLength: 0, + minValue: null, + maxValue: null, + regexPattern: null, + optionType: null, + hasEmptyValue: null, + options: null, + restUrl: null, + restResponsePath: null, + restIdProperty: null, + restLabelProperty: null, + tab: null, + className: null, + dateDisplayFormat: null, + layout: null, + sizeX: 2, + sizeY: 1, + row: -1, + col: -1, + visibilityCondition: null, + numberOfColumns: 2, + fields: { + '1': [ + { + fieldType: 'AmountFieldRepresentation', + id: 'label', + name: 'Label', + type: 'amount', + value: null, + required: false, + readOnly: false, + overrideId: false, + colspan: 1, + placeholder: null, + minLength: 0, + maxLength: 0, + minValue: null, + maxValue: null, + regexPattern: null, + optionType: null, + hasEmptyValue: null, + options: null, + restUrl: null, + restResponsePath: null, + restIdProperty: null, + restLabelProperty: null, + tab: null, + className: null, + params: { + existingColspan: 1, + maxColspan: 2 + }, + dateDisplayFormat: null, + layout: { + row: -1, + column: -1, + colspan: 1 + }, + sizeX: 1, + sizeY: 1, + row: -1, + col: -1, + visibilityCondition: null, + enableFractions: false, + currency: null + } + ], + '2': [ + { + fieldType: 'FormFieldRepresentation', + id: 'label1', + name: 'Label1', + type: 'date', + value: null, + required: false, + readOnly: false, + overrideId: false, + colspan: 1, + placeholder: null, + minLength: 0, + maxLength: 0, + minValue: null, + maxValue: null, + regexPattern: null, + optionType: null, + hasEmptyValue: null, + options: null, + restUrl: null, + restResponsePath: null, + restIdProperty: null, + restLabelProperty: null, + tab: null, + className: null, + params: { + existingColspan: 1, + maxColspan: 1 + }, + dateDisplayFormat: null, + layout: { + row: -1, + column: -1, + colspan: 1 + }, + sizeX: 1, + sizeY: 1, + row: -1, + col: -1, + visibilityCondition: null + } + ] } - ], - '2': [ - { - fieldType: 'FormFieldRepresentation', - id: 'label1', - name: 'Label1', - type: 'date', - value: null, - required: false, - readOnly: false, - overrideId: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - minValue: null, - maxValue: null, - regexPattern: null, - optionType: null, - hasEmptyValue: null, - options: null, - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null, - tab: null, - className: null, - params: { - existingColspan: 1, - maxColspan: 1 - }, - dateDisplayFormat: null, - layout: { - row: -1, - column: -1, - colspan: 1 - }, - sizeX: 1, - sizeY: 1, - row: -1, - col: -1, - visibilityCondition: null + }, + { + fieldType: 'ContainerRepresentation', + id: '1507037670167', + name: 'Label', + type: 'container', + value: null, + required: false, + readOnly: false, + overrideId: false, + colspan: 1, + placeholder: null, + minLength: 0, + maxLength: 0, + minValue: null, + maxValue: null, + regexPattern: null, + optionType: null, + hasEmptyValue: null, + options: null, + restUrl: null, + restResponsePath: null, + restIdProperty: null, + restLabelProperty: null, + tab: null, + className: null, + dateDisplayFormat: null, + layout: null, + sizeX: 2, + sizeY: 1, + row: -1, + col: -1, + visibilityCondition: null, + numberOfColumns: 2, + fields: { + '1': [ + { + fieldType: 'FormFieldRepresentation', + id: 'label2', + name: 'Label2', + type: 'boolean', + value: null, + required: false, + readOnly: false, + overrideId: false, + colspan: 1, + placeholder: null, + minLength: 0, + maxLength: 0, + minValue: null, + maxValue: null, + regexPattern: null, + optionType: null, + hasEmptyValue: null, + options: null, + restUrl: null, + restResponsePath: null, + restIdProperty: null, + restLabelProperty: null, + tab: null, + className: null, + params: { + existingColspan: 1, + maxColspan: 2 + }, + dateDisplayFormat: null, + layout: { + row: -1, + column: -1, + colspan: 1 + }, + sizeX: 1, + sizeY: 1, + row: -1, + col: -1, + visibilityCondition: null + } + ], + '2': [] } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: '1507037670167', - name: 'Label', - type: 'container', - value: null, - required: false, - readOnly: false, - overrideId: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - minValue: null, - maxValue: null, - regexPattern: null, - optionType: null, - hasEmptyValue: null, - options: null, - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null, - tab: null, - className: null, - dateDisplayFormat: null, - layout: null, - sizeX: 2, - sizeY: 1, - row: -1, - col: -1, - visibilityCondition: null, - numberOfColumns: 2, - fields: { - '1': [ - { - fieldType: 'FormFieldRepresentation', - id: 'label2', - name: 'Label2', - type: 'boolean', - value: null, - required: false, - readOnly: false, - overrideId: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - minValue: null, - maxValue: null, - regexPattern: null, - optionType: null, - hasEmptyValue: null, - options: null, - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null, - tab: null, - className: null, - params: { - existingColspan: 1, - maxColspan: 2 - }, - dateDisplayFormat: null, - layout: { - row: -1, - column: -1, - colspan: 1 - }, - sizeX: 1, - sizeY: 1, - row: -1, - col: -1, - visibilityCondition: null - } - ], - '2': [] - } + } + ], + outcomes: [], + javascriptEvents: [], + className: '', + style: '', + customFieldTemplates: {}, + metadata: {}, + variables: [], + customFieldsValueInfo: {}, + gridsterForm: false } - ], - outcomes: [], - javascriptEvents: [], - className: '', - style: '', - customFieldTemplates: {}, - metadata: {}, - variables: [], - customFieldsValueInfo: {}, - gridsterForm: false } };