import _Button from "@alifd/next/es/button";
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["title", "standards", "encoded", "controlType", "style", "customStyleName", "events", "__designMode", "pageInfo"];
import * as React from 'react';
// import event from 'events';
import { event } from '@alilc/lowcode-engine';
var CommonButton = function CommonButton(_ref) {
  var _ref$title = _ref.title,
    title = _ref$title === void 0 ? '按钮' : _ref$title,
    _ref$standards = _ref.standards,
    standards = _ref$standards === void 0 ? 'primary' : _ref$standards,
    encoded = _ref.encoded,
    controlType = _ref.controlType,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    customStyleName = _ref.customStyleName,
    events = _ref.events,
    __designMode = _ref.__designMode,
    pageInfo = _ref.pageInfo,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _otherProps = otherProps || {};
  var isDisable = standards === 'normal' ? true : false;
  //   console.log(pageInfo)
  function onClick() {
    if (__designMode == 'design') return;
    if (events && events[0]) {
      // console.log(pageInfo)
      console.log(events[0]);
      event.emit("" + events[0].action, pageInfo);
    }
  }
  return /*#__PURE__*/React.createElement(_Button, _extends({
    onClick: onClick,
    style: style,
    className: customStyleName,
    type: standards,
    disabled: isDisable
  }, _otherProps), title);
};
CommonButton.displayName = 'CommonButton';
export default CommonButton;