0.1.1 • Published 1 year ago
nocode-calculator v0.1.1
Calculator Creator
Create a form with a calculator based on a json configuration
How to use
CalculatorCreator.create({
target: 'cc-calc-element',
data: {
element: [
{
element: 'div',
class: 'cc-calc-element__fieldWrapper',
children: [
{
element: 'input',
type: 'number',
class: 'sample-1',
name: 'sample1',
placeholder: 'Sample 1',
},
]
},
{
element: 'div',
class: 'cc-calc-element__fieldWrapper',
children: [
{
element: 'input',
type: 'number',
class: 'sample-2',
name: 'sample2',
placeholder: 'Sample 2',
},
]
},
{
element: 'total',
},
],
calculation: [
{
type: 'operand',
target: 'sample1',
},
{
type: 'operator',
operator: '+',
},
{
type: 'operand',
target: 'sample2',
},
],
styles: `
.some-class { margin: 10px }
`
}
})
0.1.1
1 year ago