mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-03 17:05:16 +03:00
TSK-1148: Mixin button for Vacancy and NPE fixes (#2965)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
9224a6c8e0
commit
b88e878a42
@ -164,6 +164,9 @@ export async function createClient (
|
|||||||
let lastTx: number
|
let lastTx: number
|
||||||
|
|
||||||
function txHandler (tx: Tx): void {
|
function txHandler (tx: Tx): void {
|
||||||
|
if (tx === null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (client === null) {
|
if (client === null) {
|
||||||
txBuffer?.push(tx)
|
txBuffer?.push(tx)
|
||||||
} else {
|
} else {
|
||||||
|
@ -65,6 +65,9 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
function computeSize (t: HTMLInputElement | EventTarget | null) {
|
function computeSize (t: HTMLInputElement | EventTarget | null) {
|
||||||
|
if (t == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const target = t as HTMLInputElement
|
const target = t as HTMLInputElement
|
||||||
const value = target.value
|
const value = target.value
|
||||||
text.innerHTML = (value === '' ? phTraslate : value)
|
text.innerHTML = (value === '' ? phTraslate : value)
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
import { Vacancy } from '@hcengineering/recruit'
|
import { Vacancy } from '@hcengineering/recruit'
|
||||||
import { FullDescriptionBox } from '@hcengineering/text-editor'
|
import { FullDescriptionBox } from '@hcengineering/text-editor'
|
||||||
import tracker from '@hcengineering/tracker'
|
import tracker from '@hcengineering/tracker'
|
||||||
import { Button, Component, EditBox, Grid, IconMoreH, showPopup } from '@hcengineering/ui'
|
import { Button, Component, EditBox, Grid, IconMixin, IconMoreH, showPopup } from '@hcengineering/ui'
|
||||||
import { ContextMenu, DocAttributeBar } from '@hcengineering/view-resources'
|
import { ContextMenu, DocAttributeBar } from '@hcengineering/view-resources'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import recruit from '../plugin'
|
import recruit from '../plugin'
|
||||||
@ -34,6 +34,8 @@
|
|||||||
let rawName: string = ''
|
let rawName: string = ''
|
||||||
let rawDesc: string = ''
|
let rawDesc: string = ''
|
||||||
|
|
||||||
|
let showAllMixins = false
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
@ -65,16 +67,20 @@
|
|||||||
const hierarchy = client.getHierarchy()
|
const hierarchy = client.getHierarchy()
|
||||||
let mixins: Mixin<Doc>[] = []
|
let mixins: Mixin<Doc>[] = []
|
||||||
|
|
||||||
function getMixins (object: Doc): void {
|
function getMixins (object: Doc, showAllMixins: boolean): void {
|
||||||
if (object === undefined) return
|
if (object === undefined) return
|
||||||
const descendants = hierarchy.getDescendants(core.class.Doc).map((p) => hierarchy.getClass(p))
|
const descendants = hierarchy.getDescendants(core.class.Doc).map((p) => hierarchy.getClass(p))
|
||||||
|
|
||||||
mixins = descendants.filter(
|
mixins = descendants.filter(
|
||||||
(m) => m.kind === ClassifierKind.MIXIN && !ignoreMixins.has(m._id) && hierarchy.hasMixin(object, m._id)
|
(m) =>
|
||||||
|
m.kind === ClassifierKind.MIXIN &&
|
||||||
|
!ignoreMixins.has(m._id) &&
|
||||||
|
(hierarchy.hasMixin(object, m._id) ||
|
||||||
|
(showAllMixins && hierarchy.isDerived(object._class, hierarchy.getBaseClass(m._id))))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
$: getMixins(object)
|
$: getMixins(object, showAllMixins)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if object}
|
{#if object}
|
||||||
@ -101,6 +107,20 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="attributes" let:direction={dir}>
|
<svelte:fragment slot="attributes" let:direction={dir}>
|
||||||
|
<div class="flex flex-reverse flex-no-shrink clear-mins">
|
||||||
|
<Button
|
||||||
|
kind={'transparent'}
|
||||||
|
shape={'round'}
|
||||||
|
selected={showAllMixins}
|
||||||
|
on:click={() => {
|
||||||
|
showAllMixins = !showAllMixins
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<svelte:fragment slot="content">
|
||||||
|
<IconMixin size={'small'} />
|
||||||
|
</svelte:fragment>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
{#if dir === 'column'}
|
{#if dir === 'column'}
|
||||||
<DocAttributeBar
|
<DocAttributeBar
|
||||||
{object}
|
{object}
|
||||||
|
@ -62,8 +62,10 @@
|
|||||||
|
|
||||||
async function update (viewlets: WithLookup<Viewlet>[], active: Ref<Viewlet> | null): Promise<void> {
|
async function update (viewlets: WithLookup<Viewlet>[], active: Ref<Viewlet> | null): Promise<void> {
|
||||||
viewlet = viewlets.find((viewlet) => viewlet._id === active) ?? viewlets[0]
|
viewlet = viewlets.find((viewlet) => viewlet._id === active) ?? viewlets[0]
|
||||||
|
if (viewlet !== undefined) {
|
||||||
setActiveViewletId(viewlet._id)
|
setActiveViewletId(viewlet._id)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$: if (!label && title) {
|
$: if (!label && title) {
|
||||||
translate(title, {}).then((res) => {
|
translate(title, {}).then((res) => {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => {
|
const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => {
|
||||||
if (dir === 'vertical') {
|
if (dir === 'vertical') {
|
||||||
// Select next
|
// Select next
|
||||||
list.select(offset, of)
|
list?.select(offset, of)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user