From 662cca9282146fe8c2c5a48cb3cfa8064a0be01a Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Sat, 9 Apr 2022 23:00:48 +0700 Subject: [PATCH] Unify Popup and Panel behaviour (#1347) Signed-off-by: Andrey Sobolev --- packages/kanban/src/components/Kanban.svelte | 2 +- .../src/components/UserBox.svelte | 19 ++-- .../src/components/UserBoxList.svelte | 13 +-- packages/theme/styles/_layouts.scss | 1 + packages/theme/styles/panel.scss | 2 +- .../ui/src/components/PanelInstance.svelte | 106 +++++------------- .../ui/src/components/PopupInstance.svelte | 52 +-------- .../calendar/DateRangePresenter.svelte | 17 ++- .../components/calendar/internal/DateUtils.ts | 8 +- packages/ui/src/panelup.ts | 18 ++- packages/ui/src/popups.ts | 79 +++++++++++++ packages/ui/src/utils.ts | 93 +-------------- .../src/components/CardPresenter.svelte | 8 +- .../components/OrganizationPresenter.svelte | 8 +- .../src/components/PersonContent.svelte | 11 +- .../src/components/ProductPresenter.svelte | 10 +- .../src/components/LeadPresenter.svelte | 9 +- .../components/ApplicationPresenter.svelte | 9 +- .../src/components/VacancyPresenter.svelte | 11 +- .../src/components/review/CreateReview.svelte | 36 +++++- .../components/review/ReviewPresenter.svelte | 10 +- .../src/components/TaskPresenter.svelte | 9 +- .../src/components/issues/Board.svelte | 68 ++++++----- 23 files changed, 245 insertions(+), 354 deletions(-) diff --git a/packages/kanban/src/components/Kanban.svelte b/packages/kanban/src/components/Kanban.svelte index 083b16a664..3f39e3b622 100644 --- a/packages/kanban/src/components/Kanban.svelte +++ b/packages/kanban/src/components/Kanban.svelte @@ -238,7 +238,7 @@ } .kanban-content { display: flex; - margin: 1.5rem 2rem; + margin: 0.5rem 2rem; height: 100%; } diff --git a/packages/presentation/src/components/UserBox.svelte b/packages/presentation/src/components/UserBox.svelte index f2139ffb65..fa079d085d 100644 --- a/packages/presentation/src/components/UserBox.svelte +++ b/packages/presentation/src/components/UserBox.svelte @@ -15,20 +15,17 @@ --> {#if value}
diff --git a/plugins/contact-resources/src/components/OrganizationPresenter.svelte b/plugins/contact-resources/src/components/OrganizationPresenter.svelte index 291427ac48..b4757d3830 100644 --- a/plugins/contact-resources/src/components/OrganizationPresenter.svelte +++ b/plugins/contact-resources/src/components/OrganizationPresenter.svelte @@ -15,24 +15,20 @@ --> {#if value}
{value.name} diff --git a/plugins/contact-resources/src/components/PersonContent.svelte b/plugins/contact-resources/src/components/PersonContent.svelte index aeecc197a8..74fe5982db 100644 --- a/plugins/contact-resources/src/components/PersonContent.svelte +++ b/plugins/contact-resources/src/components/PersonContent.svelte @@ -16,7 +16,7 @@ import { formatName, Person } from '@anticrm/contact' import { Hierarchy } from '@anticrm/core' import { Avatar } from '@anticrm/presentation' - import { showPanel } from '@anticrm/ui' + import { getPanelURI } from '@anticrm/ui' import view from '@anticrm/view' export let value: Person | undefined @@ -25,12 +25,6 @@ export let shouldShowPlaceholder = false const avatarSize = 'x-small' - - const onClick = async () => { - if (value) { - showPanel(view.component.EditDoc, value._id, Hierarchy.mixinOrClass(value), 'full') - } - } {#if value || shouldShowPlaceholder} @@ -38,8 +32,7 @@
diff --git a/plugins/inventory-resources/src/components/ProductPresenter.svelte b/plugins/inventory-resources/src/components/ProductPresenter.svelte index e9f35c34ca..5f0a0e4673 100644 --- a/plugins/inventory-resources/src/components/ProductPresenter.svelte +++ b/plugins/inventory-resources/src/components/ProductPresenter.svelte @@ -15,25 +15,19 @@ --> {#if value}
{value.name} diff --git a/plugins/lead-resources/src/components/LeadPresenter.svelte b/plugins/lead-resources/src/components/LeadPresenter.svelte index 3d68046527..3d5c3c3ace 100644 --- a/plugins/lead-resources/src/components/LeadPresenter.svelte +++ b/plugins/lead-resources/src/components/LeadPresenter.svelte @@ -15,24 +15,19 @@ --> {#if value}
diff --git a/plugins/recruit-resources/src/components/ApplicationPresenter.svelte b/plugins/recruit-resources/src/components/ApplicationPresenter.svelte index 513d21ff1b..e4fc1c02f5 100644 --- a/plugins/recruit-resources/src/components/ApplicationPresenter.svelte +++ b/plugins/recruit-resources/src/components/ApplicationPresenter.svelte @@ -18,7 +18,7 @@ import type { Applicant } from '@anticrm/recruit' import recruit from '@anticrm/recruit' import { Icon, Label } from '@anticrm/ui' - import { showPanel } from '@anticrm/ui/src/panelup' + import { getPanelURI } from '@anticrm/ui/src/panelup' import view from '@anticrm/view' export let value: Applicant @@ -26,18 +26,13 @@ const client = getClient() const shortLabel = client.getHierarchy().getClass(value._class).shortLabel - - function show () { - showPanel(view.component.EditDoc, value._id, value._class, 'full') - } {#if value && shortLabel}
diff --git a/plugins/recruit-resources/src/components/VacancyPresenter.svelte b/plugins/recruit-resources/src/components/VacancyPresenter.svelte index 7eac188ffd..fff939a939 100644 --- a/plugins/recruit-resources/src/components/VacancyPresenter.svelte +++ b/plugins/recruit-resources/src/components/VacancyPresenter.svelte @@ -15,24 +15,19 @@ --> {#if value}
diff --git a/plugins/recruit-resources/src/components/review/CreateReview.svelte b/plugins/recruit-resources/src/components/review/CreateReview.svelte index 4e0a167b03..61af65df04 100644 --- a/plugins/recruit-resources/src/components/review/CreateReview.svelte +++ b/plugins/recruit-resources/src/components/review/CreateReview.svelte @@ -18,7 +18,7 @@ import { OrganizationSelector } from '@anticrm/contact-resources' import { Account, Class, Client, Doc, generateId, getCurrentAccount, Ref } from '@anticrm/core' import { getResource, OK, Resource, Severity, Status } from '@anticrm/platform' - import { Card, getClient, UserBox } from '@anticrm/presentation' + import { Card, getClient, UserBox, UserBoxList } from '@anticrm/presentation' import type { Candidate, Review } from '@anticrm/recruit' import task, { SpaceWithStates } from '@anticrm/task' import { StyledTextBox } from '@anticrm/text-editor' @@ -26,6 +26,7 @@ import view from '@anticrm/view' import { createEventDispatcher } from 'svelte' import recruit from '../../plugin' + import calendar from '@anticrm/calendar' export let space: Ref export let candidate: Ref @@ -166,18 +167,43 @@ label={recruit.string.Candidate} placeholder={recruit.string.Candidates} bind:value={doc.attachedTo} - kind={'link'} size={'x-large'} justify={'left'} width={'100%'} labelDirection={'left'} + kind={'link'} + size={'x-large'} + justify={'left'} + width={'100%'} + labelDirection={'left'} /> {:else} -
+
{/if} + + + { + doc.participants = [...(doc.participants ?? []), evt.detail._id] + }} + on:delete={(evt) => { + doc.participants = doc.participants?.filter((it) => it !== evt.detail._id) ?? [currentUser.employee] + }} + noItems={calendar.string.NoParticipants} + /> + + {#if value && shortLabel}
diff --git a/plugins/task-resources/src/components/TaskPresenter.svelte b/plugins/task-resources/src/components/TaskPresenter.svelte index 2e2dcb33b6..77b19b3526 100644 --- a/plugins/task-resources/src/components/TaskPresenter.svelte +++ b/plugins/task-resources/src/components/TaskPresenter.svelte @@ -16,7 +16,7 @@ {#if value && shortLabel}
diff --git a/plugins/tracker-resources/src/components/issues/Board.svelte b/plugins/tracker-resources/src/components/issues/Board.svelte index ce84170ee2..d6e8ad4525 100644 --- a/plugins/tracker-resources/src/components/issues/Board.svelte +++ b/plugins/tracker-resources/src/components/issues/Board.svelte @@ -1,4 +1,3 @@ - {#if currentTeam} +
+ Board +
-
-
+
+
- {state.title} - {count} + {state.title} + {count}
-
+
-
- {@const issue = toIssue(object) } -
-
- - {#if issue.$lookup?.assignee } - + {@const issue = toIssue(object)} +
+
+ + {#if issue.$lookup?.assignee} + {/if}
- + {object.title} -
{/if} +