From e83ffd3804130f24ef2ac1a49ac5282fec681035 Mon Sep 17 00:00:00 2001 From: Artyom Grigorovich Date: Thu, 14 Apr 2022 13:07:07 +0700 Subject: [PATCH] Tracker: Issue List - DueDate presenter (#1393) --- .../src/components/UserBox.svelte | 4 +- packages/ui/src/components/ActionIcon.svelte | 4 +- packages/ui/src/components/Dropdown.svelte | 4 +- .../ui/src/components/DropdownLabels.svelte | 4 +- packages/ui/src/components/Tooltip.svelte | 4 +- .../ui/src/components/TooltipInstance.svelte | 4 +- .../components/calendar/DatePresenter.svelte | 104 +++++++++---- .../components/calendar/internal/DateUtils.ts | 8 + packages/ui/src/index.ts | 5 +- packages/ui/src/tooltips.ts | 4 +- packages/ui/src/types.ts | 4 +- .../components/OrganizationSelector.svelte | 4 +- plugins/tracker-assets/lang/en.json | 9 +- .../src/components/CreateIssue.svelte | 4 +- .../src/components/PrioritySelector.svelte | 14 +- .../src/components/StatusSelector.svelte | 9 +- .../issues/CategoryPresenter.svelte | 7 +- .../src/components/issues/DueDatePopup.svelte | 85 ++++++++++ .../components/issues/DueDatePresenter.svelte | 89 +++++++++++ .../src/components/issues/IssuesList.svelte | 147 ++++++++++-------- .../issues/PriorityPresenter.svelte | 15 +- .../components/issues/StatusPresenter.svelte | 5 +- plugins/tracker-resources/src/index.ts | 2 + plugins/tracker-resources/src/plugin.ts | 6 + 24 files changed, 416 insertions(+), 129 deletions(-) create mode 100644 plugins/tracker-resources/src/components/issues/DueDatePopup.svelte create mode 100644 plugins/tracker-resources/src/components/issues/DueDatePresenter.svelte diff --git a/packages/presentation/src/components/UserBox.svelte b/packages/presentation/src/components/UserBox.svelte index fa079d085d..2a7c31d231 100644 --- a/packages/presentation/src/components/UserBox.svelte +++ b/packages/presentation/src/components/UserBox.svelte @@ -18,7 +18,7 @@ import contact, { Contact, formatName } from '@anticrm/contact' import type { Class, Ref } from '@anticrm/core' import type { IntlString } from '@anticrm/platform' - import type { TooltipAligment } from '@anticrm/ui' + import type { TooltipAlignment } from '@anticrm/ui' import { Button, Label, showPopup, Tooltip } from '@anticrm/ui' import { createEventDispatcher } from 'svelte' import presentation from '..' @@ -39,7 +39,7 @@ export let size: 'small' | 'medium' | 'large' | 'x-large' = 'small' export let justify: 'left' | 'center' = 'center' export let width: string | undefined = undefined - export let labelDirection: TooltipAligment | undefined = undefined + export let labelDirection: TooltipAlignment | undefined = undefined const dispatch = createEventDispatcher() diff --git a/packages/ui/src/components/ActionIcon.svelte b/packages/ui/src/components/ActionIcon.svelte index caa25bebbf..26afab2509 100644 --- a/packages/ui/src/components/ActionIcon.svelte +++ b/packages/ui/src/components/ActionIcon.svelte @@ -15,14 +15,14 @@ + +{#if formattedDate} +
+
+ +
+
+
+
+
+
+
+
+{/if} + + diff --git a/plugins/tracker-resources/src/components/issues/DueDatePresenter.svelte b/plugins/tracker-resources/src/components/issues/DueDatePresenter.svelte new file mode 100644 index 0000000000..ab4ff560fe --- /dev/null +++ b/plugins/tracker-resources/src/components/issues/DueDatePresenter.svelte @@ -0,0 +1,89 @@ + + + +{#if shouldRenderPresenter} + + + +{/if} diff --git a/plugins/tracker-resources/src/components/issues/IssuesList.svelte b/plugins/tracker-resources/src/components/issues/IssuesList.svelte index a990c54a45..cd337bf09f 100644 --- a/plugins/tracker-resources/src/components/issues/IssuesList.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuesList.svelte @@ -16,14 +16,16 @@ import { Class, Doc, DocumentQuery, FindOptions, Ref, getObjectValue } from '@anticrm/core' import { SortingOrder } from '@anticrm/core' import { createQuery, getClient } from '@anticrm/presentation' - import { CheckBox, Loading, showPopup, Spinner, IconMoreV } from '@anticrm/ui' + import { CheckBox, Loading, showPopup, Spinner, IconMoreV, Tooltip } from '@anticrm/ui' import { BuildModelKey } from '@anticrm/view' import { createEventDispatcher } from 'svelte' import { buildModel, LoadingProps, Menu } from '@anticrm/view-resources' + import tracker from '../../plugin' export let _class: Ref> export let baseMenuClass: Ref> | undefined = undefined - export let config: (BuildModelKey | string)[] + export let leftItemsConfig: (BuildModelKey | string)[] + export let rightItemsConfig: (BuildModelKey | string)[] | undefined = undefined export let options: FindOptions | undefined = undefined export let query: DocumentQuery @@ -92,13 +94,20 @@ 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 } + } -{#await buildModel({ client, _class, keys: config, options })} +{#await buildItemModels()} {#if !isLoading} {/if} -{:then attributeModels} +{:then itemModels}
{#if docObjects} {#each docObjects as docObject, rowIndex (docObject._id)} @@ -107,65 +116,80 @@ class:mListGridChecked={selectedIssueIds.has(docObject._id)} class:mListGridFixed={rowIndex === selectedRowIndex} > - {#each attributeModels as attributeModel, attributeModelIndex} - {#if attributeModelIndex === 0} -
-
- { - handleIssueSelected(docObject._id, event) - }} - /> +
+ {#each itemModels.leftModels as attributeModel, attributeModelIndex} + {#if attributeModelIndex === 0} +
+ +
+ { + handleIssueSelected(docObject._id, event) + }} + /> +
+
+
+ +
-
+ {:else if attributeModelIndex === 1} +
+ +
showMenu(event, docObject, rowIndex)} + > + +
+
+ {:else} +
-
- {:else if attributeModelIndex === 1} -
- -
showMenu(event, docObject, rowIndex)} - > - + {/if} + {/each} +
+ {#if itemModels.rightModels} +
+ {#each itemModels.rightModels as attributeModel} +
+
-
- {:else} -
- -
- {/if} - {/each} + {/each} +
+ {/if}
{/each} {:else if loadingProps !== undefined} {#each Array(getLoadingElementsLength(loadingProps, options)) as _, rowIndex}
- {#each attributeModels as _, attributeModelIndex} - {#if attributeModelIndex === 0} -
- -
- -
+
+
+ +
+
- {/if} - {/each} +
+
{/each} {/if} @@ -182,8 +206,9 @@ } .listGrid { - display: grid; - grid-template-columns: 4rem 5rem 2rem auto 4rem 2rem; + display: flex; + align-items: center; + justify-content: space-between; height: 3.25rem; color: var(--theme-caption-color); border-bottom: 1px solid var(--theme-button-border-hovered); @@ -203,7 +228,7 @@ } &.mListGridIsLoading { - grid-template-columns: auto; + justify-content: flex-start; } &:hover { @@ -225,24 +250,20 @@ } } - .checkBox { + .modelsContainer { display: flex; align-items: center; - justify-content: center; - padding: 0.03rem; - border-radius: 0.25rem; - background-color: rgba(247, 248, 248, 0.5); - opacity: 0; - - &:hover { - opacity: 1; - } } .gridElement { display: flex; align-items: center; justify-content: start; + margin-left: 0.5rem; + + &:first-child { + margin-left: 0; + } } .priorityPresenter { @@ -252,7 +273,7 @@ .issuePresenter { display: flex; align-items: center; - padding-right: 1rem; + margin-left: 0.5rem; .eIssuePresenterContextMenu { visibility: hidden; diff --git a/plugins/tracker-resources/src/components/issues/PriorityPresenter.svelte b/plugins/tracker-resources/src/components/issues/PriorityPresenter.svelte index 243f69be92..47a5011d0d 100644 --- a/plugins/tracker-resources/src/components/issues/PriorityPresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/PriorityPresenter.svelte @@ -16,6 +16,7 @@ import { Ref } from '@anticrm/core' import { Issue, IssuePriority, Team } from '@anticrm/tracker' import { getClient } from '@anticrm/presentation' + import { Tooltip } from '@anticrm/ui' import tracker from '../../plugin' import PrioritySelector from '../PrioritySelector.svelte' @@ -40,10 +41,12 @@ {#if value} - + + + {/if} diff --git a/plugins/tracker-resources/src/components/issues/StatusPresenter.svelte b/plugins/tracker-resources/src/components/issues/StatusPresenter.svelte index 1a2614ab66..ea309319d8 100644 --- a/plugins/tracker-resources/src/components/issues/StatusPresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/StatusPresenter.svelte @@ -16,6 +16,7 @@ import { Ref } from '@anticrm/core' import { Issue, IssueStatus, Team } from '@anticrm/tracker' import { getClient } from '@anticrm/presentation' + import { Tooltip } from '@anticrm/ui' import tracker from '../../plugin' import StatusSelector from '../StatusSelector.svelte' @@ -40,5 +41,7 @@ {#if value} - + + + {/if} diff --git a/plugins/tracker-resources/src/index.ts b/plugins/tracker-resources/src/index.ts index 5fa780183f..7541089a4c 100644 --- a/plugins/tracker-resources/src/index.ts +++ b/plugins/tracker-resources/src/index.ts @@ -29,6 +29,7 @@ import IssuePresenter from './components/issues/IssuePresenter.svelte' import TitlePresenter from './components/issues/TitlePresenter.svelte' import PriorityPresenter from './components/issues/PriorityPresenter.svelte' import StatusPresenter from './components/issues/StatusPresenter.svelte' +import DueDatePresenter from './components/issues/DueDatePresenter.svelte' import AssigneePresenter from './components/issues/AssigneePresenter.svelte' import ModificationDatePresenter from './components/issues/ModificationDatePresenter.svelte' @@ -52,6 +53,7 @@ export default async (): Promise => ({ PriorityPresenter, StatusPresenter, AssigneePresenter, + DueDatePresenter, EditIssue, NewIssueHeader } diff --git a/plugins/tracker-resources/src/plugin.ts b/plugins/tracker-resources/src/plugin.ts index 9e6e2dc4c0..d40bc60e81 100644 --- a/plugins/tracker-resources/src/plugin.ts +++ b/plugins/tracker-resources/src/plugin.ts @@ -40,6 +40,7 @@ export default mergeIds(trackerId, tracker, { AddIssue: '' as IntlString, NewIssue: '' as IntlString, Team: '' as IntlString, + SelectIssue: '' as IntlString, SelectTeam: '' as IntlString, SaveIssue: '' as IntlString, Todo: '' as IntlString, @@ -76,6 +77,10 @@ export default mergeIds(trackerId, tracker, { DocumentIcon: '' as IntlString, DocumentColor: '' as IntlString, Rank: '' as IntlString, + DueDatePopupTitle: '' as IntlString, + DueDatePopupOverdueTitle: '' as IntlString, + DueDatePopupDescription: '' as IntlString, + DueDatePopupOverdueDescription: '' as IntlString, IssueTitlePlaceholder: '' as IntlString, IssueDescriptionPlaceholder: '' as IntlString, @@ -98,6 +103,7 @@ export default mergeIds(trackerId, tracker, { PriorityPresenter: '' as AnyComponent, StatusPresenter: '' as AnyComponent, AssigneePresenter: '' as AnyComponent, + DueDatePresenter: '' as AnyComponent, EditIssue: '' as AnyComponent, CreateTeam: '' as AnyComponent, NewIssueHeader: '' as AnyComponent