From 6abf41cd0f4c9869cc43421d08d2b6a082bc0b0b Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Mon, 8 Jan 2024 19:32:25 +0300 Subject: [PATCH] UBERF-4870: Fixed attribute creation (#4325) Signed-off-by: Alexander Platov --- .../src/components/ClassAttributesList.svelte | 9 +++++++-- .../src/components/taskTypes/TypeClassEditor.svelte | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/setting-resources/src/components/ClassAttributesList.svelte b/plugins/setting-resources/src/components/ClassAttributesList.svelte index 514614a5a6..05cff99bab 100644 --- a/plugins/setting-resources/src/components/ClassAttributesList.svelte +++ b/plugins/setting-resources/src/components/ClassAttributesList.svelte @@ -41,6 +41,7 @@ Label, Menu, getEventPositionElement, + getEventPopupPositionElement, showPopup } from '@hcengineering/ui' import { getContextActions } from '@hcengineering/view-resources' @@ -48,6 +49,8 @@ import CreateAttribute from './CreateAttribute.svelte' import EditAttribute from './EditAttribute.svelte' import EditClassLabel from './EditClassLabel.svelte' + import { settingsStore } from '../store' + import TypesPopup from './typeEditors/TypesPopup.svelte' export let _class: Ref> export let ofClass: Ref> | undefined = undefined @@ -95,8 +98,10 @@ attributes = getCustomAttributes(_class) } - export function createAttribute (): void { - showPopup(CreateAttribute, { _class }, 'top', update) + export function createAttribute (ev: MouseEvent): void { + showPopup(TypesPopup, { _class }, getEventPopupPositionElement(ev), (_id) => { + if (_id !== undefined) $settingsStore = { component: CreateAttribute, props: { _id, _class } } + }) } export async function editAttribute (attribute: AnyAttribute, exist: boolean): Promise { diff --git a/plugins/task-resources/src/components/taskTypes/TypeClassEditor.svelte b/plugins/task-resources/src/components/taskTypes/TypeClassEditor.svelte index 4557465c4d..19c5b03860 100644 --- a/plugins/task-resources/src/components/taskTypes/TypeClassEditor.svelte +++ b/plugins/task-resources/src/components/taskTypes/TypeClassEditor.svelte @@ -55,7 +55,7 @@ {/if} -