mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 01:10:17 +00:00
UBERF-5837 Better organize document plugin (#4963)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
27e46ef3ae
commit
0b89fac214
@ -366,7 +366,7 @@ function defineDocument (builder: Builder): void {
|
||||
presentation.class.ObjectSearchCategory,
|
||||
core.space.Model,
|
||||
{
|
||||
title: document.string.Docs,
|
||||
title: document.string.Documents,
|
||||
icon: document.icon.Document,
|
||||
label: document.string.SearchDocument,
|
||||
query: document.completion.DocumentQuery,
|
||||
@ -397,7 +397,7 @@ function defineApplication (builder: Builder): void {
|
||||
addSpaceLabel: document.string.CreateTeamspace,
|
||||
createComponent: document.component.CreateTeamspace,
|
||||
visibleIf: document.function.IsTeamspaceVisible,
|
||||
icon: document.icon.Library,
|
||||
icon: document.icon.Teamspace,
|
||||
// intentionally left empty in order to make space presenter working
|
||||
specials: []
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import { type Attachment } from '@hcengineering/attachment'
|
||||
import { type Class, type Doc, type Ref, TxOperations, DOMAIN_TX, getCollaborativeDoc } from '@hcengineering/core'
|
||||
import { type Document } from '@hcengineering/document'
|
||||
import { type Document, type Teamspace } from '@hcengineering/document'
|
||||
import {
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
@ -23,7 +23,8 @@ import {
|
||||
tryMigrate
|
||||
} from '@hcengineering/model'
|
||||
import { DOMAIN_ATTACHMENT } from '@hcengineering/model-attachment'
|
||||
import core from '@hcengineering/model-core'
|
||||
import core, { DOMAIN_SPACE } from '@hcengineering/model-core'
|
||||
import { type Asset } from '@hcengineering/platform'
|
||||
import document, { documentId, DOMAIN_DOCUMENT } from './index'
|
||||
|
||||
async function createSpace (tx: TxOperations): Promise<void> {
|
||||
@ -159,6 +160,30 @@ async function migrateDeleteCollaboratorDocument (client: MigrationClient): Prom
|
||||
})
|
||||
}
|
||||
|
||||
async function migrateDocumentIcons (client: MigrationClient): Promise<void> {
|
||||
await client.update<Teamspace>(
|
||||
DOMAIN_SPACE,
|
||||
{
|
||||
_class: document.class.Teamspace,
|
||||
icon: 'document:icon:Library' as Asset
|
||||
},
|
||||
{
|
||||
icon: 'document:icon:Teamspace' as Asset
|
||||
}
|
||||
)
|
||||
|
||||
await client.update<Document>(
|
||||
DOMAIN_DOCUMENT,
|
||||
{
|
||||
_class: document.class.Document,
|
||||
icon: 'document:icon:Library' as Asset
|
||||
},
|
||||
{
|
||||
icon: 'document:icon:Teamspace' as Asset
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async function setNoParent (client: MigrationClient): Promise<void> {
|
||||
await client.update(
|
||||
DOMAIN_DOCUMENT,
|
||||
@ -232,6 +257,10 @@ export const documentOperation: MigrateOperation = {
|
||||
{
|
||||
state: 'deleteCollaboratorDocument',
|
||||
func: migrateDeleteCollaboratorDocument
|
||||
},
|
||||
{
|
||||
state: 'updateDocumentIcons',
|
||||
func: migrateDocumentIcons
|
||||
}
|
||||
])
|
||||
},
|
||||
|
@ -2,31 +2,12 @@
|
||||
<symbol id="documentapplication" viewBox="0 0 32 32">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 4C8.89543 4 8 4.89543 8 6V26C8 27.1046 8.89543 28 10 28H22C23.1046 28 24 27.1046 24 26V12H20C17.7909 12 16 10.2091 16 8V4H10ZM18 4.41421V8C18 9.10457 18.8954 10 20 10H23.5858L18 4.41421ZM6 6C6 3.79086 7.79086 2 10 2H17.5858C18.1162 2 18.6249 2.21071 19 2.58579L25.4142 9C25.7893 9.37507 26 9.88378 26 10.4142V26C26 28.2091 24.2091 30 22 30H10C7.79086 30 6 28.2091 6 26V6ZM10 17C10 16.4477 10.4477 16 11 16H15C15.5523 16 16 16.4477 16 17C16 17.5523 15.5523 18 15 18H11C10.4477 18 10 17.5523 10 17ZM10 21C10 20.4477 10.4477 20 11 20H21C21.5523 20 22 20.4477 22 21C22 21.5523 21.5523 22 21 22H11C10.4477 22 10 21.5523 10 21Z" />
|
||||
</symbol>
|
||||
<symbol id="newdocument" viewBox="0 0 16 16">
|
||||
<path d="M14.7826 3.26359C15.1313 2.69123 15.0606 1.93115 14.5705 1.43492C14.0757 0.933932 13.3153 0.865765 12.7483 1.23041C13.2123 2.09277 13.9198 2.79999 14.7826 3.26359Z"/>
|
||||
<path d="M11.8171 2.11829L6.78472 7.18C7.77457 7.47517 8.57699 8.21908 8.95006 9.18198L13.9064 4.20208C13.0535 3.68436 12.3369 2.9696 11.8171 2.11829Z"/>
|
||||
<path d="M7.91486 10.1761C7.80538 9.1186 6.91913 8.30487 5.8592 8.29183C5.53827 8.92804 5.21105 9.90848 5.01729 10.5311C4.93355 10.8002 5.16675 11.0527 5.44262 10.9905C6.16831 10.8268 7.36057 10.5217 7.91486 10.1761Z"/>
|
||||
<path d="M4.75 2C2.67893 2 1 3.67893 1 5.75V11.25C1 13.3211 2.67893 15 4.75 15H10.2501C12.3212 15 14.0001 13.3211 14.0001 11.25V8C14.0001 7.58579 13.6643 7.25 13.2501 7.25C12.8359 7.25 12.5001 7.58579 12.5001 8V11.25C12.5001 12.4926 11.4927 13.5 10.2501 13.5H4.75C3.50736 13.5 2.5 12.4926 2.5 11.25V5.75C2.5 4.50736 3.50736 3.5 4.75 3.5H7C7.41421 3.5 7.75 3.16421 7.75 2.75C7.75 2.33579 7.41421 2 7 2H4.75Z"/>
|
||||
</symbol>
|
||||
<symbol id="document" viewBox="0 0 32 32">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9 4C7.89543 4 7 4.89543 7 6V26C7 27.1046 7.89543 28 9 28H23C24.1046 28 25 27.1046 25 26V12H21C18.7909 12 17 10.2091 17 8V4H9ZM19 4.41421V8C19 9.10457 19.8954 10 21 10H24.5858L19 4.41421ZM5 6C5 3.79086 6.79086 2 9 2H18.5858C19.1162 2 19.6249 2.21071 20 2.58579L26.4142 9C26.7893 9.37507 27 9.88378 27 10.4142V26C27 28.2091 25.2091 30 23 30H9C6.79086 30 5 28.2091 5 26V6ZM10 17C10 16.4477 10.4477 16 11 16H21C21.5523 16 22 16.4477 22 17C22 17.5523 21.5523 18 21 18H11C10.4477 18 10 17.5523 10 17ZM10 23C10 22.4477 10.4477 22 11 22H21C21.5523 22 22 22.4477 22 23C22 23.5523 21.5523 24 21 24H11C10.4477 24 10 23.5523 10 23Z" />
|
||||
</symbol>
|
||||
<symbol id="add" viewBox="0 0 16 16">
|
||||
<path d="M7.49988 8.49991V12.9999H8.49988V8.49991L13 8.49994L13 7.49994L8.49988 7.49991V2.99988H7.49988V7.49991L3.00001 7.49988L3 8.49988L7.49988 8.49991Z" />
|
||||
</symbol>
|
||||
<symbol id="blank" viewBox="0 0 32 32">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9 4C7.89543 4 7 4.89543 7 6V26C7 27.1046 7.89543 28 9 28H23C24.1046 28 25 27.1046 25 26V12H21C18.7909 12 17 10.2091 17 8V4H9ZM19 4.41421V8C19 9.10457 19.8954 10 21 10H24.5858L19 4.41421ZM5 6C5 3.79086 6.79086 2 9 2H18.5858C19.1162 2 19.6249 2.21071 20 2.58579L26.4142 9C26.7893 9.37507 27 9.88378 27 10.4142V26C27 28.2091 25.2091 30 23 30H9C6.79086 30 5 28.2091 5 26V6Z" />
|
||||
</symbol>
|
||||
<symbol id="videofile" viewBox="0 0 32 32">
|
||||
<path d="M13 15V23L20 19L13 15Z" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9 4C7.89543 4 7 4.89543 7 6V26C7 27.1046 7.89543 28 9 28H23C24.1046 28 25 27.1046 25 26V12H21C18.7909 12 17 10.2091 17 8V4H9ZM19 4.41421V8C19 9.10457 19.8954 10 21 10H24.5858L19 4.41421ZM5 6C5 3.79086 6.79086 2 9 2H18.5858C19.1162 2 19.6249 2.21071 20 2.58579L26.4142 9C26.7893 9.37507 27 9.88378 27 10.4142V26C27 28.2091 25.2091 30 23 30H9C6.79086 30 5 28.2091 5 26V6Z" />
|
||||
</symbol>
|
||||
<symbol id="library" viewBox="0 0 24 24">
|
||||
<path d="M21,2.2h-5h-5c-0.4,0-0.8,0.3-0.8,0.8v18c0,0.4,0.3,0.8,0.8,0.8h5h5c0.4,0,0.8-0.3,0.8-0.8V3C21.8,2.6,21.4,2.2,21,2.2z M11.8,3.8h3.5v16.5h-3.5V3.8z M20.2,20.2h-3.5V3.8h3.5V20.2z"/>
|
||||
<path d="M9.1,2.8l-4-0.5c-0.2,0-0.4,0-0.6,0.2S4.3,2.7,4.3,2.9l-2,17.5c0,0.4,0.2,0.8,0.7,0.8l4.2,0.5c0.2,0,0.4,0,0.6-0.2C7.9,21.5,8,21.3,8,21.1L9.7,3.6C9.8,3.2,9.5,2.8,9.1,2.8z M6.6,20.2l-2.7-0.3l1.8-16l2.5,0.3L6.6,20.2z"/>
|
||||
<path d="M18.5,9.8c0.4,0,0.8-0.3,0.8-0.8V7.5c0-0.4-0.3-0.8-0.8-0.8s-0.8,0.3-0.8,0.8V9C17.8,9.4,18.1,9.8,18.5,9.8z"/>
|
||||
<path d="M13.5,6.8c-0.4,0-0.8,0.3-0.8,0.8V9c0,0.4,0.3,0.8,0.8,0.8s0.8-0.3,0.8-0.8V7.5C14.2,7.1,13.9,6.8,13.5,6.8z"/>
|
||||
</symbol>
|
||||
<symbol id="teamspace" viewBox="0 0 24 24">
|
||||
<path d="M21,2.2h-5h-5c-0.4,0-0.8,0.3-0.8,0.8v18c0,0.4,0.3,0.8,0.8,0.8h5h5c0.4,0,0.8-0.3,0.8-0.8V3C21.8,2.6,21.4,2.2,21,2.2z M11.8,3.8h3.5v16.5h-3.5V3.8z M20.2,20.2h-3.5V3.8h3.5V20.2z"/>
|
||||
<path d="M9.1,2.8l-4-0.5c-0.2,0-0.4,0-0.6,0.2S4.3,2.7,4.3,2.9l-2,17.5c0,0.4,0.2,0.8,0.7,0.8l4.2,0.5c0.2,0,0.4,0,0.6-0.2C7.9,21.5,8,21.3,8,21.1L9.7,3.6C9.8,3.2,9.5,2.8,9.1,2.8z M6.6,20.2l-2.7-0.3l1.8-16l2.5,0.3L6.6,20.2z"/>
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 7.8 KiB |
@ -1,21 +1,20 @@
|
||||
{
|
||||
"string": {
|
||||
"Document": "Document",
|
||||
"ParentDocument": "Parent document",
|
||||
"ChildDocument": "Child document",
|
||||
"CreateDocument": "Create a document",
|
||||
"Documents": "Documents",
|
||||
"CreateAnVersion": "Create new version",
|
||||
"Document": "Document",
|
||||
"DocumentNamePlaceholder": "Untitled",
|
||||
"Name": "Name",
|
||||
"Cancel": "Cancel",
|
||||
"Version": "Version",
|
||||
"SearchDocument": "Search document...",
|
||||
"Snapshot": "Snapshot",
|
||||
"ParentDocument": "Parent document",
|
||||
"ChildDocument": "Child document",
|
||||
"NoVersions": "No version's defined",
|
||||
"DocumentApplication": "Documents",
|
||||
"MyDocuments": "My documents",
|
||||
"Library": "Library",
|
||||
"Teamspace": "Teamspace",
|
||||
"Teamspaces": "Teamspaces",
|
||||
"Labels": "Labels",
|
||||
@ -56,7 +55,6 @@
|
||||
"UnassignToDoConfirm": "Do you want to unassign Todo? The Todo will be removed from the assignee planning.",
|
||||
"ReassignToDo": "Change Todo assignee",
|
||||
"ReassignToDoConfirm": "Do you want to change Todo assignee? The Todo will be removed from the current assignee's planning.",
|
||||
"Docs": "Docs",
|
||||
"Icon": "Icon",
|
||||
"Color": "Color"
|
||||
}
|
||||
|
@ -1,21 +1,20 @@
|
||||
{
|
||||
"string": {
|
||||
"Document": "Документ",
|
||||
"ParentDocument": "Родительский документ",
|
||||
"ChildDocument": "Дочерний документ",
|
||||
"CreateDocument": "Создать документ",
|
||||
"Documents": "Документы",
|
||||
"CreateAnVersion": "Создать новую версию",
|
||||
"Document": "Документ",
|
||||
"DocumentNamePlaceholder": "Без имени",
|
||||
"Name": "Имя",
|
||||
"Cancel": "Отмена",
|
||||
"Version": "Версия",
|
||||
"SearchDocument": "Найти документ...",
|
||||
"Snapshot": "Снимок",
|
||||
"ParentDocument": "Родительский документ",
|
||||
"ChildDocument": "Дочерний документ",
|
||||
"NoVersions": "Версии не определены",
|
||||
"DocumentApplication": "Документы",
|
||||
"MyDocuments": "Мои документы",
|
||||
"Library": "Библиотека",
|
||||
"Teamspace": "Пространство",
|
||||
"Teamspaces": "Пространства",
|
||||
"Labels": "Метки",
|
||||
@ -56,7 +55,6 @@
|
||||
"UnassignToDoConfirm": "Вы хотите отменить назначение Todo? Todo будет удалена из планирования исполнителя.",
|
||||
"ReassignToDo": "Изменить исполнителя Todo",
|
||||
"ReassignToDoConfirm": "Вы хотите изменить исполнителя Todo? Todo будет удалена из планирования текущего исполнителя.",
|
||||
"Docs": "Документы",
|
||||
"Icon": "Иконка",
|
||||
"Color": "Цвет"
|
||||
}
|
||||
|
@ -19,12 +19,8 @@ import { loadMetadata } from '@hcengineering/platform'
|
||||
const icons = require('../assets/icons.svg') as string // eslint-disable-line
|
||||
loadMetadata(document.icon, {
|
||||
DocumentApplication: `${icons}#documentapplication`,
|
||||
NewDocument: `${icons}#newdocument`,
|
||||
Document: `${icons}#document`,
|
||||
Add: `${icons}#add`,
|
||||
Blank: `${icons}#blank`,
|
||||
Videofile: `${icons}#videofile`,
|
||||
Library: `${icons}#library`,
|
||||
Teamspace: `${icons}#teamspace`,
|
||||
References: `${icons}#references`,
|
||||
History: `${icons}#history`,
|
||||
|
@ -63,7 +63,7 @@
|
||||
|
||||
function chooseIcon (): void {
|
||||
const { icon, color } = object
|
||||
const icons = [document.icon.Document, document.icon.Library]
|
||||
const icons = [document.icon.Document, document.icon.Teamspace]
|
||||
showPopup(IconPicker, { icon, color, icons }, 'top', (result) => {
|
||||
if (result !== undefined && result !== null) {
|
||||
object.icon = result.icon
|
||||
|
@ -160,7 +160,7 @@
|
||||
async function chooseIcon (): Promise<void> {
|
||||
if (doc !== undefined) {
|
||||
const { icon, color } = doc
|
||||
const icons = [document.icon.Document, document.icon.Library]
|
||||
const icons = [document.icon.Document, document.icon.Teamspace]
|
||||
const update = async (result: any): Promise<void> => {
|
||||
if (result !== undefined && result !== null && doc !== undefined) {
|
||||
await client.update(doc, { icon: result.icon, color: result.color })
|
||||
|
@ -127,7 +127,7 @@
|
||||
}
|
||||
|
||||
function chooseIcon (ev: MouseEvent): void {
|
||||
const icons = [document.icon.Document, document.icon.Library]
|
||||
const icons = [document.icon.Document, document.icon.Teamspace]
|
||||
const update = (result: any): void => {
|
||||
if (result !== undefined && result !== null) {
|
||||
icon = result.icon
|
||||
|
@ -27,7 +27,7 @@
|
||||
<div class="flex-presenter cursor-default" class:inline-presenter={inline}>
|
||||
<div class="icon" class:emoji={value.icon === view.ids.IconWithEmoji}>
|
||||
<Icon
|
||||
icon={value.icon === view.ids.IconWithEmoji ? IconWithEmoji : value.icon ?? document.icon.Library}
|
||||
icon={value.icon === view.ids.IconWithEmoji ? IconWithEmoji : value.icon ?? document.icon.Teamspace}
|
||||
iconProps={value.icon === view.ids.IconWithEmoji
|
||||
? { icon: value.color }
|
||||
: {
|
||||
|
@ -44,7 +44,6 @@ export default mergeIds(documentId, document, {
|
||||
NoBaseVersion: '' as IntlString,
|
||||
DocumentApplication: '' as IntlString,
|
||||
MyDocuments: '' as IntlString,
|
||||
Library: '' as IntlString,
|
||||
Teamspace: '' as IntlString,
|
||||
Teamspaces: '' as IntlString,
|
||||
Labels: '' as IntlString,
|
||||
@ -88,7 +87,6 @@ export default mergeIds(documentId, document, {
|
||||
ReassignToDo: '' as IntlString,
|
||||
ReassignToDoConfirm: '' as IntlString,
|
||||
|
||||
Docs: '' as IntlString,
|
||||
Color: '' as IntlString,
|
||||
Icon: '' as IntlString
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright © 2022, 2023 Hardcore Engineering Inc.
|
||||
// Copyright © 2022-2024 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
|
||||
@ -13,121 +13,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Attachment } from '@hcengineering/attachment'
|
||||
import { AttachedDoc, Class, CollaborativeDoc, Doc, Ref, Space } from '@hcengineering/core'
|
||||
import type { Asset, Plugin, Resource } from '@hcengineering/platform'
|
||||
import { Preference } from '@hcengineering/preference'
|
||||
import { IntlString, plugin } from '@hcengineering/platform'
|
||||
import type { AnyComponent, Location, ResolvedLocation } from '@hcengineering/ui'
|
||||
import { Action, IconProps } from '@hcengineering/view'
|
||||
import { NotificationGroup, NotificationType } from '@hcengineering/notification'
|
||||
import { documentId, documentPlugin } from './plugin'
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Teamspace extends Space, IconProps {}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Document extends AttachedDoc<Document, 'children', Teamspace>, IconProps {
|
||||
attachedTo: Ref<Document>
|
||||
|
||||
name: string
|
||||
content: CollaborativeDoc
|
||||
|
||||
snapshots?: number
|
||||
|
||||
attachments?: number
|
||||
children?: number
|
||||
comments?: number
|
||||
embeddings?: number
|
||||
labels?: number
|
||||
references?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface DocumentSnapshot extends AttachedDoc<Document, 'snapshots', Teamspace> {
|
||||
attachedTo: Ref<Document>
|
||||
name: string
|
||||
content: CollaborativeDoc
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface SavedDocument extends Preference {
|
||||
attachedTo: Ref<Document>
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface DocumentEmbedding extends Attachment {
|
||||
attachedTo: Ref<Document>
|
||||
attachedToClass: Ref<Class<Document>>
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const documentId = 'document' as Plugin
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
const documentPlugin = plugin(documentId, {
|
||||
class: {
|
||||
Document: '' as Ref<Class<Document>>,
|
||||
DocumentSnapshot: '' as Ref<Class<DocumentSnapshot>>,
|
||||
DocumentEmbedding: '' as Ref<Class<DocumentEmbedding>>,
|
||||
SavedDocument: '' as Ref<Class<SavedDocument>>,
|
||||
Teamspace: '' as Ref<Class<Teamspace>>
|
||||
},
|
||||
component: {
|
||||
CreateDocument: '' as AnyComponent,
|
||||
DocumentSearchIcon: '' as AnyComponent
|
||||
},
|
||||
action: {
|
||||
CopyDocumentLink: '' as Ref<Action<Doc, any>>,
|
||||
CreateChildDocument: '' as Ref<Action>,
|
||||
CreateDocument: '' as Ref<Action>,
|
||||
EditTeamspace: '' as Ref<Action>
|
||||
},
|
||||
icon: {
|
||||
DocumentApplication: '' as Asset,
|
||||
NewDocument: '' as Asset,
|
||||
Document: '' as Asset,
|
||||
Add: '' as Asset,
|
||||
Blank: '' as Asset,
|
||||
Videofile: '' as Asset,
|
||||
Library: '' as Asset,
|
||||
Teamspace: '' as Asset,
|
||||
References: '' as Asset,
|
||||
History: '' as Asset,
|
||||
Star: '' as Asset,
|
||||
Starred: '' as Asset
|
||||
},
|
||||
space: {
|
||||
Documents: '' as Ref<Space>
|
||||
},
|
||||
app: {
|
||||
Documents: '' as Ref<Doc>
|
||||
},
|
||||
resolver: {
|
||||
Location: '' as Resource<(loc: Location) => Promise<ResolvedLocation | undefined>>
|
||||
},
|
||||
string: {
|
||||
ConfigLabel: '' as IntlString,
|
||||
CreateDocument: '' as IntlString
|
||||
},
|
||||
ids: {
|
||||
NoParent: '' as Ref<Document>,
|
||||
DocumentNotificationGroup: '' as Ref<NotificationGroup>,
|
||||
ContentNotification: '' as Ref<NotificationType>
|
||||
}
|
||||
})
|
||||
export * from './types'
|
||||
export { documentId }
|
||||
|
||||
export default documentPlugin
|
||||
|
83
plugins/document/src/plugin.ts
Normal file
83
plugins/document/src/plugin.ts
Normal file
@ -0,0 +1,83 @@
|
||||
//
|
||||
// Copyright © 2024 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 { Class, Doc, Ref, Space } from '@hcengineering/core'
|
||||
import { NotificationGroup, NotificationType } from '@hcengineering/notification'
|
||||
import type { Asset, Plugin, Resource } from '@hcengineering/platform'
|
||||
import { IntlString, plugin } from '@hcengineering/platform'
|
||||
import type { AnyComponent, Location, ResolvedLocation } from '@hcengineering/ui'
|
||||
import { Action, Viewlet } from '@hcengineering/view'
|
||||
import { Document, DocumentEmbedding, DocumentSnapshot, SavedDocument, Teamspace } from './types'
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const documentId = 'document' as Plugin
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const documentPlugin = plugin(documentId, {
|
||||
class: {
|
||||
Document: '' as Ref<Class<Document>>,
|
||||
DocumentSnapshot: '' as Ref<Class<DocumentSnapshot>>,
|
||||
DocumentEmbedding: '' as Ref<Class<DocumentEmbedding>>,
|
||||
SavedDocument: '' as Ref<Class<SavedDocument>>,
|
||||
Teamspace: '' as Ref<Class<Teamspace>>
|
||||
},
|
||||
component: {
|
||||
CreateDocument: '' as AnyComponent,
|
||||
DocumentSearchIcon: '' as AnyComponent
|
||||
},
|
||||
action: {
|
||||
CopyDocumentLink: '' as Ref<Action<Doc, any>>,
|
||||
CreateChildDocument: '' as Ref<Action>,
|
||||
CreateDocument: '' as Ref<Action>,
|
||||
EditTeamspace: '' as Ref<Action>
|
||||
},
|
||||
icon: {
|
||||
Document: '' as Asset,
|
||||
DocumentApplication: '' as Asset,
|
||||
Add: '' as Asset,
|
||||
Teamspace: '' as Asset,
|
||||
References: '' as Asset,
|
||||
History: '' as Asset,
|
||||
Star: '' as Asset,
|
||||
Starred: '' as Asset
|
||||
},
|
||||
space: {
|
||||
Documents: '' as Ref<Space>
|
||||
},
|
||||
app: {
|
||||
Documents: '' as Ref<Doc>
|
||||
},
|
||||
resolver: {
|
||||
Location: '' as Resource<(loc: Location) => Promise<ResolvedLocation | undefined>>
|
||||
},
|
||||
string: {
|
||||
ConfigLabel: '' as IntlString,
|
||||
CreateDocument: '' as IntlString
|
||||
},
|
||||
ids: {
|
||||
NoParent: '' as Ref<Document>,
|
||||
DocumentNotificationGroup: '' as Ref<NotificationGroup>,
|
||||
ContentNotification: '' as Ref<NotificationType>
|
||||
},
|
||||
viewlet: {
|
||||
TableBranches: '' as Ref<Viewlet>
|
||||
}
|
||||
})
|
||||
|
||||
export default documentPlugin
|
56
plugins/document/src/types.ts
Normal file
56
plugins/document/src/types.ts
Normal file
@ -0,0 +1,56 @@
|
||||
//
|
||||
// Copyright © 2024 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 { Attachment } from '@hcengineering/attachment'
|
||||
import { AttachedDoc, Class, CollaborativeDoc, Ref, Space } from '@hcengineering/core'
|
||||
import { Preference } from '@hcengineering/preference'
|
||||
import { IconProps } from '@hcengineering/view'
|
||||
|
||||
/** @public */
|
||||
export interface Teamspace extends Space, IconProps {}
|
||||
|
||||
/** @public */
|
||||
export interface Document extends AttachedDoc<Document, 'children', Teamspace>, IconProps {
|
||||
attachedTo: Ref<Document>
|
||||
|
||||
name: string
|
||||
content: CollaborativeDoc
|
||||
|
||||
snapshots?: number
|
||||
attachments?: number
|
||||
children?: number
|
||||
comments?: number
|
||||
embeddings?: number
|
||||
labels?: number
|
||||
references?: number
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface DocumentSnapshot extends AttachedDoc<Document, 'snapshots', Teamspace> {
|
||||
attachedTo: Ref<Document>
|
||||
name: string
|
||||
content: CollaborativeDoc
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface SavedDocument extends Preference {
|
||||
attachedTo: Ref<Document>
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface DocumentEmbedding extends Attachment {
|
||||
attachedTo: Ref<Document>
|
||||
attachedToClass: Ref<Class<Document>>
|
||||
}
|
Loading…
Reference in New Issue
Block a user