diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.html b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.html index f3fcda7a3e..3d5d1d67b1 100644 --- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.html +++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.html @@ -20,7 +20,7 @@
- +
UNKNOWN WIDGET TYPE: {{field.type}} diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/core/dynamic-table-column.ts b/ng2-components/ng2-activiti-form/src/components/widgets/core/dynamic-table-column.ts new file mode 100644 index 0000000000..a5b4692f8f --- /dev/null +++ b/ng2-components/ng2-activiti-form/src/components/widgets/core/dynamic-table-column.ts @@ -0,0 +1,48 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// maps to: com.activiti.model.editor.form.ColumnDefinitionRepresentation +export interface DynamicTableColumn { + + id: string; + name: string; + type: string; + value: any; + optionType: string; + options: DynamicTableColumnOption[]; + restResponsePath: string; + restUrl: string; + restIdProperty: string; + restLabelProperty: string; + amountCurrency: string; + amountEnableFractions: boolean; + required: boolean; + editable: boolean; + sortable: boolean; + visible: boolean; + + // TODO: com.activiti.domain.idm.EndpointConfiguration.EndpointConfigurationRepresentation + endpoint: any; + // TODO: com.activiti.model.editor.form.RequestHeaderRepresentation + requestHeaders: any; +} + +// maps to: com.activiti.model.editor.form.OptionRepresentation +export interface DynamicTableColumnOption { + id: string; + name: string; +} diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/core/dynamic-table.model.ts b/ng2-components/ng2-activiti-form/src/components/widgets/core/dynamic-table.model.ts index 05115306a6..35411b5732 100644 --- a/ng2-components/ng2-activiti-form/src/components/widgets/core/dynamic-table.model.ts +++ b/ng2-components/ng2-activiti-form/src/components/widgets/core/dynamic-table.model.ts @@ -18,16 +18,27 @@ import { FormWidgetModel } from './form-widget.model'; import { FormModel } from './form.model'; import { FormFieldModel } from './form-field.model'; +import { DynamicTableColumn } from './dynamic-table-column'; export class DynamicTableModel extends FormWidgetModel { field: FormFieldModel; + columns: DynamicTableColumn[] = []; + visibleColumns: DynamicTableColumn[] = []; + rows: any[] = []; constructor(form: FormModel, json?: any) { super(form, json); if (json) { this.field = new FormFieldModel(form, json); + + if (json.columnDefinitions) { + this.columns = json.columnDefinitions.map(obj => obj); + this.visibleColumns = this.columns.filter(col => col.visible); + } + + this.rows = json.value || []; } } diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.css b/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.css index 35ac21ae0d..08af04f501 100644 --- a/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.css +++ b/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.css @@ -1,4 +1,8 @@ .dynamic-table-widget { + padding: 8px; +} + +.dynamic-table-widget__table { width: 100%; } diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.html b/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.html index 6e07c33c46..b747e57d55 100644 --- a/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.html +++ b/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.html @@ -1,6 +1,25 @@ -
-
{{field.name}}
-
DYNAMIC TABLE PLACEHOLDER
- {{field.validationSummary}} +
+
{{content.name}}
+ + + + + + + + + + + + +
+ {{column.name}} +
+ {{row[column.id]}} +
+ + {{content.validationSummary}}
diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.ts b/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.ts index 624cdc567d..09898aa4a9 100644 --- a/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.ts +++ b/ng2-components/ng2-activiti-form/src/components/widgets/dynamic-table/dynamic-table.widget.ts @@ -15,9 +15,9 @@ * limitations under the License. */ -import { Component } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { WidgetComponent } from './../widget.component'; -// import { DynamicTableModel } from './../core/index'; +import { DynamicTableModel } from './../core/index'; @Component({ moduleId: module.id, @@ -25,6 +25,11 @@ import { WidgetComponent } from './../widget.component'; templateUrl: './dynamic-table.widget.html', styleUrls: ['./dynamic-table.widget.css'] }) -export class DynamicTableWidget extends WidgetComponent { +export class DynamicTableWidget extends WidgetComponent implements OnInit { + @Input() + content: DynamicTableModel; + + ngOnInit() { + } } diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/tabs/tabs.widget.html b/ng2-components/ng2-activiti-form/src/components/widgets/tabs/tabs.widget.html index 395ad7ddb0..39664b5b7f 100644 --- a/ng2-components/ng2-activiti-form/src/components/widgets/tabs/tabs.widget.html +++ b/ng2-components/ng2-activiti-form/src/components/widgets/tabs/tabs.widget.html @@ -17,6 +17,9 @@
+
+ +
UNKNOWN WIDGET TYPE: {{field.type}}