mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-21 07:46:24 +00:00
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
ef55125963
commit
b4e25dc1a0
@ -93,7 +93,9 @@
|
|||||||
return filterKeys(keys, ignoreKeys)
|
return filterKeys(keys, ignoreKeys)
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateKeys (ignoreKeys: string[]): void {
|
let ignoreKeys: string[] = []
|
||||||
|
|
||||||
|
function updateKeys (): void {
|
||||||
const filtredKeys = getFiltredKeys(
|
const filtredKeys = getFiltredKeys(
|
||||||
selectedClass ?? object._class,
|
selectedClass ?? object._class,
|
||||||
ignoreKeys,
|
ignoreKeys,
|
||||||
@ -122,15 +124,21 @@
|
|||||||
return editorMixin.editor
|
return editorMixin.editor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mainEditor: AnyComponent
|
||||||
|
|
||||||
|
$: if (object) getEditorOrDefault(selectedClass, object._class)
|
||||||
|
|
||||||
async function getEditorOrDefault (
|
async function getEditorOrDefault (
|
||||||
_class: Ref<Class<Doc>> | undefined,
|
_class: Ref<Class<Doc>> | undefined,
|
||||||
defaultClass: Ref<Class<Doc>>
|
defaultClass: Ref<Class<Doc>>
|
||||||
): Promise<AnyComponent> {
|
): Promise<void> {
|
||||||
const editor = _class !== undefined ? await getEditor(_class) : undefined
|
console.log('get editor or default')
|
||||||
if (editor !== undefined) {
|
let editor = _class !== undefined ? await getEditor(_class) : undefined
|
||||||
return editor
|
if (editor === undefined) {
|
||||||
|
editor = await getEditor(defaultClass)
|
||||||
}
|
}
|
||||||
return getEditor(defaultClass)
|
mainEditor = editor
|
||||||
|
updateKeys()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCollectionEditor (key: KeyedAttribute): Promise<AnyComponent> {
|
async function getCollectionEditor (key: KeyedAttribute): Promise<AnyComponent> {
|
||||||
@ -218,19 +226,20 @@
|
|||||||
{/await}
|
{/await}
|
||||||
</div>
|
</div>
|
||||||
<div class="main-editor">
|
<div class="main-editor">
|
||||||
{#await getEditorOrDefault(selectedClass, object._class) then is}
|
{#if mainEditor}
|
||||||
<Component
|
<Component
|
||||||
{is}
|
is={mainEditor}
|
||||||
props={{ object }}
|
props={{ object }}
|
||||||
on:open={(ev) => {
|
on:open={(ev) => {
|
||||||
updateKeys(ev.detail.ignoreKeys)
|
ignoreKeys = ev.detail.ignoreKeys
|
||||||
|
updateKeys()
|
||||||
}}
|
}}
|
||||||
on:click={(ev) => {
|
on:click={(ev) => {
|
||||||
fullSize = true
|
fullSize = true
|
||||||
rightSection = ev.detail.presenter
|
rightSection = ev.detail.presenter
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/await}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if mixins.length > 0}
|
{#if mixins.length > 0}
|
||||||
<div class="mixin-container">
|
<div class="mixin-container">
|
||||||
|
Loading…
Reference in New Issue
Block a user