diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index b634787e3d..a641ec9f7e 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -71,13 +71,14 @@ export class TContact extends TDoc implements Contact { @Prop(Collection(chunter.class.Comment), 'Comments' as IntlString) comments?: number + + @Prop(TypeString(), 'Location' as IntlString) + city!: string } @Model(contact.class.Person, contact.class.Contact) @UX('Person' as IntlString, contact.icon.Person, undefined, 'name') export class TPerson extends TContact implements Person { - @Prop(TypeString(), 'City' as IntlString) - city!: string } @Model(contact.class.Organization, contact.class.Contact) @@ -85,6 +86,7 @@ export class TPerson extends TContact implements Person { export class TOrganization extends TContact implements Organization {} @Model(contact.class.Employee, contact.class.Person) +@UX('Employee' as IntlString, contact.icon.Person) export class TEmployee extends TPerson implements Employee {} @Model(contact.class.EmployeeAccount, core.class.Account) @@ -114,44 +116,23 @@ export function createModel (builder: Builder): void { TEmployeeAccount ) - builder.mixin(contact.class.Persons, core.class.Class, workbench.mixin.SpaceView, { - view: { - class: contact.class.Person, - createItemDialog: contact.component.CreatePerson - } + builder.mixin(contact.class.Person, core.class.Class, view.mixin.ObjectFactory, { + component: contact.component.CreatePerson }) - builder.mixin(contact.class.Organizations, core.class.Class, workbench.mixin.SpaceView, { - view: { - class: contact.class.Organization, - createItemDialog: contact.component.CreateOrganization - } + builder.mixin(contact.class.Organization, core.class.Class, view.mixin.ObjectFactory, { + component: contact.component.CreateOrganization }) builder.createDoc(workbench.class.Application, core.space.Model, { label: contact.string.Contacts, icon: contact.icon.Person, hidden: false, - navigatorModel: { - spaces: [ - { - label: contact.string.Persons, - spaceClass: contact.class.Persons, - addSpaceLabel: contact.string.CreatePersons, - createComponent: contact.component.CreatePersons - }, - { - label: contact.string.Organizations, - spaceClass: contact.class.Organizations, - addSpaceLabel: contact.string.CreateOrganizations, - createComponent: contact.component.CreateOrganizations - } - ] - } + component: contact.component.Contacts }, contact.app.Contacts) builder.createDoc(view.class.Viewlet, core.space.Model, { - attachTo: contact.class.Person, + attachTo: contact.class.Contact, descriptor: view.viewlet.Table, open: contact.component.EditContact, // eslint-disable-next-line @typescript-eslint/consistent-type-assertions @@ -161,19 +142,11 @@ export function createModel (builder: Builder): void { 'city', { presenter: attachment.component.AttachmentsPresenter, label: 'Files', sortingKey: 'attachments' }, 'modifiedOn', + { presenter: contact.component.RolePresenter, label: 'Role' }, 'channels' ] }) - builder.createDoc(view.class.Viewlet, core.space.Model, { - attachTo: contact.class.Organization, - descriptor: view.viewlet.Table, - open: contact.component.EditContact, - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - options: {}, - config: ['', { presenter: attachment.component.AttachmentsPresenter, label: 'Files', sortingKey: 'attachments' }, 'modifiedOn', 'channels'] - }) - builder.mixin(contact.class.Person, core.class.Class, view.mixin.ObjectEditor, { editor: contact.component.EditPerson }) diff --git a/models/contact/src/plugin.ts b/models/contact/src/plugin.ts index 79d4b94202..0ef9bf59e2 100644 --- a/models/contact/src/plugin.ts +++ b/models/contact/src/plugin.ts @@ -36,7 +36,9 @@ export const ids = mergeIds(contactId, contact, { CreateOrganization: '' as AnyComponent, CreatePersons: '' as AnyComponent, CreateOrganizations: '' as AnyComponent, - OrganizationPresenter: '' as AnyComponent + OrganizationPresenter: '' as AnyComponent, + Contacts: '' as AnyComponent, + RolePresenter: '' as AnyComponent }, string: { Organizations: '' as IntlString, diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 3c3e588672..97a00c68ee 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -100,6 +100,10 @@ export function createModel (builder: Builder): void { editor: recruit.component.Applications }) + builder.mixin(recruit.mixin.Candidate, core.class.Mixin, view.mixin.ObjectFactory, { + component: recruit.component.CreateCandidate + }) + builder.createDoc( workbench.class.Application, core.space.Model, @@ -235,10 +239,6 @@ export function createModel (builder: Builder): void { card: recruit.component.KanbanCard }) - builder.mixin(recruit.mixin.Candidate, core.class.Class, view.mixin.ObjectEditor, { - editor: recruit.component.EditCandidate - }) - builder.mixin(recruit.class.Applicant, core.class.Class, view.mixin.ObjectEditor, { editor: recruit.component.EditApplication }) diff --git a/models/recruit/src/plugin.ts b/models/recruit/src/plugin.ts index e526f61cb9..f8e771857c 100644 --- a/models/recruit/src/plugin.ts +++ b/models/recruit/src/plugin.ts @@ -44,7 +44,6 @@ export default mergeIds(recruitId, recruit, { component: { CreateVacancy: '' as AnyComponent, CreateApplication: '' as AnyComponent, - EditCandidate: '' as AnyComponent, KanbanCard: '' as AnyComponent, ApplicationPresenter: '' as AnyComponent, ApplicationsPresenter: '' as AnyComponent, @@ -52,7 +51,8 @@ export default mergeIds(recruitId, recruit, { EditApplication: '' as AnyComponent, TemplatesIcon: '' as AnyComponent, Applications: '' as AnyComponent, - Candidates: '' as AnyComponent + Candidates: '' as AnyComponent, + CreateCandidate: '' as AnyComponent }, template: { DefaultVacancy: '' as Ref diff --git a/models/view/src/index.ts b/models/view/src/index.ts index c68d9338d5..f694d5f941 100644 --- a/models/view/src/index.ts +++ b/models/view/src/index.ts @@ -19,7 +19,7 @@ import { Builder, Mixin, Model } from '@anticrm/model' import core, { TClass, TDoc } from '@anticrm/model-core' import type { Asset, IntlString, Resource, Status } from '@anticrm/platform' import type { AnyComponent } from '@anticrm/ui' -import type { Action, ActionTarget, AttributeEditor, AttributePresenter, ObjectEditor, ObjectValidator, Viewlet, ViewletDescriptor } from '@anticrm/view' +import type { Action, ActionTarget, AttributeEditor, AttributePresenter, ObjectEditor, ObjectFactory, ObjectValidator, Viewlet, ViewletDescriptor } from '@anticrm/view' import view from './plugin' @Mixin(view.mixin.AttributeEditor, core.class.Class) @@ -42,6 +42,11 @@ export class TObjectValidator extends TClass implements ObjectValidator { validator!: Resource<((doc: T, client: Client) => Promise>)> } +@Mixin(view.mixin.ObjectFactory, core.class.Class) +export class TObjectFactory extends TClass implements ObjectFactory { + component!: AnyComponent +} + @Model(view.class.ViewletDescriptor, core.class.Doc, DOMAIN_MODEL) export class TViewletDescriptor extends TDoc implements ViewletDescriptor { component!: AnyComponent @@ -70,7 +75,7 @@ export class TActionTarget extends TDoc implements ActionTarget { } export function createModel (builder: Builder): void { - builder.createModel(TAttributeEditor, TAttributePresenter, TObjectEditor, TViewletDescriptor, TViewlet, TAction, TActionTarget, TObjectValidator) + builder.createModel(TAttributeEditor, TAttributePresenter, TObjectEditor, TViewletDescriptor, TViewlet, TAction, TActionTarget, TObjectValidator, TObjectFactory) builder.mixin(core.class.TypeString, core.class.Class, view.mixin.AttributeEditor, { editor: view.component.StringEditor diff --git a/packages/core/src/hierarchy.ts b/packages/core/src/hierarchy.ts index 2e4b7990aa..2dd2e6f416 100644 --- a/packages/core/src/hierarchy.ts +++ b/packages/core/src/hierarchy.ts @@ -157,7 +157,7 @@ export class Hierarchy { } private txMixin (tx: TxMixin): void { - if (tx.objectClass === core.class.Class) { + if (this.isDerived(tx.objectClass, core.class.Class)) { const obj = this.getClass(tx.objectId as Ref>) as any TxProcessor.updateMixin4Doc(obj, tx.mixin, tx.attributes) } @@ -304,7 +304,14 @@ export class Hierarchy { const result = new Map() let ancestors = this.getAncestors(clazz) if (to !== undefined) { - ancestors = ancestors.filter(c => this.isDerived(c, to) && c !== to) + const toAncestors = this.getAncestors(to) + for (const uto of toAncestors) { + if (ancestors.includes(uto)) { + to = uto + break + } + } + ancestors = ancestors.filter(c => this.isDerived(c, to as Ref>) && c !== to) } for (const cls of ancestors) { diff --git a/packages/ui/src/components/Menu.svelte b/packages/ui/src/components/Menu.svelte index b81d9bbd5f..8c678755b0 100644 --- a/packages/ui/src/components/Menu.svelte +++ b/packages/ui/src/components/Menu.svelte @@ -14,27 +14,22 @@ -->