[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:
Michal Kinas
2026-05-20 11:39:42 +02:00
committed by GitHub
parent 1d163c6749
commit ece50ac32c
10 changed files with 519 additions and 54 deletions
@@ -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',
@@ -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 {