1
0
Fork 0
mirror of synced 2024-08-01 11:21:41 +12:00

Merge branch 'develop' of github.com:Budibase/budibase into feature/json-backend

This commit is contained in:
mike12345567 2021-11-24 13:27:58 +00:00
commit de71e83411
46 changed files with 672 additions and 407 deletions

View file

@ -1,5 +1,5 @@
{ {
"version": "0.9.185-alpha.14", "version": "0.9.185-alpha.19",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/auth", "name": "@budibase/auth",
"version": "0.9.185-alpha.14", "version": "0.9.185-alpha.19",
"description": "Authentication middlewares for budibase builder and apps", "description": "Authentication middlewares for budibase builder and apps",
"main": "src/index.js", "main": "src/index.js",
"author": "Budibase", "author": "Budibase",

View file

@ -1,7 +1,7 @@
{ {
"name": "@budibase/bbui", "name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.", "description": "A UI solution used in the different Budibase projects.",
"version": "0.9.185-alpha.14", "version": "0.9.185-alpha.19",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"module": "dist/bbui.es.js", "module": "dist/bbui.es.js",

View file

@ -6,6 +6,7 @@
export let value = null export let value = null
export let label = undefined export let label = undefined
export let disabled = false export let disabled = false
export let readonly = false
export let labelPosition = "above" export let labelPosition = "above"
export let error = null export let error = null
export let placeholder = "Choose an option or type" export let placeholder = "Choose an option or type"
@ -33,6 +34,7 @@
{value} {value}
{options} {options}
{placeholder} {placeholder}
{readonly}
{getOptionLabel} {getOptionLabel}
{getOptionValue} {getOptionValue}
on:change={onChange} on:change={onChange}

View file

@ -9,6 +9,7 @@
export let id = null export let id = null
export let placeholder = "Choose an option or type" export let placeholder = "Choose an option or type"
export let disabled = false export let disabled = false
export let readonly = false
export let error = null export let error = null
export let options = [] export let options = []
export let getOptionLabel = option => option export let getOptionLabel = option => option
@ -73,6 +74,7 @@
value={value || ""} value={value || ""}
placeholder={placeholder || ""} placeholder={placeholder || ""}
{disabled} {disabled}
{readonly}
class="spectrum-Textfield-input spectrum-InputGroup-input" class="spectrum-Textfield-input spectrum-InputGroup-input"
/> />
</div> </div>

View file

@ -16,15 +16,15 @@
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
let focus = false let focus = false
const updateValue = value => { const updateValue = newValue => {
if (readonly) { if (readonly) {
return return
} }
if (type === "number") { if (type === "number") {
const float = parseFloat(value) const float = parseFloat(newValue)
value = isNaN(float) ? null : float newValue = isNaN(float) ? null : float
} }
dispatch("change", value) dispatch("change", newValue)
} }
const onFocus = () => { const onFocus = () => {

View file

@ -1,41 +1,44 @@
context("Add Multi-Option Datatype", () => { context("Add Multi-Option Datatype", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
}) })
it("should create a new table, with data", () => { it("should create a new table, with data", () => {
cy.createTable("Multi Data") cy.createTable("Multi Data")
cy.addColumn("Multi Data", "Test Data", "Multi-select", "1\n2\n3\n4\n5") cy.addColumn("Multi Data", "Test Data", "Multi-select", "1\n2\n3\n4\n5")
cy.addRowMultiValue(["1", "2", "3", "4", "5"]) cy.addRowMultiValue(["1", "2", "3", "4", "5"])
}) })
it ("should add form with multi select picker, containing 5 options", () => { it("should add form with multi select picker, containing 5 options", () => {
cy.navigateToFrontend() cy.navigateToFrontend()
cy.wait(500) cy.wait(500)
// Add data provider // Add data provider
cy.get(`[data-cy="category-Data Provider"]`).click() cy.get(`[data-cy="category-Data"]`).click()
cy.get('[data-cy="dataSource-prop-control"]').click() cy.get(`[data-cy="component-Data Provider"]`).click()
cy.get(".dropdown").contains("Multi Data").click() cy.get('[data-cy="dataSource-prop-control"]').click()
cy.wait(500) cy.get(".dropdown").contains("Multi Data").click()
// Add Form with schema to match table cy.wait(500)
cy.addComponent("Form", "Form") // Add Form with schema to match table
cy.get('[data-cy="dataSource-prop-control"').click() cy.addComponent("Form", "Form")
cy.get(".dropdown").contains("Multi Data").click() cy.get('[data-cy="dataSource-prop-control"').click()
cy.wait(500) cy.get(".dropdown").contains("Multi Data").click()
// Add multi-select picker to form cy.wait(500)
cy.addComponent("Form", "Multi-select Picker").then((componentId) => { // Add multi-select picker to form
cy.get('[data-cy="field-prop-control"]').type("Test Data").type('{enter}') cy.addComponent("Form", "Multi-select Picker").then(componentId => {
cy.wait(1000) cy.get('[data-cy="field-prop-control"]').type("Test Data").type("{enter}")
cy.getComponent(componentId).contains("Choose some options").click() cy.wait(1000)
// Check picker has 5 items cy.getComponent(componentId).contains("Choose some options").click()
cy.getComponent(componentId).find('li').should('have.length', 5) // Check picker has 5 items
// Select all items cy.getComponent(componentId).find("li").should("have.length", 5)
for (let i = 1; i < 6; i++) { // Select all items
cy.getComponent(componentId).find('li').contains(i).click() for (let i = 1; i < 6; i++) {
} cy.getComponent(componentId).find("li").contains(i).click()
// Check items have been selected }
cy.getComponent(componentId).find('.spectrum-Picker-label').contains("(5)") // Check items have been selected
}) cy.getComponent(componentId)
.find(".spectrum-Picker-label")
.contains("(5)")
}) })
})
}) })

View file

@ -22,9 +22,9 @@ context("Create a automation", () => {
cy.get(".spectrum-Picker-label").click() cy.get(".spectrum-Picker-label").click()
cy.wait(500) cy.wait(500)
cy.contains("dog").click() cy.contains("dog").click()
cy.wait(2000)
// Create action // Create action
cy.contains("Add Action").click() cy.get(".block > .spectrum-Icon").click()
cy.get(".modal-inner-wrapper").within(() => { cy.get(".modal-inner-wrapper").within(() => {
cy.wait(1000) cy.wait(1000)
cy.contains("Create Row").trigger('mouseover').click().click() cy.contains("Create Row").trigger('mouseover').click().click()

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "0.9.185-alpha.14", "version": "0.9.185-alpha.19",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -65,10 +65,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^0.9.185-alpha.14", "@budibase/bbui": "^0.9.185-alpha.19",
"@budibase/client": "^0.9.185-alpha.14", "@budibase/client": "^0.9.185-alpha.19",
"@budibase/colorpicker": "1.1.2", "@budibase/colorpicker": "1.1.2",
"@budibase/string-templates": "^0.9.185-alpha.14", "@budibase/string-templates": "^0.9.185-alpha.19",
"@sentry/browser": "5.19.1", "@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1", "@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1", "@spectrum-css/vars": "^3.0.1",

View file

@ -93,7 +93,9 @@ const automationActions = store => ({
}, },
select: automation => { select: automation => {
store.update(state => { store.update(state => {
let testResults = state.selectedAutomation?.testResults
state.selectedAutomation = new Automation(cloneDeep(automation)) state.selectedAutomation = new Automation(cloneDeep(automation))
state.selectedAutomation.testResults = testResults
state.selectedBlock = null state.selectedBlock = null
return state return state
}) })

View file

@ -84,7 +84,6 @@
class="block" class="block"
animate:flip={{ duration: 500 }} animate:flip={{ duration: 500 }}
in:fly|local={{ x: 500, duration: 1500 }} in:fly|local={{ x: 500, duration: 1500 }}
out:fly|local={{ x: 500, duration: 800 }}
> >
<FlowItem {testDataModal} {testAutomation} {onSelect} {block} /> <FlowItem {testDataModal} {testAutomation} {onSelect} {block} />
</div> </div>

View file

@ -25,10 +25,10 @@
let resultsModal let resultsModal
let setupToggled let setupToggled
let blockComplete let blockComplete
$: testResult = $automationStore.selectedAutomation.testResults?.steps.filter( $: testResult = $automationStore.selectedAutomation.testResults?.steps.filter(
step => step.stepId === block.stepId step => step.stepId === block.stepId
) )
$: isTrigger = block.type === "TRIGGER" $: isTrigger = block.type === "TRIGGER"
$: selected = $automationStore.selectedBlock?.id === block.id $: selected = $automationStore.selectedBlock?.id === block.id
@ -150,15 +150,6 @@
>Finish and test automation</Button >Finish and test automation</Button
> >
{/if} {/if}
<Button
disabled={!hasCompletedInputs}
on:click={() => {
setupToggled = false
actionModal.show()
}}
primary={!isTrigger}
cta={isTrigger}>Add Action</Button
>
{/if} {/if}
</Layout> </Layout>
</div> </div>

View file

@ -9,6 +9,7 @@
onMount(() => { onMount(() => {
automationStore.actions.fetch() automationStore.actions.fetch()
}) })
function selectAutomation(automation) { function selectAutomation(automation) {
automationStore.actions.select(automation) automationStore.actions.select(automation)
$goto(`./${automation._id}`) $goto(`./${automation._id}`)

View file

@ -51,31 +51,31 @@
: { schema: {} } : { schema: {} }
$: schemaFields = table ? Object.values(table.schema) : [] $: schemaFields = table ? Object.values(table.schema) : []
const onChange = debounce( const onChange = debounce(async function (e, key) {
async function (e, key) { if (isTestModal) {
if (isTestModal) { // Special case for webhook, as it requires a body, but the schema already brings back the body's contents
// Special case for webhook, as it requires a body, but the schema already brings back the body's contents if (stepId === "WEBHOOK") {
if (stepId === "WEBHOOK") {
automationStore.actions.addTestDataToAutomation({
body: {
[key]: e.detail,
...$automationStore.selectedAutomation.automation.testData.body,
},
})
}
automationStore.actions.addTestDataToAutomation({ automationStore.actions.addTestDataToAutomation({
[key]: e.detail, body: {
[key]: e.detail,
...$automationStore.selectedAutomation.automation.testData.body,
},
}) })
testData[key] = e.detail
} else {
block.inputs[key] = e.detail
await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
} }
}, automationStore.actions.addTestDataToAutomation({
isTestModal ? 0 : 800 [key]: e.detail,
) })
testData[key] = e.detail
await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
} else {
block.inputs[key] = e.detail
await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
}
}, 800)
function getAvailableBindings(block, automation) { function getAvailableBindings(block, automation) {
if (!block || !automation) { if (!block || !automation) {

View file

@ -398,7 +398,7 @@
value={field.formula} value={field.formula}
on:change={e => (field.formula = e.detail)} on:change={e => (field.formula = e.detail)}
bindings={getBindings({ table })} bindings={getBindings({ table })}
serverSide="true" allowJS
/> />
{:else if field.type === AUTO_TYPE} {:else if field.type === AUTO_TYPE}
<Select <Select

View file

@ -72,15 +72,17 @@
} }
</script> </script>
<ActionMenu> {#if allowDeletion}
<div slot="control" class="icon"> <ActionMenu>
<Icon s hoverable name="MoreSmallList" /> <div slot="control" class="icon">
</div> <Icon s hoverable name="MoreSmallList" />
<MenuItem icon="Edit" on:click={editorModal.show}>Edit</MenuItem> </div>
{#if allowDeletion} {#if !external}
<MenuItem icon="Edit" on:click={editorModal.show}>Edit</MenuItem>
{/if}
<MenuItem icon="Delete" on:click={showDeleteModal}>Delete</MenuItem> <MenuItem icon="Delete" on:click={showDeleteModal}>Delete</MenuItem>
{/if} </ActionMenu>
</ActionMenu> {/if}
<Modal bind:this={editorModal}> <Modal bind:this={editorModal}>
<ModalContent <ModalContent

View file

@ -1,6 +1,4 @@
<script context="module"> <script context="module">
import { Label } from "@budibase/bbui"
export const EditorModes = { export const EditorModes = {
JS: { JS: {
name: "javascript", name: "javascript",
@ -21,6 +19,7 @@
</script> </script>
<script> <script>
import { Label } from "@budibase/bbui"
import CodeMirror from "components/integration/codemirror" import CodeMirror from "components/integration/codemirror"
import { themeStore } from "builderStore" import { themeStore } from "builderStore"
import { createEventDispatcher, onMount } from "svelte" import { createEventDispatcher, onMount } from "svelte"
@ -156,4 +155,9 @@
div :global(.CodeMirror-focused) { div :global(.CodeMirror-focused) {
border-color: var(--spectrum-alias-border-color-mouse-focus); border-color: var(--spectrum-alias-border-color-mouse-focus);
} }
/* Ensure hints are always on top */
:global(.CodeMirror-hints) {
z-index: 999999;
}
</style> </style>

View file

@ -22,7 +22,7 @@
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
export let bindableProperties export let bindings
export let value = "" export let value = ""
export let valid export let valid
export let allowJS = false export let allowJS = false
@ -36,17 +36,23 @@
let hbsValue = initialValueJS ? null : value let hbsValue = initialValueJS ? null : value
$: usingJS = mode === "JavaScript" $: usingJS = mode === "JavaScript"
$: ({ context } = groupBy("type", bindableProperties))
$: searchRgx = new RegExp(search, "ig") $: searchRgx = new RegExp(search, "ig")
$: filteredBindings = context?.filter(context => { $: categories = Object.entries(groupBy("category", bindings))
return context.readableBinding.match(searchRgx) $: filteredCategories = categories
}) .map(([name, categoryBindings]) => ({
name,
bindings: categoryBindings?.filter(binding => {
return binding.readableBinding.match(searchRgx)
}),
}))
.filter(category => category.bindings?.length > 0)
$: filteredHelpers = helpers?.filter(helper => { $: filteredHelpers = helpers?.filter(helper => {
return helper.label.match(searchRgx) || helper.description.match(searchRgx) return helper.label.match(searchRgx) || helper.description.match(searchRgx)
}) })
$: codeMirrorHints = bindings?.map(x => `$("${x.readableBinding}")`)
const updateValue = value => { const updateValue = value => {
valid = isValid(readableToRuntimeBinding(bindableProperties, value)) valid = isValid(readableToRuntimeBinding(bindings, value))
if (valid) { if (valid) {
dispatch("change", value) dispatch("change", value)
} }
@ -91,7 +97,7 @@
} }
onMount(() => { onMount(() => {
valid = isValid(readableToRuntimeBinding(bindableProperties, value)) valid = isValid(readableToRuntimeBinding(bindings, value))
}) })
</script> </script>
@ -102,18 +108,29 @@
<div class="heading">Search</div> <div class="heading">Search</div>
<Search placeholder="Search" bind:value={search} /> <Search placeholder="Search" bind:value={search} />
</section> </section>
{#if filteredBindings?.length} {#each filteredCategories as category}
<section> {#if category.bindings?.length}
<div class="heading">Bindable Values</div> <section>
<ul> <div class="heading">{category.name}</div>
{#each filteredBindings as binding} <ul>
<li on:click={() => addBinding(binding)}> {#each category.bindings as binding}
{binding.readableBinding} <li on:click={() => addBinding(binding)}>
</li> <span class="binding__label">{binding.readableBinding}</span>
{/each} {#if binding.type}
</ul> <span class="binding__type">{binding.type}</span>
</section> {/if}
{/if} {#if binding.description}
<br />
<div class="binding__description">
{binding.description || ""}
</div>
{/if}
</li>
{/each}
</ul>
</section>
{/if}
{/each}
{#if filteredHelpers?.length && !usingJS} {#if filteredHelpers?.length && !usingJS}
<section> <section>
<div class="heading">Helpers</div> <div class="heading">Helpers</div>
@ -162,7 +179,7 @@
height={200} height={200}
value={decodeJSBinding(jsValue)} value={decodeJSBinding(jsValue)}
on:change={onChangeJSValue} on:change={onChangeJSValue}
hints={context?.map(x => `$("${x.readableBinding}")`)} hints={codeMirrorHints}
/> />
<Body size="S"> <Body size="S">
JavaScript expressions are executed as functions, so ensure that JavaScript expressions are executed as functions, so ensure that
@ -234,6 +251,24 @@
color: var(--spectrum-global-color-gray-900) !important; color: var(--spectrum-global-color-gray-900) !important;
} }
.binding__label {
font-weight: 600;
text-transform: capitalize;
}
.binding__description {
color: var(--spectrum-global-color-gray-700);
margin: 0.5rem 0 0 0;
white-space: normal;
}
.binding__type {
font-family: monospace;
background-color: var(--spectrum-global-color-gray-200);
border-radius: var(--border-radius-s);
padding: 2px 4px;
margin-left: 2px;
font-weight: 600;
}
.helper { .helper {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View file

@ -0,0 +1,30 @@
<script>
import BindingPanel from "./BindingPanel.svelte"
export let bindings = []
export let valid
export let value = ""
export let allowJS = false
$: enrichedBindings = enrichBindings(bindings)
// Ensure bindings have the correct categories
const enrichBindings = bindings => {
if (!bindings?.length) {
return bindings
}
return bindings?.map(binding => ({
...binding,
category: "Bindable Values",
type: null,
}))
}
</script>
<BindingPanel
bind:valid
bindings={enrichedBindings}
{value}
{allowJS}
on:change
/>

View file

@ -4,11 +4,11 @@
readableToRuntimeBinding, readableToRuntimeBinding,
runtimeToReadableBinding, runtimeToReadableBinding,
} from "builderStore/dataBinding" } from "builderStore/dataBinding"
import BindingPanel from "components/common/bindings/BindingPanel.svelte" import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { isJSBinding } from "@budibase/string-templates" import { isJSBinding } from "@budibase/string-templates"
export let panel = BindingPanel export let panel = ClientBindingPanel
export let value = "" export let value = ""
export let bindings = [] export let bindings = []
export let title = "Bindings" export let title = "Bindings"
@ -55,6 +55,7 @@
<Combobox <Combobox
{label} {label}
{disabled} {disabled}
readonly={isJS}
value={isJS ? "(JavaScript function)" : readableValue} value={isJS ? "(JavaScript function)" : readableValue}
on:type={e => onChange(e.detail, false)} on:type={e => onChange(e.detail, false)}
on:pick={e => onChange(e.detail, true)} on:pick={e => onChange(e.detail, true)}
@ -82,7 +83,7 @@
value={readableValue} value={readableValue}
close={handleClose} close={handleClose}
on:change={event => (tempValue = event.detail)} on:change={event => (tempValue = event.detail)}
bindableProperties={bindings} {bindings}
{allowJS} {allowJS}
/> />
</Drawer> </Drawer>

View file

@ -4,11 +4,11 @@
readableToRuntimeBinding, readableToRuntimeBinding,
runtimeToReadableBinding, runtimeToReadableBinding,
} from "builderStore/dataBinding" } from "builderStore/dataBinding"
import BindingPanel from "components/common/bindings/BindingPanel.svelte" import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { isJSBinding } from "@budibase/string-templates" import { isJSBinding } from "@budibase/string-templates"
export let panel = BindingPanel export let panel = ClientBindingPanel
export let value = "" export let value = ""
export let bindings = [] export let bindings = []
export let title = "Bindings" export let title = "Bindings"
@ -40,6 +40,7 @@
<Input <Input
{label} {label}
{disabled} {disabled}
readonly={isJS}
value={isJS ? "(JavaScript function)" : readableValue} value={isJS ? "(JavaScript function)" : readableValue}
on:change={event => onChange(event.detail)} on:change={event => onChange(event.detail)}
{placeholder} {placeholder}
@ -63,7 +64,7 @@
bind:valid bind:valid
value={readableValue} value={readableValue}
on:change={event => (tempValue = event.detail)} on:change={event => (tempValue = event.detail)}
bindableProperties={bindings} {bindings}
{allowJS} {allowJS}
/> />
</Drawer> </Drawer>

View file

@ -6,20 +6,23 @@
} from "builderStore/dataBinding" } from "builderStore/dataBinding"
import ServerBindingPanel from "components/common/bindings/ServerBindingPanel.svelte" import ServerBindingPanel from "components/common/bindings/ServerBindingPanel.svelte"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { isJSBinding } from "@budibase/string-templates"
export let panel = ServerBindingPanel export let panel = ServerBindingPanel
export let value = "" export let value = ""
export let bindings = [] export let bindings = []
export let thin = true
export let title = "Bindings" export let title = "Bindings"
export let placeholder export let placeholder
export let label export let label
export let allowJS = false
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
let bindingModal let bindingModal
let valid = true let valid = true
$: readableValue = runtimeToReadableBinding(bindings, value) $: readableValue = runtimeToReadableBinding(bindings, value)
$: tempValue = readableValue $: tempValue = readableValue
$: isJS = isJSBinding(value)
const saveBinding = () => { const saveBinding = () => {
onChange(tempValue) onChange(tempValue)
@ -34,8 +37,8 @@
<div class="control"> <div class="control">
<Input <Input
{label} {label}
{thin} readonly={isJS}
value={readableValue} value={isJS ? "(JavaScript function)" : readableValue}
on:change={event => onChange(event.detail)} on:change={event => onChange(event.detail)}
{placeholder} {placeholder}
/> />
@ -55,7 +58,8 @@
value={readableValue} value={readableValue}
bind:valid bind:valid
on:change={e => (tempValue = e.detail)} on:change={e => (tempValue = e.detail)}
bindableProperties={bindings} {bindings}
{allowJS}
/> />
</div> </div>
</ModalContent> </ModalContent>

View file

@ -1,209 +1,27 @@
<script> <script>
import groupBy from "lodash/fp/groupBy" import BindingPanel from "./BindingPanel.svelte"
import { Search, TextArea, DrawerContent } from "@budibase/bbui"
import { createEventDispatcher } from "svelte"
import { isValid } from "@budibase/string-templates"
import { handlebarsCompletions } from "constants/completions"
import { readableToRuntimeBinding } from "builderStore/dataBinding"
import { addHBSBinding } from "./utils"
const dispatch = createEventDispatcher() export let bindings = []
export let valid
export let bindableProperties = []
export let valid = true
export let value = "" export let value = ""
export let allowJS = false
let helpers = handlebarsCompletions() $: enrichedBindings = enrichBindings(bindings)
let getCaretPosition
let search = ""
$: categories = Object.entries(groupBy("category", bindableProperties)) // Ensure bindings have the correct properties
$: valid = isValid(readableToRuntimeBinding(bindableProperties, value)) const enrichBindings = bindings => {
$: dispatch("change", value) return bindings?.map(binding => ({
$: searchRgx = new RegExp(search, "ig") ...binding,
$: filteredCategories = categories.map(([categoryName, bindings]) => { readableBinding: binding.label || binding.readableBinding,
const filteredBindings = bindings.filter(binding => { runtimeBinding: binding.path || binding.runtimeBinding,
return binding.label.match(searchRgx) }))
}) }
return [categoryName, filteredBindings]
})
$: filteredHelpers = helpers?.filter(helper => {
return helper.label.match(searchRgx) || helper.description.match(searchRgx)
})
</script> </script>
<DrawerContent> <BindingPanel
<svelte:fragment slot="sidebar"> bind:valid
<div class="container"> bindings={enrichedBindings}
<section> {value}
<div class="heading">Search</div> {allowJS}
<Search placeholder="Search" bind:value={search} /> on:change
</section> />
{#each filteredCategories as [categoryName, bindings]}
{#if bindings.length}
<section>
<div class="heading">{categoryName}</div>
<ul>
{#each bindings as binding}
<li
on:click={() => {
value = addHBSBinding(value, getCaretPosition(), binding)
}}
>
<span class="binding__label">{binding.label}</span>
<span class="binding__type">{binding.type}</span>
{#if binding.description}
<br />
<div class="binding__description">
{binding.description || ""}
</div>
{/if}
</li>
{/each}
</ul>
</section>
{/if}
{/each}
{#if filteredHelpers?.length}
<section>
<div class="heading">Helpers</div>
<ul>
{#each filteredHelpers as helper}
<li
on:click={() => {
value = addHBSBinding(value, getCaretPosition(), helper.text)
}}
>
<div class="helper">
<div class="helper__name">{helper.displayText}</div>
<div class="helper__description">
{@html helper.description}
</div>
<pre class="helper__example">{helper.example || ''}</pre>
</div>
</li>
{/each}
</ul>
</section>
{/if}
</div>
</svelte:fragment>
<div class="main">
<TextArea
bind:getCaretPosition
bind:value
placeholder="Add text, or click the objects on the left to add them to the textbox."
/>
{#if !valid}
<p class="syntax-error">
Current Handlebars syntax is invalid, please check the guide
<a href="https://handlebarsjs.com/guide/">here</a>
for more details.
</p>
{/if}
</div>
</DrawerContent>
<style>
.main :global(textarea) {
min-height: 150px !important;
}
.container {
margin: calc(-1 * var(--spacing-xl));
}
.heading {
font-size: var(--font-size-s);
font-weight: 600;
text-transform: uppercase;
color: var(--spectrum-global-color-gray-600);
padding: var(--spacing-xl) 0 var(--spacing-m) 0;
}
section {
padding: 0 var(--spacing-xl) var(--spacing-xl) var(--spacing-xl);
}
section:not(:first-child) {
border-top: var(--border-light);
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
li {
font-size: var(--font-size-s);
padding: var(--spacing-m);
border-radius: 4px;
border: var(--border-light);
transition: background-color 130ms ease-in-out, color 130ms ease-in-out,
border-color 130ms ease-in-out;
}
li:not(:last-of-type) {
margin-bottom: var(--spacing-s);
}
li :global(*) {
transition: color 130ms ease-in-out;
}
li:hover {
color: var(--spectrum-global-color-gray-900);
background-color: var(--spectrum-global-color-gray-50);
border-color: var(--spectrum-global-color-gray-500);
cursor: pointer;
}
li:hover :global(*) {
color: var(--spectrum-global-color-gray-900) !important;
}
.helper {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
gap: var(--spacing-xs);
}
.helper__name {
font-weight: bold;
}
.helper__description,
.helper__description :global(*) {
color: var(--spectrum-global-color-gray-700);
}
.helper__example {
white-space: normal;
margin: 0.5rem 0 0 0;
font-weight: 700;
}
.helper__description :global(p) {
margin: 0;
}
.syntax-error {
padding-top: var(--spacing-m);
color: var(--red);
font-size: 12px;
}
.syntax-error a {
color: var(--red);
text-decoration: underline;
}
.binding__label {
font-weight: 600;
text-transform: capitalize;
}
.binding__description {
color: var(--spectrum-global-color-gray-700);
margin: 0.5rem 0 0 0;
white-space: normal;
}
.binding__type {
font-family: monospace;
background-color: var(--spectrum-global-color-gray-200);
border-radius: var(--border-radius-s);
padding: 2px 4px;
margin-left: 2px;
font-weight: 600;
}
</style>

View file

@ -8,12 +8,24 @@
"repeaterblock" "repeaterblock"
] ]
}, },
"section", {
"container", "name": "Layout",
"dataprovider", "icon": "ClassicGridView",
"table", "children": [
"repeater", "container",
"button", "section"
]
},
{
"name": "Data",
"icon": "Data",
"children": [
"dataprovider",
"repeater",
"table",
"dynamicfilter"
]
},
{ {
"name": "Form", "name": "Form",
"icon": "Form", "icon": "Form",
@ -60,6 +72,7 @@
"children": [ "children": [
"heading", "heading",
"text", "text",
"button",
"divider", "divider",
"image", "image",
"backgroundimage", "backgroundimage",

View file

@ -60,7 +60,7 @@
</div> </div>
<Detail size="S">Autogenerated Screens</Detail> <Detail size="S">Autogenerated Screens</Detail>
{#each $tables.list.filter(table => table.type !== "external" && table._id !== "ta_users") as table} {#each $tables.list.filter(table => table._id !== "ta_users") as table}
<div <div
class:disabled={blankSelected} class:disabled={blankSelected}
class:selected={selectedScreens.find(x => x.name.includes(table.name))} class:selected={selectedScreens.find(x => x.name.includes(table.name))}
@ -90,7 +90,6 @@
.content { .content {
letter-spacing: 0px; letter-spacing: 0px;
color: #2c2c2c;
} }
.item { .item {
cursor: pointer; cursor: pointer;

View file

@ -11,14 +11,14 @@
Select, Select,
} from "@budibase/bbui" } from "@budibase/bbui"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
import BindingPanel from "components/common/bindings/BindingPanel.svelte" import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
import { generate } from "shortid" import { generate } from "shortid"
import { getValidOperatorsForType, OperatorOptions } from "constants/lucene" import { getValidOperatorsForType, OperatorOptions } from "constants/lucene"
export let schemaFields export let schemaFields
export let filters = [] export let filters = []
export let bindings = [] export let bindings = []
export let panel = BindingPanel export let panel = ClientBindingPanel
export let allowBindings = true export let allowBindings = true
const BannedTypes = ["link", "attachment", "formula"] const BannedTypes = ["link", "attachment", "formula"]

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "0.9.185-alpha.14", "version": "0.9.185-alpha.19",
"description": "Budibase CLI, for developers, self hosting and migrations.", "description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js", "main": "src/index.js",
"bin": { "bin": {

View file

@ -247,7 +247,6 @@
"description": "A basic html button that is ready for styling", "description": "A basic html button that is ready for styling",
"icon": "Button", "icon": "Button",
"editable": true, "editable": true,
"illegalChildren": ["section"],
"showSettingsBar": true, "showSettingsBar": true,
"settings": [ "settings": [
{ {
@ -2647,6 +2646,49 @@
} }
] ]
}, },
"dynamicfilter": {
"name": "Dynamic Filter",
"icon": "FilterEdit",
"showSettingsBar": true,
"settings": [
{
"type": "dataProvider",
"label": "Provider",
"key": "dataProvider"
},
{
"type": "multifield",
"label": "Allowed filter fields",
"key": "allowedFields",
"placeholder": "All fields"
},
{
"type": "select",
"label": "Button size",
"showInBar": true,
"key": "size",
"options": [
{
"label": "Small",
"value": "S"
},
{
"label": "Medium",
"value": "M"
},
{
"label": "Large",
"value": "L"
},
{
"label": "Extra large",
"value": "XL"
}
],
"defaultValue": "M"
}
]
},
"tableblock": { "tableblock": {
"block": true, "block": true,
"name": "Table block", "name": "Table block",

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/client", "name": "@budibase/client",
"version": "0.9.185-alpha.14", "version": "0.9.185-alpha.19",
"license": "MPL-2.0", "license": "MPL-2.0",
"module": "dist/budibase-client.js", "module": "dist/budibase-client.js",
"main": "dist/budibase-client.js", "main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw" "dev:builder": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^0.9.185-alpha.14", "@budibase/bbui": "^0.9.185-alpha.19",
"@budibase/standard-components": "^0.9.139", "@budibase/standard-components": "^0.9.139",
"@budibase/string-templates": "^0.9.185-alpha.14", "@budibase/string-templates": "^0.9.185-alpha.19",
"regexparam": "^1.3.0", "regexparam": "^1.3.0",
"shortid": "^2.2.15", "shortid": "^2.2.15",
"svelte-spa-router": "^3.0.5" "svelte-spa-router": "^3.0.5"

View file

@ -121,6 +121,9 @@
--> -->
<div id="flatpickr-root" /> <div id="flatpickr-root" />
<!-- Modal container to ensure they sit on top -->
<div class="modal-container" />
<!-- Layers on top of app --> <!-- Layers on top of app -->
<NotificationDisplay /> <NotificationDisplay />
<ConfirmationDisplay /> <ConfirmationDisplay />

View file

@ -72,13 +72,18 @@
$: inSelectedPath = $builderStore.selectedComponentPath?.includes(id) $: inSelectedPath = $builderStore.selectedComponentPath?.includes(id)
$: inDragPath = inSelectedPath && $builderStore.editMode $: inDragPath = inSelectedPath && $builderStore.editMode
// Derive definition properties which can all be optional, so need to be
// coerced to booleans
$: editable = !!definition?.editable
$: hasChildren = !!definition?.hasChildren
$: showEmptyState = definition?.showEmptyState !== false
// Interactive components can be selected, dragged and highlighted inside // Interactive components can be selected, dragged and highlighted inside
// the builder preview // the builder preview
$: interactive = $: interactive =
$builderStore.inBuilder && $builderStore.inBuilder &&
($builderStore.previewType === "layout" || insideScreenslot) && ($builderStore.previewType === "layout" || insideScreenslot) &&
!isBlock !isBlock
$: editable = definition?.editable
$: editing = editable && selected && $builderStore.editMode $: editing = editable && selected && $builderStore.editMode
$: draggable = !inDragPath && interactive && !isLayout && !isScreen $: draggable = !inDragPath && interactive && !isLayout && !isScreen
$: droppable = interactive && !isLayout && !isScreen $: droppable = interactive && !isLayout && !isScreen
@ -86,8 +91,8 @@
// Empty components are those which accept children but do not have any. // Empty components are those which accept children but do not have any.
// Empty states can be shown for these components, but can be disabled // Empty states can be shown for these components, but can be disabled
// in the component manifest. // in the component manifest.
$: empty = interactive && !children.length && definition?.hasChildren $: empty = interactive && !children.length && hasChildren
$: emptyState = empty && definition?.showEmptyState !== false $: emptyState = empty && showEmptyState
// Raw settings are all settings excluding internal props and children // Raw settings are all settings excluding internal props and children
$: rawSettings = getRawSettings(instance) $: rawSettings = getRawSettings(instance)
@ -103,6 +108,9 @@
// Build up the final settings object to be passed to the component // Build up the final settings object to be passed to the component
$: cacheSettings(enrichedSettings, nestedSettings, conditionalSettings) $: cacheSettings(enrichedSettings, nestedSettings, conditionalSettings)
// Render key is used to determine when components need to fully remount
$: renderKey = getRenderKey(id, editing)
// Update component context // Update component context
$: componentStore.set({ $: componentStore.set({
id, id,
@ -268,35 +276,43 @@
}) })
} }
} }
// Generates a key used to determine when components need to fully remount.
// Currently only toggling editing requires remounting.
const getRenderKey = (id, editing) => {
return hashString(`${id}-${editing}`)
}
</script> </script>
{#if constructor && cachedSettings && (visible || inSelectedPath)} {#key renderKey}
<!-- The ID is used as a class because getElementsByClassName is O(1) --> {#if constructor && cachedSettings && (visible || inSelectedPath)}
<!-- and the performance matters for the selection indicators --> <!-- The ID is used as a class because getElementsByClassName is O(1) -->
<div <!-- and the performance matters for the selection indicators -->
class={`component ${id}`} <div
class:draggable class={`component ${id}`}
class:droppable class:draggable
class:empty class:droppable
class:interactive class:empty
class:editing class:interactive
class:block={isBlock} class:editing
data-id={id} class:block={isBlock}
data-name={name} data-id={id}
> data-name={name}
<svelte:component this={constructor} {...cachedSettings}> >
{#if children.length} <svelte:component this={constructor} {...cachedSettings}>
{#each children as child (child._id)} {#if children.length}
<svelte:self instance={child} /> {#each children as child (child._id)}
{/each} <svelte:self instance={child} />
{:else if emptyState} {/each}
<Placeholder /> {:else if emptyState}
{:else if isBlock} <Placeholder />
<slot /> {:else if isBlock}
{/if} <slot />
</svelte:component> {/if}
</div> </svelte:component>
{/if} </div>
{/if}
{/key}
<style> <style>
.component { .component {

View file

@ -12,6 +12,10 @@
export let type = "primary" export let type = "primary"
export let quiet = false export let quiet = false
// For internal use only for now - not defined in the manifest
export let icon = null
export let active = false
let node let node
$: $component.editing && node?.focus() $: $component.editing && node?.focus()
@ -25,7 +29,7 @@
} }
const updateText = e => { const updateText = e => {
builderStore.actions.updateProp("text", e.target.textContent) builderStore.actions.updateProp("text", e.target.textContent.trim())
} }
</script> </script>
@ -35,10 +39,22 @@
{disabled} {disabled}
use:styleable={$component.styles} use:styleable={$component.styles}
on:click={onClick} on:click={onClick}
contenteditable={$component.editing} contenteditable={$component.editing && !icon}
on:blur={$component.editing ? updateText : null} on:blur={$component.editing ? updateText : null}
bind:this={node} bind:this={node}
class:active
> >
{#if icon}
<svg
class:hasText={componentText?.length > 0}
class="spectrum-Icon spectrum-Icon--size{size.toUpperCase()}"
focusable="false"
aria-hidden="true"
aria-label={icon}
>
<use xlink:href="#spectrum-icon-18-{icon}" />
</svg>
{/if}
{componentText} {componentText}
</button> </button>
@ -56,4 +72,10 @@
.spectrum-Button::after { .spectrum-Button::after {
display: none; display: none;
} }
.spectrum-Icon.hasText {
margin-right: var(--spectrum-button-primary-icon-gap);
}
.active {
color: var(--spectrum-global-color-blue-600);
}
</style> </style>

View file

@ -275,11 +275,10 @@
allRows = res.rows allRows = res.rows
} }
const addQueryExtension = (key, operator, field, value) => { const addQueryExtension = (key, extension) => {
if (!key || !operator || !field) { if (!key || !extension) {
return return
} }
const extension = { operator, field, value }
queryExtensions = { ...queryExtensions, [key]: extension } queryExtensions = { ...queryExtensions, [key]: extension }
} }
@ -295,11 +294,13 @@
const extendQuery = (defaultQuery, extensions) => { const extendQuery = (defaultQuery, extensions) => {
const extensionValues = Object.values(extensions || {}) const extensionValues = Object.values(extensions || {})
let extendedQuery = { ...defaultQuery } let extendedQuery = { ...defaultQuery }
extensionValues.forEach(({ operator, field, value }) => { extensionValues.forEach(extension => {
extendedQuery[operator] = { Object.entries(extension || {}).forEach(([operator, fields]) => {
...extendedQuery[operator], extendedQuery[operator] = {
[field]: value, ...extendedQuery[operator],
} ...fields,
}
})
}) })
if (JSON.stringify(query) !== JSON.stringify(extendedQuery)) { if (JSON.stringify(query) !== JSON.stringify(extendedQuery)) {

View file

@ -13,15 +13,6 @@
const component = getContext("component") const component = getContext("component")
const { styleable, ActionTypes, getAction } = getContext("sdk") const { styleable, ActionTypes, getAction } = getContext("sdk")
$: addExtension = getAction(
dataProvider?.id,
ActionTypes.AddDataProviderQueryExtension
)
$: removeExtension = getAction(
dataProvider?.id,
ActionTypes.RemoveDataProviderQueryExtension
)
const options = [ const options = [
"Last 1 day", "Last 1 day",
"Last 7 days", "Last 7 days",
@ -32,10 +23,23 @@
] ]
let value = options.includes(defaultValue) ? defaultValue : "Last 30 days" let value = options.includes(defaultValue) ? defaultValue : "Last 30 days"
$: queryExtension = getQueryExtension(value) $: dataProviderId = dataProvider?.id
$: addExtension?.($component.id, "range", field, queryExtension) $: addExtension = getAction(
dataProviderId,
ActionTypes.AddDataProviderQueryExtension
)
$: removeExtension = getAction(
dataProviderId,
ActionTypes.RemoveDataProviderQueryExtension
)
$: queryExtension = getQueryExtension(field, value)
$: addExtension?.($component.id, queryExtension)
const getQueryExtension = (field, value) => {
if (!field || !value) {
return null
}
const getQueryExtension = value => {
let low = dayjs.utc().subtract(1, "year") let low = dayjs.utc().subtract(1, "year")
let high = dayjs.utc().add(1, "day") let high = dayjs.utc().add(1, "day")
@ -51,7 +55,14 @@
low = dayjs.utc().subtract(6, "months") low = dayjs.utc().subtract(6, "months")
} }
return { low: low.format(), high: high.format() } return {
range: {
[field]: {
low: low.format(),
high: high.format(),
},
},
}
} }
onDestroy(() => { onDestroy(() => {

View file

@ -47,7 +47,7 @@
// Convert contenteditable HTML to text and save // Convert contenteditable HTML to text and save
const updateText = e => { const updateText = e => {
const sanitized = e.target.innerHTML.replace(/<br>/gi, "\n") const sanitized = e.target.innerHTML.replace(/<br>/gi, "\n").trim()
builderStore.actions.updateProp("text", sanitized) builderStore.actions.updateProp("text", sanitized)
} }
</script> </script>

View file

@ -47,7 +47,7 @@
} }
const updateText = e => { const updateText = e => {
builderStore.actions.updateProp("text", e.target.textContent) builderStore.actions.updateProp("text", e.target.textContent.trim())
} }
</script> </script>

View file

@ -46,7 +46,7 @@
// Convert contenteditable HTML to text and save // Convert contenteditable HTML to text and save
const updateText = e => { const updateText = e => {
const sanitized = e.target.innerHTML.replace(/<br>/gi, "\n") const sanitized = e.target.innerHTML.replace(/<br>/gi, "\n").trim()
builderStore.actions.updateProp("text", sanitized) builderStore.actions.updateProp("text", sanitized)
} }
</script> </script>

View file

@ -0,0 +1,85 @@
<script>
import { get } from "svelte/store"
import { getContext, onDestroy } from "svelte"
import { ModalContent, Modal } from "@budibase/bbui"
import FilterModal from "./FilterModal.svelte"
import { buildLuceneQuery } from "builder/src/helpers/lucene"
import Button from "../Button.svelte"
export let dataProvider
export let allowedFields
export let size = "M"
const component = getContext("component")
const { builderStore, ActionTypes, getAction } = getContext("sdk")
let modal
let tmpFilters = []
let filters = []
$: dataProviderId = dataProvider?.id
$: addExtension = getAction(
dataProviderId,
ActionTypes.AddDataProviderQueryExtension
)
$: removeExtension = getAction(
dataProviderId,
ActionTypes.RemoveDataProviderQueryExtension
)
$: schema = dataProvider?.schema
$: schemaFields = getSchemaFields(schema, allowedFields)
// Add query extension to data provider
$: {
if (filters?.length) {
const queryExtension = buildLuceneQuery(filters)
addExtension?.($component.id, queryExtension)
} else {
removeExtension?.($component.id)
}
}
const getSchemaFields = (schema, allowedFields) => {
let clonedSchema = {}
if (!allowedFields?.length) {
clonedSchema = schema
} else {
allowedFields?.forEach(field => {
clonedSchema[field] = schema[field]
})
}
return Object.values(clonedSchema || {})
}
const openEditor = () => {
if (get(builderStore).inBuilder) {
return
}
tmpFilters = [...filters]
modal.show()
}
const updateQuery = () => {
filters = [...tmpFilters]
}
onDestroy(() => {
removeExtension?.($component.id)
})
</script>
<Button
onClick={openEditor}
icon="Properties"
text="Filter"
{size}
type="secondary"
quiet
active={filters?.length > 0}
/>
<Modal bind:this={modal}>
<ModalContent title="Edit filters" size="XL" onConfirm={updateQuery}>
<FilterModal bind:filters={tmpFilters} {schemaFields} />
</ModalContent>
</Modal>

View file

@ -0,0 +1,176 @@
<script>
import {
Body,
Button,
Combobox,
DatePicker,
DrawerContent,
Icon,
Input,
Layout,
Select,
} from "@budibase/bbui"
import { generate } from "shortid"
import {
getValidOperatorsForType,
OperatorOptions,
} from "builder/src/constants/lucene"
export let schemaFields
export let filters = []
const BannedTypes = ["link", "attachment", "formula"]
$: fieldOptions = (schemaFields ?? [])
.filter(field => !BannedTypes.includes(field.type))
.map(field => field.name)
const addFilter = () => {
filters = [
...filters,
{
id: generate(),
field: null,
operator: OperatorOptions.Equals.value,
value: null,
valueType: "Value",
},
]
}
const removeFilter = id => {
filters = filters.filter(field => field.id !== id)
}
const duplicateFilter = id => {
const existingFilter = filters.find(filter => filter.id === id)
const duplicate = { ...existingFilter, id: generate() }
filters = [...filters, duplicate]
}
const onFieldChange = (expression, field) => {
// Update the field type
expression.type = schemaFields.find(x => x.name === field)?.type
// Ensure a valid operator is set
const validOperators = getValidOperatorsForType(expression.type).map(
x => x.value
)
if (!validOperators.includes(expression.operator)) {
expression.operator = validOperators[0] ?? OperatorOptions.Equals.value
onOperatorChange(expression, expression.operator)
}
// if changed to an array, change default value to empty array
const idx = filters.findIndex(x => x.field === field)
if (expression.type === "array") {
filters[idx].value = []
} else {
filters[idx].value = null
}
}
const onOperatorChange = (expression, operator) => {
const noValueOptions = [
OperatorOptions.Empty.value,
OperatorOptions.NotEmpty.value,
]
expression.noValue = noValueOptions.includes(operator)
if (expression.noValue) {
expression.value = null
}
}
const getFieldOptions = field => {
const schema = schemaFields.find(x => x.name === field)
return schema?.constraints?.inclusion || []
}
</script>
<DrawerContent>
<div class="container">
<Layout noPadding>
<Body size="S">
{#if !filters?.length}
Add your first filter expression.
{:else}
Results are filtered to only those which match all of the following
constraints.
{/if}
</Body>
{#if filters?.length}
<div class="fields">
{#each filters as filter, idx}
<Select
bind:value={filter.field}
options={fieldOptions}
on:change={e => onFieldChange(filter, e.detail)}
placeholder="Column"
/>
<Select
disabled={!filter.field}
options={getValidOperatorsForType(filter.type)}
bind:value={filter.operator}
on:change={e => onOperatorChange(filter, e.detail)}
placeholder={null}
/>
{#if ["string", "longform", "number"].includes(filter.type)}
<Input disabled={filter.noValue} bind:value={filter.value} />
{:else if ["options", "array"].includes(filter.type)}
<Combobox
disabled={filter.noValue}
options={getFieldOptions(filter.field)}
bind:value={filter.value}
/>
{:else if filter.type === "boolean"}
<Combobox
disabled={filter.noValue}
options={[
{ label: "True", value: "true" },
{ label: "False", value: "false" },
]}
bind:value={filter.value}
/>
{:else if filter.type === "datetime"}
<DatePicker disabled={filter.noValue} bind:value={filter.value} />
{:else}
<Input disabled />
{/if}
<Icon
name="Duplicate"
hoverable
size="S"
on:click={() => duplicateFilter(filter.id)}
/>
<Icon
name="Close"
hoverable
size="S"
on:click={() => removeFilter(filter.id)}
/>
{/each}
</div>
{/if}
<div>
<Button icon="AddCircle" size="M" secondary on:click={addFilter}>
Add filter
</Button>
</div>
</Layout>
</div>
</DrawerContent>
<style>
.container {
width: 100%;
max-width: 1000px;
margin: 0 auto;
}
.fields {
display: grid;
column-gap: var(--spacing-l);
row-gap: var(--spacing-s);
align-items: center;
grid-template-columns: 1fr 120px 1fr auto auto;
}
</style>

View file

@ -0,0 +1 @@
export { default as dynamicfilter } from "./DynamicFilter.svelte"

View file

@ -49,7 +49,7 @@
$: labelClass = labelPos === "above" ? "" : `spectrum-FieldLabel--${labelPos}` $: labelClass = labelPos === "above" ? "" : `spectrum-FieldLabel--${labelPos}`
const updateLabel = e => { const updateLabel = e => {
builderStore.actions.updateProp("label", e.target.textContent) builderStore.actions.updateProp("label", e.target.textContent.trim())
} }
</script> </script>

View file

@ -33,6 +33,7 @@ export * from "./charts"
export * from "./forms" export * from "./forms"
export * from "./table" export * from "./table"
export * from "./blocks" export * from "./blocks"
export * from "./dynamic-filter"
// Deprecated component left for compatibility in old apps // Deprecated component left for compatibility in old apps
export { default as navigation } from "./deprecated/Navigation.svelte" export { default as navigation } from "./deprecated/Navigation.svelte"

View file

@ -10,7 +10,6 @@ const dispatchEvent = (type, data = {}) => {
const createBuilderStore = () => { const createBuilderStore = () => {
const initialState = { const initialState = {
inBuilder: false, inBuilder: false,
appId: null,
layout: null, layout: null,
screen: null, screen: null,
selectedComponentId: null, selectedComponentId: null,
@ -94,6 +93,7 @@ const createBuilderStore = () => {
} }
return { return {
...writableStore, ...writableStore,
set: state => writableStore.set({ ...initialState, ...state }),
subscribe: derivedStore.subscribe, subscribe: derivedStore.subscribe,
actions, actions,
} }

View file

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "0.9.185-alpha.14", "version": "0.9.185-alpha.19",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.js", "main": "src/index.js",
"repository": { "repository": {
@ -68,9 +68,9 @@
"author": "Budibase", "author": "Budibase",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@budibase/auth": "^0.9.185-alpha.14", "@budibase/auth": "^0.9.185-alpha.19",
"@budibase/client": "^0.9.185-alpha.14", "@budibase/client": "^0.9.185-alpha.19",
"@budibase/string-templates": "^0.9.185-alpha.14", "@budibase/string-templates": "^0.9.185-alpha.19",
"@bull-board/api": "^3.7.0", "@bull-board/api": "^3.7.0",
"@bull-board/koa": "^3.7.0", "@bull-board/koa": "^3.7.0",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",
@ -155,4 +155,4 @@
"oracledb": "^5.3.0" "oracledb": "^5.3.0"
}, },
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc" "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "0.9.185-alpha.14", "version": "0.9.185-alpha.19",
"description": "Handlebars wrapper for Budibase templating.", "description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs", "main": "src/index.cjs",
"module": "dist/bundle.mjs", "module": "dist/bundle.mjs",

View file

@ -1,7 +1,7 @@
{ {
"name": "@budibase/worker", "name": "@budibase/worker",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "0.9.185-alpha.14", "version": "0.9.185-alpha.19",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.js", "main": "src/index.js",
"repository": { "repository": {
@ -29,8 +29,8 @@
"author": "Budibase", "author": "Budibase",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@budibase/auth": "^0.9.185-alpha.14", "@budibase/auth": "^0.9.185-alpha.19",
"@budibase/string-templates": "^0.9.185-alpha.14", "@budibase/string-templates": "^0.9.185-alpha.19",
"@koa/router": "^8.0.0", "@koa/router": "^8.0.0",
"@sentry/node": "^6.0.0", "@sentry/node": "^6.0.0",
"@techpass/passport-openidconnect": "^0.3.0", "@techpass/passport-openidconnect": "^0.3.0",