budibase/packages/standard-components/src/Templates/saveRecordButton.js

24 lines
477 B
JavaScript
Raw Normal View History

2020-02-19 22:38:21 +01:00
export default ({ records }) =>
records.map(r => ({
name: `Save ${r.name} Button`,
props: buttonProps(r),
}))
const buttonProps = record => ({
_component: "@budibase/standard-components/button",
_children: [
{
_component: "@budibase/standard-components/text",
text: `Save ${record.name}`,
},
],
onClick: [
{
"##eventHandlerType": "Save Record",
parameters: {
statePath: `${record.name}`,
},
},
],
})