mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
make UXObject
s label
mandatory
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
dbbe33045e
commit
8d4d052a5d
@ -40,7 +40,7 @@ export class TTypeChannels extends TType {}
|
||||
* @public
|
||||
*/
|
||||
export function TypeChannels (): Type<Channel[]> {
|
||||
return { _class: contact.class.TypeChannels }
|
||||
return { _class: contact.class.TypeChannels, label: 'TypeChannels' as IntlString }
|
||||
}
|
||||
|
||||
@Model(contact.class.Contact, core.class.Doc, DOMAIN_CONTACT)
|
||||
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { IntlString } from '@anticrm/platform'
|
||||
import type { Account, AnyAttribute, Class, ClassifierKind, Doc, Domain, Mixin, Obj, Ref, Space, Timestamp, Type } from '@anticrm/core'
|
||||
import { DOMAIN_MODEL } from '@anticrm/core'
|
||||
import { Model } from '@anticrm/model'
|
||||
@ -35,6 +36,7 @@ export class TDoc extends TObj implements Doc {
|
||||
@Model(core.class.Class, core.class.Doc, DOMAIN_MODEL)
|
||||
export class TClass extends TDoc implements Class<Obj> {
|
||||
kind!: ClassifierKind
|
||||
label!: IntlString
|
||||
extends!: Ref<Class<Obj>>
|
||||
domain!: Domain
|
||||
}
|
||||
@ -47,10 +49,13 @@ export class TAttribute extends TDoc implements AnyAttribute {
|
||||
attributeOf!: Ref<Class<Obj>>
|
||||
name!: string
|
||||
type!: Type<any>
|
||||
label!: IntlString
|
||||
}
|
||||
|
||||
@Model(core.class.Type, core.class.Doc)
|
||||
export class TType extends TDoc implements Type<any> {}
|
||||
export class TType extends TDoc implements Type<any> {
|
||||
label!: IntlString
|
||||
}
|
||||
|
||||
@Model(core.class.TypeString, core.class.Type)
|
||||
export class TTypeString extends TType {}
|
||||
|
@ -47,6 +47,7 @@ export class TObjectEditor extends TClass implements ObjectEditor {
|
||||
@Model(view.class.ViewletDescriptor, core.class.Doc, DOMAIN_MODEL)
|
||||
export class TViewletDescriptor extends TDoc implements ViewletDescriptor {
|
||||
component!: AnyComponent
|
||||
label!: IntlString
|
||||
}
|
||||
|
||||
@Model(view.class.Viewlet, core.class.Doc, DOMAIN_MODEL)
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Plugin } from '@anticrm/platform'
|
||||
import type { Plugin, IntlString } from '@anticrm/platform'
|
||||
import { plugin } from '@anticrm/platform'
|
||||
import type { Class, Data, Doc, Obj, Ref, Mixin, Arr } from '../classes'
|
||||
import { ClassifierKind, DOMAIN_MODEL } from '../classes'
|
||||
@ -48,18 +48,18 @@ export const test = plugin('test' as Plugin, {
|
||||
export function genMinModel (): TxCUD<Doc>[] {
|
||||
const txes = []
|
||||
// Fill Tx'es with basic model classes.
|
||||
txes.push(createClass(core.class.Obj, { kind: ClassifierKind.CLASS }))
|
||||
txes.push(createClass(core.class.Doc, { extends: core.class.Obj, kind: ClassifierKind.CLASS }))
|
||||
txes.push(createClass(core.class.Class, { extends: core.class.Doc, kind: ClassifierKind.CLASS, domain: DOMAIN_MODEL }))
|
||||
txes.push(createClass(core.class.Space, { extends: core.class.Doc, kind: ClassifierKind.CLASS, domain: DOMAIN_MODEL }))
|
||||
txes.push(createClass(core.class.Account, { extends: core.class.Doc, kind: ClassifierKind.CLASS, domain: DOMAIN_MODEL }))
|
||||
txes.push(createClass(core.class.Obj, { label: 'Obj' as IntlString, kind: ClassifierKind.CLASS }))
|
||||
txes.push(createClass(core.class.Doc, { label: 'Doc' as IntlString, extends: core.class.Obj, kind: ClassifierKind.CLASS }))
|
||||
txes.push(createClass(core.class.Class, { label: 'Class' as IntlString, extends: core.class.Doc, kind: ClassifierKind.CLASS, domain: DOMAIN_MODEL }))
|
||||
txes.push(createClass(core.class.Space, { label: 'Space' as IntlString, extends: core.class.Doc, kind: ClassifierKind.CLASS, domain: DOMAIN_MODEL }))
|
||||
txes.push(createClass(core.class.Account, { label: 'Account' as IntlString, extends: core.class.Doc, kind: ClassifierKind.CLASS, domain: DOMAIN_MODEL }))
|
||||
|
||||
txes.push(createClass(core.class.Tx, { extends: core.class.Doc, kind: ClassifierKind.CLASS, domain: DOMAIN_TX }))
|
||||
txes.push(createClass(core.class.TxCreateDoc, { extends: core.class.Tx, kind: ClassifierKind.CLASS }))
|
||||
txes.push(createClass(core.class.TxUpdateDoc, { extends: core.class.Tx, kind: ClassifierKind.CLASS }))
|
||||
txes.push(createClass(core.class.TxRemoveDoc, { extends: core.class.Tx, kind: ClassifierKind.CLASS }))
|
||||
txes.push(createClass(core.class.Tx, { label: 'Tx' as IntlString, extends: core.class.Doc, kind: ClassifierKind.CLASS, domain: DOMAIN_TX }))
|
||||
txes.push(createClass(core.class.TxCreateDoc, { label: 'TxCreateDoc' as IntlString, extends: core.class.Tx, kind: ClassifierKind.CLASS }))
|
||||
txes.push(createClass(core.class.TxUpdateDoc, { label: 'TxUpdateDoc' as IntlString, extends: core.class.Tx, kind: ClassifierKind.CLASS }))
|
||||
txes.push(createClass(core.class.TxRemoveDoc, { label: 'TxRemoveDoc' as IntlString, extends: core.class.Tx, kind: ClassifierKind.CLASS }))
|
||||
|
||||
txes.push(createClass(test.mixin.TestMixin, { extends: core.class.Doc, kind: ClassifierKind.MIXIN }))
|
||||
txes.push(createClass(test.mixin.TestMixin, { label: 'TestMixin' as IntlString, extends: core.class.Doc, kind: ClassifierKind.MIXIN }))
|
||||
|
||||
txes.push(
|
||||
createDoc(core.class.Space, {
|
||||
|
@ -57,7 +57,7 @@ export type PropertyType = any
|
||||
* @public
|
||||
*/
|
||||
export interface UXObject extends Obj {
|
||||
label?: IntlString
|
||||
label: IntlString
|
||||
icon?: Asset
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { IntlString } from '@anticrm/platform'
|
||||
import type { Class, Ref, Obj, Doc } from '@anticrm/core'
|
||||
import { Model, Prop, TypeString, Builder } from '../dsl'
|
||||
import core from '@anticrm/core'
|
||||
@ -34,7 +35,7 @@ describe('dsl', () => {
|
||||
@Model('class:test.MyClass' as Ref<Class<Obj>>, core.class.Doc)
|
||||
class MyClass {
|
||||
_class!: Ref<Class<MyClass>>
|
||||
@Prop(TypeString()) name!: string
|
||||
@Prop(TypeString(), 'name' as IntlString) name!: string
|
||||
}
|
||||
const builder = new Builder()
|
||||
builder.createModel(MyClass)
|
||||
@ -76,14 +77,14 @@ describe('dsl', () => {
|
||||
@Model('class:test.MyClass' as Ref<Class<Obj>>, core.class.Doc)
|
||||
class MyClass {
|
||||
_class!: Ref<Class<MyClass>>
|
||||
@Prop(TypeString()) name!: string
|
||||
@Prop(TypeString(), 'name' as IntlString) name!: string
|
||||
}
|
||||
@Model(
|
||||
'class:test.MyClass2' as Ref<Class<Obj>>,
|
||||
'class:test.MyClass' as Ref<Class<Obj>>
|
||||
)
|
||||
class MyClass2 extends MyClass {
|
||||
@Prop(TypeString()) lastName!: string
|
||||
@Prop(TypeString(), 'lastName' as IntlString) lastName!: string
|
||||
}
|
||||
|
||||
const valid = [
|
||||
|
@ -54,7 +54,7 @@ interface ClassTxes {
|
||||
_id: Ref<Class<Obj>>
|
||||
extends?: Ref<Class<Obj>>
|
||||
domain?: Domain
|
||||
label?: IntlString
|
||||
label: IntlString
|
||||
icon?: Asset
|
||||
txes: Array<NoIDs<Tx>>
|
||||
kind: ClassifierKind
|
||||
@ -79,7 +79,7 @@ function getTxes (target: any): ClassTxes {
|
||||
* @param icon -
|
||||
* @returns
|
||||
*/
|
||||
export function Prop (type: Type<PropertyType>, label?: IntlString, icon?: Asset) {
|
||||
export function Prop (type: Type<PropertyType>, label: IntlString, icon?: Asset) {
|
||||
return function (target: any, propertyKey: string): void {
|
||||
const txes = getTxes(target)
|
||||
const tx: NoIDs<TxCreateDoc<Attribute<PropertyType>>> = {
|
||||
@ -268,19 +268,19 @@ export class Builder {
|
||||
* @public
|
||||
*/
|
||||
export function TypeString (): Type<string> {
|
||||
return { _class: core.class.TypeString }
|
||||
return { _class: core.class.TypeString, label: 'TypeString' as IntlString }
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function TypeBoolean (): Type<string> {
|
||||
return { _class: core.class.TypeBoolean }
|
||||
return { _class: core.class.TypeBoolean, label: 'TypeBoolean' as IntlString }
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function Bag (): Type<Record<string, PropertyType>> {
|
||||
return { _class: core.class.Bag }
|
||||
return { _class: core.class.Bag, label: 'Bag' as IntlString }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user