Merge pull request #10759 from Budibase/bindings-fixes
Fixes for Bindings V2
This commit is contained in:
commit
76cfb9d58e
|
@ -54,6 +54,7 @@
|
||||||
<section
|
<section
|
||||||
class:fillWidth
|
class:fillWidth
|
||||||
class="drawer"
|
class="drawer"
|
||||||
|
class:headless
|
||||||
transition:slide|local
|
transition:slide|local
|
||||||
style={`width: ${width}; left: ${left};`}
|
style={`width: ${width}; left: ${left};`}
|
||||||
>
|
>
|
||||||
|
@ -77,6 +78,10 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.drawer.headless :global(.drawer-contents) {
|
||||||
|
height: calc(40vh + 75px);
|
||||||
|
}
|
||||||
|
|
||||||
.buttons {
|
.buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--spacing-m);
|
gap: var(--spacing-m);
|
||||||
|
|
|
@ -592,7 +592,6 @@ export const getEventContextBindings = (
|
||||||
actionId
|
actionId
|
||||||
) => {
|
) => {
|
||||||
let bindings = []
|
let bindings = []
|
||||||
|
|
||||||
// Check if any context bindings are provided by the component for this
|
// Check if any context bindings are provided by the component for this
|
||||||
// setting
|
// setting
|
||||||
const component = findComponent(asset.props, componentId)
|
const component = findComponent(asset.props, componentId)
|
||||||
|
@ -608,6 +607,9 @@ export const getEventContextBindings = (
|
||||||
)}`,
|
)}`,
|
||||||
category: component._instanceName,
|
category: component._instanceName,
|
||||||
icon: def.icon,
|
icon: def.icon,
|
||||||
|
display: {
|
||||||
|
name: contextEntry.label,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -631,6 +633,9 @@ export const getEventContextBindings = (
|
||||||
runtimeBinding: `actions.${idx}.${contextValue.value}`,
|
runtimeBinding: `actions.${idx}.${contextValue.value}`,
|
||||||
category: "Actions",
|
category: "Actions",
|
||||||
icon: "JourneyAction",
|
icon: "JourneyAction",
|
||||||
|
display: {
|
||||||
|
name: contextValue.label,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
ActionButton,
|
ActionButton,
|
||||||
Drawer,
|
Drawer,
|
||||||
Modal,
|
Modal,
|
||||||
Detail,
|
|
||||||
notifications,
|
notifications,
|
||||||
|
Icon,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import CreateWebhookModal from "components/automation/Shared/CreateWebhookModal.svelte"
|
import CreateWebhookModal from "components/automation/Shared/CreateWebhookModal.svelte"
|
||||||
import { automationStore, selectedAutomation } from "builderStore"
|
import { automationStore, selectedAutomation } from "builderStore"
|
||||||
|
@ -27,6 +27,12 @@
|
||||||
import CronBuilder from "./CronBuilder.svelte"
|
import CronBuilder from "./CronBuilder.svelte"
|
||||||
import Editor from "components/integration/QueryEditor.svelte"
|
import Editor from "components/integration/QueryEditor.svelte"
|
||||||
import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte"
|
import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte"
|
||||||
|
import CodeEditor from "components/common/CodeEditor/CodeEditor.svelte"
|
||||||
|
import {
|
||||||
|
bindingsToCompletions,
|
||||||
|
jsAutocomplete,
|
||||||
|
EditorModes,
|
||||||
|
} from "components/common/CodeEditor"
|
||||||
import FilterDrawer from "components/design/settings/controls/FilterEditor/FilterDrawer.svelte"
|
import FilterDrawer from "components/design/settings/controls/FilterEditor/FilterDrawer.svelte"
|
||||||
import { LuceneUtils } from "@budibase/frontend-core"
|
import { LuceneUtils } from "@budibase/frontend-core"
|
||||||
import {
|
import {
|
||||||
|
@ -46,7 +52,6 @@
|
||||||
let webhookModal
|
let webhookModal
|
||||||
let drawer
|
let drawer
|
||||||
let fillWidth = true
|
let fillWidth = true
|
||||||
let codeBindingOpen = false
|
|
||||||
let inputData
|
let inputData
|
||||||
|
|
||||||
$: filters = lookForFilters(schemaProperties) || []
|
$: filters = lookForFilters(schemaProperties) || []
|
||||||
|
@ -457,25 +462,27 @@
|
||||||
<SchemaSetup on:change={e => onChange(e, key)} value={inputData[key]} />
|
<SchemaSetup on:change={e => onChange(e, key)} value={inputData[key]} />
|
||||||
{:else if value.customType === "code"}
|
{:else if value.customType === "code"}
|
||||||
<CodeEditorModal>
|
<CodeEditorModal>
|
||||||
<ActionButton
|
<CodeEditor
|
||||||
on:click={() => (codeBindingOpen = !codeBindingOpen)}
|
value={inputData[key]}
|
||||||
quiet
|
|
||||||
icon={codeBindingOpen ? "ChevronDown" : "ChevronRight"}
|
|
||||||
>
|
|
||||||
<Detail size="S">Bindings</Detail>
|
|
||||||
</ActionButton>
|
|
||||||
{#if codeBindingOpen}
|
|
||||||
<pre>{JSON.stringify(bindings, null, 2)}</pre>
|
|
||||||
{/if}
|
|
||||||
<Editor
|
|
||||||
mode="javascript"
|
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
// need to pass without the value inside
|
// need to pass without the value inside
|
||||||
onChange({ detail: e.detail.value }, key)
|
onChange({ detail: e.detail }, key)
|
||||||
inputData[key] = e.detail.value
|
inputData[key] = e.detail
|
||||||
}}
|
}}
|
||||||
value={inputData[key]}
|
completions={[
|
||||||
|
jsAutocomplete([
|
||||||
|
...bindingsToCompletions(bindings, EditorModes.JS),
|
||||||
|
]),
|
||||||
|
]}
|
||||||
|
mode={EditorModes.JS}
|
||||||
|
height={500}
|
||||||
/>
|
/>
|
||||||
|
<div class="messaging">
|
||||||
|
<Icon name="FlashOn" />
|
||||||
|
<div class="messaging-wrap">
|
||||||
|
<div>Add available bindings by typing <strong>$</strong></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</CodeEditorModal>
|
</CodeEditorModal>
|
||||||
{:else if value.customType === "loopOption"}
|
{:else if value.customType === "loopOption"}
|
||||||
<Select
|
<Select
|
||||||
|
@ -525,6 +532,11 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.messaging {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: var(--spacing-xl);
|
||||||
|
}
|
||||||
.fields {
|
.fields {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
@ -258,12 +258,14 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="code-editor">
|
<div class={`code-editor ${mode?.name || ""}`}>
|
||||||
<div tabindex="-1" bind:this={textarea} />
|
<div tabindex="-1" bind:this={textarea} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* Push into theme */
|
.code-editor.handlebars :global(.cm-content) {
|
||||||
|
font-family: var(--font-sans);
|
||||||
|
}
|
||||||
.code-editor :global(.cm-tooltip.cm-completionInfo) {
|
.code-editor :global(.cm-tooltip.cm-completionInfo) {
|
||||||
padding: var(--spacing-m);
|
padding: var(--spacing-m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,25 +64,38 @@ export const getDefaultTheme = opts => {
|
||||||
fontStyle: "unset",
|
fontStyle: "unset",
|
||||||
textTransform: "uppercase",
|
textTransform: "uppercase",
|
||||||
fontSize: "10px",
|
fontSize: "10px",
|
||||||
|
backgroundColor: "var(--spectrum-global-color-gray-100)",
|
||||||
|
color: "var(--spectrum-global-color-gray-600)",
|
||||||
|
},
|
||||||
|
"& .cm-completionLabel": {
|
||||||
|
marginLeft:
|
||||||
|
"calc(var(--spectrum-alias-workflow-icon-size-m) + var(--spacing-m))",
|
||||||
},
|
},
|
||||||
"& .info-bubble": {
|
"& .info-bubble": {
|
||||||
fontSize: "var(--font-size-s)",
|
fontSize: "var(--font-size-s)",
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridGap: "var(--spacing-s)",
|
gridGap: "var(--spacing-s)",
|
||||||
gridTemplateColumns: "1fr",
|
gridTemplateColumns: "1fr",
|
||||||
|
color: "var(--spectrum-global-color-gray-800)",
|
||||||
},
|
},
|
||||||
"& .cm-tooltip": {
|
"& .cm-tooltip": {
|
||||||
marginLeft: "var(--spacing-s)",
|
marginLeft: "var(--spacing-s)",
|
||||||
border: "1px solid var(--spectrum-global-color-gray-300)",
|
border: "1px solid var(--spectrum-global-color-gray-300)",
|
||||||
borderRadius:
|
borderRadius:
|
||||||
"var( --spectrum-popover-border-radius, var(--spectrum-alias-border-radius-regular) )",
|
"var( --spectrum-popover-border-radius, var(--spectrum-alias-border-radius-regular) )",
|
||||||
|
backgroundColor: "var(--spectrum-global-color-gray-50)",
|
||||||
},
|
},
|
||||||
// Section header
|
// Section header
|
||||||
"& .info-section": {
|
"& .info-section": {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
padding: "var(--spacing-s)",
|
padding: "var(--spacing-s)",
|
||||||
gap: "var(--spacing-m)",
|
gap: "var(--spacing-m)",
|
||||||
borderBottom: "1px solid var(--spectrum-global-color-gray-300)",
|
borderBottom: "1px solid var(--spectrum-global-color-gray-200)",
|
||||||
|
color: "var(--spectrum-global-color-gray-800)",
|
||||||
|
fontWeight: "bold",
|
||||||
|
},
|
||||||
|
"& .info-section .spectrum-Icon": {
|
||||||
|
color: "var(--spectrum-global-color-gray-600)",
|
||||||
},
|
},
|
||||||
// Autocomplete Option
|
// Autocomplete Option
|
||||||
"& .cm-tooltip.cm-tooltip-autocomplete .autocomplete-option": {
|
"& .cm-tooltip.cm-tooltip-autocomplete .autocomplete-option": {
|
||||||
|
@ -91,13 +104,14 @@ export const getDefaultTheme = opts => {
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
fontSize: "var(--spectrum-alias-font-size-default)",
|
fontSize: "var(--spectrum-alias-font-size-default)",
|
||||||
padding: "var(--spacing-s)",
|
padding: "var(--spacing-s)",
|
||||||
|
color: "var(--spectrum-global-color-gray-800)",
|
||||||
},
|
},
|
||||||
"& .cm-tooltip-autocomplete ul li[aria-selected].autocomplete-option": {
|
"& .cm-tooltip-autocomplete ul li[aria-selected].autocomplete-option": {
|
||||||
backgroundColor: "var(--spectrum-global-color-gray-200)",
|
backgroundColor: "var(--spectrum-global-color-gray-200)",
|
||||||
color: "var(--ink)",
|
|
||||||
},
|
},
|
||||||
"& .binding-wrap": {
|
"& .binding-wrap": {
|
||||||
color: "var(--spectrum-global-color-blue-700)",
|
color: "var(--spectrum-global-color-blue-700)",
|
||||||
|
fontFamily: "monospace",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ dark }
|
{ dark }
|
||||||
|
|
|
@ -365,6 +365,34 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.binding-drawer :global(.container > .main) {
|
||||||
|
overflow: hidden;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.binding-drawer :global(.container > .main > .main) {
|
||||||
|
overflow: hidden;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.binding-drawer :global(.spectrum-Tabs-content) {
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.binding-drawer :global(.spectrum-Tabs-content > div),
|
||||||
|
.binding-drawer :global(.spectrum-Tabs-content > div > div),
|
||||||
|
.binding-drawer :global(.spectrum-Tabs-content .main-content) {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.binding-drawer .main-content {
|
||||||
|
grid-template-rows: unset;
|
||||||
|
}
|
||||||
|
|
||||||
.messaging {
|
.messaging {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -380,15 +408,10 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.binding-drawer :global(.drawer-contents) {
|
|
||||||
height: unset;
|
|
||||||
}
|
|
||||||
.main :global(textarea) {
|
.main :global(textarea) {
|
||||||
min-height: 202px !important;
|
min-height: 202px !important;
|
||||||
}
|
}
|
||||||
.main {
|
|
||||||
margin: calc(-1 * var(--spacing-xl));
|
|
||||||
}
|
|
||||||
.main-content {
|
.main-content {
|
||||||
padding: var(--spacing-s) var(--spacing-xl);
|
padding: var(--spacing-s) var(--spacing-xl);
|
||||||
}
|
}
|
||||||
|
@ -426,15 +449,16 @@
|
||||||
.main-content {
|
.main-content {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
grid-template-rows: 315px;
|
grid-template-rows: 380px;
|
||||||
}
|
}
|
||||||
.main-content.binding-panel {
|
.main-content.binding-panel {
|
||||||
grid-template-columns: 1fr 320px;
|
grid-template-columns: 1fr 320px;
|
||||||
}
|
}
|
||||||
.binding-picker {
|
.binding-picker {
|
||||||
overflow-y: auto;
|
|
||||||
border-left: 2px solid var(--border-light);
|
border-left: 2px solid var(--border-light);
|
||||||
border-left: var(--border-light);
|
border-left: var(--border-light);
|
||||||
|
overflow: scroll;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
.editor {
|
.editor {
|
||||||
padding: var(--spacing-xl);
|
padding: var(--spacing-xl);
|
||||||
|
|
Loading…
Reference in New Issue