role select style

This commit is contained in:
Yuri Kuznetsov
2024-02-26 11:21:53 +02:00
parent 2ed620335f
commit dbfb1c696f
@@ -94,6 +94,11 @@ class LinkMultipleWithRoleFieldView extends LinkMultipleFieldView {
this.skipRoles = true;
}
}
if (this.roleType === this.ROLE_TYPE_ENUM) {
this.styleMap = /** @type {Record<string>}*/ this.getMetadata()
.get(['entityDefs', this.model.entityType, 'fields', this.roleField, 'style']) || {};
}
}
getAttributeList() {
@@ -136,8 +141,7 @@ class LinkMultipleWithRoleFieldView extends LinkMultipleFieldView {
}
if (role) {
let style = this.getMetadata()
.get(['entityDefs', this.model.entityType, 'fields', this.roleField, 'style', role]);
let style = this.styleMap[role];
let className = 'text';
@@ -242,6 +246,12 @@ class LinkMultipleWithRoleFieldView extends LinkMultipleFieldView {
$option.attr('selected', 'selected');
}
const style = this.styleMap[role];
if (style) {
$option.addClass('text-' + style)
}
$role.append($option);
});