mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-08 01:10:02 +01:00
* Creating copy of object * Creating copy of object * Create new object Co-authored-by: Harsh Khandeparkar <34770591+HarshKhandeparkar@users.noreply.github.com> Co-authored-by: Jeffrey Warren <jeff@unterbahn.com>
32 lines
803 B
JavaScript
32 lines
803 B
JavaScript
/**
|
|
* @description Maps module input types to their respective html <input> tag types.
|
|
* @param {Object} inputInfo Object containing the type and optionally min/max for range type inputs.
|
|
*/
|
|
function mapHtmlTypes(inputInfo){
|
|
var htmlType;
|
|
switch(inputInfo.type.toLowerCase()){
|
|
case 'integer':
|
|
htmlType = inputInfo.min != undefined ? 'range' : 'number';
|
|
break;
|
|
case 'string':
|
|
htmlType = 'text';
|
|
break;
|
|
case 'select':
|
|
htmlType = 'select';
|
|
break;
|
|
case 'percentage':
|
|
htmlType = 'number';
|
|
break;
|
|
case 'float':
|
|
htmlType = inputInfo.min != undefined ? 'range' : 'text';
|
|
break;
|
|
default:
|
|
htmlType = 'text';
|
|
break;
|
|
}
|
|
var response = Object.assign({}, inputInfo);
|
|
response.type = htmlType;
|
|
return response;
|
|
}
|
|
|
|
module.exports = mapHtmlTypes; |