Board: Update board card model (#1329)

Signed-off-by: Anna No <anna.no@xored.com>
This commit is contained in:
Anna No
2022-04-09 01:07:21 +07:00
committed by GitHub
parent 9826fb38fc
commit ec6bf3a1eb
9 changed files with 66 additions and 29 deletions
+1
View File
@@ -23,6 +23,7 @@
"DescriptionPlaceholder": "Add a more detailed description...",
"Location": "Location",
"Members": "Members",
"IsArchived": "Archived",
"BoardCreateLabel": "Board",
"Settings": "Settings",
"InList": "in list",
+1
View File
@@ -23,6 +23,7 @@
"DescriptionPlaceholder": "Добавьте более подробное описание...",
"Location": "Location",
"Members": "Участники",
"IsArchived": "Архивировано",
"BoardCreateLabel": "Board",
"Settings": "Настройки",
"InList": "в списке",
@@ -18,7 +18,7 @@
import type { Card, CardAction } from '@anticrm/board'
import { IntlString, getResource } from '@anticrm/platform'
import { getClient } from '@anticrm/presentation'
import { Button, Label } from '@anticrm/ui'
import { Button, Component, Label } from '@anticrm/ui'
import plugin from '../../plugin'
import { cardActionSorter, getCardActions } from '../../utils/CardActionUtils'
@@ -74,18 +74,24 @@
<div class="flex-col flex-gap-1">
<Label label={group.label} />
{#each group.actions as action}
<Button
icon={action.icon}
label={action.label}
kind={action.isTransparent ? 'transparent' : 'no-border'}
justify="left"
on:click={async () => {
if (action.handler) {
const handler = await getResource(action.handler)
handler(value, client)
}
}}
/>
{#if action.component}
<Component is={action.component} props={{ object: value }}>
<slot />
</Component>
{:else}
<Button
icon={action.icon}
label={action.label}
kind={action.kind ?? 'no-border'}
justify="left"
on:click={async () => {
if (action.handler) {
const handler = await getResource(action.handler)
handler(value, client)
}
}}
/>
{/if}
{/each}
</div>
{/if}
+2 -1
View File
@@ -15,7 +15,7 @@
import board, { boardId } from '@anticrm/board'
import { IntlString, mergeIds } from '@anticrm/platform'
import { AnyComponent } from '@anticrm/ui'
import type { AnyComponent } from '@anticrm/ui'
export default mergeIds(boardId, board, {
string: {
@@ -44,6 +44,7 @@ export default mergeIds(boardId, board, {
DescriptionPlaceholder: '' as IntlString,
Location: '' as IntlString,
Members: '' as IntlString,
IsArchived: '' as IntlString,
BoardCreateLabel: '' as IntlString,
Settings: '' as IntlString,
InList: '' as IntlString,
+2 -1
View File
@@ -30,6 +30,7 @@
"@anticrm/core": "~0.6.16",
"@anticrm/platform": "~0.6.5",
"@anticrm/view": "~0.6.0",
"@anticrm/task": "~0.6.0"
"@anticrm/task": "~0.6.0",
"@anticrm/ui": "~0.6.0"
}
}
+22 -5
View File
@@ -15,10 +15,11 @@
//
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 { plugin } from '@anticrm/platform'
import type { KanbanTemplateSpace, SpaceWithStates, Task } from '@anticrm/task'
import type { AnyComponent } from '@anticrm/ui'
/**
* @public
@@ -47,17 +48,31 @@ export interface CardLabel extends AttachedDoc {
color: number
}
/**
* @public
*/
export interface CardDate {
dueDate?: Timestamp
isChecked?: boolean
startDate?: Timestamp
}
/**
* @public
*/
export interface Card extends Task {
title: string
date?: CardDate
description: Markup
members: Ref<Employee>[]
isArchived?: boolean
location: string
members?: Ref<Employee>[]
labels?: Ref<CardLabel>[]
location?: string
coverColor?: number
coverImage?: string
@@ -69,10 +84,11 @@ export interface Card extends Task {
* @public
*/
export interface CardAction extends Doc {
component?: AnyComponent
hint?: IntlString
icon: Asset
isInline?: boolean
isTransparent?: boolean
kind?: 'primary' | 'secondary' | 'no-border' | 'transparent' | 'dangerous'
label: IntlString
position: number
type: string
@@ -102,7 +118,8 @@ const boards = plugin(boardId, {
class: {
Board: '' as Ref<Class<Board>>,
Card: '' as Ref<Class<Card>>,
CardAction: '' as Ref<Class<CardAction>>
CardAction: '' as Ref<Class<CardAction>>,
CardLabel: '' as Ref<Class<CardLabel>>
},
icon: {
Board: '' as Asset,
+1
View File
@@ -46,6 +46,7 @@ export interface DocWithRank extends Doc {
export interface State extends DocWithRank {
title: string
color: number
isArchived?: boolean
}
/**