Tracker: Status should be positioned at same offset (#1464)

Signed-off-by: Artyom Grigorovich <grigorovichartyom@gmail.com>
This commit is contained in:
Artyom Grigorovich 2022-04-20 23:31:56 +07:00 committed by GitHub
parent 43c0413cd0
commit 55b389f22b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 97 additions and 79 deletions

View File

@ -61,13 +61,11 @@
<Scroller> <Scroller>
<IssuesList <IssuesList
_class={tracker.class.Issue} _class={tracker.class.Issue}
leftItemsConfig={[ itemsConfig={[
{ key: '', presenter: tracker.component.PriorityPresenter, props: { currentSpace } }, { key: '', presenter: tracker.component.PriorityPresenter, props: { currentSpace } },
{ key: '', presenter: tracker.component.IssuePresenter, props: { currentTeam } }, { key: '', presenter: tracker.component.IssuePresenter, props: { currentTeam } },
{ key: '', presenter: tracker.component.StatusPresenter, props: { currentSpace } }, { key: '', presenter: tracker.component.StatusPresenter, props: { currentSpace } },
{ key: '', presenter: tracker.component.TitlePresenter } { key: '', presenter: tracker.component.TitlePresenter, props: { shouldUseMargin: true } },
]}
rightItemsConfig={[
{ key: '', presenter: tracker.component.DueDatePresenter, props: { currentSpace } }, { key: '', presenter: tracker.component.DueDatePresenter, props: { currentSpace } },
{ key: 'modifiedOn', presenter: tracker.component.ModificationDatePresenter }, { key: 'modifiedOn', presenter: tracker.component.ModificationDatePresenter },
{ key: '', presenter: tracker.component.AssigneePresenter, props: { currentSpace } } { key: '', presenter: tracker.component.AssigneePresenter, props: { currentSpace } }

View File

@ -25,16 +25,31 @@
const client = getClient() const client = getClient()
const shortLabel = client.getHierarchy().getClass(value._class).shortLabel const shortLabel = client.getHierarchy().getClass(value._class).shortLabel
$: issueName = `${currentTeam.identifier}-${value.number}`
const handleIssueEditorOpened = () => { const handleIssueEditorOpened = () => {
showPanel(tracker.component.EditIssue, value._id, value._class, 'content') showPanel(tracker.component.EditIssue, value._id, value._class, 'content')
} }
</script> </script>
{#if value && shortLabel} {#if value && shortLabel}
<div class="flex-presenter" class:inline-presenter={inline} on:click={handleIssueEditorOpened}> <div class="flex-presenter issuePresenterRoot" class:inline-presenter={inline} on:click={handleIssueEditorOpened}>
<div class="icon"> <div class="icon">
<Icon icon={tracker.icon.Issue} size={'small'} /> <Icon icon={tracker.icon.Issue} size={'small'} />
</div> </div>
<span class="label nowrap">{currentTeam.identifier}-{value.number}</span> <span title={issueName} class="label nowrap issueLabel">{issueName}</span>
</div> </div>
{/if} {/if}
<style lang="scss">
.issuePresenterRoot {
max-width: 5rem;
}
.issueLabel {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>

View File

@ -23,8 +23,7 @@
export let _class: Ref<Class<Doc>> export let _class: Ref<Class<Doc>>
export let baseMenuClass: Ref<Class<Doc>> | undefined = undefined export let baseMenuClass: Ref<Class<Doc>> | undefined = undefined
export let leftItemsConfig: (BuildModelKey | string)[] export let itemsConfig: (BuildModelKey | string)[]
export let rightItemsConfig: (BuildModelKey | string)[] | undefined = undefined
export let options: FindOptions<Doc> | undefined = undefined export let options: FindOptions<Doc> | undefined = undefined
export let query: DocumentQuery<Doc> export let query: DocumentQuery<Doc>
@ -92,16 +91,9 @@
return props.length return props.length
} }
const buildItemModels = async () => {
const leftModels = await buildModel({ client, _class, keys: leftItemsConfig, options })
const rightModels = rightItemsConfig && (await buildModel({ client, _class, keys: rightItemsConfig, options }))
return { leftModels, rightModels }
}
</script> </script>
{#await buildItemModels()} {#await buildModel({ client, _class, keys: itemsConfig, options })}
{#if !isLoading} {#if !isLoading}
<Loading /> <Loading />
{/if} {/if}
@ -114,8 +106,7 @@
class:mListGridChecked={selectedIssueIds.has(docObject._id)} class:mListGridChecked={selectedIssueIds.has(docObject._id)}
class:mListGridFixed={rowIndex === selectedRowIndex} class:mListGridFixed={rowIndex === selectedRowIndex}
> >
<div class="modelsContainer"> {#each itemModels as attributeModel, attributeModelIndex}
{#each itemModels.leftModels as attributeModel, attributeModelIndex}
{#if attributeModelIndex === 0} {#if attributeModelIndex === 0}
<div class="gridElement"> <div class="gridElement">
<Tooltip direction={'bottom'} label={tracker.string.SelectIssue}> <Tooltip direction={'bottom'} label={tracker.string.SelectIssue}>
@ -151,6 +142,13 @@
<IconMoreV size={'small'} /> <IconMoreV size={'small'} />
</div> </div>
</div> </div>
{:else if attributeModelIndex === 3}
<svelte:component
this={attributeModel.presenter}
value={getObjectValue(attributeModel.key, docObject) ?? ''}
{...attributeModel.props}
/>
<div class="filler" />
{:else} {:else}
<div class="gridElement"> <div class="gridElement">
<svelte:component <svelte:component
@ -162,25 +160,10 @@
{/if} {/if}
{/each} {/each}
</div> </div>
{#if itemModels.rightModels}
<div class="modelsContainer">
{#each itemModels.rightModels as attributeModel}
<div class="gridElement">
<svelte:component
this={attributeModel.presenter}
value={getObjectValue(attributeModel.key, docObject) ?? ''}
{...attributeModel.props}
/>
</div>
{/each}
</div>
{/if}
</div>
{/each} {/each}
{:else if loadingProps !== undefined} {:else if loadingProps !== undefined}
{#each Array(getLoadingElementsLength(loadingProps, options)) as _, rowIndex} {#each Array(getLoadingElementsLength(loadingProps, options)) as _, rowIndex}
<div class="listGrid mListGridIsLoading" class:fixed={rowIndex === selectedRowIndex}> <div class="listGrid mListGridIsLoading" class:fixed={rowIndex === selectedRowIndex}>
<div class="modelsContainer">
<div class="gridElement"> <div class="gridElement">
<CheckBox checked={false} /> <CheckBox checked={false} />
<div class="ml-4"> <div class="ml-4">
@ -188,7 +171,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
{/each} {/each}
{/if} {/if}
</div> </div>
@ -206,7 +188,6 @@
.listGrid { .listGrid {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;
height: 3.25rem; height: 3.25rem;
color: var(--theme-caption-color); color: var(--theme-caption-color);
border-bottom: 1px solid var(--theme-button-border-hovered); border-bottom: 1px solid var(--theme-button-border-hovered);
@ -245,9 +226,9 @@
} }
} }
.modelsContainer { .filler {
display: flex; display: flex;
align-items: center; flex-grow: 1;
} }
.gridElement { .gridElement {
@ -268,6 +249,8 @@
.issuePresenter { .issuePresenter {
display: flex; display: flex;
align-items: center; align-items: center;
flex-shrink: 0;
width: 5.5rem;
margin-left: 0.5rem; margin-left: 0.5rem;
.eIssuePresenterContextMenu { .eIssuePresenterContextMenu {

View File

@ -29,5 +29,13 @@
</script> </script>
<Tooltip label={tracker.string.ModificationDate} props={{ value: fullModificationDate }}> <Tooltip label={tracker.string.ModificationDate} props={{ value: fullModificationDate }}>
<span class="nowrap">{shortModificationDate}</span> <span class="modificationDateLabel">{shortModificationDate}</span>
</Tooltip> </Tooltip>
<style lang="scss">
.modificationDateLabel {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>

View File

@ -16,8 +16,22 @@
import type { Issue } from '@anticrm/tracker' import type { Issue } from '@anticrm/tracker'
export let value: Issue export let value: Issue
export let shouldUseMargin: boolean = false
</script> </script>
{#if value} {#if value}
<span class="label nowrap" title={value.title}>{value.title}</span> <span class="titleLabel" class:mTitleLabelWithMargin={shouldUseMargin} title={value.title}>{value.title}</span>
{/if} {/if}
<style lang="scss">
.titleLabel {
flex-shrink: 1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
&.mTitleLabelWithMargin {
margin-left: 0.5rem;
}
}
</style>