diff --git a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte index 3996add741..3b04e1b510 100644 --- a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte +++ b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte @@ -13,7 +13,6 @@ } from "components/common/Icons/" import CodeEditor from "./CodeEditor.svelte" import LayoutEditor from "./LayoutEditor.svelte" - import EventsEditor from "./EventsEditor" import panelStructure from "./temporaryPanelStructure.js" import CategoryTab from "./CategoryTab.svelte" import DesignView from "./DesignView.svelte" @@ -25,7 +24,6 @@ let categories = [ { value: "settings", name: "Settings" }, { value: "design", name: "Design" }, - { value: "events", name: "Events" }, ] let selectedCategory = categories[0] @@ -113,8 +111,6 @@ displayNameField={displayName} onChange={onPropChanged} screenOrPageInstance={$store.currentView !== 'component' && $store.currentPreviewItem} /> - {:else if selectedCategory.value === 'events'} - {/if} diff --git a/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte b/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte index 8132d502d1..3a16170043 100644 --- a/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte +++ b/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte @@ -10,28 +10,25 @@ import Input from "../../common/Input.svelte" import getIcon from "../../common/icon" import { CloseIcon } from "components/common/Icons/" - import { EVENT_TYPE_MEMBER_NAME } from "../../common/eventHandlers" - export let event - export let eventOptions = [] + export let event = [] + export let eventType export let onClose + export let onChange - let eventType = "" let draftEventHandler = { parameters: [] } - $: eventData = event || { handlers: [] } - $: if (!eventOptions.includes(eventType) && eventOptions.length > 0) - eventType = eventOptions[0].name + $: handlers = event || [] const closeModal = () => { onClose() draftEventHandler = { parameters: [] } - eventData = { handlers: [] } + handlers = [] } const updateEventHandler = (updatedHandler, index) => { - eventData.handlers[index] = updatedHandler + handlers[index] = updatedHandler } const updateDraftEventHandler = updatedHandler => { @@ -39,8 +36,7 @@ } const deleteEventHandler = index => { - eventData.handlers.splice(index, 1) - eventData = eventData + handlers.splice(index, 1) } const createNewEventHandler = handler => { @@ -48,17 +44,18 @@ parameters: {}, [EVENT_TYPE_MEMBER_NAME]: "", } - eventData.handlers.push(newHandler) - eventData = eventData + handlers.push(newHandler) + handlers = handlers } const deleteEvent = () => { - store.setComponentProp(eventType, []) + handlers = [] + onChange([]) closeModal() } const saveEventData = () => { - store.setComponentProp(eventType, eventData.handlers) + onChange(handlers) closeModal() } @@ -66,19 +63,7 @@
-

- {eventData.name ? `${eventData.name} Event` : 'Create a New Component Event'} -

-
-
-
-

Event Type

- -
+

{eventType} Event

@@ -92,31 +77,23 @@ }} handler={draftEventHandler} />
- {#if eventData} - {#each eventData.handlers as handler, index} - deleteEventHandler(index)} - {handler} /> - {/each} - {/if} + {#each handlers as handler, index} + deleteEventHandler(index)} + {handler} /> + {/each}