mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
Fix class editor (#7099)
This commit is contained in:
parent
9d79ab65ae
commit
3ea2659d9e
@ -99,13 +99,12 @@
|
|||||||
async function showMenu (ev: MouseEvent, attribute: AnyAttribute, row: number): Promise<void> {
|
async function showMenu (ev: MouseEvent, attribute: AnyAttribute, row: number): Promise<void> {
|
||||||
hovered = row
|
hovered = row
|
||||||
const exist = (await client.findOne(attribute.attributeOf, { [attribute.name]: { $exists: true } })) !== undefined
|
const exist = (await client.findOne(attribute.attributeOf, { [attribute.name]: { $exists: true } })) !== undefined
|
||||||
|
|
||||||
const actions: Action[] = [
|
const actions: Action[] = [
|
||||||
{
|
{
|
||||||
label: presentation.string.Edit,
|
label: presentation.string.Edit,
|
||||||
icon: IconEdit,
|
icon: IconEdit,
|
||||||
action: async () => {
|
action: async () => {
|
||||||
dispatch('select', attribute._id)
|
dispatch('select', attribute)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -118,7 +117,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const extra = await getContextActions(client, attribute, { mode: 'context' })
|
const extra = await getContextActions(client, attribute, { mode: 'context' }, core.class.Attribute)
|
||||||
actions.push(
|
actions.push(
|
||||||
...extra.map((it) => ({
|
...extra.map((it) => ({
|
||||||
label: it.label,
|
label: it.label,
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
const data: Data<AnyAttribute> = {
|
const data: Data<AnyAttribute> = {
|
||||||
attributeOf: _class,
|
attributeOf: _class,
|
||||||
name: name.trim().replace('/', '').replace(' ', '') + '_' + generateId(),
|
name: 'custom' + generateId(),
|
||||||
label: getEmbeddedLabel(name),
|
label: getEmbeddedLabel(name),
|
||||||
isCustom: true,
|
isCustom: true,
|
||||||
type,
|
type,
|
||||||
|
@ -44,7 +44,8 @@
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
let refClass: Ref<Doc> | undefined = type !== undefined ? hierarchy.getClass(type.of._class)._id : undefined
|
let refClass: Ref<Doc> | undefined =
|
||||||
|
type?.of?._class !== undefined ? hierarchy.getClass(type.of._class)._id : undefined
|
||||||
|
|
||||||
$: selected = types.find((p) => p._id === refClass)
|
$: selected = types.find((p) => p._id === refClass)
|
||||||
|
|
||||||
|
@ -136,9 +136,10 @@ export async function getContextActions (
|
|||||||
context: {
|
context: {
|
||||||
mode: ViewContextType
|
mode: ViewContextType
|
||||||
application?: Ref<Doc>
|
application?: Ref<Doc>
|
||||||
}
|
},
|
||||||
|
derived: Ref<Class<Doc>> = core.class.Doc
|
||||||
): Promise<Action[]> {
|
): Promise<Action[]> {
|
||||||
const result = await getActions(client, doc, undefined, context.mode)
|
const result = await getActions(client, doc, derived, context.mode)
|
||||||
|
|
||||||
if (context.application !== undefined) {
|
if (context.application !== undefined) {
|
||||||
return result.filter((it) => it.context.application === context.application || it.context.application === undefined)
|
return result.filter((it) => it.context.application === context.application || it.context.application === undefined)
|
||||||
|
Loading…
Reference in New Issue
Block a user