Skip to content

Instantly share code, notes, and snippets.

@devotox
Created May 29, 2019 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devotox/ec82cc66baeb0f835bde9ad3af84dcb0 to your computer and use it in GitHub Desktop.
Save devotox/ec82cc66baeb0f835bde9ad3af84dcb0 to your computer and use it in GitHub Desktop.
const def = {
'id': '11223344',
'label': 'D Form',
'description': 'Forms so good ... Makes you wanna slap yo mama',
'hooks': [{
'type': 'http',
'run': 'click',
'pollTime': 5000,
'encrypted': true,
'element': 'form',
'responseType': 'json',
'url': 'https://restcountries.eu/rest/v2/all', // eslint-disable-next-line
'transform': '\n\t\t\tlet section = form.sections[1];\n\t\t\t\n\t\t\treturn {\n\t\t\t\t[section.dataname]: {\n\t\t\t\t \t[section.fields[4].dataname]: { value: data[2].name },\n\t\t\t\t\t[section.fields[5].dataname]: { value: data[3].name }\n\t\t\t\t}\n\t\t\t}\n\t\t'
}],
'options': {
'form': {
'header': {
'hide': false
}
},
'sections': {
'header': {
'hide': false
}
},
'navigation': {
'buttons': {
'hide': {
'all': false
}
}
}
},
'request': {
'headers': {
'Content-Type': null
},
'url': 'https://rawgit.com/devotox/8150918d70e4ef0a6f0f3b562cd425e4/raw/cd8f34d28c47beeeed075f63db19f96afccf1ce1/form.json'
},
'sections': [{
'id': '4994a7',
'label': 'Default',
'description': 'Calculation description',
'calculations': {
'label': '{{field-2}} || Default'
},
'fields': [{
'id': '333',
'type': 'checkbox',
'labelPosition': 'left',
'helpPosition': 'right',
'allowOther': true,
'otherOption': {
'label': 'Other',
'value': '__other__'
}
}, {
'id': '1',
'label': 'Text 1',
'calculations': {
'value': '{{field-12 key=value subform=field-121}}'
},
'type': 'text',
'labelPosition': 'left',
'helpPosition': 'right'
}, {
'id': '12',
'label': 'Subform Validation',
'type': 'subform',
'required': true,
'labelPosition': 'above',
'helpPosition': 'right',
'definition': {
'label': 'Subform Top',
'sections': [{
'label': 'Subform Top',
'fields': [{
'id': '121',
'label': 'top name 1',
'calculations': {
'value': '{{field-122 key=value subform=field-123}}'
},
'type': 'text',
'required': true,
'labelPosition': 'left'
}, {
'id': '122',
'label': 'Subform Validation',
'type': 'subform',
'required': true,
'labelPosition': 'left',
'definition': {
'label': 'Subform Inner',
'sections': [{
'label': 'Subform Inner',
'fields': [{
'id': '123',
'label': 'inner Name',
'type': 'text',
'required': true,
'labelPosition': 'left',
'value': 'work please'
}]
}]
},
'subformType': 'modal'
}]
}]
},
'subformType': 'inline'
}, {
'id': '13',
'label': 'Name',
'type': 'compound',
'required': false,
'labelPosition': 'left',
'helpPosition': 'right',
'definitions': [{
'label': 'Title',
'type': 'autocomplete',
'required': true,
'labelPosition': 'inner',
'options': [{
'label': 'Dr.',
'value': 'dr'
}, {
'label': 'Mr.',
'value': 'mr'
}, {
'label': 'Mrs.',
'value': 'mrs'
}, {
'label': 'Ms.',
'value': 'ms'
}, {
'label': 'Miss.',
'value': 'miss'
}]
}, {
'label': 'First Name',
'type': 'text',
'required': true,
'labelPosition': 'inner'
}, {
'label': 'Last Name',
'type': 'text',
'required': true,
'labelPosition': 'inner'
}]
}, {
'id': '2',
'label': 'Text 2',
'calculations': {
'value': '{{field-1}}',
'readonly': '({{field-1}} && true) || false',
'disabled': '({{field-3}} && true) || false',
'required': '({{field-1}} && true) || false'
},
'type': 'password',
'required': false,
'disabled': false,
'readonly': false,
'labelPosition': 'left',
'helpPosition': 'right',
'reveal': true,
'showPasswordStrength': true
}, {
'id': '3',
'label': 'Text 3',
'type': 'text',
'hidden': false,
'validateHidden': false,
'messages': {
'valid': 'Field 2 does not equal Field 3'
},
'required': true,
'labelPosition': 'left',
'helpPosition': 'right'
}],
'columns': 1
}, {
'id': '3316eb',
'label': 'Table',
'description': 'Table description',
'calculations': {
'hidden': '(!{{field-1}} && true) || false'
},
'fields': [{
'id': '4',
'label': 'Text 4',
'calculations': {
'value': '{{field-1}}'
},
'type': 'text',
'required': true
}, {
'id': 'fc62e6',
'label': 'Table Data Display 1',
'calculations': {
'hidden': '({{field-1}} && true) || false'
},
'type': 'table',
'hidden': false,
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': '50',
'width': '22.3',
'depth': '14',
'girth': '23'
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': '11',
'width': '11',
'depth': '9',
'girth': '15'
}, {
'label': 'Banana',
'color': 'Yellow',
'height': '21',
'width': '5',
'depth': '18',
'girth': '20'
}, {
'label': 'Grape',
'color': 'Green',
'height': '4',
'width': '4',
'depth': '3',
'girth': '6'
}]
},
'sortDir': 'desc',
'sortProp': 'label',
'pagination': true
}, {
'id': 'bc12c0',
'label': 'Table Data Display 2',
'type': 'table',
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': '50',
'width': '22.3',
'depth': '14',
'girth': '23'
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': '11',
'width': '11',
'depth': '9',
'girth': '15'
}, {
'label': 'Banana',
'color': 'Yellow',
'height': '21',
'width': '5',
'depth': '18',
'girth': '20'
}, {
'label': 'Grape',
'color': 'Green',
'height': '4',
'width': '4',
'depth': '3',
'girth': '6'
}]
},
'checkbox': true
}, {
'id': '921d74',
'label': 'Bar Data Display',
'type': 'table',
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': '50',
'width': '22.3',
'depth': '14',
'girth': '23'
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': '11',
'width': '11',
'depth': '9',
'girth': '15'
}, {
'label': 'Banana',
'color': 'Yellow',
'height': '21',
'width': '5',
'depth': '18',
'girth': '20'
}, {
'label': 'Grape',
'color': 'Green',
'height': '4',
'width': '4',
'depth': '3',
'girth': '6'
}]
}
}, {
'id': 'a17790',
'label': 'Horizontal Bar Data Display',
'type': 'table',
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': '50',
'width': '22.3',
'depth': '14',
'girth': '23'
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': '11',
'width': '11',
'depth': '9',
'girth': '15'
}, {
'label': 'Banana',
'color': 'Yellow',
'height': '21',
'width': '5',
'depth': '18',
'girth': '20'
}, {
'label': 'Grape',
'color': 'Green',
'height': '4',
'width': '4',
'depth': '3',
'girth': '6'
}]
}
}, {
'id': 'c8658b',
'label': 'Line Data Display',
'type': 'table',
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': '50',
'width': '22.3',
'depth': '14',
'girth': '23'
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': '11',
'width': '11',
'depth': '9',
'girth': '15'
}, {
'label': 'Banana',
'color': 'Yellow',
'height': '21',
'width': '5',
'depth': '18',
'girth': '20'
}, {
'label': 'Grape',
'color': 'Green',
'height': '4',
'width': '4',
'depth': '3',
'girth': '6'
}]
}
}, {
'id': '4fe180',
'label': 'Radar Data Display',
'type': 'table',
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': '50',
'width': '22.3',
'depth': '14',
'girth': '23'
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': '11',
'width': '11',
'depth': '9',
'girth': '15'
}, {
'label': 'Banana',
'color': 'Yellow',
'height': '21',
'width': '5',
'depth': '18',
'girth': '20'
}, {
'label': 'Grape',
'color': 'Green',
'height': '4',
'width': '4',
'depth': '3',
'girth': '6'
}]
}
}, {
'id': '294f7c',
'label': 'Pie Data Display',
'type': 'table',
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': '50',
'width': '22.3',
'depth': '14',
'girth': '23'
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': '11',
'width': '11',
'depth': '9',
'girth': '15'
}, {
'label': 'Banana',
'color': 'Yellow',
'height': '21',
'width': '5',
'depth': '18',
'girth': '20'
}, {
'label': 'Grape',
'color': 'Green',
'height': '4',
'width': '4',
'depth': '3',
'girth': '6'
}]
}
}, {
'id': 'f56e7f',
'label': 'Doughnut Data Display',
'type': 'table',
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': '50',
'width': '22.3',
'depth': '14',
'girth': '23'
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': '11',
'width': '11',
'depth': '9',
'girth': '15'
}, {
'label': 'Banana',
'color': 'Yellow',
'height': '21',
'width': '5',
'depth': '18',
'girth': '20'
}, {
'label': 'Grape',
'color': 'Green',
'height': '4',
'width': '4',
'depth': '3',
'girth': '6'
}]
}
}, {
'id': '7f3c2f',
'label': 'Polar Data Display',
'type': 'table',
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': '50',
'width': '22.3',
'depth': '14',
'girth': '23'
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': '11',
'width': '11',
'depth': '9',
'girth': '15'
}, {
'label': 'Banana',
'color': 'Yellow',
'height': '21',
'width': '5',
'depth': '18',
'girth': '20'
}, {
'label': 'Grape',
'color': 'Green',
'height': '4',
'width': '4',
'depth': '3',
'girth': '6'
}]
}
}, {
'id': '53d9a6',
'label': 'Bubble Data Display',
'type': 'table',
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': {
'x': '50',
'y': '50',
'r': 8
},
'width': {
'x': '22.3',
'y': '22.3',
'r': 4
},
'depth': {
'x': '14',
'y': '14',
'r': 12
},
'girth': {
'x': '23',
'y': '23',
'r': 6
}
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': {
'x': '11',
'y': '11',
'r': 8
},
'width': {
'x': '11',
'y': '11',
'r': 4
},
'depth': {
'x': '9',
'y': '9',
'r': 12
},
'girth': {
'x': '15',
'y': '15',
'r': 6
}
}, {
'label': 'Banana',
'color': 'Yellow',
'height': {
'x': '21',
'y': '21',
'r': 8
},
'width': {
'x': '5',
'y': '5',
'r': 4
},
'depth': {
'x': '18',
'y': '18',
'r': 12
},
'girth': {
'x': '20',
'y': '20',
'r': 6
}
}, {
'label': 'Grape',
'color': 'Green',
'height': {
'x': '4',
'y': '4',
'r': 8
},
'width': {
'x': '4',
'y': '4',
'r': 4
},
'depth': {
'x': '3',
'y': '3',
'r': 12
},
'girth': {
'x': '6',
'y': '6',
'r': 6
}
}]
},
'sortLabel': true
}, {
'id': '35fcd1',
'label': 'Scatter Data Display',
'type': 'table',
'labelPosition': 'above',
'data': {
'head': [{
'label': 'Color',
'key': 'color',
'sortable': true,
'hideOnMobile': true
}, {
'label': 'Width',
'key': 'width',
'numeric': true,
'sortable': true,
'hideOnMobile': true,
'hideOnTablet': true
}, {
'label': 'Height',
'key': 'height',
'numeric': true,
'sortable': true
}, {
'label': 'Depth',
'key': 'depth',
'numeric': true,
'sortable': true
}, {
'label': 'Girth',
'key': 'girth',
'numeric': true,
'sortable': true
}],
'body': [{
'label': 'Pineapple',
'color': 'Green & Yellow',
'height': {
'x': '50',
'y': '50',
'r': 8
},
'width': {
'x': '22.3',
'y': '22.3',
'r': 4
},
'depth': {
'x': '14',
'y': '14',
'r': 12
},
'girth': {
'x': '23',
'y': '23',
'r': 6
}
}, {
'label': 'Apple',
'color': 'Green / Red',
'height': {
'x': '11',
'y': '11',
'r': 8
},
'width': {
'x': '11',
'y': '11',
'r': 4
},
'depth': {
'x': '9',
'y': '9',
'r': 12
},
'girth': {
'x': '15',
'y': '15',
'r': 6
}
}, {
'label': 'Banana',
'color': 'Yellow',
'height': {
'x': '21',
'y': '21',
'r': 8
},
'width': {
'x': '5',
'y': '5',
'r': 4
},
'depth': {
'x': '18',
'y': '18',
'r': 12
},
'girth': {
'x': '20',
'y': '20',
'r': 6
}
}, {
'label': 'Grape',
'color': 'Green',
'height': {
'x': '4',
'y': '4',
'r': 8
},
'width': {
'x': '4',
'y': '4',
'r': 4
},
'depth': {
'x': '3',
'y': '3',
'r': 12
},
'girth': {
'x': '6',
'y': '6',
'r': 6
}
}]
},
'hideLabel': true
}],
'columns': 1
}],
'sectionPosition': 'left',
'allowSectionChangeOnlyWhenValid': true
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment