mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-5390] [ADF-5391] Add multivalue cardview for Date, Datetime, Integers and Decimal properties. (#6980)
* [ADF-5390] Addd multivalue cardview for Date, Datetime, Integers and Decimal properties * Fix unit test * Fix linting * Fix e2e tests * fix e2e Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
This commit is contained in:
@@ -89,6 +89,8 @@ export class CardViewDateItemComponent extends BaseCardView<CardViewDateItemMode
|
||||
|
||||
if (this.property.value) {
|
||||
this.valueDate = moment(this.property.value, this.dateFormat);
|
||||
} else if (this.property.multivalued && !this.property.value) {
|
||||
this.property.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,8 +120,8 @@ export class CardViewDateItemComponent extends BaseCardView<CardViewDateItemMode
|
||||
const momentDate = moment(newDateValue.value, this.dateFormat, true);
|
||||
if (momentDate.isValid()) {
|
||||
this.valueDate = momentDate;
|
||||
this.cardViewUpdateService.update(<CardViewDateItemModel> { ...this.property }, momentDate.toDate());
|
||||
this.property.value = momentDate.toDate();
|
||||
this.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,4 +137,24 @@ export class CardViewDateItemComponent extends BaseCardView<CardViewDateItemMode
|
||||
const clipboardMessage = this.translateService.instant('CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE');
|
||||
this.clipboardService.copyContentToClipboard(valueToCopy, clipboardMessage);
|
||||
}
|
||||
|
||||
addDateToList(newDateValue) {
|
||||
if (newDateValue) {
|
||||
const momentDate = moment(newDateValue.value, this.dateFormat, true);
|
||||
if (momentDate.isValid()) {
|
||||
this.property.value.push(momentDate.toDate());
|
||||
this.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removeValueFromList(itemIndex: number) {
|
||||
this.property.value.splice(itemIndex, 1);
|
||||
this.update();
|
||||
}
|
||||
|
||||
update() {
|
||||
this.cardViewUpdateService.update(<CardViewDateItemModel> { ...this.property }, this.property.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user