mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
@@ -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>
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
@@ -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[];
|
||||
}
|
||||
|
Reference in New Issue
Block a user