UNPKG

plot-plan-designer

Version:

Design Editor Tools with React.js + ant.design + fabric.js

68 lines (67 loc) 4.26 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const react_1 = __importStar(require("react")); const prop_types_1 = __importDefault(require("prop-types")); const antd_1 = require("antd"); const Icon_1 = __importDefault(require("../icon/Icon")); let CommonButton = /** @class */ (() => { class CommonButton extends react_1.Component { render() { return this.props.visible ? (react_1.default.createElement(antd_1.Tooltip, { title: this.props.tooltipTitle, placement: this.props.tooltipPlacement }, this.props.wrapperClassName || this.props.wrapperStyle ? (react_1.default.createElement("span", { style: this.props.wrapperStyle, className: this.props.wrapperClassName }, react_1.default.createElement(antd_1.Button, { id: this.props.id, className: this.props.className, name: this.props.name, style: this.props.style, shape: this.props.shape, size: this.props.size, onClick: this.props.onClick, type: this.props.type, disabled: this.props.disabled, loading: this.props.loading }, this.props.icon ? (this.props.iconAnimation ? (react_1.default.createElement(Icon_1.default, { name: this.props.icon, style: this.props.iconStyle, className: this.props.iconClassName, animation: this.props.iconAnimation })) : (react_1.default.createElement(Icon_1.default, { name: this.props.icon, style: this.props.iconStyle, className: this.props.iconClassName }))) : null, this.props.children))) : (react_1.default.createElement(antd_1.Button, { id: this.props.id, className: this.props.className, name: this.props.name, style: this.props.style, shape: this.props.shape, size: this.props.size, onClick: this.props.onClick, type: this.props.type, disabled: this.props.disabled, loading: this.props.loading }, this.props.icon ? (this.props.iconAnimation ? (react_1.default.createElement(Icon_1.default, { name: this.props.icon, style: this.props.iconStyle, className: this.props.iconClassName, animation: this.props.iconAnimation })) : (react_1.default.createElement(Icon_1.default, { name: this.props.icon, style: this.props.iconStyle, className: this.props.iconClassName }))) : null, this.props.children)))) : null; } } CommonButton.propTypes = { name: prop_types_1.default.string, id: prop_types_1.default.string, style: prop_types_1.default.object, wrapperStyle: prop_types_1.default.object, wrapperClassName: prop_types_1.default.string, tooltipTitle: prop_types_1.default.string, tooltipPlacement: prop_types_1.default.string, className: prop_types_1.default.string, icon: prop_types_1.default.string, iconStyle: prop_types_1.default.object, iconClassName: prop_types_1.default.string, iconAnimation: prop_types_1.default.string, visible: prop_types_1.default.bool, shape: prop_types_1.default.string, disabled: prop_types_1.default.bool, loading: prop_types_1.default.bool, type: prop_types_1.default.string, }; CommonButton.defaultProps = { type: 'default', visible: true, disabled: false, loading: false, }; return CommonButton; })(); exports.default = CommonButton;