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

24 lines
477 B
JavaScript

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}`,
},
},
],
})