2022-04-02 03:49:23 +00:00
|
|
|
//
|
|
|
|
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
|
|
|
// Copyright © 2021 Hardcore Engineering Inc.
|
|
|
|
//
|
|
|
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License. You may
|
|
|
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
//
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
|
|
|
|
import { Employee } from '@anticrm/contact'
|
2022-04-08 03:08:30 +00:00
|
|
|
import type { AttachedDoc, Class, Client, Doc, Markup, Ref } from '@anticrm/core'
|
|
|
|
import type { Asset, IntlString, Plugin, Resource } from '@anticrm/platform'
|
2022-04-02 03:49:23 +00:00
|
|
|
import { plugin } from '@anticrm/platform'
|
|
|
|
import type { KanbanTemplateSpace, SpaceWithStates, Task } from '@anticrm/task'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export interface Board extends SpaceWithStates {
|
|
|
|
color?: number
|
|
|
|
background?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export interface BoardView extends SpaceWithStates {
|
|
|
|
title: string
|
|
|
|
type: 'table' | 'calendar'
|
|
|
|
boards: Ref<Board>[]
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export interface CardLabel extends AttachedDoc {
|
|
|
|
attachedTo: Ref<Board>
|
|
|
|
|
|
|
|
title: string
|
|
|
|
color: number
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export interface Card extends Task {
|
|
|
|
title: string
|
|
|
|
|
|
|
|
description: Markup
|
|
|
|
|
|
|
|
members: Ref<Employee>[]
|
|
|
|
|
|
|
|
location: string
|
|
|
|
|
|
|
|
coverColor?: number
|
|
|
|
coverImage?: string
|
|
|
|
|
|
|
|
comments?: number
|
|
|
|
attachments?: number
|
|
|
|
}
|
2022-04-08 03:08:30 +00:00
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export interface CardAction extends Doc {
|
|
|
|
hint?: IntlString
|
|
|
|
icon: Asset
|
|
|
|
isInline?: boolean
|
|
|
|
isTransparent?: boolean
|
|
|
|
label: IntlString
|
|
|
|
position: number
|
|
|
|
type: string
|
|
|
|
handler?: Resource<(card: Card, client: Client) => void>
|
|
|
|
supported?: Resource<(card: Card, client: Client) => boolean>
|
|
|
|
}
|
2022-04-02 03:49:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export const boardId = 'board' as Plugin
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
const boards = plugin(boardId, {
|
|
|
|
app: {
|
|
|
|
Board: '' as Ref<Doc>
|
|
|
|
},
|
2022-04-08 03:08:30 +00:00
|
|
|
cardActionType: {
|
|
|
|
Editor: 'Editor',
|
|
|
|
Cover: 'Cover',
|
|
|
|
AddToCard: 'AddToCard',
|
|
|
|
Automation: 'Automation',
|
|
|
|
Action: 'Action'
|
|
|
|
},
|
2022-04-02 03:49:23 +00:00
|
|
|
class: {
|
|
|
|
Board: '' as Ref<Class<Board>>,
|
2022-04-08 03:08:30 +00:00
|
|
|
Card: '' as Ref<Class<Card>>,
|
|
|
|
CardAction: '' as Ref<Class<CardAction>>
|
2022-04-02 03:49:23 +00:00
|
|
|
},
|
|
|
|
icon: {
|
|
|
|
Board: '' as Asset,
|
|
|
|
Card: '' as Asset
|
|
|
|
},
|
|
|
|
space: {
|
|
|
|
BoardTemplates: '' as Ref<KanbanTemplateSpace>
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export default boards
|