mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[MNT-24715] App with APS does not show display value of dynamic table (#10799)
* [MNT-24715] App with APS does not show display value of dynamic table * [MNT-24715] fix linting
This commit is contained in:
parent
1f73f7fe40
commit
0dc45e95af
@ -62,6 +62,10 @@
|
||||
<div *ngIf="currentRootElement.type === 'dynamic-table'" class="adf-container-widget">
|
||||
<adf-form-field [field]="currentRootElement" />
|
||||
</div>
|
||||
<div class="adf-container-widget"
|
||||
*ngIf="currentRootElement.type === 'readonly' && currentRootElement.field.params.field.type === 'dynamic-table'">
|
||||
<adf-form-field [field]="currentRootElement.field"/>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
|
@ -29,6 +29,7 @@ import {
|
||||
customWidgetFormWithVisibility,
|
||||
dateWidgetFormVisibilityMock,
|
||||
displayBigDecimalWidgetMock,
|
||||
displayDynamicTableMock,
|
||||
displayTextWidgetFormVisibilityMock,
|
||||
formDateVisibility,
|
||||
formDisplayValueCombinedVisibility,
|
||||
@ -245,6 +246,13 @@ describe('Form Renderer Component', () => {
|
||||
expectInputElementValueIs(testingUtils, '#TextTwo', 'bbb');
|
||||
expectElementToBeVisible(testingUtils, 'Displayvalue0g6092');
|
||||
});
|
||||
|
||||
it('should render display value of dynamic-table widget', () => {
|
||||
formRendererComponent.formDefinition = formService.parseForm(displayDynamicTableMock);
|
||||
fixture.detectChanges();
|
||||
|
||||
expectElementToBeVisible(testingUtils, 'dynamic-table-id');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Number widget', () => {
|
||||
|
@ -2345,3 +2345,70 @@ export const mockSectionVisibilityForm = {
|
||||
variables: []
|
||||
}
|
||||
};
|
||||
|
||||
export const displayDynamicTableMock = {
|
||||
id: 1,
|
||||
name: 'Dynamic Table Form',
|
||||
processDefinitionId: 'TestDynamicTable:0:00000',
|
||||
processDefinitionName: 'Test Dynamic Table',
|
||||
processDefinitionKey: 'TestDynamicTable',
|
||||
taskId: 'fake-id',
|
||||
taskName: 'Task Name',
|
||||
taskDefinitionKey: 'sid-fake-id',
|
||||
tabs: [],
|
||||
fields: [
|
||||
{
|
||||
fieldType: 'FormFieldRepresentation',
|
||||
id: 'dynamic-table-id',
|
||||
name: 'Label1',
|
||||
type: 'readonly',
|
||||
value: [
|
||||
{
|
||||
name: 'name',
|
||||
desc: 'desc'
|
||||
}
|
||||
],
|
||||
required: false,
|
||||
readOnly: false,
|
||||
overrideId: false,
|
||||
colspan: 1,
|
||||
placeholder: null,
|
||||
minLength: 0,
|
||||
maxLength: 0,
|
||||
className: null,
|
||||
params: {
|
||||
existingColspan: 1,
|
||||
maxColspan: 1,
|
||||
field: {
|
||||
id: 'dynamic-table-id',
|
||||
name: 'Label1',
|
||||
type: 'dynamic-table',
|
||||
columnDefinitions: [
|
||||
{
|
||||
id: 'name',
|
||||
name: 'Name',
|
||||
type: 'String'
|
||||
},
|
||||
{
|
||||
id: 'desc',
|
||||
name: 'Desc',
|
||||
type: 'String'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
layout: {
|
||||
row: -1,
|
||||
column: -1,
|
||||
colspan: 2
|
||||
},
|
||||
sizeX: 2,
|
||||
sizeY: 2,
|
||||
row: -1,
|
||||
col: -1
|
||||
}
|
||||
],
|
||||
outcomes: [],
|
||||
metadata: {},
|
||||
variables: []
|
||||
};
|
||||
|
@ -110,6 +110,12 @@ describe('DynamicTableWidgetComponent', () => {
|
||||
expect(row.selected).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should set readOnly to true when field type is readonly', () => {
|
||||
widget.field.type = 'readonly';
|
||||
widget.ngOnInit();
|
||||
expect(widget.readOnly).toBeTrue();
|
||||
});
|
||||
|
||||
it('should reset selected row', () => {
|
||||
const row = { selected: false } as DynamicTableRow;
|
||||
widget.content.rows.push(row);
|
||||
|
@ -69,6 +69,9 @@ export class DynamicTableWidgetComponent extends WidgetComponent implements OnIn
|
||||
if (this.field) {
|
||||
this.content = new DynamicTableModel(this.field, this.formService);
|
||||
this.visibilityService.refreshVisibility(this.field.form);
|
||||
if (this.field.type === 'readonly') {
|
||||
this.readOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user