Merge in master

This commit is contained in:
Andrew Kingston 2020-09-14 13:55:40 +01:00
commit fe97579d36
9 changed files with 6581 additions and 19 deletions

View File

@ -63,7 +63,7 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.32.0", "@budibase/bbui": "^1.33.0",
"@budibase/client": "^0.1.19", "@budibase/client": "^0.1.19",
"@budibase/colorpicker": "^1.0.1", "@budibase/colorpicker": "^1.0.1",
"@sentry/browser": "5.19.1", "@sentry/browser": "5.19.1",

View File

@ -12,6 +12,5 @@
</script> </script>
<div class="bb-margin-m"> <div class="bb-margin-m">
<Label small forAttr={'datepicker-label'}>{label}</Label>
<DatePicker placeholder={label} on:change={onChange} {value} /> <DatePicker placeholder={label} on:change={onChange} {value} />
</div> </div>

View File

@ -71,7 +71,16 @@
} }
function addFilter() { function addFilter() {
view.filters = [...view.filters, {}] view.filters.push({})
view.filters = view.filters
}
function isMultipleChoice(field) {
return (
viewModel.schema[field].constraints &&
viewModel.schema[field].constraints.inclusion &&
viewModel.schema[field].constraints.inclusion.length
)
} }
</script> </script>
@ -108,10 +117,18 @@
<option value={condition.key}>{condition.name}</option> <option value={condition.key}>{condition.name}</option>
{/each} {/each}
</Select> </Select>
<Input {#if filter.key && isMultipleChoice(filter.key)}
thin <Select secondary thin bind:value={filter.value}>
placeholder={filter.key || fields[0]} {#each viewModel.schema[filter.key].constraints.inclusion as option}
bind:value={filter.value} /> <option value={option}>{option}</option>
{/each}
</Select>
{:else}
<Input
thin
placeholder={filter.key || fields[0]}
bind:value={filter.value} />
{/if}
<i class="ri-close-circle-fill" on:click={() => removeFilter(idx)} /> <i class="ri-close-circle-fill" on:click={() => removeFilter(idx)} />
{/each} {/each}
</div> </div>

View File

@ -12,7 +12,7 @@
<Button secondary small on:click={eventsModal.show}>Define Actions</Button> <Button secondary small on:click={eventsModal.show}>Define Actions</Button>
<Modal bind:this={eventsModal} maxWidth="100vw" hideCloseButton> <Modal bind:this={eventsModal} maxWidth="100vw" hideCloseButton padding="0">
<EventEditorModal <EventEditorModal
event={value} event={value}
eventType={name} eventType={name}

View File

@ -1,5 +1,5 @@
<script> <script>
import { Select, Label } from "@budibase/bbui" import { DataList, Label } from "@budibase/bbui"
import { store } from "builderStore" import { store } from "builderStore"
export let parameters export let parameters
@ -7,12 +7,12 @@
<div class="root"> <div class="root">
<Label size="m" color="dark">Screen</Label> <Label size="m" color="dark">Screen</Label>
<Select secondary bind:value={parameters.url}> <DataList secondary bind:value={parameters.url}>
<option value="" /> <option value="" />
{#each $store.screens as screen} {#each $store.screens as screen}
<option value={screen.route}>{screen.props._instanceName}</option> <option value={screen.route}>{screen.props._instanceName}</option>
{/each} {/each}
</Select> </DataList>
</div> </div>
<style> <style>

6542
packages/builder/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -47,6 +47,7 @@ export const bbFactory = ({
setBinding: setBindableComponentProp(treeNode), setBinding: setBindableComponentProp(treeNode),
api, api,
parent, parent,
store: store.getStore(treeNode.contextStoreKey),
// these parameters are populated by screenRouter // these parameters are populated by screenRouter
routeParams: () => store.getState()["##routeParams"], routeParams: () => store.getState()["##routeParams"],
} }

View File

@ -11,6 +11,7 @@ const contextStoreKey = (dataProviderId, childIndex) =>
`${dataProviderId}${childIndex >= 0 ? ":" + childIndex : ""}` `${dataProviderId}${childIndex >= 0 ? ":" + childIndex : ""}`
// creates a store for a datacontext (e.g. each item in a list component) // creates a store for a datacontext (e.g. each item in a list component)
// overrides store if already exists
const create = (data, dataProviderId, childIndex, parentContextStoreId) => { const create = (data, dataProviderId, childIndex, parentContextStoreId) => {
const key = contextStoreKey(dataProviderId, childIndex) const key = contextStoreKey(dataProviderId, childIndex)
const state = { data } const state = { data }
@ -22,14 +23,13 @@ const create = (data, dataProviderId, childIndex, parentContextStoreId) => {
? contextStores[parentContextStoreId].state ? contextStores[parentContextStoreId].state
: rootState : rootState
if (!contextStores[key]) { contextStores[key] = {
contextStores[key] = { store: writable(state),
store: writable(state), subscriberCount: 0,
subscriberCount: 0, state,
state, parentContextStoreId,
parentContextStoreId,
}
} }
return key return key
} }
@ -94,6 +94,9 @@ const set = (value, dataProviderId, childIndex) =>
const getState = contextStoreKey => const getState = contextStoreKey =>
contextStoreKey ? contextStores[contextStoreKey].state : rootState contextStoreKey ? contextStores[contextStoreKey].state : rootState
const getStore = contextStoreKey =>
contextStoreKey ? contextStores[contextStoreKey] : rootStore
export default { export default {
subscribe, subscribe,
update, update,
@ -101,4 +104,5 @@ export default {
getState, getState,
create, create,
contextStoreKey, contextStoreKey,
getStore,
} }

View File

@ -41,7 +41,6 @@
([field, message]) => `${field} ${message}` ([field, message]) => `${field} ${message}`
) )
async function fetchModel() { async function fetchModel() {
const FETCH_MODEL_URL = `/api/models/${model}` const FETCH_MODEL_URL = `/api/models/${model}`
const response = await _bb.api.get(FETCH_MODEL_URL) const response = await _bb.api.get(FETCH_MODEL_URL)