From c752b2032150a290a853f333d329a960473a958c Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Thu, 8 Aug 2024 19:32:25 +0500 Subject: [PATCH] do not use lookup if RefPresenter is set (#6289) Signed-off-by: Vyacheslav Tumanov --- .../src/components/ViewletSetting.svelte | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/view-resources/src/components/ViewletSetting.svelte b/plugins/view-resources/src/components/ViewletSetting.svelte index cdc0a870d0..1bd50bac27 100644 --- a/plugins/view-resources/src/components/ViewletSetting.svelte +++ b/plugins/view-resources/src/components/ViewletSetting.svelte @@ -148,13 +148,14 @@ return result } - function getValue (name: string, type: Type): string { + function getValue (name: string, type: Type, attrClass: Ref>): string { + const presenter = hierarchy.classHierarchyMixin(attrClass, view.mixin.AttributePresenter)?.presenter + if (presenter !== undefined) { + return name + } if (hierarchy.isDerived(type._class, core.class.RefTo)) { return '$lookup.' + name } - // if (hierarchy.isDerived(type._class, core.class.ArrOf)) { - // return getValue(name, (type as ArrOf).of) - // } return name } @@ -162,14 +163,14 @@ if (attribute.hidden === true || attribute.label === undefined) return if (viewlet.configOptions?.hiddenKeys?.includes(attribute.name)) return if (hierarchy.isDerived(attribute.type._class, core.class.Collection)) return - const value = getValue(attribute.name, attribute.type) + const { attrClass, category } = getAttributePresenterClass(hierarchy, attribute) + const value = getValue(attribute.name, attribute.type, attrClass) for (const res of result) { const key = typeof res.value === 'string' ? res.value : res.value?.key if (key === undefined) return if (key === attribute.name) return if (key === value) return } - const { attrClass, category } = getAttributePresenterClass(hierarchy, attribute) const mixin = category === 'object' ? view.mixin.ObjectPresenter