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 }
) {
node.classList.add("mdc-ripple-surface")
const component = new MDCRipple(node)
let component = new MDCRipple(node)
component.unbounded = props.unbounded
if (props.colour === "secondary") {

View File

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

View File

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

View File

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