import { _ as _extends } from '../_rollupPluginBabelHelpers-736b301a.js';
import React__default, { Component } from 'react';
import Drawer from '../Drawer/index.js';
import { inject, observer } from 'mobx-react';
import SelectDevices from '../SelectDevices/index.js';
import { isEqual, treeHelper } from '@zenview/micro-utils';
import 'antd';
import 'lodash';
import '@zenview/micro-basic-library';
import '../IconFont/index.js';
import '../CBox/index.js';
import '../SearchInput/index.js';
import '../PlaceTree/index.js';
import '../Tree/index.js';
import '../index-71189681.js';
import '../_commonjsHelpers-e7b0df42.js';
import 'react-is';
import '../HightLevel/index.js';
import '../TreeTitle/index.js';
import '../OrgTreeWithSystem/index.js';
import '../OrgTree/index.js';
import '../DeviceList/index.js';
import '../index-6ef7005c.js';
import '../index-f41abfce.js';
import 'react-virtualized';
import '../index-33416316.js';
import 'ahooks';

var _dec, _class;
let ListSelectDevices = (_dec = inject("org", "place"), _dec(_class = observer(_class = class ListSelectDevices extends Component {
  constructor(props) {
    super(props);
    this.onChange = selectDevices => {
      this.setState({
        selectDevices
      }); // 修改当前组件的数据
    };
    this.onSubmit = () => {
      const {
        onChange,
        onClose
      } = this.props;
      onChange && onChange(this.state.selectDevices); // 改变数据
      onClose && onClose();
    };
    this.state = {
      selectDevices: props.selectDevices || []
    };
  }
  UNSAFE_componentWillReceiveProps(props) {
    if (isEqual(props.selectDevices, this.props.selectDevices)) {
      this.setState({
        selectDevices: props.selectDevices || []
      });
    }
  }
  render() {
    const {
      onClose,
      orgTreeData,
      placeTreeData,
      deviceList,
      onChange,
      org,
      place,
      selectDevices,
      ...props
    } = this.props;
    return /*#__PURE__*/React__default.createElement(Drawer, _extends({}, props, {
      onClose: onClose,
      onOk: this.onSubmit
    }), /*#__PURE__*/React__default.createElement(SelectDevices, {
      selectDevices: this.state.selectDevices,
      deviceList: deviceList,
      placeTreeData: placeTreeData || treeHelper.computPlaceTree(place.placeListWithCameraCount),
      orgTreeData: orgTreeData || treeHelper.computTreeList(org.orgListWithCameraCount),
      onChange: this.onChange
    }));
  }
}) || _class) || _class);

export { ListSelectDevices as default };
//# sourceMappingURL=index.js.map
