More conversions...

This commit is contained in:
Keviin Åberg Kultalahti 2021-04-26 14:31:32 +02:00
parent 3a638798a6
commit bc391d32a3
4 changed files with 11 additions and 27 deletions

View File

@ -28,7 +28,7 @@
</div> </div>
<Popover bind:this={dropdown} {anchor} align="left"> <Popover bind:this={dropdown} {anchor} align="left">
<Menu> <Menu>
<slot closeOnClick={closeOnClickWrapper} /> <slot open={show} closeOnClick={closeOnClickWrapper} />
</Menu> </Menu>
</Popover> </Popover>

View File

@ -32,8 +32,8 @@
} }
</script> </script>
<ActionMenu bind:this={dropdown} let:closeOnClick > <ActionMenu bind:this={dropdown} let:open let:closeOnClick >
<div slot="button" class="icon" on:click={dropdown.show}> <div slot="button" class="icon" on:click={open}>
<Icon s hoverable name="MoreSmallList" /> <Icon s hoverable name="MoreSmallList" />
</div> </div>
<MenuItem icon="Delete" on:click={closeOnClick(confirmDeleteDialog.show)}>Delete</MenuItem> <MenuItem icon="Delete" on:click={closeOnClick(confirmDeleteDialog.show)}>Delete</MenuItem>

View File

@ -12,11 +12,6 @@
dropdown?.hide() dropdown?.hide()
} }
function showModal() {
hideEditor()
confirmDeleteDialog.show()
}
async function deleteQuery() { async function deleteQuery() {
await queries.delete(query) await queries.delete(query)
notifications.success("Query deleted") notifications.success("Query deleted")
@ -24,8 +19,8 @@
} }
</script> </script>
<ActionMenu bind:this={dropdown} let:closeOnClick> <ActionMenu bind:this={dropdown} let:open let:closeOnClick>
<div slot="button" class="icon" on:click={dropdown.show}> <div slot="button" class="icon" on:click={open}>
<Icon s hoverable name="MoreSmallList" /> <Icon s hoverable name="MoreSmallList" />
</div> </div>
<MenuItem icon="Delete" on:click={closeOnClick(confirmDeleteDialog.show)}>Delete</MenuItem> <MenuItem icon="Delete" on:click={closeOnClick(confirmDeleteDialog.show)}>Delete</MenuItem>

View File

@ -26,16 +26,6 @@
let templateScreens let templateScreens
let willBeDeleted let willBeDeleted
function showEditor() {
editorModal.show()
dropdown?.hide()
}
function hideEditor() {
editorModal.hide()
dropdown?.hide()
}
function showDeleteModal() { function showDeleteModal() {
const screens = $allScreens const screens = $allScreens
templateScreens = screens.filter( templateScreens = screens.filter(
@ -44,7 +34,6 @@
willBeDeleted = ["All table data"].concat( willBeDeleted = ["All table data"].concat(
templateScreens.map((screen) => `Screen ${screen.props._instanceName}`) templateScreens.map((screen) => `Screen ${screen.props._instanceName}`)
) )
hideEditor()
confirmDeleteDialog.show() confirmDeleteDialog.show()
} }
@ -57,13 +46,13 @@
if (wasSelectedTable._id === table._id) { if (wasSelectedTable._id === table._id) {
$goto("./table") $goto("./table")
} }
hideEditor() editorModal.hide()
} }
async function save() { async function save() {
await tables.save(table) await tables.save(table)
notifications.success("Table renamed successfully") notifications.success("Table renamed successfully")
hideEditor() editorModal.hide()
} }
function checkValid(evt) { function checkValid(evt) {
@ -75,12 +64,12 @@
} }
</script> </script>
<ActionMenu bind:this={dropdown}> <ActionMenu bind:this={dropdown} let:open let:closeOnClick>
<div slot="button" class="icon" on:click={dropdown.show}> <div slot="button" class="icon" on:click={open}>
<Icon s hoverable name="MoreSmallList" /> <Icon s hoverable name="MoreSmallList" />
</div> </div>
<MenuItem icon="Edit" on:click={showEditor}>Edit</MenuItem> <MenuItem icon="Edit" on:click={closeOnClick(editorModal.show)}>Edit</MenuItem>
<MenuItem icon="Delete" on:click={showDeleteModal}>Delete</MenuItem> <MenuItem icon="Delete" on:click={closeOnClick(showDeleteModal)}>Delete</MenuItem>
</ActionMenu> </ActionMenu>
<Modal bind:this={editorModal}> <Modal bind:this={editorModal}>