import React, { useCallback } from 'react';
import { observer } from 'mobx-react-lite';
import { stopPropagation } from '../../../es/_util/EventManager';
import { SELECTION_KEY } from './TableStore';
import ObserverCheckBox from '../check-box/CheckBox';

var SelectionTreeBox = function SelectionTreeBox(props) {
  var record = props.record;
  var handleChange = useCallback(function (value) {
    var dataSet = record.dataSet;

    if (dataSet) {
      if (value) {
        dataSet.treeSelect(record);
      } else {
        dataSet.treeUnSelect(record);
      }
    }
  }, [record]);
  return /*#__PURE__*/React.createElement(ObserverCheckBox, {
    checked: record.isSelected,
    onChange: handleChange,
    onClick: stopPropagation,
    disabled: !record.selectable,
    "data-selection-key": SELECTION_KEY,
    indeterminate: record.isSelectionIndeterminate,
    value: true
  });
};

SelectionTreeBox.displayName = 'SelectionTreeBox';
export default observer(SelectionTreeBox);
//# sourceMappingURL=SelectionTreeBox.js.map
