UNPKG

@vs-form/vs-form

Version:

A schema-based form generator component for React using material-ui

72 lines (67 loc) 2.26 kB
'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var React = require('react'); var React__default = _interopDefault(React); require('lodash/capitalize'); require('lodash/cloneDeep'); require('lodash/get'); require('lodash/has'); require('lodash/isArray'); require('lodash/isDate'); require('lodash/isBoolean'); require('lodash/isEmpty'); require('lodash/isFunction'); require('lodash/isInteger'); require('lodash/isNull'); require('lodash/isNumber'); require('lodash/isObject'); require('lodash/isPlainObject'); require('lodash/isRegExp'); require('lodash/isString'); require('lodash/isUndefined'); require('lodash/merge'); require('lodash/set'); require('lodash/toInteger'); require('lodash/toNumber'); require('lodash/trimEnd'); require('lodash/uniq'); require('lodash/debounce'); require('lodash/throttle'); require('./chunk-7581cbb1.js'); require('classnames'); var IconButton = _interopDefault(require('@material-ui/core/IconButton')); require('./chunk-e28442a5.js'); var __chunk_10 = require('./chunk-c3a0ac72.js'); const styles = { icon: { fontSize: '1em', paddingRight: '5px' } }; class VsIconButton extends React.Component { constructor(props) { super(props); this.buttonProps = {}; this.IconProps = {}; this.renderComp = (_p) => { const Icon = this.comp.iconComp; return (React.createElement(IconButton, Object.assign({}, this.buttonProps), Icon && React.createElement(Icon, Object.assign({}, this.IconProps)))); }; this.initProps(); } get comp() { return this.props.comp; } render() { return (React.createElement(__chunk_10.VsButtonBase, { comp: this.comp, schemaManager: this.props.schemaManager, buttonProps: this.buttonProps, IconProps: this.IconProps, classes: this.props.classes }, this.renderComp)); } initProps() { const { IconProps, ...buttonProps } = this.comp.props; if (buttonProps) { this.buttonProps = buttonProps; } if (IconProps) { this.IconProps = IconProps; } } } exports.default = VsIconButton; exports.styles = styles;