mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[MNT-25149] Card view select item multivalued property support (#11891)
* [MNT-25149] Card view select item multivalued property support * [MNT-25149] CR fixes * [MNT-25149] CR fixes * [MNT-25149] CR fixes
This commit is contained in:
+27
@@ -367,6 +367,33 @@ describe('PropertyGroupTranslatorService', () => {
|
||||
expect(cardViewProperty.value).toBe('two');
|
||||
});
|
||||
|
||||
it('should translate property for type LIST constraint with multivalued property', () => {
|
||||
const definition: Definition = {
|
||||
properties: [
|
||||
{
|
||||
id: 'FAS:PLAGUE',
|
||||
constraints: [
|
||||
{
|
||||
type: 'LIST',
|
||||
parameters: {
|
||||
allowedValues: ['one', 'two', 'three']
|
||||
}
|
||||
}
|
||||
]
|
||||
} as Constraint
|
||||
]
|
||||
};
|
||||
property.dataType = 'd:text';
|
||||
property.multiValued = true;
|
||||
propertyValues = { 'FAS:PLAGUE': ['one', 'three'] };
|
||||
const cardViewGroup = service.translateToCardViewGroups(propertyGroups, propertyValues, definition);
|
||||
|
||||
const cardViewProperty = cardViewGroup[0].properties[0] as CardViewSelectItemModel<string>;
|
||||
expect(cardViewProperty instanceof CardViewSelectItemModel).toBeTruthy();
|
||||
expect(cardViewProperty.multivalued).toBe(true);
|
||||
expect(cardViewProperty.value).toEqual(['one', 'three']);
|
||||
});
|
||||
|
||||
it('should translate content type properties into card items', () => {
|
||||
const propertyBase = {
|
||||
id: 'fk:brendonstare',
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ export class PropertyGroupTranslatorService {
|
||||
|
||||
if (this.isListOfValues(propertyDefinition.constraints)) {
|
||||
const options = propertyDefinition.constraints[0].parameters.allowedValues.map((value) => ({ key: value, label: value }));
|
||||
const properties = Object.assign(propertyDefinition, { options$: of(options) });
|
||||
const properties = Object.assign(propertyDefinition, { options$: of(options), multivalued: isMultiValued });
|
||||
|
||||
cardViewItemProperty = new CardViewSelectItemModel(properties);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user