Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions plugins/view-resources/src/components/ViewletSetting.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -148,28 +148,29 @@
return result
}

function getValue (name: string, type: Type<any>): string {
function getValue (name: string, type: Type<any>, attrClass: Ref<Class<Doc>>): 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<any>).of)
// }
return name
}

function processAttribute (attribute: AnyAttribute, result: Config[], useMixinProxy = false): void {
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
Expand Down