@tomino/dynamic-form-semantic-ui
Version:
Semantic UI form renderer based on dynamic form generation
65 lines • 1.62 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const form_query_data_1 = require("./form_query_data");
const common_1 = require("./common");
const schema = {
type: 'object',
properties: {
name: {
type: 'string'
},
age: {
type: 'number',
minimum: 30
},
younger: {
type: 'string',
expression: `console.log(this); return this['age'] - 20`
},
older: {
type: 'string',
expression: `this['age'] + 10`
}
},
required: ['name']
};
const formDefinition = form_query_data_1.create.grid({
props: {
columns: 4,
rows: 2
},
elements: [
{
control: 'Input',
props: {
row: 1,
column: 1,
width: 2,
inputLabel: 'Name',
label: 'Mimo',
value: { source: 'name' }
}
},
{
props: { row: 2, column: 1, width: 1, value: { source: 'age' }, label: 'Age: ' },
control: 'Input'
},
{
props: { row: 2, column: 3, width: 2, value: { source: 'younger' }, label: 'Younger:' },
control: 'Input'
}
]
});
const formData = {
name: 'Tomas',
age: 33
};
describe('Input', () => {
return {
component: common_1.prepareComponent(formDefinition, schema, formData, {
addEditor: true,
showStandard: true
})
};
});
//# sourceMappingURL=input_view.test.js.map