mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 16:56:07 +00:00
EditDocFix (#1886)
This commit is contained in:
parent
2993925842
commit
4e69e4f0d1
@ -77,18 +77,21 @@
|
|||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
function getMixins (): void {
|
function getMixins (parentClass: Ref<Class<Doc>>, object: Doc): void {
|
||||||
|
if (object === undefined || parentClass === undefined) return
|
||||||
const descendants = hierarchy.getDescendants(parentClass).map((p) => hierarchy.getClass(p))
|
const descendants = hierarchy.getDescendants(parentClass).map((p) => hierarchy.getClass(p))
|
||||||
mixins = descendants.filter(
|
mixins = descendants.filter(
|
||||||
(m) => m.kind === ClassifierKind.MIXIN && hierarchy.hasMixin(object, m._id) && !ignoreMixins.has(m._id)
|
(m) => m.kind === ClassifierKind.MIXIN && hierarchy.hasMixin(object, m._id) && !ignoreMixins.has(m._id)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: getMixins(parentClass, object)
|
||||||
|
|
||||||
let ignoreKeys: string[] = []
|
let ignoreKeys: string[] = []
|
||||||
let ignoreMixins: Set<Ref<Mixin<Doc>>> = new Set<Ref<Mixin<Doc>>>()
|
let ignoreMixins: Set<Ref<Mixin<Doc>>> = new Set<Ref<Mixin<Doc>>>()
|
||||||
|
|
||||||
async function updateKeys (): Promise<void> {
|
async function updateKeys (): Promise<void> {
|
||||||
const keysMap = new Map(getFiltredKeys(hierarchy, object._class, ignoreKeys).map((p) => [p.attr._id, p]))
|
const keysMap = new Map(getFiltredKeys(hierarchy, realObjectClass, ignoreKeys).map((p) => [p.attr._id, p]))
|
||||||
for (const m of mixins) {
|
for (const m of mixins) {
|
||||||
const mkeys = getFiltredKeys(hierarchy, m._id, ignoreKeys)
|
const mkeys = getFiltredKeys(hierarchy, m._id, ignoreKeys)
|
||||||
for (const key of mkeys) {
|
for (const key of mkeys) {
|
||||||
@ -120,7 +123,6 @@
|
|||||||
async function getEditorOrDefault (_class: Ref<Class<Doc>>): Promise<void> {
|
async function getEditorOrDefault (_class: Ref<Class<Doc>>): Promise<void> {
|
||||||
parentClass = getParentClass(_class)
|
parentClass = getParentClass(_class)
|
||||||
mainEditor = await getEditor(_class)
|
mainEditor = await getEditor(_class)
|
||||||
getMixins()
|
|
||||||
updateKeys()
|
updateKeys()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +256,7 @@
|
|||||||
on:open={(ev) => {
|
on:open={(ev) => {
|
||||||
ignoreKeys = ev.detail.ignoreKeys
|
ignoreKeys = ev.detail.ignoreKeys
|
||||||
ignoreMixins = new Set(ev.detail.ignoreMixins)
|
ignoreMixins = new Set(ev.detail.ignoreMixins)
|
||||||
getMixins()
|
getMixins(parentClass, object)
|
||||||
updateKeys()
|
updateKeys()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user