mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 11:01:54 +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
|
||||
|
||||
function txHandler (tx: Tx): void {
|
||||
if (tx === null) {
|
||||
return
|
||||
}
|
||||
if (client === null) {
|
||||
txBuffer?.push(tx)
|
||||
} else {
|
||||
|
@ -65,6 +65,9 @@
|
||||
})
|
||||
|
||||
function computeSize (t: HTMLInputElement | EventTarget | null) {
|
||||
if (t == null) {
|
||||
return
|
||||
}
|
||||
const target = t as HTMLInputElement
|
||||
const value = target.value
|
||||
text.innerHTML = (value === '' ? phTraslate : value)
|
||||
|
@ -21,7 +21,7 @@
|
||||
import { Vacancy } from '@hcengineering/recruit'
|
||||
import { FullDescriptionBox } from '@hcengineering/text-editor'
|
||||
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 { createEventDispatcher } from 'svelte'
|
||||
import recruit from '../plugin'
|
||||
@ -34,6 +34,8 @@
|
||||
let rawName: string = ''
|
||||
let rawDesc: string = ''
|
||||
|
||||
let showAllMixins = false
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
const client = getClient()
|
||||
@ -65,16 +67,20 @@
|
||||
const hierarchy = client.getHierarchy()
|
||||
let mixins: Mixin<Doc>[] = []
|
||||
|
||||
function getMixins (object: Doc): void {
|
||||
function getMixins (object: Doc, showAllMixins: boolean): void {
|
||||
if (object === undefined) return
|
||||
const descendants = hierarchy.getDescendants(core.class.Doc).map((p) => hierarchy.getClass(p))
|
||||
|
||||
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>
|
||||
|
||||
{#if object}
|
||||
@ -101,6 +107,20 @@
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
<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'}
|
||||
<DocAttributeBar
|
||||
{object}
|
||||
|
@ -62,7 +62,9 @@
|
||||
|
||||
async function update (viewlets: WithLookup<Viewlet>[], active: Ref<Viewlet> | null): Promise<void> {
|
||||
viewlet = viewlets.find((viewlet) => viewlet._id === active) ?? viewlets[0]
|
||||
setActiveViewletId(viewlet._id)
|
||||
if (viewlet !== undefined) {
|
||||
setActiveViewletId(viewlet._id)
|
||||
}
|
||||
}
|
||||
|
||||
$: if (!label && title) {
|
||||
|
@ -25,7 +25,7 @@
|
||||
const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => {
|
||||
if (dir === 'vertical') {
|
||||
// Select next
|
||||
list.select(offset, of)
|
||||
list?.select(offset, of)
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user