From c09544923d91ad759e3d3b95a523b9419a93cb89 Mon Sep 17 00:00:00 2001 From: Conor_Mack Date: Mon, 30 Mar 2020 13:09:36 +0100 Subject: [PATCH] Tidyup --- .../src/Checkbox/Checkbox.svelte | 3 ++- .../src/Checkbox/CheckboxGroup.svelte | 1 + .../src/Radiobutton/RadiobuttonGroup.svelte | 2 +- .../src/Slider/Slider.svelte | 1 + .../src/Test/TestApp.svelte | 17 ++++++++++++++++- .../materialdesign-components/src/Test/props.js | 2 -- .../src/Textfield/Textfield.svelte | 1 - 7 files changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/materialdesign-components/src/Checkbox/Checkbox.svelte b/packages/materialdesign-components/src/Checkbox/Checkbox.svelte index 05c057889c..9a6c6119fb 100644 --- a/packages/materialdesign-components/src/Checkbox/Checkbox.svelte +++ b/packages/materialdesign-components/src/Checkbox/Checkbox.svelte @@ -59,6 +59,7 @@ function changed(e) { const val = e.target.checked checked = val + handleOnClick() if (_bb.isBound(_bb.props.checked)) { _bb.setStateFromBinding(_bb.props.checked, val) @@ -67,7 +68,7 @@ function handleOnClick() { let item = { _id, checked, label, value } - + debugger if (context === "checkboxgroup") { let idx = selectedItems.getItemIdx($selectedItems, _id) if (idx > -1) { diff --git a/packages/materialdesign-components/src/Checkbox/CheckboxGroup.svelte b/packages/materialdesign-components/src/Checkbox/CheckboxGroup.svelte index 89449185f2..2070e903b8 100644 --- a/packages/materialdesign-components/src/Checkbox/CheckboxGroup.svelte +++ b/packages/materialdesign-components/src/Checkbox/CheckboxGroup.svelte @@ -24,6 +24,7 @@ if (_bb.isBound(_bb.props.value)) { _bb.setStateFromBinding(_bb.props.value, value) } + debugger _bb.call(onChange, value) }, value) _bb.setContext("BBMD:checkbox:selectedItemsStore", selectedItemsStore) diff --git a/packages/materialdesign-components/src/Radiobutton/RadiobuttonGroup.svelte b/packages/materialdesign-components/src/Radiobutton/RadiobuttonGroup.svelte index b5fd333bc7..631a63fe20 100644 --- a/packages/materialdesign-components/src/Radiobutton/RadiobuttonGroup.svelte +++ b/packages/materialdesign-components/src/Radiobutton/RadiobuttonGroup.svelte @@ -24,7 +24,7 @@ onMount(() => { _bb.setContext("BBMD:input:context", "radiobuttongroup") selectedItemsStore = createItemStore(() => { - value = $selectedItemsStore + value = $selectedItemsStore[0] if (_bb.isBound(_bb.props.value)) { _bb.setStateFromBinding(_bb.props.value, value) } diff --git a/packages/materialdesign-components/src/Slider/Slider.svelte b/packages/materialdesign-components/src/Slider/Slider.svelte index 3d41f9024b..e45cfda2b4 100644 --- a/packages/materialdesign-components/src/Slider/Slider.svelte +++ b/packages/materialdesign-components/src/Slider/Slider.svelte @@ -9,6 +9,7 @@ let instance export let _bb + export let onChange = value => {} export let variant = "continuous" //or discrete export let showTicks = false export let min = 0 diff --git a/packages/materialdesign-components/src/Test/TestApp.svelte b/packages/materialdesign-components/src/Test/TestApp.svelte index 01aeb8b18a..2012a81593 100644 --- a/packages/materialdesign-components/src/Test/TestApp.svelte +++ b/packages/materialdesign-components/src/Test/TestApp.svelte @@ -33,7 +33,22 @@ const page = { props: { _component: "testcomponents/rootComponent", - _children: [Checkbox], + _children: [ + Textfield, + Checkboxgroup, + Radiobutton, + Radiobuttongroup, + Datatable, + CustomersIndexTable, + Icon, + List, + Select, + DatePicker, + IconButton, + Card, + Switch, + Slider, + ], }, } _appPromise.then(initialise => { diff --git a/packages/materialdesign-components/src/Test/props.js b/packages/materialdesign-components/src/Test/props.js index 1980a2c10f..b09f5e528b 100644 --- a/packages/materialdesign-components/src/Test/props.js +++ b/packages/materialdesign-components/src/Test/props.js @@ -84,7 +84,6 @@ export const props = { Checkboxgroup: { _component: "@budibase/materialdesign-components/Checkboxgroup", label: "Whats your favourite?", - disabled: true, alignEnd: true, onChange: selectedItems => console.log(selectedItems), _children: [ @@ -117,7 +116,6 @@ export const props = { _component: "@budibase/materialdesign-components/Radiobuttongroup", label: "Preferred method of contact: ", orientation: "column", - disabled: true, alignEnd: true, onChange: selected => console.log("Radiobutton Group", selected), _children: [ diff --git a/packages/materialdesign-components/src/Textfield/Textfield.svelte b/packages/materialdesign-components/src/Textfield/Textfield.svelte index dff9ac6413..ace20dbf3f 100644 --- a/packages/materialdesign-components/src/Textfield/Textfield.svelte +++ b/packages/materialdesign-components/src/Textfield/Textfield.svelte @@ -18,7 +18,6 @@ let tfInstance = null onMount(() => { - debugger if (!!tf) tfInstance = new MDCTextField(tf) return () => { !!tfInstance && tf.tfInstance && tf.tfInstance.destroy()