1414import activity from '@hcengineering/activity'
1515import { CardEvents , cardId , type Card , type MasterTag , type Tag } from '@hcengineering/card'
1616import chunter from '@hcengineering/chunter'
17+ import contact from '@hcengineering/contact'
1718import core , {
1819 AccountRole ,
20+ DOMAIN_MODEL ,
21+ IndexKind ,
1922 type CollectionSize ,
2023 type Domain ,
2124 type MarkupBlobRef ,
@@ -24,12 +27,12 @@ import core, {
2427} from '@hcengineering/core'
2528import {
2629 Collection ,
30+ Index ,
2731 Model ,
2832 Prop ,
2933 TypeCollaborativeDoc ,
3034 TypeRef ,
3135 TypeString ,
32- UX ,
3336 type Builder
3437} from '@hcengineering/model'
3538import attachment from '@hcengineering/model-attachment'
@@ -38,8 +41,9 @@ import presentation from '@hcengineering/model-presentation'
3841import setting from '@hcengineering/model-setting'
3942import view , { createAction } from '@hcengineering/model-view'
4043import workbench from '@hcengineering/model-workbench'
41- import { getEmbeddedLabel } from '@hcengineering/platform'
44+ import { getEmbeddedLabel , type IntlString } from '@hcengineering/platform'
4245import time , { type ToDo } from '@hcengineering/time'
46+ import { type AnyComponent } from '@hcengineering/ui'
4347import card from './plugin'
4448
4549export { cardId } from '@hcengineering/card'
@@ -53,12 +57,12 @@ export class TMasterTag extends TClass implements MasterTag {}
5357export class TTag extends TMixin implements Tag { }
5458
5559@Model ( card . class . Card , core . class . Doc , DOMAIN_CARD )
56- @UX ( card . string . Card )
5760export class TCard extends TDoc implements Card {
5861 @Prop ( TypeRef ( card . class . MasterTag ) , card . string . MasterTag )
5962 declare _class : Ref < MasterTag >
6063
6164 @Prop ( TypeString ( ) , core . string . Name )
65+ @Index ( IndexKind . FullText )
6266 title ! : string
6367
6468 @Prop ( TypeCollaborativeDoc ( ) , card . string . Content )
@@ -75,8 +79,15 @@ export class TCard extends TDoc implements Card {
7579 todos ?: CollectionSize < ToDo >
7680}
7781
82+ @Model ( card . class . MasterTagEditorSection , core . class . Doc , DOMAIN_MODEL )
83+ export class MasterTagEditorSection extends TDoc implements MasterTagEditorSection {
84+ id ! : string
85+ label ! : IntlString
86+ component ! : AnyComponent
87+ }
88+
7889export function createModel ( builder : Builder ) : void {
79- builder . createModel ( TMasterTag , TTag , TCard )
90+ builder . createModel ( TMasterTag , TTag , TCard , MasterTagEditorSection )
8091
8192 builder . createDoc (
8293 workbench . class . Application ,
@@ -113,20 +124,6 @@ export function createModel (builder: Builder): void {
113124 card . viewlet . CardTable
114125 )
115126
116- builder . createDoc (
117- setting . class . WorkspaceSettingCategory ,
118- core . space . Model ,
119- {
120- name : 'masterTags' ,
121- label : card . string . Tags ,
122- icon : card . icon . Tags ,
123- role : AccountRole . User ,
124- component : card . component . MasterTags ,
125- order : 4400
126- } ,
127- card . ids . MasterTags
128- )
129-
130127 builder . mixin ( card . class . Card , core . class . Class , view . mixin . ObjectPresenter , {
131128 presenter : card . component . CardPresenter
132129 } )
@@ -268,11 +265,55 @@ export function createModel (builder: Builder): void {
268265 }
269266 } )
270267
268+ builder . createDoc (
269+ setting . class . WorkspaceSettingCategory ,
270+ core . space . Model ,
271+ {
272+ name : 'tagrelation' ,
273+ label : card . string . TagRelations ,
274+ icon : setting . icon . Relations ,
275+ props : { _classes : [ card . class . Card , contact . class . Contact ] , exclude : [ ] } ,
276+ component : setting . component . RelationSetting ,
277+ group : 'settings-editor' ,
278+ role : AccountRole . Maintainer ,
279+ order : 4501
280+ } ,
281+ card . ids . TagRelations
282+ )
283+
284+ builder . createDoc (
285+ setting . class . SettingsCategory ,
286+ core . space . Model ,
287+ {
288+ name : 'masterTags' ,
289+ label : card . string . MasterTags ,
290+ icon : card . icon . Card ,
291+ component : card . component . ManageMasterTagsContent ,
292+ extraComponents : {
293+ navigation : card . component . ManageMasterTags ,
294+ tools : card . component . ManageMasterTagsTools
295+ } ,
296+ group : 'settings-editor' ,
297+ role : AccountRole . User ,
298+ order : 5000 ,
299+ expandable : true
300+ } ,
301+ card . ids . ManageMasterTags
302+ )
303+
271304 builder . mixin ( card . class . Card , core . class . Class , view . mixin . ClassFilters , {
272305 filters : [ ] ,
273306 ignoreKeys : [ 'parent' ]
274307 } )
275308
309+ builder . createDoc ( core . class . FullTextSearchContext , core . space . Model , {
310+ toClass : card . class . Card ,
311+ fullTextSummary : true ,
312+ forceIndex : true ,
313+ childProcessingAllowed : true ,
314+ propagate : [ ]
315+ } )
316+
276317 builder . createDoc (
277318 presentation . class . ObjectSearchCategory ,
278319 core . space . Model ,
@@ -283,10 +324,42 @@ export function createModel (builder: Builder): void {
283324 query : card . completion . CardQuery ,
284325 context : [ 'search' , 'mention' , 'spotlight' ] ,
285326 classToSearch : card . class . Card ,
327+ includeChilds : true ,
286328 priority : 500
287329 } ,
288330 card . completion . CardCategory
289331 )
332+
333+ builder . createDoc ( card . class . MasterTagEditorSection , core . space . Model , {
334+ id : 'general' ,
335+ label : setting . string . General ,
336+ component : card . component . GeneralSection
337+ } )
338+
339+ builder . createDoc ( card . class . MasterTagEditorSection , core . space . Model , {
340+ id : 'properties' ,
341+ label : setting . string . Properties ,
342+ component : card . component . ProperitiesSection
343+ } )
344+
345+ builder . createDoc ( card . class . MasterTagEditorSection , core . space . Model , {
346+ id : 'tags' ,
347+ label : card . string . Tags ,
348+ component : card . component . TagsSection
349+ } )
350+
351+ builder . createDoc ( card . class . MasterTagEditorSection , core . space . Model , {
352+ id : 'childs' ,
353+ label : card . string . MasterTags ,
354+ masterOnly : true ,
355+ component : card . component . ChildsSection
356+ } )
357+
358+ builder . createDoc ( card . class . MasterTagEditorSection , core . space . Model , {
359+ id : 'relations' ,
360+ label : core . string . Relations ,
361+ component : card . component . RelationsSection
362+ } )
290363}
291364
292365export default card
0 commit comments