diff --git a/changelog.md b/changelog.md index ce2f56a74d..693b7483f6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,10 +1,11 @@ # Changelog -## 0.6.23 +## 0.6.23 (upcoming) Platform: - Fix first filter disappear +- Adjust label editors design ## 0.6.22 diff --git a/models/board/src/index.ts b/models/board/src/index.ts index fed8b95629..f55e2a54e9 100644 --- a/models/board/src/index.ts +++ b/models/board/src/index.ts @@ -40,6 +40,7 @@ import workbench, { Application } from '@anticrm/model-workbench' import { IntlString } from '@anticrm/platform' import type { AnyComponent } from '@anticrm/ui' import preference, { TPreference } from '@anticrm/model-preference' +import tags from '@anticrm/model-tags' import board from './plugin' @Model(board.class.Board, task.class.SpaceWithStates) @@ -64,8 +65,6 @@ export class TCardCover extends TType implements CardCover { export class TCommonBoardPreference extends TPreference implements CommonBoardPreference { @Prop(TypeRef(workbench.class.Application), board.string.CommonBoardPreference) attachedTo!: Ref - - cardLabelsCompactMode!: boolean } @Model(board.class.Card, task.class.Task) @@ -282,8 +281,9 @@ export function createModel (builder: Builder): void { { action: view.actionImpl.ShowPopup, actionProps: { - component: board.component.LabelsActionPopup, - element: view.popup.PositionElementAlignment + component: tags.component.TagsEditorPopup, + element: view.popup.PositionElementAlignment, + value: 'object' }, label: board.string.Labels, icon: board.icon.Card, diff --git a/models/board/src/plugin.ts b/models/board/src/plugin.ts index 8a4b1caf6c..89409f720f 100644 --- a/models/board/src/plugin.ts +++ b/models/board/src/plugin.ts @@ -28,13 +28,11 @@ export default mergeIds(boardId, board, { CreateCard: '' as AnyComponent, KanbanCard: '' as AnyComponent, CardPresenter: '' as AnyComponent, - CardLabelPresenter: '' as AnyComponent, BoardPresenter: '' as AnyComponent, TemplatesIcon: '' as AnyComponent, Cards: '' as AnyComponent, KanbanView: '' as AnyComponent, TableView: '' as AnyComponent, - LabelsActionPopup: '' as AnyComponent, DatesActionPopup: '' as AnyComponent, CoverActionPopup: '' as AnyComponent, MoveActionPopup: '' as AnyComponent, diff --git a/models/tags/src/index.ts b/models/tags/src/index.ts index 2a4598a883..5ff53bf4a9 100644 --- a/models/tags/src/index.ts +++ b/models/tags/src/index.ts @@ -90,6 +90,9 @@ export function createModel (builder: Builder): void { builder.mixin(tags.class.TagReference, core.class.Class, view.mixin.CollectionEditor, { editor: tags.component.Tags }) + builder.mixin(tags.class.TagReference, core.class.Class, view.mixin.AttributeEditor, { + editor: tags.component.TagsAttributeEditor + }) builder.mixin(tags.class.TagReference, core.class.Class, view.mixin.AttributePresenter, { presenter: tags.component.TagReferencePresenter diff --git a/models/tags/src/plugin.ts b/models/tags/src/plugin.ts index b5f3ef0a7c..44b438dc60 100644 --- a/models/tags/src/plugin.ts +++ b/models/tags/src/plugin.ts @@ -24,9 +24,9 @@ export default mergeIds(tagsId, tags, { component: { Tags: '' as AnyComponent, TagReferencePresenter: '' as AnyComponent, - TagsPresenter: '' as AnyComponent, TagsItemPresenter: '' as AnyComponent, - TagsFilter: '' as AnyComponent + TagsFilter: '' as AnyComponent, + TagsEditorPopup: '' as AnyComponent }, string: { TagElementLabel: '' as IntlString, diff --git a/packages/presentation/src/components/AttributeBarEditor.svelte b/packages/presentation/src/components/AttributeBarEditor.svelte index 5be8e5c2ff..385ddb02ec 100644 --- a/packages/presentation/src/components/AttributeBarEditor.svelte +++ b/packages/presentation/src/components/AttributeBarEditor.svelte @@ -81,6 +81,7 @@ space={object.space} {onChange} {focus} + {object} /> @@ -104,6 +105,7 @@ space={object.space} {onChange} {focus} + {object} /> {/if} {:else if showHeader} @@ -121,6 +123,7 @@ space={object.space} {onChange} {focus} + {object} /> @@ -141,6 +144,7 @@ space={object.space} {onChange} {focus} + {object} /> {/if} @@ -154,6 +158,7 @@ space={object.space} {onChange} {focus} + {object} /> {/if} diff --git a/plugins/board-resources/src/components/EditCard.svelte b/plugins/board-resources/src/components/EditCard.svelte index f7def294f4..86ecba15f6 100644 --- a/plugins/board-resources/src/components/EditCard.svelte +++ b/plugins/board-resources/src/components/EditCard.svelte @@ -56,6 +56,7 @@ let handleMove: (e: Event) => void let checklists: TodoItem[] = [] const mixins: Mixin[] = [] + const allowedCollections = ['labels'] const ignoreKeys = [ 'isArchived', 'location', @@ -184,7 +185,7 @@ {#if direction === 'column'} - + {:else} diff --git a/plugins/board-resources/src/components/KanbanCard.svelte b/plugins/board-resources/src/components/KanbanCard.svelte index e6f76045a8..7a975694ed 100644 --- a/plugins/board-resources/src/components/KanbanCard.svelte +++ b/plugins/board-resources/src/components/KanbanCard.svelte @@ -21,6 +21,7 @@ import type { Ref, WithLookup } from '@anticrm/core' import notification from '@anticrm/notification' import view from '@anticrm/view' + import tags from '@anticrm/tags' import { getClient, UserBoxList } from '@anticrm/presentation' import { Button, @@ -35,7 +36,6 @@ } from '@anticrm/ui' import { ContextMenu } from '@anticrm/view-resources' import board from '../plugin' - import CardLabels from './editor/CardLabels.svelte' import DatePresenter from './presenters/DatePresenter.svelte' import { hasDate, openCardPanel, updateCard, updateCardMembers } from '../utils/CardUtils' import CheckListsPresenter from './presenters/ChecklistsPresenter.svelte' @@ -94,9 +94,6 @@ class="abs-full-content background-theme-content-accent h-full w-full flex-center fs-title" /> {/if} -
- -
{#if !isEditMode}
{/if} + {#if (object.labels ?? 0) > 0} +
+ +
+ {/if} {#if (object.members?.length ?? 0) > 0} diff --git a/plugins/board-resources/src/components/TableView.svelte b/plugins/board-resources/src/components/TableView.svelte index b95019dd43..85c51b71a7 100644 --- a/plugins/board-resources/src/components/TableView.svelte +++ b/plugins/board-resources/src/components/TableView.svelte @@ -3,6 +3,7 @@ import { Class, FindOptions, Ref } from '@anticrm/core' import { createQuery } from '@anticrm/presentation' import task, { SpaceWithStates, State } from '@anticrm/task' + import tags from '@anticrm/tags' import { TableBrowser } from '@anticrm/view-resources' import board from '../plugin' @@ -23,7 +24,12 @@ config={[ 'title', '$lookup.state', - { key: '', presenter: board.component.CardLabels, label: board.string.Labels }, + { + key: '', + presenter: tags.component.TagsAttributeEditor, + props: { isEditable: false }, + label: board.string.Labels + }, 'startDate', 'dueDate', { key: 'members', presenter: board.component.UserBoxList, label: board.string.Members, sortingKey: '' }, diff --git a/plugins/board-resources/src/components/editor/CardActions.svelte b/plugins/board-resources/src/components/editor/CardActions.svelte index fbbadce15e..6f8eca11d6 100644 --- a/plugins/board-resources/src/components/editor/CardActions.svelte +++ b/plugins/board-resources/src/components/editor/CardActions.svelte @@ -24,7 +24,6 @@ import plugin from '../../plugin' import { updateCardMembers } from '../../utils/CardUtils' import UserBoxList from '../UserBoxList.svelte' - import CardLabels from './CardLabels.svelte' export let value: Card const client = getClient() @@ -55,10 +54,6 @@
-
-
- {/if} diff --git a/plugins/board-resources/src/components/editor/CardLabels.svelte b/plugins/board-resources/src/components/editor/CardLabels.svelte deleted file mode 100644 index d315510b88..0000000000 --- a/plugins/board-resources/src/components/editor/CardLabels.svelte +++ /dev/null @@ -1,94 +0,0 @@ - - - -
- {#if labels && labels.length > 0} -
- {#each labels as label} - - {/each} -
- {:else if !isInline} - - {/if} -
diff --git a/plugins/board-resources/src/components/popups/CardLabelsEditor.svelte b/plugins/board-resources/src/components/popups/CardLabelsEditor.svelte deleted file mode 100644 index c1c93125a4..0000000000 --- a/plugins/board-resources/src/components/popups/CardLabelsEditor.svelte +++ /dev/null @@ -1,106 +0,0 @@ - - -
-
-
-
-
-
- -
-
-
-
-
-
-
- -
- -
-
-
-
-
- -
- {#each colorGroups as colorGroup} -
- {#each colorGroup as c} -
- { - color = c - }} - > - {#if c === color} -
- -
- {/if} -
-
- {/each} -
- {/each} -
-
- -
diff --git a/plugins/board-resources/src/components/popups/CardLabelsPicker.svelte b/plugins/board-resources/src/components/popups/CardLabelsPicker.svelte deleted file mode 100644 index 0ed43f20b8..0000000000 --- a/plugins/board-resources/src/components/popups/CardLabelsPicker.svelte +++ /dev/null @@ -1,119 +0,0 @@ - - -
-
-
-
-
-
-
-
-
-
- -
-
-
- {#each labels as label} -
{ - hovered = label._id - }} - on:focus={() => { - hovered = label._id - }} - on:mouseout={() => { - hovered = undefined - }} - on:blur={() => { - hovered = undefined - }} - > -
toggle(label)} - > - {label.title} - {#if cardLabelRefs.includes(label._id)} -
- -
- {/if} -
-
- {/each} -
-
-
diff --git a/plugins/board-resources/src/components/popups/CardLabelsPopup.svelte b/plugins/board-resources/src/components/popups/CardLabelsPopup.svelte deleted file mode 100644 index e6cda8b53c..0000000000 --- a/plugins/board-resources/src/components/popups/CardLabelsPopup.svelte +++ /dev/null @@ -1,30 +0,0 @@ - - -{#if editMode.isEdit} - setEditMode(false, undefined)} /> -{:else} - setEditMode(true, undefined)} - onEdit={(o) => setEditMode(true, o)} - /> -{/if} diff --git a/plugins/board-resources/src/index.ts b/plugins/board-resources/src/index.ts index f5a538c2b5..394dd077f4 100644 --- a/plugins/board-resources/src/index.ts +++ b/plugins/board-resources/src/index.ts @@ -24,11 +24,9 @@ import CreateCard from './components/CreateCard.svelte' import EditCard from './components/EditCard.svelte' import KanbanCard from './components/KanbanCard.svelte' import KanbanView from './components/KanbanView.svelte' -import CardLabelsPopup from './components/popups/CardLabelsPopup.svelte' import MoveCard from './components/popups/MoveCard.svelte' import CopyCard from './components/popups/CopyCard.svelte' import DateRangePicker from './components/popups/DateRangePicker.svelte' -import CardLabelPresenter from './components/presenters/LabelPresenter.svelte' import TemplatesIcon from './components/TemplatesIcon.svelte' import BoardHeader from './components/BoardHeader.svelte' import BoardMenu from './components/BoardMenu.svelte' @@ -36,7 +34,6 @@ import MenuMainPage from './components/MenuMainPage.svelte' import Archive from './components/Archive.svelte' import TableView from './components/TableView.svelte' import UserBoxList from './components/UserBoxList.svelte' -import CardLabels from './components/editor/CardLabels.svelte' import CardCoverEditor from './components/editor/CardCoverEditor.svelte' import CardCoverPresenter from './components/presenters/CardCoverPresenter.svelte' import CardCoverPicker from './components/popups/CardCoverPicker.svelte' @@ -62,7 +59,6 @@ export default async (): Promise => ({ EditCard, KanbanCard, CardPresenter, - CardLabelPresenter, TemplatesIcon, KanbanView, BoardPresenter, @@ -72,11 +68,9 @@ export default async (): Promise => ({ MenuMainPage, TableView, UserBoxList, - CardLabels, CardCoverEditor, CardCoverPresenter, // action popups - LabelsActionPopup: CardLabelsPopup, DatesActionPopup: DateRangePicker, CoverActionPopup: CardCoverPicker, MoveActionPopup: MoveCard, diff --git a/plugins/board-resources/src/plugin.ts b/plugins/board-resources/src/plugin.ts index 0d4b9fc029..1b6f8693b0 100644 --- a/plugins/board-resources/src/plugin.ts +++ b/plugins/board-resources/src/plugin.ts @@ -133,7 +133,6 @@ export default mergeIds(boardId, board, { BoardMenu: '' as AnyComponent, Archive: '' as AnyComponent, MenuMainPage: '' as AnyComponent, - UserBoxList: '' as AnyComponent, - CardLabels: '' as AnyComponent + UserBoxList: '' as AnyComponent } }) diff --git a/plugins/board-resources/src/utils/BoardUtils.ts b/plugins/board-resources/src/utils/BoardUtils.ts index ef3ad992e3..13130b54b8 100644 --- a/plugins/board-resources/src/utils/BoardUtils.ts +++ b/plugins/board-resources/src/utils/BoardUtils.ts @@ -1,9 +1,8 @@ import { readable } from 'svelte/store' -import board, { Board, Card, CommonBoardPreference } from '@anticrm/board' +import board, { Board, CommonBoardPreference } from '@anticrm/board' import core, { Ref, TxOperations } from '@anticrm/core' import type { KanbanTemplate, TodoItem } from '@anticrm/task' import preference from '@anticrm/preference' -import tags, { TagElement } from '@anticrm/tags' import { createKanban } from '@anticrm/task' import { createQuery, getClient } from '@anticrm/presentation' import { @@ -53,28 +52,6 @@ export function getBoardAvailableColors (): string[] { ] } -export async function createCardLabel ( - client: TxOperations, - { title, color }: { title: string, color: number } -): Promise { - await client.createDoc(tags.class.TagElement, tags.space.Tags, { - title, - color, - targetClass: board.class.Card, - description: '', - category: board.category.Other - }) -} - -export async function addCardLabel (client: TxOperations, card: Card, label: TagElement): Promise { - const { title, color, _id: tag } = label - await client.addCollection(tags.class.TagReference, card.space, card._id, card._class, 'labels', { - title, - color, - tag - }) -} - export function getDateIcon (item: TodoItem): 'normal' | 'warning' | 'overdue' { if (item.dueTo === null) return 'normal' const date = new Date() @@ -86,8 +63,7 @@ export const commonBoardPreference = readable(undefined, createQuery().query(board.class.CommonBoardPreference, { attachedTo: board.app.Board }, (result) => { if (result.total > 0) return set(result[0]) void getClient().createDoc(board.class.CommonBoardPreference, preference.space.Preference, { - attachedTo: board.app.Board, - cardLabelsCompactMode: false + attachedTo: board.app.Board }) }) }) diff --git a/plugins/board/src/index.ts b/plugins/board/src/index.ts index c765af778c..8b4dae08fa 100644 --- a/plugins/board/src/index.ts +++ b/plugins/board/src/index.ts @@ -80,9 +80,7 @@ export interface MenuPage extends Doc { /** * @public */ -export interface CommonBoardPreference extends Preference { - cardLabelsCompactMode: boolean -} +export interface CommonBoardPreference extends Preference {} /** * @public */ diff --git a/plugins/tags-resources/src/components/TagsAttributeEditor.svelte b/plugins/tags-resources/src/components/TagsAttributeEditor.svelte new file mode 100644 index 0000000000..d7c1a05ed3 --- /dev/null +++ b/plugins/tags-resources/src/components/TagsAttributeEditor.svelte @@ -0,0 +1,36 @@ + + +{#if items.length} +
+ {#each items as value} + + {/each} +
+{:else if isEditable} + +{/if} diff --git a/plugins/tags-resources/src/components/TagsEditorPopup.svelte b/plugins/tags-resources/src/components/TagsEditorPopup.svelte new file mode 100644 index 0000000000..67e7ee6394 --- /dev/null +++ b/plugins/tags-resources/src/components/TagsEditorPopup.svelte @@ -0,0 +1,34 @@ + + + diff --git a/plugins/tags-resources/src/index.ts b/plugins/tags-resources/src/index.ts index 0c3c960f0b..6a0cc37d25 100644 --- a/plugins/tags-resources/src/index.ts +++ b/plugins/tags-resources/src/index.ts @@ -27,6 +27,8 @@ import TagsPresenter from './components/TagsPresenter.svelte' import TagsView from './components/TagsView.svelte' import TagElementCountPresenter from './components/TagElementCountPresenter.svelte' import TagsFilter from './components/TagsFilter.svelte' +import TagsAttributeEditor from './components/TagsAttributeEditor.svelte' +import TagsEditorPopup from './components/TagsEditorPopup.svelte' export default async (): Promise => ({ component: { @@ -41,7 +43,9 @@ export default async (): Promise => ({ TagsItemPresenter, CategoryPresenter, TagsCategoryBar, - TagElementCountPresenter + TagElementCountPresenter, + TagsAttributeEditor, + TagsEditorPopup }, actionImpl: { Open: (value: TagElement, evt: MouseEvent) => { diff --git a/plugins/tags/src/index.ts b/plugins/tags/src/index.ts index 4d6ef2b5dc..321dedd756 100644 --- a/plugins/tags/src/index.ts +++ b/plugins/tags/src/index.ts @@ -81,7 +81,9 @@ const tagsPlugin = plugin(tagsId, { TagsView: '' as AnyComponent, TagsEditor: '' as AnyComponent, TagsDropdownEditor: '' as AnyComponent, - TagsCategoryBar: '' as AnyComponent + TagsCategoryBar: '' as AnyComponent, + TagsAttributeEditor: '' as AnyComponent, + TagsPresenter: '' as AnyComponent }, category: { NoCategory: '' as Ref diff --git a/plugins/view-resources/src/components/ClassAttributeBar.svelte b/plugins/view-resources/src/components/ClassAttributeBar.svelte index a0f37513b1..1cc61a8bee 100644 --- a/plugins/view-resources/src/components/ClassAttributeBar.svelte +++ b/plugins/view-resources/src/components/ClassAttributeBar.svelte @@ -17,12 +17,13 @@ import { AttributesBar, getClient, KeyedAttribute } from '@anticrm/presentation' import setting from '@anticrm/setting' import { Button, getCurrentLocation, Label, navigate, Tooltip } from '@anticrm/ui' - import { collectionsFilter, getFiltredKeys } from '../utils' + import { getFiltredKeys, isCollectionAttr } from '../utils' export let object: Doc export let _class: Ref> export let to: Ref> | undefined export let ignoreKeys: string[] = [] + export let allowedCollections: string[] = [] export let vertical: boolean const client = getClient() const hierarchy = client.getHierarchy() @@ -32,7 +33,7 @@ function updateKeys (ignoreKeys: string[]): void { const filtredKeys = getFiltredKeys(hierarchy, _class, ignoreKeys, to) - keys = collectionsFilter(hierarchy, filtredKeys, false) + keys = filtredKeys.filter((key) => !isCollectionAttr(hierarchy, key) || allowedCollections.includes(key.key)) } $: updateKeys(ignoreKeys) diff --git a/plugins/view-resources/src/components/DocAttributeBar.svelte b/plugins/view-resources/src/components/DocAttributeBar.svelte index 8de831800b..09ac56f401 100644 --- a/plugins/view-resources/src/components/DocAttributeBar.svelte +++ b/plugins/view-resources/src/components/DocAttributeBar.svelte @@ -19,9 +19,26 @@ export let object: Doc export let mixins: Mixin[] export let ignoreKeys: string[] + export let allowedCollections: string[] = [] - + {#each mixins as mixin} - + {/each} diff --git a/plugins/view-resources/src/utils.ts b/plugins/view-resources/src/utils.ts index 6151aedb33..d2545f7ca8 100644 --- a/plugins/view-resources/src/utils.ts +++ b/plugins/view-resources/src/utils.ts @@ -374,6 +374,6 @@ export function collectionsFilter (hierarchy: Hierarchy, keys: KeyedAttribute[], return result } -function isCollectionAttr (hierarchy: Hierarchy, key: KeyedAttribute): boolean { +export function isCollectionAttr (hierarchy: Hierarchy, key: KeyedAttribute): boolean { return hierarchy.isDerived(key.attr.type._class, core.class.Collection) }