some MD component changes

This commit is contained in:
Michael Shanks 2020-02-24 14:57:56 +00:00
parent 6233c01f4f
commit e25de45c4c
4 changed files with 27 additions and 18 deletions

View File

@ -5,7 +5,7 @@ export default function ripple(
props = { colour: "primary", unbounded: false } props = { colour: "primary", unbounded: false }
) { ) {
node.classList.add("mdc-ripple-surface") node.classList.add("mdc-ripple-surface")
const component = new MDCRipple(node) let component = new MDCRipple(node)
component.unbounded = props.unbounded component.unbounded = props.unbounded
if (props.colour === "secondary") { if (props.colour === "secondary") {

View File

@ -55,11 +55,7 @@ const dataCells = (index, indexSchema) =>
{ {
_component: "@budibase/standard-components/text", _component: "@budibase/standard-components/text",
type: "none", type: "none",
text: { text: `context.${dataItem(index)}.${col.name}`,
"##bbstate": `${dataItem(index)}.${col.name}`,
"##bbstatefallback": "",
"##bbsource": "context",
},
}, },
], ],
})) }))

View File

@ -7,8 +7,17 @@ export default ({ records }) =>
const outerContainer = record => ({ const outerContainer = record => ({
_component: "@budibase/standard-components/container", _component: "@budibase/standard-components/container",
_code: "", _code: "",
onLoad: [],
type: "div", type: "div",
onLoad: [
{
"##eventHandlerType": "Get New Record",
parameters: {
collectionKey: record.collectionKey,
childRecordType: record.name,
statePath: record.name,
},
},
],
_children: [ _children: [
heading(record), heading(record),
...record.fields.map(f => field(record, f)), ...record.fields.map(f => field(record, f)),
@ -33,7 +42,8 @@ const textField = (record, f) => ({
disabled: false, disabled: false,
fullwidth: false, fullwidth: false,
colour: "primary", colour: "primary",
maxLength: f.typeOptions && f.typeOptions.maxLength ? f.typeOptions.maxLength : 0, maxLength:
f.typeOptions && f.typeOptions.maxLength ? f.typeOptions.maxLength : 0,
placeholder: f.label, placeholder: f.label,
value: fieldValueBinding(record, f), value: fieldValueBinding(record, f),
}) })
@ -57,15 +67,15 @@ const buttons = record => ({
position: { position: {
column: ["", ""], column: ["", ""],
row: ["", ""], row: ["", ""],
margin: ["","","",""], margin: ["", "", "", ""],
padding: ["30px","","",""], padding: ["30px", "", "", ""],
height: [""], height: [""],
width: [""], width: [""],
zindex: [""] zindex: [""],
}, },
layout: { layout: {
templaterows: [""], templaterows: [""],
templatecolumns: [""] templatecolumns: [""],
}, },
}, },
_children: [ _children: [

View File

@ -18,7 +18,7 @@
onMount(() => { onMount(() => {
if (!!tf) tfInstance = new MDCTextField(tf) if (!!tf) tfInstance = new MDCTextField(tf)
return () => { return () => {
!!tfInstance && tf.tfInstance.destroy() !!tfInstance && tf.tfInstance && tf.tfInstance.destroy()
tf = null tf = null
} }
}) })
@ -79,6 +79,7 @@
$: useNotchedOutline = variant == "outlined" || textarea $: useNotchedOutline = variant == "outlined" || textarea
$: renderLeadingIcon = useIcon && !trailingIcon $: renderLeadingIcon = useIcon && !trailingIcon
$: renderTrailingIcon = useIcon && trailingIcon $: renderTrailingIcon = useIcon && trailingIcon
$: safeMaxLength = maxLength <= 0 ? undefined : maxLength
let props = { modifiers, customs } let props = { modifiers, customs }
const blockClasses = cb.build({ props }) const blockClasses = cb.build({ props })
@ -91,10 +92,12 @@
} }
function changed(e) { function changed(e) {
const val = e.target.value
value = val
if (_bb.isBound(_bb.props.value)) { if (_bb.isBound(_bb.props.value)) {
_bb.setStateFromBinding(_bb.props.value, e.target.value) _bb.setStateFromBinding(_bb.props.value, val)
} }
_bb.call(onChange, e.target.value) _bb.call(onChange, val)
} }
</script> </script>
@ -116,7 +119,7 @@ TODO:Needs error handling - this will depend on how Budibase handles errors
{required} {required}
{placeholder} {placeholder}
{minLength} {minLength}
{maxLength} maxLength={safeMaxLength}
value={value} value={value}
on:change={changed} /> on:change={changed} />
{:else} {:else}
@ -131,11 +134,11 @@ TODO:Needs error handling - this will depend on how Budibase handles errors
{required} {required}
placeholder={!!label && fullwidth ? label : placeholder} placeholder={!!label && fullwidth ? label : placeholder}
{minLength} {minLength}
{maxLength} maxLength={safeMaxLength}
value={value} value={value}
aria-label={`Textfield ${variant}`} aria-label={`Textfield ${variant}`}
on:focus={focus} on:focus={focus}
on:change={changed} /> on:input={changed} />
{#if renderTrailingIcon} {#if renderTrailingIcon}
<Icon {icon} /> <Icon {icon} />
{/if} {/if}