diff --git a/models/card/src/index.ts b/models/card/src/index.ts index 7212a88e92..2fe5dfd8bd 100644 --- a/models/card/src/index.ts +++ b/models/card/src/index.ts @@ -224,6 +224,10 @@ export function createModel (builder: Builder): void { inlineEditor: card.component.CardEditor }) + builder.mixin(card.class.Card, core.class.Class, view.mixin.ArrayEditor, { + inlineEditor: card.component.CardArrayEditor + }) + createAction( builder, { @@ -319,7 +323,8 @@ export function createModel (builder: Builder): void { }) builder.mixin(card.class.Card, core.class.Class, view.mixin.AttributePresenter, { - presenter: card.component.CardRefPresenter + presenter: card.component.CardRefPresenter, + arrayPresenter: card.component.CardArrayEditor }) builder.mixin(card.class.Card, core.class.Class, activity.mixin.ActivityDoc, {}) diff --git a/models/server-card/src/index.ts b/models/server-card/src/index.ts index 010088488f..cf3e27453f 100644 --- a/models/server-card/src/index.ts +++ b/models/server-card/src/index.ts @@ -51,6 +51,7 @@ export function createModel (builder: Builder): void { builder.createDoc(serverCore.class.Trigger, core.space.Model, { trigger: serverCard.trigger.OnMasterTagRemove, + isAsync: true, txMatch: { _class: core.class.TxUpdateDoc, objectClass: card.class.MasterTag, diff --git a/plugins/card-resources/src/components/CardArrayEditor.svelte b/plugins/card-resources/src/components/CardArrayEditor.svelte new file mode 100644 index 0000000000..576b2a91ee --- /dev/null +++ b/plugins/card-resources/src/components/CardArrayEditor.svelte @@ -0,0 +1,115 @@ + + + + diff --git a/plugins/card-resources/src/components/CardsPopup.svelte b/plugins/card-resources/src/components/CardsPopup.svelte index 8ac4b13c14..306c410f7d 100644 --- a/plugins/card-resources/src/components/CardsPopup.svelte +++ b/plugins/card-resources/src/components/CardsPopup.svelte @@ -22,6 +22,7 @@ export let _class: Ref> export let selected: Ref | undefined + export let selectedObjects: Ref[] | undefined export let multiSelect: boolean = false export let allowDeselect: boolean = true export let titleDeselect: IntlString | undefined = undefined @@ -36,6 +37,7 @@ [] = [] diff --git a/plugins/card-resources/src/components/MasterTags.svelte b/plugins/card-resources/src/components/MasterTags.svelte index b6689958c5..cbd66fe831 100644 --- a/plugins/card-resources/src/components/MasterTags.svelte +++ b/plugins/card-resources/src/components/MasterTags.svelte @@ -14,7 +14,7 @@ --> diff --git a/plugins/card-resources/src/components/settings/RelationSetting.svelte b/plugins/card-resources/src/components/settings/RelationSetting.svelte index f4b5f5d19c..b203f1f0fc 100644 --- a/plugins/card-resources/src/components/settings/RelationSetting.svelte +++ b/plugins/card-resources/src/components/settings/RelationSetting.svelte @@ -4,13 +4,17 @@ import contact from '@hcengineering/contact' import card from '../../plugin' import { Analytics } from '@hcengineering/analytics' - import { CardEvents } from '@hcengineering/card' + import { CardEvents, MasterTag } from '@hcengineering/card' const client = getClient() const hierarchy = client.getHierarchy() - const _classes = [...hierarchy.getDescendants(card.class.Card), contact.class.Contact].filter( - (c) => c !== card.class.Card - ) + const _classes = [...hierarchy.getDescendants(card.class.Card), contact.class.Contact].filter((c) => { + if (c === card.class.Card) return false + const cl = hierarchy.getClass(c) + if (cl._class !== card.class.MasterTag) return true + if ((cl as MasterTag).removed === true) return false + return true + }) function createHandler (): void { Analytics.handleEvent(CardEvents.RelationCreated) diff --git a/plugins/card-resources/src/index.ts b/plugins/card-resources/src/index.ts index 05f782ba52..985b97232c 100644 --- a/plugins/card-resources/src/index.ts +++ b/plugins/card-resources/src/index.ts @@ -39,6 +39,7 @@ import RelationSetting from './components/settings/RelationSetting.svelte' import CardEditor from './components/CardEditor.svelte' import CardRefPresenter from './components/CardRefPresenter.svelte' import ChangeType from './components/ChangeType.svelte' +import CardArrayEditor from './components/CardArrayEditor.svelte' export { default as CardSelector } from './components/CardSelector.svelte' @@ -61,7 +62,8 @@ export default async (): Promise => ({ RelationSetting, CardEditor, CardRefPresenter, - ChangeType + ChangeType, + CardArrayEditor }, completion: { CardQuery: queryCard diff --git a/plugins/card-resources/src/plugin.ts b/plugins/card-resources/src/plugin.ts index e6da5f30dd..c22fbd504c 100644 --- a/plugins/card-resources/src/plugin.ts +++ b/plugins/card-resources/src/plugin.ts @@ -39,7 +39,8 @@ export default mergeIds(cardId, card, { RelationSetting: '' as AnyComponent, CardEditor: '' as AnyComponent, CardRefPresenter: '' as AnyComponent, - ChangeType: '' as AnyComponent + ChangeType: '' as AnyComponent, + CardArrayEditor: '' as AnyComponent }, completion: { CardQuery: '' as Resource, diff --git a/plugins/setting-resources/src/components/ClassAttributes.svelte b/plugins/setting-resources/src/components/ClassAttributes.svelte index 954ddb536e..289c7de91a 100644 --- a/plugins/setting-resources/src/components/ClassAttributes.svelte +++ b/plugins/setting-resources/src/components/ClassAttributes.svelte @@ -139,7 +139,11 @@ selected = event.detail as AnyAttribute if (selected?._id != null) { const exist = (await client.findOne(selected.attributeOf, { [selected.name]: { $exists: true } })) !== undefined - $settingsStore = { id: selected._id, component: EditAttribute, props: { attribute: selected, exist, disabled } } + $settingsStore = { + id: selected._id, + component: EditAttribute, + props: { attribute: selected, exist, disabled, isCard } + } } } onDestroy(() => { diff --git a/plugins/setting-resources/src/components/EditAttribute.svelte b/plugins/setting-resources/src/components/EditAttribute.svelte index 17e7f97653..b2d98092e4 100644 --- a/plugins/setting-resources/src/components/EditAttribute.svelte +++ b/plugins/setting-resources/src/components/EditAttribute.svelte @@ -38,6 +38,7 @@ export let exist: boolean export let disabled: boolean = true export let noTopIndent: boolean = false + export let isCard: boolean = false let name: string let type: Type | undefined = attribute.type @@ -201,6 +202,7 @@ a.concat(b)) .filter((p) => p !== card.class.Card) ) - const excluded = new Set() + // exclude removed card types + const removedTypes = client.getModel().findAllSync(card.class.MasterTag, { removed: true }) + const excluded = new Set(removedTypes.map((p) => p._id)) for (const _class of exclude) { const desc = hierarchy.getDescendants(_class) for (const _id of desc) { diff --git a/plugins/view-resources/src/components/Table.svelte b/plugins/view-resources/src/components/Table.svelte index c14b642445..c6d703d189 100644 --- a/plugins/view-resources/src/components/Table.svelte +++ b/plugins/view-resources/src/components/Table.svelte @@ -452,6 +452,7 @@ this={attribute.presenter} value={getValue(attribute, object)} onChange={getOnChange(object, attribute)} + attribute={attribute.attribute} {...joinProps(attribute, object, readonly || $restrictionStore.readonly)} /> diff --git a/plugins/view-resources/src/components/filter/FilterTypePopup.svelte b/plugins/view-resources/src/components/filter/FilterTypePopup.svelte index 72146eed21..3b0c0f6f40 100644 --- a/plugins/view-resources/src/components/filter/FilterTypePopup.svelte +++ b/plugins/view-resources/src/components/filter/FilterTypePopup.svelte @@ -13,7 +13,7 @@ // limitations under the License. -->