Add TypeIdentifier

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2025-10-21 18:25:38 +05:00
parent a0fb0a7b74
commit 0643a1fc9c
3 changed files with 26 additions and 3 deletions
+11
View File
@@ -338,6 +338,13 @@ export interface TypeDate extends Type<Date> {
withShift: boolean
}
/**
* @public
*/
export interface TypeIdentifier extends Type<string> {
of: Ref<CustomSequence>
}
/**
* @public
*/
@@ -628,6 +635,10 @@ export interface Sequence extends Doc {
sequence: number
}
export interface CustomSequence extends Sequence {
prefix: string
}
/**
* @public
*/
+3
View File
@@ -49,6 +49,7 @@ import type {
Relation,
Role,
Sequence,
CustomSequence,
Space,
SpaceType,
SpaceTypeDescriptor,
@@ -145,6 +146,7 @@ export default plugin(coreId, {
TypeCollaborativeDoc: '' as Ref<Class<Type<MarkupBlobRef>>>,
TypePersonId: '' as Ref<Class<Type<string>>>,
TypeAccountUuid: '' as Ref<Class<Type<string>>>,
TypeIdentifier: '' as Ref<Class<Type<string>>>,
RefTo: '' as Ref<Class<RefTo<Doc>>>,
ArrOf: '' as Ref<Class<ArrOf<Doc>>>,
Enum: '' as Ref<Class<Enum>>,
@@ -169,6 +171,7 @@ export default plugin(coreId, {
Association: '' as Ref<Class<Association>>,
Relation: '' as Ref<Class<Relation>>,
Sequence: '' as Ref<Class<Sequence>>,
CustomSequence: '' as Ref<Class<CustomSequence>>,
ClassCollaborators: '' as Ref<Class<ClassCollaborators<Doc>>>,
Collaborator: '' as Ref<Class<Collaborator>>
},
+12 -3
View File
@@ -14,12 +14,13 @@
//
import core, {
type PersonId,
type AccountUuid,
type AttachedDoc,
type Attribute,
type Class,
type Classifier,
ClassifierKind,
CustomSequence,
type Data,
DateRangeMode,
type Doc,
@@ -35,6 +36,7 @@ import core, {
type MarkupBlobRef,
type MixinData,
type Obj,
type PersonId,
type PropertyType,
type Rank,
type Ref,
@@ -50,9 +52,9 @@ import core, {
type ArrOf as TypeArrOf,
type Collection as TypeCollection,
type TypeDate as TypeDateType,
type TypeIdentifier as TypeIdentifierType,
type TypeNumber as TypeNumberType,
generateId,
type AccountUuid
generateId
} from '@hcengineering/core'
import type { Asset, IntlString } from '@hcengineering/platform'
import toposort from 'toposort'
@@ -467,6 +469,13 @@ export function TypeRef (_class: Ref<Class<Doc>>): RefTo<Doc> {
return { _class: core.class.RefTo, label: core.string.Ref, icon: core.icon.TypeRef, to: _class }
}
/**
* @public
*/
export function TypeIdentifier (of: Ref<CustomSequence>): TypeIdentifierType {
return { _class: core.class.TypeIdentifier, label: core.string.Id, icon: core.icon.TypeRef, of }
}
/**
* @public
*/