[ADF-3484] - Metadata drop-down list option for properties constrained by a list of values (#5892)

* update js-api

* include definition field

* process LIST constraint

* update tests

* dropdown visibility

* optional chaining
This commit is contained in:
Cilibiu Bogdan
2020-07-22 00:46:46 +03:00
committed by GitHub
parent 826bd32e60
commit 5257917258
10 changed files with 4337 additions and 3332 deletions

View File

@@ -1,20 +1,22 @@
<div [attr.data-automation-id]="'card-select-label-' + property.key"
class="adf-property-label">{{ property.label | translate }}</div>
<div class="adf-property-field">
<div *ngIf="!isEditable()"
class="adf-select-item-padding adf-property-value"
data-automation-class="read-only-value">{{ property.displayValue | async }}</div>
<div *ngIf="isEditable()">
<mat-form-field class="adf-select-item-padding-editable adf-property-value">
<mat-select [(value)]="value"
(selectionChange)="onChange($event)"
data-automation-class="select-box">
<mat-option *ngIf="showNoneOption()">{{ 'CORE.CARDVIEW.NONE' | translate }}</mat-option>
<mat-option *ngFor="let option of getOptions() | async"
[value]="option.key">
{{ option.label | translate }}
</mat-option>
</mat-select>
</mat-form-field>
<ng-container *ngIf="!property.isEmpty() || isEditable()">
<div [attr.data-automation-id]="'card-select-label-' + property.key"
class="adf-property-label">{{ property.label | translate }}</div>
<div class="adf-property-field">
<div *ngIf="!isEditable()"
class="adf-select-item-padding adf-property-value"
data-automation-class="read-only-value">{{ property.displayValue | async }}</div>
<div *ngIf="isEditable()">
<mat-form-field class="adf-select-item-padding-editable adf-property-value">
<mat-select [(value)]="value"
(selectionChange)="onChange($event)"
data-automation-class="select-box">
<mat-option *ngIf="showNoneOption()">{{ 'CORE.CARDVIEW.NONE' | translate }}</mat-option>
<mat-option *ngFor="let option of getOptions() | async"
[value]="option.key">
{{ option.label | translate }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div>
</ng-container>

View File

@@ -37,6 +37,9 @@ export class CardViewSelectItemComponent extends BaseCardView<CardViewSelectItem
@Input()
displayNoneOption: boolean = true;
@Input()
displayEmpty: boolean = true;
value: string;
constructor(cardViewUpdateService: CardViewUpdateService) {
@@ -64,4 +67,8 @@ export class CardViewSelectItemComponent extends BaseCardView<CardViewSelectItem
showNoneOption() {
return this.displayNoneOption;
}
get showProperty(): boolean {
return this.displayEmpty || !this.property.isEmpty();
}
}

View File

@@ -16,6 +16,7 @@
*/
import { CardViewItemValidator } from './card-view-item-validator.interface';
import { Constraint } from '@alfresco/js-api';
export interface CardViewItemProperties {
label: string;
@@ -27,4 +28,5 @@ export interface CardViewItemProperties {
icon?: string;
validators?: CardViewItemValidator[];
data?: any;
constraints?: Constraint[];
}