mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
Board: Update board card model (#1329)
Signed-off-by: Anna No <anna.no@xored.com>
This commit is contained in:
parent
9826fb38fc
commit
ec6bf3a1eb
@ -15,10 +15,10 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
// To help typescript locate view plugin properly
|
// To help typescript locate view plugin properly
|
||||||
import type { Board, Card, CardAction } from '@anticrm/board'
|
import type { Board, Card, CardAction, CardDate, CardLabel } from '@anticrm/board'
|
||||||
import type { Employee } from '@anticrm/contact'
|
import type { Employee } from '@anticrm/contact'
|
||||||
import { Client, Doc, DOMAIN_MODEL, FindOptions, IndexKind, Ref } from '@anticrm/core'
|
import { TxOperations as Client, Doc, DOMAIN_MODEL, FindOptions, IndexKind, Ref } from '@anticrm/core'
|
||||||
import { Builder, Collection, Index, Model, Prop, TypeMarkup, TypeRef, TypeString, UX } from '@anticrm/model'
|
import { Builder, Collection, Index, Model, Prop, TypeBoolean, TypeMarkup, TypeRef, TypeString, UX } from '@anticrm/model'
|
||||||
import attachment from '@anticrm/model-attachment'
|
import attachment from '@anticrm/model-attachment'
|
||||||
import chunter from '@anticrm/model-chunter'
|
import chunter from '@anticrm/model-chunter'
|
||||||
import contact from '@anticrm/model-contact'
|
import contact from '@anticrm/model-contact'
|
||||||
@ -27,7 +27,7 @@ import task, { TSpaceWithStates, TTask } from '@anticrm/model-task'
|
|||||||
import view from '@anticrm/model-view'
|
import view from '@anticrm/model-view'
|
||||||
import workbench from '@anticrm/model-workbench'
|
import workbench from '@anticrm/model-workbench'
|
||||||
import { Asset, IntlString, Resource } from '@anticrm/platform'
|
import { Asset, IntlString, Resource } from '@anticrm/platform'
|
||||||
import type {} from '@anticrm/view'
|
import type { AnyComponent } from '@anticrm/ui'
|
||||||
import board from './plugin'
|
import board from './plugin'
|
||||||
|
|
||||||
@Model(board.class.Board, task.class.SpaceWithStates)
|
@Model(board.class.Board, task.class.SpaceWithStates)
|
||||||
@ -44,13 +44,21 @@ export class TCard extends TTask implements Card {
|
|||||||
@Index(IndexKind.FullText)
|
@Index(IndexKind.FullText)
|
||||||
title!: string
|
title!: string
|
||||||
|
|
||||||
|
@Prop(TypeBoolean(), board.string.IsArchived)
|
||||||
|
isArchived?: boolean
|
||||||
|
|
||||||
|
date?: CardDate
|
||||||
|
|
||||||
@Prop(TypeMarkup(), board.string.Description)
|
@Prop(TypeMarkup(), board.string.Description)
|
||||||
@Index(IndexKind.FullText)
|
@Index(IndexKind.FullText)
|
||||||
description!: string
|
description!: string
|
||||||
|
|
||||||
|
@Prop(Collection(board.class.CardLabel), board.string.Labels)
|
||||||
|
labels?: Ref<CardLabel>[]
|
||||||
|
|
||||||
@Prop(TypeString(), board.string.Location)
|
@Prop(TypeString(), board.string.Location)
|
||||||
@Index(IndexKind.FullText)
|
@Index(IndexKind.FullText)
|
||||||
location!: string
|
location?: string
|
||||||
|
|
||||||
@Prop(Collection(chunter.class.Comment), chunter.string.Comments)
|
@Prop(Collection(chunter.class.Comment), chunter.string.Comments)
|
||||||
comments?: number
|
comments?: number
|
||||||
@ -62,15 +70,16 @@ export class TCard extends TTask implements Card {
|
|||||||
declare assignee: Ref<Employee> | null
|
declare assignee: Ref<Employee> | null
|
||||||
|
|
||||||
@Prop(Collection(contact.class.Employee), board.string.Members)
|
@Prop(Collection(contact.class.Employee), board.string.Members)
|
||||||
members!: Ref<Employee>[]
|
members?: Ref<Employee>[]
|
||||||
}
|
}
|
||||||
|
|
||||||
@Model(board.class.CardAction, core.class.Doc, DOMAIN_MODEL)
|
@Model(board.class.CardAction, core.class.Doc, DOMAIN_MODEL)
|
||||||
export class TCardAction extends TDoc implements CardAction {
|
export class TCardAction extends TDoc implements CardAction {
|
||||||
|
component?: AnyComponent
|
||||||
hint?: IntlString
|
hint?: IntlString
|
||||||
icon!: Asset
|
icon!: Asset
|
||||||
isInline?: boolean
|
isInline?: boolean
|
||||||
isTransparent?: boolean
|
kind?: 'primary' | 'secondary' | 'no-border' | 'transparent' | 'dangerous'
|
||||||
label!: IntlString
|
label!: IntlString
|
||||||
position!: number
|
position!: number
|
||||||
type!: string
|
type!: string
|
||||||
@ -287,7 +296,7 @@ export function createModel (builder: Builder): void {
|
|||||||
{
|
{
|
||||||
icon: board.icon.Card,
|
icon: board.icon.Card,
|
||||||
isInline: false,
|
isInline: false,
|
||||||
isTransparent: true,
|
kind: 'transparent',
|
||||||
label: board.string.AddButton,
|
label: board.string.AddButton,
|
||||||
position: 70,
|
position: 70,
|
||||||
type: board.cardActionType.Automation,
|
type: board.cardActionType.Automation,
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import { boardId, Card, CardAction } from '@anticrm/board'
|
import { boardId, Card, CardAction } from '@anticrm/board'
|
||||||
import board from '@anticrm/board-resources/src/plugin'
|
import board from '@anticrm/board-resources/src/plugin'
|
||||||
import type { Client, Ref, Space } from '@anticrm/core'
|
import type { TxOperations as Client, Ref, Space } from '@anticrm/core'
|
||||||
import { mergeIds, Resource } from '@anticrm/platform'
|
import { mergeIds, Resource } from '@anticrm/platform'
|
||||||
import { KanbanTemplate, Sequence } from '@anticrm/task'
|
import { KanbanTemplate, Sequence } from '@anticrm/task'
|
||||||
import type { AnyComponent } from '@anticrm/ui'
|
import type { AnyComponent } from '@anticrm/ui'
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
"DescriptionPlaceholder": "Add a more detailed description...",
|
"DescriptionPlaceholder": "Add a more detailed description...",
|
||||||
"Location": "Location",
|
"Location": "Location",
|
||||||
"Members": "Members",
|
"Members": "Members",
|
||||||
|
"IsArchived": "Archived",
|
||||||
"BoardCreateLabel": "Board",
|
"BoardCreateLabel": "Board",
|
||||||
"Settings": "Settings",
|
"Settings": "Settings",
|
||||||
"InList": "in list",
|
"InList": "in list",
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
"DescriptionPlaceholder": "Добавьте более подробное описание...",
|
"DescriptionPlaceholder": "Добавьте более подробное описание...",
|
||||||
"Location": "Location",
|
"Location": "Location",
|
||||||
"Members": "Участники",
|
"Members": "Участники",
|
||||||
|
"IsArchived": "Архивировано",
|
||||||
"BoardCreateLabel": "Board",
|
"BoardCreateLabel": "Board",
|
||||||
"Settings": "Настройки",
|
"Settings": "Настройки",
|
||||||
"InList": "в списке",
|
"InList": "в списке",
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import type { Card, CardAction } from '@anticrm/board'
|
import type { Card, CardAction } from '@anticrm/board'
|
||||||
import { IntlString, getResource } from '@anticrm/platform'
|
import { IntlString, getResource } from '@anticrm/platform'
|
||||||
import { getClient } from '@anticrm/presentation'
|
import { getClient } from '@anticrm/presentation'
|
||||||
import { Button, Label } from '@anticrm/ui'
|
import { Button, Component, Label } from '@anticrm/ui'
|
||||||
|
|
||||||
import plugin from '../../plugin'
|
import plugin from '../../plugin'
|
||||||
import { cardActionSorter, getCardActions } from '../../utils/CardActionUtils'
|
import { cardActionSorter, getCardActions } from '../../utils/CardActionUtils'
|
||||||
@ -74,10 +74,15 @@
|
|||||||
<div class="flex-col flex-gap-1">
|
<div class="flex-col flex-gap-1">
|
||||||
<Label label={group.label} />
|
<Label label={group.label} />
|
||||||
{#each group.actions as action}
|
{#each group.actions as action}
|
||||||
|
{#if action.component}
|
||||||
|
<Component is={action.component} props={{ object: value }}>
|
||||||
|
<slot />
|
||||||
|
</Component>
|
||||||
|
{:else}
|
||||||
<Button
|
<Button
|
||||||
icon={action.icon}
|
icon={action.icon}
|
||||||
label={action.label}
|
label={action.label}
|
||||||
kind={action.isTransparent ? 'transparent' : 'no-border'}
|
kind={action.kind ?? 'no-border'}
|
||||||
justify="left"
|
justify="left"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
if (action.handler) {
|
if (action.handler) {
|
||||||
@ -86,6 +91,7 @@
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import board, { boardId } from '@anticrm/board'
|
import board, { boardId } from '@anticrm/board'
|
||||||
import { IntlString, mergeIds } from '@anticrm/platform'
|
import { IntlString, mergeIds } from '@anticrm/platform'
|
||||||
import { AnyComponent } from '@anticrm/ui'
|
import type { AnyComponent } from '@anticrm/ui'
|
||||||
|
|
||||||
export default mergeIds(boardId, board, {
|
export default mergeIds(boardId, board, {
|
||||||
string: {
|
string: {
|
||||||
@ -44,6 +44,7 @@ export default mergeIds(boardId, board, {
|
|||||||
DescriptionPlaceholder: '' as IntlString,
|
DescriptionPlaceholder: '' as IntlString,
|
||||||
Location: '' as IntlString,
|
Location: '' as IntlString,
|
||||||
Members: '' as IntlString,
|
Members: '' as IntlString,
|
||||||
|
IsArchived: '' as IntlString,
|
||||||
BoardCreateLabel: '' as IntlString,
|
BoardCreateLabel: '' as IntlString,
|
||||||
Settings: '' as IntlString,
|
Settings: '' as IntlString,
|
||||||
InList: '' as IntlString,
|
InList: '' as IntlString,
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
"@anticrm/core": "~0.6.16",
|
"@anticrm/core": "~0.6.16",
|
||||||
"@anticrm/platform": "~0.6.5",
|
"@anticrm/platform": "~0.6.5",
|
||||||
"@anticrm/view": "~0.6.0",
|
"@anticrm/view": "~0.6.0",
|
||||||
"@anticrm/task": "~0.6.0"
|
"@anticrm/task": "~0.6.0",
|
||||||
|
"@anticrm/ui": "~0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import { Employee } from '@anticrm/contact'
|
import { Employee } from '@anticrm/contact'
|
||||||
import type { AttachedDoc, Class, Client, Doc, Markup, Ref } from '@anticrm/core'
|
import type { AttachedDoc, Class, TxOperations as Client, Doc, Markup, Ref, Timestamp } from '@anticrm/core'
|
||||||
import type { Asset, IntlString, Plugin, Resource } from '@anticrm/platform'
|
import type { Asset, IntlString, Plugin, Resource } from '@anticrm/platform'
|
||||||
import { plugin } from '@anticrm/platform'
|
import { plugin } from '@anticrm/platform'
|
||||||
import type { KanbanTemplateSpace, SpaceWithStates, Task } from '@anticrm/task'
|
import type { KanbanTemplateSpace, SpaceWithStates, Task } from '@anticrm/task'
|
||||||
|
import type { AnyComponent } from '@anticrm/ui'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -47,17 +48,31 @@ export interface CardLabel extends AttachedDoc {
|
|||||||
color: number
|
color: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export interface CardDate {
|
||||||
|
dueDate?: Timestamp
|
||||||
|
isChecked?: boolean
|
||||||
|
startDate?: Timestamp
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export interface Card extends Task {
|
export interface Card extends Task {
|
||||||
title: string
|
title: string
|
||||||
|
|
||||||
|
date?: CardDate
|
||||||
description: Markup
|
description: Markup
|
||||||
|
|
||||||
members: Ref<Employee>[]
|
isArchived?: boolean
|
||||||
|
|
||||||
location: string
|
members?: Ref<Employee>[]
|
||||||
|
|
||||||
|
labels?: Ref<CardLabel>[]
|
||||||
|
|
||||||
|
location?: string
|
||||||
|
|
||||||
coverColor?: number
|
coverColor?: number
|
||||||
coverImage?: string
|
coverImage?: string
|
||||||
@ -69,10 +84,11 @@ export interface Card extends Task {
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export interface CardAction extends Doc {
|
export interface CardAction extends Doc {
|
||||||
|
component?: AnyComponent
|
||||||
hint?: IntlString
|
hint?: IntlString
|
||||||
icon: Asset
|
icon: Asset
|
||||||
isInline?: boolean
|
isInline?: boolean
|
||||||
isTransparent?: boolean
|
kind?: 'primary' | 'secondary' | 'no-border' | 'transparent' | 'dangerous'
|
||||||
label: IntlString
|
label: IntlString
|
||||||
position: number
|
position: number
|
||||||
type: string
|
type: string
|
||||||
@ -102,7 +118,8 @@ const boards = plugin(boardId, {
|
|||||||
class: {
|
class: {
|
||||||
Board: '' as Ref<Class<Board>>,
|
Board: '' as Ref<Class<Board>>,
|
||||||
Card: '' as Ref<Class<Card>>,
|
Card: '' as Ref<Class<Card>>,
|
||||||
CardAction: '' as Ref<Class<CardAction>>
|
CardAction: '' as Ref<Class<CardAction>>,
|
||||||
|
CardLabel: '' as Ref<Class<CardLabel>>
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
Board: '' as Asset,
|
Board: '' as Asset,
|
||||||
|
@ -46,6 +46,7 @@ export interface DocWithRank extends Doc {
|
|||||||
export interface State extends DocWithRank {
|
export interface State extends DocWithRank {
|
||||||
title: string
|
title: string
|
||||||
color: number
|
color: number
|
||||||
|
isArchived?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user