From 920ef90e14b46c0221a9924bb5b0f9c6f9f6e104 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 24 Nov 2020 11:13:26 +0000 Subject: [PATCH] Add datepicked data binding and fix mustache rendering for non string values --- packages/client/src/utils/enrichDataBinding.js | 3 +++ packages/standard-components/src/DatePicker.svelte | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/client/src/utils/enrichDataBinding.js b/packages/client/src/utils/enrichDataBinding.js index 3b16f70fc9..93d51daf10 100644 --- a/packages/client/src/utils/enrichDataBinding.js +++ b/packages/client/src/utils/enrichDataBinding.js @@ -8,6 +8,9 @@ const entityMap = { ">": ">", } mustache.escape = text => { + if (text == null || typeof text !== "string") { + return text + } return text.replace(/[<>]/g, function fromEntityMap(s) { return entityMap[s] || s }) diff --git a/packages/standard-components/src/DatePicker.svelte b/packages/standard-components/src/DatePicker.svelte index 5f1c70f63c..77b98b670b 100644 --- a/packages/standard-components/src/DatePicker.svelte +++ b/packages/standard-components/src/DatePicker.svelte @@ -2,11 +2,13 @@ import { DatePicker } from "@budibase/bbui" import { getContext } from "svelte" - const { styleable } = getContext("sdk") + const { styleable, setBindableValue } = getContext("sdk") const component = getContext("component") export let placeholder - export let value + + let value + $: setBindableValue(value, $component.id) function handleChange(event) { const [fullDate] = event.detail