From e54fd6a0d9e5179106a20fdc52620b7252dbb533 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 28 Jan 2020 22:39:16 +0000 Subject: [PATCH] merge --- .../builder/src/common/Icons/Events.svelte | 8 + .../builder/src/common/Icons/Pencil.svelte | 19 ++ packages/builder/src/common/Icons/index.js | 2 + .../src/userInterface/ComponentPanel.svelte | 10 +- .../EventsEditor/EventEditorModal.svelte | 49 +++++ .../EventsEditor/EventSelector.svelte | 110 +++++++++++ .../EventsEditor/EventsEditor.svelte | 149 +++++++++++++++ .../EventsEditor/StateBindingControl.svelte | 177 ++++++++++++++++++ .../src/userInterface/EventsEditor/index.js | 1 + packages/server/package.json | 2 +- 10 files changed, 525 insertions(+), 2 deletions(-) create mode 100644 packages/builder/src/common/Icons/Events.svelte create mode 100644 packages/builder/src/common/Icons/Pencil.svelte create mode 100644 packages/builder/src/userInterface/EventsEditor/EventEditorModal.svelte create mode 100644 packages/builder/src/userInterface/EventsEditor/EventSelector.svelte create mode 100644 packages/builder/src/userInterface/EventsEditor/EventsEditor.svelte create mode 100644 packages/builder/src/userInterface/EventsEditor/StateBindingControl.svelte create mode 100644 packages/builder/src/userInterface/EventsEditor/index.js diff --git a/packages/builder/src/common/Icons/Events.svelte b/packages/builder/src/common/Icons/Events.svelte new file mode 100644 index 0000000000..d3728b9901 --- /dev/null +++ b/packages/builder/src/common/Icons/Events.svelte @@ -0,0 +1,8 @@ + + + + diff --git a/packages/builder/src/common/Icons/Pencil.svelte b/packages/builder/src/common/Icons/Pencil.svelte new file mode 100644 index 0000000000..266458a132 --- /dev/null +++ b/packages/builder/src/common/Icons/Pencil.svelte @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/packages/builder/src/common/Icons/index.js b/packages/builder/src/common/Icons/index.js index 2e2ffc2010..c00ebb3ce4 100644 --- a/packages/builder/src/common/Icons/index.js +++ b/packages/builder/src/common/Icons/index.js @@ -4,3 +4,5 @@ export { default as TerminalIcon } from './Terminal.svelte'; export { default as InputIcon } from './Input.svelte'; export { default as ImageIcon } from './Image.svelte'; export { default as ArrowDownIcon } from './ArrowDown.svelte'; +export { default as EventsIcon } from './Events.svelte'; +export { default as PencilIcon } from './Pencil.svelte'; diff --git a/packages/builder/src/userInterface/ComponentPanel.svelte b/packages/builder/src/userInterface/ComponentPanel.svelte index 5649820970..1fa8ce0642 100644 --- a/packages/builder/src/userInterface/ComponentPanel.svelte +++ b/packages/builder/src/userInterface/ComponentPanel.svelte @@ -2,9 +2,10 @@ import PropsView from "./PropsView.svelte"; import { store } from "../builderStore"; import IconButton from "../common/IconButton.svelte"; - import { LayoutIcon, PaintIcon, TerminalIcon } from '../common/Icons/'; + import { LayoutIcon, PaintIcon, TerminalIcon, EventsIcon } from '../common/Icons/'; import CodeEditor from './CodeEditor.svelte'; import LayoutEditor from './LayoutEditor.svelte'; + import EventsEditor from "./EventsEditor"; let current_view = 'props'; @@ -36,6 +37,11 @@ +
  • + +
  • {#if !componentInfo.component} @@ -45,6 +51,8 @@ {:else if current_view === 'layout'} + {:else if current_view === 'events'} + {:else} {/if} diff --git a/packages/builder/src/userInterface/EventsEditor/EventEditorModal.svelte b/packages/builder/src/userInterface/EventsEditor/EventEditorModal.svelte new file mode 100644 index 0000000000..6cb72f6310 --- /dev/null +++ b/packages/builder/src/userInterface/EventsEditor/EventEditorModal.svelte @@ -0,0 +1,49 @@ + + + +

    {action} Event

    + +
    + + \ No newline at end of file diff --git a/packages/builder/src/userInterface/EventsEditor/EventSelector.svelte b/packages/builder/src/userInterface/EventsEditor/EventSelector.svelte new file mode 100644 index 0000000000..332a2ed32b --- /dev/null +++ b/packages/builder/src/userInterface/EventsEditor/EventSelector.svelte @@ -0,0 +1,110 @@ + + + + +
    + + + + +
    + +{#if parameters} + {#each parameters as p, index} +
    {p.name}
    + + {/each} +{/if} diff --git a/packages/builder/src/userInterface/EventsEditor/EventsEditor.svelte b/packages/builder/src/userInterface/EventsEditor/EventsEditor.svelte new file mode 100644 index 0000000000..c1066322e8 --- /dev/null +++ b/packages/builder/src/userInterface/EventsEditor/EventsEditor.svelte @@ -0,0 +1,149 @@ + + + + +

    Events

    + +
    + +
    + {#each events as event, index} +
    + {event[0]} + openModal({ ...event, index })} /> +
    + {/each} +
    + +
    + +

    {action} Event

    + {#if selectedEvent} + {JSON.stringify(selectedEvent)} + + {:else} + + +
    + +
    + + {/if} +
    diff --git a/packages/builder/src/userInterface/EventsEditor/StateBindingControl.svelte b/packages/builder/src/userInterface/EventsEditor/StateBindingControl.svelte new file mode 100644 index 0000000000..f8e6ca6da8 --- /dev/null +++ b/packages/builder/src/userInterface/EventsEditor/StateBindingControl.svelte @@ -0,0 +1,177 @@ + + +{#if isBound} +
    +
    +
    {isExpanded ? "" : bindingPath}
    + isExpanded=!isExpanded}/> + {#if !canOnlyBind} + + {/if} +
    + {#if isExpanded} +
    +
    Binding Path
    + +
    Fallback Value
    + +
    Binding Source
    + +
    + {/if} + +
    +{:else} +
    + + {#if type === "bool"} + +
    + onChanged(!value)} /> +
    + + {:else if type === "options"} + + + + {:else} + + onChanged(ev.target.value)} + bind:value={value} + style="flex: 1 0 auto;" /> + + + {/if} + +
    +{/if} + + + diff --git a/packages/builder/src/userInterface/EventsEditor/index.js b/packages/builder/src/userInterface/EventsEditor/index.js new file mode 100644 index 0000000000..7782e7fccd --- /dev/null +++ b/packages/builder/src/userInterface/EventsEditor/index.js @@ -0,0 +1 @@ +export { default } from "./EventsEditor.svelte"; \ No newline at end of file diff --git a/packages/server/package.json b/packages/server/package.json index 7f607b533d..6a86bb4d1f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -8,7 +8,7 @@ "build": "cd appPackages/_master && yarn && cd ../testApp && yarn && cd ../testApp2 && yarn", "initialise": "node ./initialise/initialiseBudibase init -d ./myapps -c contributors -u admin -p admin", "budi": "node ../cli/bin/budi", - "dev:builder": "nodemon index" + "dev:builder": "node index" }, "keywords": [ "budibase"