mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-24 20:40:59 +00:00
Board: fix attribute views for tags (#2046)
* Board: fix attribute views for tags Signed-off-by: Anna No <anna.no@xored.com> * Board: fix attribute views for tags Signed-off-by: Anna No <anna.no@xored.com> * fix formatting Signed-off-by: Anna No <anna.no@xored.com> * fix review comments Signed-off-by: Anna No <anna.no@xored.com> * fix review comments Signed-off-by: Anna No <anna.no@xored.com> * fix review comments Signed-off-by: Anna No <anna.no@xored.com>
This commit is contained in:
parent
cbaf13cd72
commit
4e5fc37506
@ -88,9 +88,6 @@ export function createModel (builder: Builder): void {
|
||||
builder.createModel(TTagElement, TTagReference, TTagCategory)
|
||||
|
||||
builder.mixin(tags.class.TagReference, core.class.Class, view.mixin.CollectionEditor, {
|
||||
editor: tags.component.Tags
|
||||
})
|
||||
builder.mixin(tags.class.TagReference, core.class.Class, view.mixin.AttributeEditor, {
|
||||
editor: tags.component.TagsAttributeEditor
|
||||
})
|
||||
|
||||
|
@ -41,16 +41,24 @@
|
||||
attribute: AnyAttribute,
|
||||
presenterClass?: { attrClass: Ref<Class<Doc>>; category: AttributeCategory }
|
||||
): void {
|
||||
if (presenterClass?.attrClass !== undefined && presenterClass?.category === 'attribute') {
|
||||
const typeClass = hierarchy.getClass(presenterClass.attrClass)
|
||||
const editorMixin = hierarchy.as(typeClass, view.mixin.AttributeEditor)
|
||||
editor = getResource(editorMixin.editor).catch((cause) => {
|
||||
console.error(`failed to find editor for ${_class} ${attribute} ${presenterClass.attrClass} cause: ${cause}`)
|
||||
})
|
||||
if (presenterClass?.attrClass === undefined) {
|
||||
return
|
||||
}
|
||||
if (presenterClass?.attrClass !== undefined && presenterClass?.category === 'array') {
|
||||
const category = presenterClass.category
|
||||
let mixinRef = undefined
|
||||
if (category === 'attribute') {
|
||||
mixinRef = view.mixin.AttributeEditor
|
||||
}
|
||||
if (category === 'collection') {
|
||||
mixinRef = view.mixin.CollectionEditor
|
||||
}
|
||||
if (category === 'array') {
|
||||
mixinRef = view.mixin.ArrayEditor
|
||||
}
|
||||
|
||||
if (mixinRef !== undefined) {
|
||||
const typeClass = hierarchy.getClass(presenterClass.attrClass)
|
||||
const editorMixin = hierarchy.as(typeClass, view.mixin.ArrayEditor)
|
||||
const editorMixin = hierarchy.as(typeClass, mixinRef)
|
||||
editor = getResource(editorMixin.editor).catch((cause) => {
|
||||
console.error(`failed to find editor for ${_class} ${attribute} ${presenterClass.attrClass} cause: ${cause}`)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user