UNPKG

appxigon-react

Version:

Appxigon implementation on React JS

58 lines (48 loc) 2.02 kB
'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // import action from './action' var ItemTypes = { 'action.button': require('./action-button'), // 'action': require('./action'), // 'action': action, 'input': require('./input'), 'input.file': require('./input-file'), 'input.dropzone': require('./input-dropzone'), 'select': require('./select'), 'select.radio': require('./select-radio'), 'select.checkbox': require('./select-checkbox'), 'display': require('./display'), 'todo-item-type': require('./todo-item-type') }; /** * Add an item type * See playground sample for usage * @param type name Name of ItemType * @param Component instance Item Type Component */ ItemTypes.addItemType = function (name, instance) { if (typeof name !== 'string') { throw new Error('Flow Conductor: First parameter of addItemType ' + 'must be of type string'); } if (!(_react2.default.Component instanceof instance.constructor)) { throw new Error('Flow Conductor: Cannot not assign ' + name + ' as an ItemType. ' + 'Second paramter expects a React component'); } ItemTypes[name] = instance; }; /** * Add multiple ItemTypes * See playground sample for usage * @param object types ItemTypes to add. string => Component */ ItemTypes.addItemTypes = function (types) { if ((typeof types === 'undefined' ? 'undefined' : _typeof(types)) !== 'object') { throw new Error('Flow Conductor: First parameter of addItemTypes ' + 'must be of type object'); } for (var type in types) { ItemTypes.addInputType(type, types[type]); } }; module.exports = ItemTypes;