Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
lib.xp.examples.schema.createLayout.js Maven / Gradle / Ivy
var schemaLib = require('/lib/xp/schema');
var assert = require('/lib/xp/testing');
/* global log*/
let resource = `
Virtual Layout
My Layout Description
`;
// BEGIN
// Create virtual layout.
var result = schemaLib.createComponent({
key: 'myapp:mylayout',
type: 'LAYOUT',
resource
});
log.info('Created layout: ' + result.key);
// END
assert.assertJsonEquals({
key: 'myapp:mylayout',
displayName: 'Virtual Layout',
displayNameI18nKey: 'key.display-name',
description: 'My Layout Description',
descriptionI18nKey: 'key.description',
componentPath: 'myapp:/site/layouts/mylayout',
modifiedTime: '2021-09-25T10:00:00Z',
resource: '\n' +
' \n' +
' Virtual Layout \n' +
' My Layout Description \n' +
' \n \n' +
' \n' +
' \n' +
' \n' +
' \n' +
' \n' +
' ',
type: 'LAYOUT',
form: [
{
'formItemType': 'Input',
'name': 'pause',
'label': 'Pause parameter',
'helpText': 'key1.help-text',
'maximize': true,
'inputType': 'Double',
'occurrences': {
'maximum': 1,
'minimum': 0
},
'config': {}
},
{
'formItemType': 'ItemSet',
'name': 'myFormItemSet',
'label': 'My form item set',
'occurrences': {
'maximum': 1,
'minimum': 0
},
'items': [
{
'formItemType': 'Input',
'name': 'myTextLine',
'label': 'My text line',
'maximize': true,
'inputType': 'TextLine',
'occurrences': {
'maximum': 1,
'minimum': 1
},
'config': {}
},
{
'formItemType': 'Input',
'name': 'myCustomInput',
'label': 'My custom input',
'maximize': true,
'inputType': 'TextLine',
'occurrences': {
'maximum': 1,
'minimum': 0
},
'config': {}
},
{
'formItemType': 'Layout',
'name': 'fieldSet1',
'label': 'My field set',
'items': [
{
'formItemType': 'Input',
'name': 'fieldSetItem',
'label': 'Field set Item',
'helpText': 'key2.help-text',
'maximize': true,
'inputType': 'TextLine',
'occurrences': {
'maximum': 1,
'minimum': 0
},
'config': {}
}
]
}
]
}
],
config: {},
regions: [
'header',
'main',
'footer'
]
}, result);