mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +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:
@@ -22,8 +22,13 @@ export class CardViewItemFloatValidator implements CardViewItemValidator {
|
||||
message = 'CORE.CARDVIEW.VALIDATORS.FLOAT_VALIDATION_ERROR';
|
||||
|
||||
isValid(value: any): boolean {
|
||||
return value === ''
|
||||
|| !isNaN(parseFloat(value))
|
||||
&& isFinite(value);
|
||||
if (Array.isArray(value)) {
|
||||
return value.every(this.isDecimalNumber);
|
||||
}
|
||||
return value === '' || this.isDecimalNumber(value);
|
||||
}
|
||||
|
||||
isDecimalNumber(value: any): boolean {
|
||||
return !isNaN(parseFloat(value)) && isFinite(value);
|
||||
}
|
||||
}
|
||||
|
@@ -22,13 +22,15 @@ export class CardViewItemIntValidator implements CardViewItemValidator {
|
||||
message = 'CORE.CARDVIEW.VALIDATORS.INT_VALIDATION_ERROR';
|
||||
|
||||
isValid(value: any): boolean {
|
||||
return value === ''
|
||||
|| !isNaN(value)
|
||||
&& this.isIntegerNumber(value);
|
||||
if (Array.isArray(value)) {
|
||||
return value.every(this.isIntegerNumber);
|
||||
}
|
||||
|
||||
return value === '' || !isNaN(value) && this.isIntegerNumber(value);
|
||||
}
|
||||
|
||||
isIntegerNumber(value: any): boolean {
|
||||
const parsedNumber = parseFloat(value);
|
||||
const parsedNumber = Number(value);
|
||||
return (parsedNumber | 0) === parsedNumber;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user