From 9b14b9417bd8e04c5e5b9d1d6416bd5be7fcb566 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Thu, 8 Aug 2024 16:41:41 +0500 Subject: [PATCH] do not use lookup if RefPresenter is set 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 cdc0a870d00..1bd50bac279 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