Fix Issues TSK-220, TSK-221 (#2170)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-06-30 10:36:15 +07:00 committed by GitHub
parent 07f25de59f
commit c1a8b89855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 9 deletions

View File

@ -275,7 +275,7 @@ export const actionTemplates = template({
label: task.string.Archive,
message: task.string.ArchiveConfirm
},
input: 'focus',
input: 'any',
category: task.category.Task,
query: {
archived: false
@ -296,7 +296,7 @@ export const actionTemplates = template({
label: task.string.Unarchive,
message: task.string.UnarchiveConfirm
},
input: 'focus',
input: 'any',
category: task.category.Task,
query: {
archived: true

View File

@ -27,6 +27,8 @@
export let okLabel: IntlString = presentation.string.Create
const dispatch = createEventDispatcher()
let okProcessing = false
</script>
<form id={label} class="antiCard dialog" on:submit|preventDefault={() => {}}>
@ -71,17 +73,24 @@
<MiniToggle label={presentation.string.CreateMore} bind:on={createMore} />
{/if}
<Button
loading={okProcessing}
focusIndex={10001}
disabled={!canSave}
label={okLabel}
kind={'primary'}
on:click={() => {
if (okProcessing) {
return
}
okProcessing = true
const r = okAction()
if (r instanceof Promise && !createMore) {
r.then(() => {
okProcessing = false
dispatch('close')
})
} else if (!createMore) {
okProcessing = false
dispatch('close')
}
}}

View File

@ -125,8 +125,9 @@
{/if}
{#if loading}
<Spinner />
{:else if label}
<span class="overflow-label disabled">
{/if}
{#if label}
<span class="overflow-label disabled" class:ml-2={loading}>
<Label {label} params={labelParams} />
</span>
{:else if $$slots.content}

View File

@ -20,12 +20,14 @@ export function resizeObserver (element: Element, onResize: (element: Element) =
if (observer === undefined) {
callbacks = new WeakMap()
observer = new ResizeObserver((entries) => {
for (const entry of entries) {
const onResize = callbacks.get(entry.target)
if (onResize != null) {
onResize(entry.target)
window.requestAnimationFrame(() => {
for (const entry of entries) {
const onResize = callbacks.get(entry.target)
if (onResize != null) {
onResize(entry.target)
}
}
}
})
})
}