diff --git a/models/board/src/index.ts b/models/board/src/index.ts
index 6a905d00e1..a4cea3329f 100644
--- a/models/board/src/index.ts
+++ b/models/board/src/index.ts
@@ -117,7 +117,7 @@ export class TCardAction extends TDoc implements CardAction {
label!: IntlString
position!: number
type!: string
- handler?: Resource<(card: Card, client: Client) => void>
+ handler?: Resource<(card: Card, client: Client, e?: Event) => void>
supported?: Resource<(card: Card, client: Client) => boolean>
}
diff --git a/plugins/board-resources/src/components/editor/CardActions.svelte b/plugins/board-resources/src/components/editor/CardActions.svelte
index 21af1e103a..99636d90fc 100644
--- a/plugins/board-resources/src/components/editor/CardActions.svelte
+++ b/plugins/board-resources/src/components/editor/CardActions.svelte
@@ -99,10 +99,10 @@
label={action.label}
kind={action.kind ?? 'no-border'}
justify="left"
- on:click={async () => {
+ on:click={async (e) => {
if (action.handler) {
const handler = await getResource(action.handler)
- handler(value, client)
+ handler(value, client, e)
}
}}
/>
diff --git a/plugins/board-resources/src/components/popups/EditAttachment.svelte b/plugins/board-resources/src/components/popups/EditAttachment.svelte
index 0939d732a2..17a7cac004 100644
--- a/plugins/board-resources/src/components/popups/EditAttachment.svelte
+++ b/plugins/board-resources/src/components/popups/EditAttachment.svelte
@@ -2,12 +2,12 @@
import { createEventDispatcher } from 'svelte'
import { Label, Button, ActionIcon, IconClose, EditBox } from '@anticrm/ui'
import board from '../../plugin'
- import { getClient } from '@anticrm/presentation';
- import { Attachment } from '@anticrm/attachment';
+ import { getClient } from '@anticrm/presentation'
+ import { Attachment } from '@anticrm/attachment'
export let object: Attachment
- let {name} = object
+ let { name } = object
const client = getClient()
const dispatch = createEventDispatcher()
@@ -19,8 +19,8 @@
-
-
{dispatch("close")}} />
+
+
{ dispatch('close') }} />
@@ -36,7 +36,7 @@
kind={'primary'}
on:click={() => {
if (!name) return
- client.update(object, {name})
+ client.update(object, { name })
dispatch('close')
}}
/>
diff --git a/plugins/board-resources/src/components/popups/RemoveAttachment.svelte b/plugins/board-resources/src/components/popups/RemoveAttachment.svelte
index 09925615fa..7340370e61 100644
--- a/plugins/board-resources/src/components/popups/RemoveAttachment.svelte
+++ b/plugins/board-resources/src/components/popups/RemoveAttachment.svelte
@@ -2,8 +2,8 @@
import { createEventDispatcher } from 'svelte'
import { Label, Button, ActionIcon, IconClose } from '@anticrm/ui'
import board from '../../plugin'
- import { getClient } from '@anticrm/presentation';
- import { Attachment } from '@anticrm/attachment';
+ import { getClient } from '@anticrm/presentation'
+ import { Attachment } from '@anticrm/attachment'
export let object: Attachment
@@ -17,8 +17,8 @@
-
-
{dispatch("close")}} />
+
+
{ dispatch('close') }} />
diff --git a/plugins/board-resources/src/components/presenters/AttachmentPresenter.svelte b/plugins/board-resources/src/components/presenters/AttachmentPresenter.svelte
index 5ab83e2098..097339aa16 100644
--- a/plugins/board-resources/src/components/presenters/AttachmentPresenter.svelte
+++ b/plugins/board-resources/src/components/presenters/AttachmentPresenter.svelte
@@ -12,21 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-->
-
@@ -51,14 +51,26 @@
{:else}
- {iconLabel(value.name)}
+
+ {iconLabel(value.name)}
+
{/if}
{trimFilename(value.name)}
-
-
- {showPopup(EditAttachment, {object: value})}} kind="transparent"/>
- {showPopup(RemoveAttachment, {object: value})}} kind="transparent"/>
+
+
+ {
+ showPopup(EditAttachment, { object: value }, getPopupAlignment(e))
+ }}
+ kind="transparent" />
+ {
+ showPopup(RemoveAttachment, { object: value }, getPopupAlignment(e))
+ }}
+ kind="transparent" />
@@ -73,8 +85,8 @@
font-size: 1rem;
color: var(--primary-button-color);
background-color: var(--primary-button-enabled);
- border: 1px solid rgba(0, 0, 0, .1);
- border-radius: .5rem;
+ border: 1px solid rgba(0, 0, 0, 0.1);
+ border-radius: 0.5rem;
}
.content {
width: 8rem;
diff --git a/plugins/board-resources/src/index.ts b/plugins/board-resources/src/index.ts
index 24e5545e5a..ec7b7717a4 100644
--- a/plugins/board-resources/src/index.ts
+++ b/plugins/board-resources/src/index.ts
@@ -20,6 +20,7 @@ import { Ref } from '@anticrm/core'
import contact, { Employee } from '@anticrm/contact'
import { showPopup } from '@anticrm/ui'
import { Card } from '@anticrm/board'
+import type { TxOperations as Client } from '@anticrm/core'
import { Resources } from '@anticrm/platform'
import { TxOperations } from '@anticrm/core'
import CardPresenter from './components/CardPresenter.svelte'
@@ -46,17 +47,18 @@ import {
unarchiveCard,
deleteCard
} from './utils/CardUtils'
+import { getPopupAlignment } from './utils/PopupUtils'
-async function showMoveCardPopup (object: Card): Promise {
- showPopup(MoveView, { object })
+async function showMoveCardPopup (object: Card, client: Client, e?: Event): Promise {
+ showPopup(MoveView, { object }, getPopupAlignment(e))
}
-async function showDatePickerPopup (object: Card): Promise {
- showPopup(DateRangePicker, { object })
+async function showDatePickerPopup (object: Card, client: Client, e?: Event): Promise {
+ showPopup(DateRangePicker, { object }, getPopupAlignment(e))
}
-async function showCardLabelsPopup (object: Card): Promise {
- showPopup(CardLabelsPopup, { object })
+async function showCardLabelsPopup (object: Card, client: Client, e?: Event): Promise {
+ showPopup(CardLabelsPopup, { object }, getPopupAlignment(e))
}
async function showEditMembersPopup(object: Card, client: TxOperations): Promise {
diff --git a/plugins/board-resources/src/utils/PopupUtils.ts b/plugins/board-resources/src/utils/PopupUtils.ts
new file mode 100644
index 0000000000..f3c6e60807
--- /dev/null
+++ b/plugins/board-resources/src/utils/PopupUtils.ts
@@ -0,0 +1,15 @@
+import { PopupAlignment } from '@anticrm/ui'
+
+export function getPopupAlignment (e?: Event): PopupAlignment | undefined {
+ if (!e || !e.target) {
+ return undefined
+ }
+ const target = e.target as HTMLElement
+ if (target.getBoundingClientRect) {
+ return {
+ getBoundingClientRect: () => target.getBoundingClientRect()
+ }
+ }
+
+ return undefined
+}
diff --git a/plugins/board/src/index.ts b/plugins/board/src/index.ts
index 122d2266f4..09c2f2f2d7 100644
--- a/plugins/board/src/index.ts
+++ b/plugins/board/src/index.ts
@@ -91,7 +91,7 @@ export interface CardAction extends Doc {
label: IntlString
position: number
type: string
- handler?: Resource<(card: Card, client: Client) => void>
+ handler?: Resource<(card: Card, client: Client, e?: Event) => void>
supported?: Resource<(card: Card, client: Client) => boolean>
}
@@ -148,22 +148,22 @@ const boards = plugin(boardId, {
Delete: '' as Ref
},
cardActionHandler: {
- Cover: '' as Resource<(card: Card, client: Client) => void>,
- Join: '' as Resource<(card: Card, client: Client) => void>,
- Members: '' as Resource<(card: Card, client: Client) => void>,
- Labels: '' as Resource<(card: Card, client: Client) => void>,
- Checklist: '' as Resource<(card: Card, client: Client) => void>,
- Dates: '' as Resource<(card: Card, client: Client) => void>,
- Attachments: '' as Resource<(card: Card, client: Client) => void>,
- CustomFields: '' as Resource<(card: Card, client: Client) => void>,
- AddButton: '' as Resource<(card: Card, client: Client) => void>,
- Move: '' as Resource<(card: Card, client: Client) => void>,
- Copy: '' as Resource<(card: Card, client: Client) => void>,
- MakeTemplate: '' as Resource<(card: Card, client: Client) => void>,
- Watch: '' as Resource<(card: Card, client: Client) => void>,
- Archive: '' as Resource<(card: Card, client: Client) => void>,
- SendToBoard: '' as Resource<(card: Card, client: Client) => void>,
- Delete: '' as Resource<(card: Card, client: Client) => void>
+ Cover: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Join: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Members: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Labels: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Checklist: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Dates: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Attachments: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ CustomFields: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ AddButton: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Move: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Copy: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ MakeTemplate: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Watch: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Archive: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ SendToBoard: '' as Resource<(card: Card, client: Client, e?: Event) => void>,
+ Delete: '' as Resource<(card: Card, client: Client, e?: Event) => void>
},
cardActionSupportedHandler: {
Join: '' as Resource<(card: Card, client: Client) => boolean>,