mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-06 17:57:42 +02:00
UBERF-5603 (#4754)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -163,7 +163,6 @@
|
||||
void showMenu(event, attr, i)
|
||||
}}
|
||||
on:contextmenu={async (event) => {
|
||||
event.preventDefault()
|
||||
void showMenu(event, attr, i)
|
||||
}}
|
||||
on:click={async () => {
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<script lang="ts">
|
||||
import { Class, ClassifierKind, Doc, Ref } from '@hcengineering/core'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { getEventPositionElement, showPopup, NavItem } from '@hcengineering/ui'
|
||||
import { ContextMenu } from '@hcengineering/view-resources'
|
||||
import { NavItem } from '@hcengineering/ui'
|
||||
import { showMenu } from '@hcengineering/view-resources'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import settings from '../plugin'
|
||||
|
||||
@@ -50,9 +50,6 @@
|
||||
}
|
||||
return result
|
||||
}
|
||||
function showContextMenu (evt: MouseEvent, clazz: Class<Doc>): void {
|
||||
showPopup(ContextMenu, { object: clazz }, getEventPositionElement(evt))
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each classes as cl}
|
||||
@@ -68,7 +65,7 @@
|
||||
dispatch('select', cl)
|
||||
}}
|
||||
on:contextmenu={(evt) => {
|
||||
showContextMenu(evt, clazz)
|
||||
showMenu(evt, { object: clazz })
|
||||
}}
|
||||
/>
|
||||
{#if desc.length}
|
||||
|
||||
@@ -13,26 +13,25 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import core, { Enum } from '@hcengineering/core'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import {
|
||||
eventToHTMLElement,
|
||||
Breadcrumb,
|
||||
ButtonIcon,
|
||||
Header,
|
||||
IconAdd,
|
||||
IconMoreH,
|
||||
IconTableOfContents,
|
||||
Label,
|
||||
showPopup,
|
||||
Header,
|
||||
Breadcrumb,
|
||||
ModernButton,
|
||||
Scroller,
|
||||
Separator,
|
||||
defineSeparators,
|
||||
settingsSeparators,
|
||||
Separator,
|
||||
Scroller,
|
||||
ButtonIcon,
|
||||
IconTableOfContents,
|
||||
ModernButton
|
||||
showPopup
|
||||
} from '@hcengineering/ui'
|
||||
import { ContextMenu } from '@hcengineering/view-resources'
|
||||
import { showMenu } from '@hcengineering/view-resources'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import setting from '../plugin'
|
||||
import EnumValues from './EnumValues.svelte'
|
||||
|
||||
@@ -106,7 +105,7 @@
|
||||
pressed={hovered === i}
|
||||
on:click={(ev) => {
|
||||
hovered = i
|
||||
showPopup(ContextMenu, { object: value }, eventToHTMLElement(ev), () => {
|
||||
showMenu(ev, { object: value }, () => {
|
||||
hovered = null
|
||||
})
|
||||
}}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import contact, { PersonAccount } from '@hcengineering/contact'
|
||||
import { EmployeePresenter, personByIdStore } from '@hcengineering/contact-resources'
|
||||
import { AccountRole, SortingOrder, getCurrentAccount } from '@hcengineering/core'
|
||||
import { AccountRole, SortingOrder, getCurrentAccount, roleOrder } from '@hcengineering/core'
|
||||
import presentation, { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { DropdownIntlItem, DropdownLabelsIntl, EditBox, Header, Breadcrumb, Scroller } from '@hcengineering/ui'
|
||||
import setting from '../plugin'
|
||||
@@ -32,24 +32,17 @@
|
||||
const currentRole = getCurrentAccount().role
|
||||
|
||||
const items: DropdownIntlItem[] = [
|
||||
{ id: AccountRole.User.toString(), label: setting.string.User },
|
||||
{ id: AccountRole.Maintainer.toString(), label: setting.string.Maintainer },
|
||||
{ id: AccountRole.Owner.toString(), label: setting.string.Owner }
|
||||
{ id: AccountRole.User, label: setting.string.User },
|
||||
{ id: AccountRole.Maintainer, label: setting.string.Maintainer },
|
||||
{ id: AccountRole.Owner, label: setting.string.Owner }
|
||||
]
|
||||
|
||||
let accounts: PersonAccount[] = []
|
||||
$: owners = accounts.filter((p) => p.role === AccountRole.Owner)
|
||||
|
||||
query.query(
|
||||
contact.class.PersonAccount,
|
||||
{},
|
||||
(res) => {
|
||||
accounts = res
|
||||
},
|
||||
{
|
||||
sort: { name: SortingOrder.Descending }
|
||||
}
|
||||
)
|
||||
query.query(contact.class.PersonAccount, {}, (res) => {
|
||||
accounts = res
|
||||
})
|
||||
|
||||
async function change (account: PersonAccount, value: AccountRole): Promise<void> {
|
||||
await client.update(account, {
|
||||
@@ -80,13 +73,14 @@
|
||||
</div>
|
||||
<DropdownLabelsIntl
|
||||
label={setting.string.Role}
|
||||
disabled={account.role > currentRole || (account.role === AccountRole.Owner && owners.length === 1)}
|
||||
disabled={roleOrder[account.role] > roleOrder[currentRole] ||
|
||||
(account.role === AccountRole.Owner && owners.length === 1)}
|
||||
kind={'primary'}
|
||||
size={'medium'}
|
||||
{items}
|
||||
selected={account.role?.toString()}
|
||||
selected={account.role}
|
||||
on:selected={(e) => {
|
||||
void change(account, Number(e.detail))
|
||||
void change(account, e.detail)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user