Direct open Candidate from Candidates (#1076)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-03-01 16:14:30 +07:00 committed by GitHub
parent 3acd536335
commit 0d7857fe99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -59,6 +59,11 @@ export class Hierarchy {
return _mixinClass(doc)
}
static mixinOrClass<D extends Doc, M extends D>(doc: D): Ref<Mixin<M> | Class<Doc>> {
const m = _mixinClass(doc)
return m ?? doc._class
}
hasMixin<D extends Doc, M extends D>(doc: D, mixin: Ref<Mixin<M>>): boolean {
const d = Hierarchy.toDoc(doc)
return typeof (d as any)[mixin] === 'object'

View File

@ -15,6 +15,7 @@
-->
<script lang="ts">
import { formatName, Person } from '@anticrm/contact'
import { Hierarchy } from '@anticrm/core'
import { Avatar } from '@anticrm/presentation'
import { showPanel } from '@anticrm/ui'
import view from '@anticrm/view'
@ -23,7 +24,7 @@
export let inline: boolean = false
async function onClick () {
showPanel(view.component.EditDoc, value._id, value._class, 'full')
showPanel(view.component.EditDoc, value._id, Hierarchy.mixinOrClass(value), 'full')
}
</script>

View File

@ -15,7 +15,8 @@
-->
<script lang="ts">
import contact, { formatName } from '@anticrm/contact'
import core, { Class, ClassifierKind, Doc, Mixin, Obj, Ref } from '@anticrm/core'
import core, { Class, ClassifierKind, Doc, Hierarchy, Mixin, Obj, Ref } from '@anticrm/core'
import notification from '@anticrm/notification'
import { Panel } from '@anticrm/panel'
import { Asset, getResource, translate } from '@anticrm/platform'
import {
@ -27,9 +28,8 @@
} from '@anticrm/presentation'
import { AnyComponent, Component, Label } from '@anticrm/ui'
import view from '@anticrm/view'
import { createEventDispatcher, afterUpdate, onDestroy } from 'svelte'
import { createEventDispatcher, onDestroy } from 'svelte'
import { getCollectionCounter, getMixinStyle } from '../utils'
import notification from '@anticrm/notification'
export let _id: Ref<Doc>
export let _class: Ref<Class<Doc>>
@ -81,7 +81,7 @@
$: if (object && prevSelected !== object._class) {
prevSelected = object._class
selectedClass = objectClass._id
selectedClass = Hierarchy.mixinOrClass(object)
parentClass = getParentClass(object._class)
mixins = getMixins()