diff --git a/models/all/src/migration.ts b/models/all/src/migration.ts index 93b86e7bd7..727ad48eb4 100644 --- a/models/all/src/migration.ts +++ b/models/all/src/migration.ts @@ -34,6 +34,7 @@ import { trackerOperation } from '@hcengineering/model-tracker' import { boardOperation } from '@hcengineering/model-board' import { demoOperation } from '@hcengineering/model-demo' import { hrOperation } from '@hcengineering/model-hr' +import { documentOperation } from '@hcengineering/model-document' export const migrateOperations: MigrateOperation[] = [ coreOperation, @@ -54,5 +55,6 @@ export const migrateOperations: MigrateOperation[] = [ settingOperation, trackerOperation, boardOperation, - hrOperation + hrOperation, + documentOperation ] diff --git a/models/document/package.json b/models/document/package.json index 342930e92a..74fd32dbd3 100644 --- a/models/document/package.json +++ b/models/document/package.json @@ -39,6 +39,7 @@ "@hcengineering/document": "^0.6.0", "@hcengineering/document-resources": "^0.6.0", "@hcengineering/view": "^0.6.1", - "@hcengineering/contact": "~0.6.5" + "@hcengineering/contact": "~0.6.5", + "@hcengineering/tags": "~0.6.2" } } diff --git a/models/document/src/index.ts b/models/document/src/index.ts index 79861d5f42..b93b063966 100644 --- a/models/document/src/index.ts +++ b/models/document/src/index.ts @@ -13,11 +13,12 @@ // limitations under the License. // -import { Employee } from '@hcengineering/contact' +import contact, { Employee } from '@hcengineering/contact' import type { Class, Domain, Markup, Ref } from '@hcengineering/core' import { IndexKind } from '@hcengineering/core' import { Document, documentId, DocumentVersion, RichDocumentContent, Step } from '@hcengineering/document' import { + ArrOf, Builder, Collection, Hidden, @@ -36,17 +37,20 @@ import core, { TAttachedDoc, TDoc } from '@hcengineering/model-core' import presentation from '@hcengineering/model-presentation' import view, { actionTemplates, createAction } from '@hcengineering/model-view' import workbench from '@hcengineering/model-workbench' +import tags from '@hcengineering/tags' import document from './plugin' export const DOMAIN_DOCUMENT = 'document' as Domain @Model(document.class.RichDocumentContent, core.class.AttachedDoc, DOMAIN_DOCUMENT) +@UX(document.string.Document) export class TRichDocumentContent extends TAttachedDoc implements RichDocumentContent { steps!: Step[] version!: number } @Model(document.class.DocumentVersion, core.class.AttachedDoc, DOMAIN_DOCUMENT) +@UX(document.string.Version) export class TDocumentVersion extends TAttachedDoc implements DocumentVersion { @Prop(TypeNumber(), document.string.Version) @ReadOnly() @@ -79,6 +83,9 @@ export class TDocument extends TDoc implements Document { @Prop(Collection(chunter.class.Comment), chunter.string.Comments) comments?: number + @Prop(Collection(tags.class.TagReference), document.string.Labels) + labels?: number + @Prop(TypeRef(core.class.Class), core.string.ClassLabel) declare _class: Ref> @@ -98,35 +105,92 @@ export class TDocument extends TDoc implements Document { @ReadOnly() @Hidden() versionCounter!: number + + @Prop(ArrOf(TypeRef(contact.class.Employee)), document.string.Responsible) + responsible!: Ref[] } export function createModel (builder: Builder): void { builder.createModel(TDocument, TRichDocumentContent, TDocumentVersion) - builder.mixin(document.class.Document, core.class.Class, view.mixin.ObjectFactory, { - component: document.component.CreateDocument - }) - builder.createDoc( workbench.class.Application, core.space.Model, { - label: document.string.Documents, + label: document.string.DocumentApplication, icon: document.icon.DocumentApplication, alias: documentId, hidden: false, - component: document.component.Documents + navigatorModel: { + specials: [ + { + id: 'my-documents', + position: 'top', + label: document.string.MyDocuments, + icon: document.icon.Document, + component: document.component.MyDocuments + }, + { + id: 'library', + position: 'top', + label: document.string.Library, + icon: document.icon.Document, + component: document.component.Documents + } + ], + spaces: [] + }, + navHeaderComponent: document.component.NewDocumentHeader }, document.app.Documents ) + builder.mixin(document.class.Document, core.class.Class, view.mixin.ObjectFactory, { + component: document.component.CreateDocument + }) + + builder.mixin(document.class.Document, core.class.Class, view.mixin.ClassFilters, { + filters: ['_class', 'modifiedOn'] + }) + builder.createDoc( view.class.Viewlet, core.space.Model, { attachTo: document.class.Document, descriptor: view.viewlet.Table, - config: ['', 'comments', 'attachments', 'modifiedOn'], + config: [ + '', + { + key: '', + presenter: document.component.Status, + label: document.string.Status + }, + { + key: '', + presenter: document.component.Version, + label: document.string.Version + }, + { + key: '', + presenter: document.component.Revision, + label: document.string.Revision + }, + 'comments', + 'attachments', + { + key: '', + presenter: tags.component.TagsPresenter, + label: document.string.Labels, + sortingKey: 'labels', + props: { + _class: document.class.Document, + key: 'labels', + icon: document.icon.Document + } + }, + 'modifiedOn' + ], options: { lookup: { _id: { @@ -173,5 +237,5 @@ export function createModel (builder: Builder): void { }) } -export { contactOperation } from './migration' +export { documentOperation } from './migration' export { document as default } diff --git a/models/document/src/migration.ts b/models/document/src/migration.ts index d443380d98..5433ba2d97 100644 --- a/models/document/src/migration.ts +++ b/models/document/src/migration.ts @@ -14,8 +14,9 @@ // import { TxOperations } from '@hcengineering/core' -import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model' +import { createOrUpdate, MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model' import core from '@hcengineering/model-core' +import tags from '@hcengineering/tags' import document from './index' async function createSpace (tx: TxOperations): Promise { @@ -38,10 +39,24 @@ async function createSpace (tx: TxOperations): Promise { } } -export const contactOperation: MigrateOperation = { +export const documentOperation: MigrateOperation = { async migrate (client: MigrationClient): Promise {}, async upgrade (client: MigrationUpgradeClient): Promise { const tx = new TxOperations(client, core.account.System) await createSpace(tx) + + await createOrUpdate( + tx, + tags.class.TagCategory, + tags.space.Tags, + { + icon: tags.icon.Tags, + label: 'Labels', + targetClass: document.class.Document, + tags: [], + default: true + }, + document.category.Other + ) } } diff --git a/models/document/src/plugin.ts b/models/document/src/plugin.ts index 4bb87b6007..9e09993205 100644 --- a/models/document/src/plugin.ts +++ b/models/document/src/plugin.ts @@ -19,6 +19,7 @@ import { documentId } from '@hcengineering/document' import document from '@hcengineering/document-resources/src/plugin' import { ObjectSearchCategory, ObjectSearchFactory } from '@hcengineering/model-presentation' import { mergeIds, Resource } from '@hcengineering/platform' +import { TagCategory } from '@hcengineering/tags' import { AnyComponent } from '@hcengineering/ui' import { ActionCategory } from '@hcengineering/view' @@ -34,7 +35,8 @@ export default mergeIds(documentId, document, { DocumentQueryCategory: '' as Ref }, category: { - Document: '' as Ref + Document: '' as Ref, + Other: '' as Ref }, viewlet: { TableDocument: '' as Ref diff --git a/plugins/document-assets/lang/en.json b/plugins/document-assets/lang/en.json index 54249463eb..64381f483e 100644 --- a/plugins/document-assets/lang/en.json +++ b/plugins/document-assets/lang/en.json @@ -17,6 +17,16 @@ "CreateDocumentVersion": "Review content version", "ApprovedBy": "Approved by", "Status": "Status", - "LastRevision": "Last revision" + "LastRevision": "Last revision", + "DocumentApplication": "Documents", + "MyDocuments": "My documents", + "Library": "Library", + "Labels": "Labels", + "AddLabel": "Add label...", + "Responsible": "Responsible", + + "PendingReview": "Pending", + "Latest": "Actual", + "Draft": "Draft" } } \ No newline at end of file diff --git a/plugins/document-assets/lang/ru.json b/plugins/document-assets/lang/ru.json index c7bc568e98..935a6c0197 100644 --- a/plugins/document-assets/lang/ru.json +++ b/plugins/document-assets/lang/ru.json @@ -17,6 +17,16 @@ "CreateDocumentVersion": "Оцените версию документа", "ApprovedBy": "Подтверждено", "Status": "Статус", - "LastRevision": "Последняя ревизия" - } + "LastRevision": "Последняя ревизия", + "DocumentApplication": "Документы", + "MyDocuments": "Мои документы", + "Library": "Библиотека", + "Labels": "Метки", + "AddLabel": "Добавить метку...", + "Responsible": "Ответственные", + + "PendingReview": "Ожидает", + "Latest": "Актуальная", + "Draft": "Драфт" + } } \ No newline at end of file diff --git a/plugins/document-resources/package.json b/plugins/document-resources/package.json index af2af0d410..61c17413ee 100644 --- a/plugins/document-resources/package.json +++ b/plugins/document-resources/package.json @@ -59,6 +59,8 @@ "emoji-regex": "^10.1.0", "prosemirror-collab": "~1.3.0", "prosemirror-state": "~1.4.1", - "prosemirror-transform": "~1.7.0" + "prosemirror-transform": "~1.7.0", + "@hcengineering/contact": "~0.6.5", + "@hcengineering/tags": "~0.6.2" } } diff --git a/plugins/document-resources/src/components/CreateDocument.svelte b/plugins/document-resources/src/components/CreateDocument.svelte index dd1c77e33d..01a21c9bad 100644 --- a/plugins/document-resources/src/components/CreateDocument.svelte +++ b/plugins/document-resources/src/components/CreateDocument.svelte @@ -15,7 +15,8 @@ // --> {#if value} @@ -48,17 +34,5 @@ {value.name} - - {#if lastVersion} - - {lastVersion.version} - {#if lastVersion.sequenceNumber !== value.editSequence} - ( {/if} diff --git a/plugins/document-resources/src/components/Documents.svelte b/plugins/document-resources/src/components/Documents.svelte index a878a1910b..7e73ef61a2 100644 --- a/plugins/document-resources/src/components/Documents.svelte +++ b/plugins/document-resources/src/components/Documents.svelte @@ -16,27 +16,20 @@ --> @@ -93,18 +82,11 @@ { - updateResultQuery(search) + updateResultQuery(search, query) }} />
-
diff --git a/plugins/document-resources/src/components/EditDoc.svelte b/plugins/document-resources/src/components/EditDoc.svelte index 375307bf95..f2cce6a849 100644 --- a/plugins/document-resources/src/components/EditDoc.svelte +++ b/plugins/document-resources/src/components/EditDoc.svelte @@ -22,12 +22,13 @@ import { Panel } from '@hcengineering/panel' import { getResource } from '@hcengineering/platform' import presentation, { createQuery, getClient } from '@hcengineering/presentation' + import tags from '@hcengineering/tags' import { Button, + Component, EditBox, eventToHTMLElement, - Grid, IconAdd, IconEdit, IconMoreH, @@ -279,7 +280,18 @@
- +
+ + +
+ +
+
+ @@ -289,7 +301,7 @@
{/if} @@ -301,10 +313,6 @@ color: var(--theme-caption-color); } - .content { - height: auto; - } - .description-preview { color: var(--theme-content-color); line-height: 150%; @@ -313,13 +321,6 @@ color: var(--theme-content-trans-color); } } - .divider { - margin-top: 1rem; - margin-bottom: 1rem; - grid-column: 1 / 3; - height: 1px; - background-color: var(--divider-color); - } .tool { align-self: start; @@ -331,4 +332,25 @@ opacity: 1; } } + + .tab-content { + display: grid; + grid-template-columns: 1fr 1.5fr; + grid-auto-flow: row; + justify-content: start; + align-items: center; + gap: 1rem; + margin-top: 1rem; + width: 100%; + height: min-content; + } + + .divider { + grid-column: 1 / 3; + height: 1px; + background-color: var(--divider-color); + } + .labelTop { + align-self: start; + } diff --git a/plugins/document-resources/src/components/MyDocuments.svelte b/plugins/document-resources/src/components/MyDocuments.svelte new file mode 100644 index 0000000000..51fd143c55 --- /dev/null +++ b/plugins/document-resources/src/components/MyDocuments.svelte @@ -0,0 +1,9 @@ + + + diff --git a/plugins/document-resources/src/components/NewDocumentHeader.svelte b/plugins/document-resources/src/components/NewDocumentHeader.svelte new file mode 100644 index 0000000000..208140c50e --- /dev/null +++ b/plugins/document-resources/src/components/NewDocumentHeader.svelte @@ -0,0 +1,35 @@ + + + +
+
+
+
diff --git a/plugins/document-resources/src/components/Revision.svelte b/plugins/document-resources/src/components/Revision.svelte new file mode 100644 index 0000000000..bc828df4b7 --- /dev/null +++ b/plugins/document-resources/src/components/Revision.svelte @@ -0,0 +1,45 @@ + + + +{#if value} +
+ {#if lastVersion} + {lastVersion.sequenceNumber}/ + {/if} + {value.editSequence} +
+{/if} diff --git a/plugins/document-resources/src/components/Status.svelte b/plugins/document-resources/src/components/Status.svelte new file mode 100644 index 0000000000..459467f2db --- /dev/null +++ b/plugins/document-resources/src/components/Status.svelte @@ -0,0 +1,78 @@ + + + +{#if value} +
+ {#if value.versions === 0} +
+
+ {/if} + {#if value.editSequence !== lastVersion?.sequenceNumber} +
+
+ {/if} + {#if value.editSequence === lastVersion?.sequenceNumber} +
+
+ {/if} +
+{/if} + + diff --git a/plugins/document-resources/src/components/Version.svelte b/plugins/document-resources/src/components/Version.svelte new file mode 100644 index 0000000000..be4a3bd8f6 --- /dev/null +++ b/plugins/document-resources/src/components/Version.svelte @@ -0,0 +1,40 @@ + + + +{#if lastVersion} + {lastVersion.version} +{/if} diff --git a/plugins/document-resources/src/index.ts b/plugins/document-resources/src/index.ts index feecd945e2..21202f7ba8 100644 --- a/plugins/document-resources/src/index.ts +++ b/plugins/document-resources/src/index.ts @@ -22,9 +22,14 @@ import CreateDocument from './components/CreateDocument.svelte' import DocumentPresenter from './components/DocumentPresenter.svelte' import DocumentVersionPresenter from './components/DocumentVersionPresenter.svelte' import Documents from './components/Documents.svelte' +import MyDocuments from './components/MyDocuments.svelte' import DocumentVersions from './components/DocumentVersions.svelte' import EditDoc from './components/EditDoc.svelte' import DocumentItem from './components/DocumentItem.svelte' +import NewDocumentHeader from './components/NewDocumentHeader.svelte' +import Status from './components/Status.svelte' +import Revision from './components/Revision.svelte' +import Version from './components/Version.svelte' import document from './plugin' @@ -70,7 +75,12 @@ export default async (): Promise => ({ Documents, EditDoc, DocumentVersions, - DocumentVersionPresenter + DocumentVersionPresenter, + NewDocumentHeader, + MyDocuments, + Status, + Revision, + Version }, completion: { DocumentQuery: async ( diff --git a/plugins/document-resources/src/plugin.ts b/plugins/document-resources/src/plugin.ts index 7d408f0889..0bb70bde11 100644 --- a/plugins/document-resources/src/plugin.ts +++ b/plugins/document-resources/src/plugin.ts @@ -19,7 +19,12 @@ import { AnyComponent } from '@hcengineering/ui' export default mergeIds(documentId, document, { component: { - EditDoc: '' as AnyComponent + EditDoc: '' as AnyComponent, + MyDocuments: '' as AnyComponent, + NewDocumentHeader: '' as AnyComponent, + Status: '' as AnyComponent, + Version: '' as AnyComponent, + Revision: '' as AnyComponent }, string: { Apply: '' as IntlString, @@ -39,6 +44,16 @@ export default mergeIds(documentId, document, { CreateDocumentVersion: '' as IntlString, ApprovedBy: '' as IntlString, Status: '' as IntlString, - LastRevision: '' as IntlString + LastRevision: '' as IntlString, + DocumentApplication: '' as IntlString, + MyDocuments: '' as IntlString, + Library: '' as IntlString, + Labels: '' as IntlString, + Responsible: '' as IntlString, + AddLabel: '' as IntlString, + + PendingReview: '' as IntlString, + Latest: '' as IntlString, + Draft: '' as IntlString } }) diff --git a/plugins/document/src/index.ts b/plugins/document/src/index.ts index 004569841f..ab5051b84c 100644 --- a/plugins/document/src/index.ts +++ b/plugins/document/src/index.ts @@ -58,6 +58,9 @@ export interface Document extends Doc { attachments?: number comments?: number labels?: number + + // List of reponsible persons, for document. + responsible: Ref[] } /**