mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-20 15:20:18 +00:00
TSK-849: Show labels in list (#2749)
+ speedup list rendering Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
acd3cf7276
commit
f989c79c20
@ -566,6 +566,11 @@ export function createModel (builder: Builder): void {
|
|||||||
{ key: '', presenter: tracker.component.TitlePresenter, props: { shouldUseMargin: true } },
|
{ key: '', presenter: tracker.component.TitlePresenter, props: { shouldUseMargin: true } },
|
||||||
{ key: '', presenter: tracker.component.SubIssuesSelector, props: {} },
|
{ key: '', presenter: tracker.component.SubIssuesSelector, props: {} },
|
||||||
{ key: '', presenter: view.component.GrowPresenter, props: { type: 'grow' } },
|
{ key: '', presenter: view.component.GrowPresenter, props: { type: 'grow' } },
|
||||||
|
{
|
||||||
|
key: '$lookup.labels',
|
||||||
|
presenter: tags.component.LabelsPresenter,
|
||||||
|
props: { kind: 'list', full: false, lookupField: 'labels' }
|
||||||
|
},
|
||||||
{ key: '', presenter: tracker.component.DueDatePresenter, props: { kind: 'list' } },
|
{ key: '', presenter: tracker.component.DueDatePresenter, props: { kind: 'list' } },
|
||||||
{
|
{
|
||||||
key: '',
|
key: '',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Doc } from '@hcengineering/core'
|
import { Doc, WithLookup } from '@hcengineering/core'
|
||||||
import { createQuery } from '@hcengineering/presentation'
|
import { createQuery } from '@hcengineering/presentation'
|
||||||
import type { TagReference } from '@hcengineering/tags'
|
import type { TagReference } from '@hcengineering/tags'
|
||||||
import tags from '@hcengineering/tags'
|
import tags from '@hcengineering/tags'
|
||||||
@ -8,21 +8,28 @@
|
|||||||
import TagsEditorPopup from './TagsEditorPopup.svelte'
|
import TagsEditorPopup from './TagsEditorPopup.svelte'
|
||||||
import { createEventDispatcher, afterUpdate } from 'svelte'
|
import { createEventDispatcher, afterUpdate } from 'svelte'
|
||||||
|
|
||||||
export let object: Doc
|
export let object: WithLookup<Doc>
|
||||||
export let full: boolean
|
export let full: boolean
|
||||||
export let ckeckFilled: boolean = false
|
export let ckeckFilled: boolean = false
|
||||||
export let kind: 'short' | 'full' = 'short'
|
export let kind: 'short' | 'full' = 'short'
|
||||||
export let isEditable: boolean = false
|
export let isEditable: boolean = false
|
||||||
export let action: (evt: MouseEvent) => Promise<void> | void = async () => {}
|
export let action: (evt: MouseEvent) => Promise<void> | void = async () => {}
|
||||||
|
|
||||||
|
export let lookupField: string | undefined
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
let items: TagReference[] = []
|
let items: TagReference[] = []
|
||||||
const query = createQuery()
|
const query = createQuery()
|
||||||
|
|
||||||
$: query.query(tags.class.TagReference, { attachedTo: object._id }, (result) => {
|
$: if (lookupField === undefined) {
|
||||||
items = result
|
query.query(tags.class.TagReference, { attachedTo: object._id }, (result) => {
|
||||||
})
|
items = result
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
query.unsubscribe()
|
||||||
|
items = (object.$lookup as any)[lookupField]
|
||||||
|
}
|
||||||
async function tagsHandler (evt: MouseEvent): Promise<void> {
|
async function tagsHandler (evt: MouseEvent): Promise<void> {
|
||||||
showPopup(TagsEditorPopup, { object }, getEventPopupPositionElement(evt))
|
showPopup(TagsEditorPopup, { object }, getEventPopupPositionElement(evt))
|
||||||
}
|
}
|
||||||
@ -42,6 +49,7 @@
|
|||||||
<div
|
<div
|
||||||
class="labels-container"
|
class="labels-container"
|
||||||
style:justify-content={kind === 'short' ? 'space-between' : 'flex-start'}
|
style:justify-content={kind === 'short' ? 'space-between' : 'flex-start'}
|
||||||
|
class:w-full={kind === 'full'}
|
||||||
style:flex-wrap={kind === 'short' ? 'nowrap' : 'wrap'}
|
style:flex-wrap={kind === 'short' ? 'nowrap' : 'wrap'}
|
||||||
use:resizeObserver={(element) => {
|
use:resizeObserver={(element) => {
|
||||||
allWidth = element.clientWidth
|
allWidth = element.clientWidth
|
||||||
@ -64,7 +72,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
width: 100%;
|
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if hasSubIssues}
|
{#if hasSubIssues}
|
||||||
<ExpandCollapse isExpanded={!isCollapsed} duration={400} on:changeContent>
|
<ExpandCollapse isExpanded={!isCollapsed} on:changeContent>
|
||||||
<div class="flex-col flex-no-shrink max-h-30 list clear-mins" class:collapsed={isCollapsed}>
|
<div class="flex-col flex-no-shrink max-h-30 list clear-mins" class:collapsed={isCollapsed}>
|
||||||
<Scroller>
|
<Scroller>
|
||||||
<DraftIssueChildList
|
<DraftIssueChildList
|
||||||
@ -220,7 +220,7 @@
|
|||||||
</ExpandCollapse>
|
</ExpandCollapse>
|
||||||
{/if}
|
{/if}
|
||||||
{#if isCreating && team}
|
{#if isCreating && team}
|
||||||
<ExpandCollapse isExpanded={!isCollapsed} duration={400} on:changeContent>
|
<ExpandCollapse isExpanded={!isCollapsed} on:changeContent>
|
||||||
<DraftIssueChildEditor
|
<DraftIssueChildEditor
|
||||||
{team}
|
{team}
|
||||||
{statuses}
|
{statuses}
|
||||||
|
@ -160,19 +160,21 @@
|
|||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
{#if issueStatuses}
|
{#if issueStatuses}
|
||||||
{#if hasSubIssues && viewOptions && viewlet}
|
{#if hasSubIssues && viewOptions && viewlet}
|
||||||
<ExpandCollapse isExpanded={!isCollapsed} duration={400}>
|
<ExpandCollapse isExpanded={!isCollapsed}>
|
||||||
<div class="list" class:collapsed={isCollapsed}>
|
{#if !isCollapsed}
|
||||||
<SubIssueList
|
<div class="list" class:collapsed={isCollapsed}>
|
||||||
teams={_teams}
|
<SubIssueList
|
||||||
{viewlet}
|
teams={_teams}
|
||||||
{viewOptions}
|
{viewlet}
|
||||||
issueStatuses={_issueStatuses}
|
{viewOptions}
|
||||||
query={{ attachedTo: issue._id }}
|
issueStatuses={_issueStatuses}
|
||||||
/>
|
query={{ attachedTo: issue._id }}
|
||||||
</div>
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</ExpandCollapse>
|
</ExpandCollapse>
|
||||||
{/if}
|
{/if}
|
||||||
<ExpandCollapse isExpanded={!isCollapsed} duration={400}>
|
<ExpandCollapse isExpanded={!isCollapsed}>
|
||||||
{#if isCreating}
|
{#if isCreating}
|
||||||
{@const team = teams.get(issue.space)}
|
{@const team = teams.get(issue.space)}
|
||||||
{@const statuses = issueStatuses.get(issue.space)}
|
{@const statuses = issueStatuses.get(issue.space)}
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if hasSubIssues}
|
{#if hasSubIssues}
|
||||||
<ExpandCollapse isExpanded={!isCollapsed} duration={400} on:changeContent>
|
<ExpandCollapse isExpanded={!isCollapsed} on:changeContent>
|
||||||
<div class="flex-col flex-no-shrink max-h-30 list clear-mins" class:collapsed={isCollapsed}>
|
<div class="flex-col flex-no-shrink max-h-30 list clear-mins" class:collapsed={isCollapsed}>
|
||||||
<Scroller>
|
<Scroller>
|
||||||
<IssueTemplateChildList
|
<IssueTemplateChildList
|
||||||
@ -100,7 +100,7 @@
|
|||||||
</ExpandCollapse>
|
</ExpandCollapse>
|
||||||
{/if}
|
{/if}
|
||||||
{#if isCreating}
|
{#if isCreating}
|
||||||
<ExpandCollapse isExpanded={!isCollapsed} duration={400} on:changeContent>
|
<ExpandCollapse isExpanded={!isCollapsed} on:changeContent>
|
||||||
<IssueTemplateChildEditor
|
<IssueTemplateChildEditor
|
||||||
{project}
|
{project}
|
||||||
{sprint}
|
{sprint}
|
||||||
|
@ -300,7 +300,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
<ExpandCollapse duration={200} isExpanded>
|
<ExpandCollapse isExpanded>
|
||||||
{#if editingStatus && !('_id' in editingStatus) && editingStatus.category === category._id}
|
{#if editingStatus && !('_id' in editingStatus) && editingStatus.category === category._id}
|
||||||
<StatusEditor value={editingStatus} on:cancel={cancelEditing} on:save={addStatus} {isSaving} isSingle />
|
<StatusEditor value={editingStatus} on:cancel={cancelEditing} on:save={addStatus} {isSaving} isSingle />
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -300,7 +300,7 @@
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
<ExpandCollapse isExpanded={!collapsed || dragItemIndex !== undefined} duration={400}>
|
<ExpandCollapse isExpanded={!collapsed || dragItemIndex !== undefined}>
|
||||||
{#if !lastLevel}
|
{#if !lastLevel}
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<ListCategories
|
<ListCategories
|
||||||
@ -332,7 +332,7 @@
|
|||||||
on:dragstart={dragStartHandler}
|
on:dragstart={dragStartHandler}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{:else if itemModels}
|
{:else if itemModels && (!collapsed || dragItemIndex !== undefined)}
|
||||||
{#if limited}
|
{#if limited}
|
||||||
{#each limited as docObject, i (docObject._id)}
|
{#each limited as docObject, i (docObject._id)}
|
||||||
<ListItem
|
<ListItem
|
||||||
|
Loading…
Reference in New Issue
Block a user