diff --git a/models/board/src/index.ts b/models/board/src/index.ts index d881c81dd4..b45942db72 100644 --- a/models/board/src/index.ts +++ b/models/board/src/index.ts @@ -14,9 +14,9 @@ // // To help typescript locate view plugin properly -import type { Board, Card, CardLabel, MenuPage, CommonBoardPreference } from '@anticrm/board' +import type { Board, Card, CardLabel, MenuPage, CommonBoardPreference, CardCover } from '@anticrm/board' import type { Employee } from '@anticrm/contact' -import { DOMAIN_MODEL, IndexKind, Markup, Ref } from '@anticrm/core' +import { DOMAIN_MODEL, IndexKind, Markup, Ref, Type } from '@anticrm/core' import { ArrOf, Builder, @@ -33,7 +33,7 @@ import { import attachment from '@anticrm/model-attachment' import chunter from '@anticrm/model-chunter' import contact from '@anticrm/model-contact' -import core, { TAttachedDoc, TDoc } from '@anticrm/model-core' +import core, { TAttachedDoc, TDoc, TType } from '@anticrm/model-core' import task, { TSpaceWithStates, TTask } from '@anticrm/model-task' import view, { actionTemplates, createAction } from '@anticrm/model-view' import workbench, { Application } from '@anticrm/model-workbench' @@ -57,6 +57,17 @@ export class TCardLabel extends TAttachedDoc implements CardLabel { isHidden?: boolean } +function TypeCardCover (): Type { + return { _class: board.class.CardCover, label: board.string.Cover } +} + +@UX(board.string.Cover) +@Model(board.class.CardCover, core.class.Type) +export class TCardCover extends TType implements CardCover { + size!: 'large' | 'small' + color!: number +} + @Model(board.class.CommonBoardPreference, preference.class.Preference) export class TCommonBoardPreference extends TPreference implements CommonBoardPreference { @Prop(TypeRef(workbench.class.Application), board.string.CommonBoardPreference) @@ -97,6 +108,9 @@ export class TCard extends TTask implements Card { @Prop(ArrOf(TypeRef(contact.class.Employee)), board.string.Members) members?: Ref[] + + @Prop(TypeCardCover(), board.string.Cover) + cover?: CardCover } @Model(board.class.MenuPage, core.class.Doc, DOMAIN_MODEL) @@ -107,7 +121,7 @@ export class TMenuPage extends TDoc implements MenuPage { } export function createModel (builder: Builder): void { - builder.createModel(TBoard, TCard, TCardLabel, TMenuPage, TCommonBoardPreference) + builder.createModel(TBoard, TCard, TCardLabel, TMenuPage, TCommonBoardPreference, TCardCover) builder.createDoc(board.class.MenuPage, core.space.Model, { component: board.component.Archive, @@ -214,6 +228,14 @@ export function createModel (builder: Builder): void { presenter: board.component.BoardPresenter }) + builder.mixin(board.class.CardCover, core.class.Class, view.mixin.AttributePresenter, { + presenter: board.component.CardCoverPresenter + }) + + builder.mixin(board.class.CardCover, core.class.Class, view.mixin.AttributeEditor, { + editor: board.component.CardCoverEditor + }) + builder.createDoc( task.class.KanbanTemplateSpace, core.space.Model, diff --git a/models/board/src/plugin.ts b/models/board/src/plugin.ts index 71578750dd..8a4b1caf6c 100644 --- a/models/board/src/plugin.ts +++ b/models/board/src/plugin.ts @@ -38,7 +38,9 @@ export default mergeIds(boardId, board, { DatesActionPopup: '' as AnyComponent, CoverActionPopup: '' as AnyComponent, MoveActionPopup: '' as AnyComponent, - CopyActionPopup: '' as AnyComponent + CopyActionPopup: '' as AnyComponent, + CardCoverPresenter: '' as AnyComponent, + CardCoverEditor: '' as AnyComponent }, space: { DefaultBoard: '' as Ref diff --git a/plugins/board-resources/src/components/EditCard.svelte b/plugins/board-resources/src/components/EditCard.svelte index 19b8326922..e97772128c 100644 --- a/plugins/board-resources/src/components/EditCard.svelte +++ b/plugins/board-resources/src/components/EditCard.svelte @@ -48,7 +48,7 @@ let handleMove: (e: Event) => void let checklists: TodoItem[] = [] const mixins: Mixin[] = [] - const ignoreKeys = ['isArchived', 'location', 'title', 'description', 'state', 'members', 'doneState', 'number'] + const ignoreKeys = ['isArchived', 'location', 'title', 'description', 'state', 'members', 'number', 'assignee'] function change (field: string, value: any) { if (object) { diff --git a/plugins/board-resources/src/components/editor/CardActions.svelte b/plugins/board-resources/src/components/editor/CardActions.svelte index 8b117e46fa..149e90341c 100644 --- a/plugins/board-resources/src/components/editor/CardActions.svelte +++ b/plugins/board-resources/src/components/editor/CardActions.svelte @@ -19,13 +19,12 @@ import { Employee } from '@anticrm/contact' import { Ref } from '@anticrm/core' import { getClient } from '@anticrm/presentation' - import { Button, CheckBox, Label, IconAdd } from '@anticrm/ui' + import { CheckBox, Label } from '@anticrm/ui' import { invokeAction } from '@anticrm/view-resources' import plugin from '../../plugin' import { getCardActions } from '../../utils/CardActionUtils' import { updateCardMembers } from '../../utils/CardUtils' - import ColorPresenter from '../presenters/ColorPresenter.svelte' import UserBoxList from '../UserBoxList.svelte' import CardLabels from './CardLabels.svelte' @@ -76,15 +75,5 @@ -
-
-
- {#if !value.cover?.color} -
{/if} diff --git a/plugins/board-resources/src/components/editor/CardCoverEditor.svelte b/plugins/board-resources/src/components/editor/CardCoverEditor.svelte new file mode 100644 index 0000000000..088d0b5718 --- /dev/null +++ b/plugins/board-resources/src/components/editor/CardCoverEditor.svelte @@ -0,0 +1,19 @@ + + +{#if value} + +{:else} +