Fix context class set (#9830)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2025-09-10 23:16:05 +07:00
committed by GitHub
parent b1c54d17ba
commit c6c074aba1
6 changed files with 35 additions and 16 deletions
@@ -42,6 +42,9 @@
props = {}
params.props = props
step.params = params
if (step.context != null) {
step.context._class = _id
}
dispatch('change', step)
}
}
@@ -70,7 +70,7 @@
{/if}
</svelte:fragment>
{#if step != null}
<StepEditor bind:step {process} on:change={change} />
<StepEditor {step} {process} on:change={change} />
{/if}
<div slot="footer" class="flex-row-center flex-gap-2 w-full">
<ContextFooter {process} {step} />
@@ -39,12 +39,16 @@
const hierarchy = client.getHierarchy()
translateCB(cardPlugin.string.Card, {}, undefined, (res) => {
setName(res)
})
function setName (name: string): void {
if (params.title === undefined || params.title === '') {
params.title = res
params.title = name
;(step.params as any) = params
dispatch('change', step)
}
})
}
function change (e: CustomEvent<any>): void {
if (e.detail !== undefined) {
@@ -106,9 +110,9 @@
}
}
function typeChange (e: CustomEvent<Ref<Class<MasterTag>>>): void {
if (e.detail === undefined || e.detail === _class) return
allAttrs = getKeys(e.detail)
function typeChange (_id: Ref<Class<MasterTag>>): void {
if (_id === undefined) return
allAttrs = getKeys(_id)
const oldParams = { ...params }
params = {}
for (const attr of allAttrs) {
@@ -117,7 +121,6 @@
;(params as any)[key] = oldParams[key]
}
}
_class = e.detail
keys = Object.keys(params)
params._class = _class
step.params = params
@@ -126,6 +129,8 @@
}
dispatch('change', step)
}
$: typeChange(_class)
</script>
<div class="grid">
@@ -137,7 +142,15 @@
>
<Label label={cardPlugin.string.MasterTag} />
</span>
<TypeSelector value={_class} width={'100%'} on:change={typeChange} />
<TypeSelector
value={_class}
width={'100%'}
on:change={(e) => {
if (e.detail !== undefined) {
_class = e.detail
}
}}
/>
</div>
<div class="divider" />
{#key _class}
@@ -32,7 +32,7 @@
let _id: Ref<Process> = step.params._id as any
$: context = parseContext(step.params.card)
$: masterTag = getContextMasterTag(client, context, process.masterTag) ?? process.masterTag
$: masterTag = getContextMasterTag(client, context, process) ?? process.masterTag
$: executionContext = (step.params.context ?? {}) as ExecutionContext
@@ -48,9 +48,7 @@
let thisCard: boolean = step.params.card === undefined
$: ancestors = hierarchy
.getAncestors(masterTag)
.filter((it) => !hierarchy.isMixin(it) && hierarchy.isDerived(it, card.class.Card))
$: ancestors = hierarchy.getAncestors(masterTag).filter((it) => hierarchy.isDerived(it, card.class.Card))
let processes: Process[] = []
let items: DropdownTextItem[] = []