import React from 'react';
import CnMessageView from './cn-message';
import { calculateTextExprValue } from '@/common/util/util';

class CnMessage extends React.Component {
  constructor(props) {
    super(props);
    this.ref = React.createRef();
  }

  render() {
    const { visible, _context, ...rest } = this.props;
    const hidden = calculateTextExprValue(visible, {
      recordDataSource: {},
      state: _context?.state,
    });
    return <CnMessageView ref={this.ref} _context={_context} {...rest} visible={hidden !== true} />;
  }
}
CnMessage.displayName = 'CnMessage';
export default CnMessage;

export { CnMessage };
