From 0ee681e70a09370f2dac39f0cf808b8bf84c596e Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Tue, 11 Aug 2020 10:43:43 +0100 Subject: [PATCH] events as popover, in settings panel --- .../EventsEditor/EventEditorModal.svelte | 35 ++++------------ .../EventsEditor/EventPropertyControl.svelte | 41 +++++++------------ .../EventsEditor/HandlerSelector.svelte | 7 +--- 3 files changed, 24 insertions(+), 59 deletions(-) diff --git a/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte b/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte index 74004960dc..0b880df480 100644 --- a/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte +++ b/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte @@ -4,24 +4,25 @@ import HandlerSelector from "./HandlerSelector.svelte" import { CloseIcon } from "components/common/Icons/" import { EVENT_TYPE_MEMBER_NAME } from "../../common/eventHandlers" + import { createEventDispatcher } from "svelte" export let event = [] export let eventType - export let onClose - export let onChange + const dispatch = createEventDispatcher() let draftEventHandler = { parameters: [] } - $: handlers = event || [] + $: handlers = (event && [...event]) || [] const closeModal = () => { - onClose() + dispatch("close") draftEventHandler = { parameters: [] } handlers = [] } const updateEventHandler = (updatedHandler, index) => { handlers[index] = updatedHandler + dispatch("change", handlers) } const updateDraftEventHandler = updatedHandler => { @@ -30,6 +31,7 @@ const deleteEventHandler = index => { handlers.splice(index, 1) + dispatch("change", handlers) } const createNewEventHandler = handler => { @@ -38,18 +40,7 @@ [EVENT_TYPE_MEMBER_NAME]: "", } handlers.push(newHandler) - handlers = handlers - } - - const deleteEvent = () => { - handlers = [] - onChange([]) - closeModal() - } - - const saveEventData = () => { - onChange(handlers) - closeModal() + dispatch("change", handlers) } @@ -79,18 +70,7 @@ {/each} -
@@ -99,6 +79,7 @@