mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#964 improve amount editor rendering
- fixed: showing currently symbol for the rows (non-complete forms) - new: currency symbol for the editor label (row editor)
This commit is contained in:
@@ -161,6 +161,15 @@ export class DynamicTableModel extends FormWidgetModel {
|
|||||||
|
|
||||||
return result || '';
|
return result || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDisplayText(column: DynamicTableColumn): string {
|
||||||
|
let result = column.name;
|
||||||
|
if (column.type === 'Amount') {
|
||||||
|
let currency = column.amountCurrency || '$';
|
||||||
|
result = `${column.name} (${currency})`;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DynamicRowValidationSummary {
|
export interface DynamicRowValidationSummary {
|
||||||
|
@@ -97,7 +97,11 @@ export class DynamicTableWidget extends WidgetComponent {
|
|||||||
|
|
||||||
getCellValue(row: DynamicTableRow, column: DynamicTableColumn): any {
|
getCellValue(row: DynamicTableRow, column: DynamicTableColumn): any {
|
||||||
if (this.content) {
|
if (this.content) {
|
||||||
return this.content.getCellValue(row, column);
|
let result = this.content.getCellValue(row, column);
|
||||||
|
if (column.type === 'Amount') {
|
||||||
|
return (column.amountCurrency || '$') + ' ' + (result || 0);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -7,5 +7,5 @@
|
|||||||
[required]="column.required"
|
[required]="column.required"
|
||||||
[disabled]="!column.editable"
|
[disabled]="!column.editable"
|
||||||
[attr.id]="column.id">
|
[attr.id]="column.id">
|
||||||
<label class="mdl-textfield__label" [attr.for]="column.id">{{column.name}}</label>
|
<label class="mdl-textfield__label" [attr.for]="column.id">{{displayName}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { CellEditorComponent } from './../cell.editor';
|
import { CellEditorComponent } from './../cell.editor';
|
||||||
import { DynamicTableRow, DynamicTableColumn } from './../../../core/index';
|
import { DynamicTableRow, DynamicTableColumn } from './../../../core/index';
|
||||||
|
|
||||||
@@ -25,7 +25,13 @@ import { DynamicTableRow, DynamicTableColumn } from './../../../core/index';
|
|||||||
templateUrl: './text.editor.html',
|
templateUrl: './text.editor.html',
|
||||||
styleUrls: ['./text.editor.css']
|
styleUrls: ['./text.editor.css']
|
||||||
})
|
})
|
||||||
export class TextEditorComponent extends CellEditorComponent {
|
export class TextEditorComponent extends CellEditorComponent implements OnInit {
|
||||||
|
|
||||||
|
displayName: string;
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.displayName = this.table.getDisplayText(this.column);
|
||||||
|
}
|
||||||
|
|
||||||
onValueChanged(row: DynamicTableRow, column: DynamicTableColumn, event: any) {
|
onValueChanged(row: DynamicTableRow, column: DynamicTableColumn, event: any) {
|
||||||
let value: any = (<HTMLInputElement>event.target).value;
|
let value: any = (<HTMLInputElement>event.target).value;
|
||||||
|
Reference in New Issue
Block a user