"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.simpleScrollbarProps = exports.default = void 0;
var _vue = require("vue");
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _useConfigInject2 = _interopRequireDefault(require("../_util/hooks/useConfigInject"));
var _classNames2 = _interopRequireDefault(require("../_util/classNames"));
var simpleScrollbarProps = function simpleScrollbarProps() {
  return {
    trigger: {
      type: String,
      default: 'hover'
    },
    xScrollable: {
      type: Boolean,
      default: true
    },
    yScrollable: {
      type: Boolean,
      default: true
    },
    isAlwaysExist: {
      type: Boolean,
      default: true
    } // 滚动条是否始终占据体积
  };
};
exports.simpleScrollbarProps = simpleScrollbarProps;
var SimpleScrollbar = (0, _vue.defineComponent)({
  name: 'PfSimpleScrollbar',
  props: simpleScrollbarProps(),
  setup: function setup(props, _ref) {
    var slots = _ref.slots;
    var _useConfigInject = (0, _useConfigInject2.default)('scrollbar', props),
      prefixCls = _useConfigInject.prefixCls,
      direction = _useConfigInject.direction;
    var simpleScrollbarPrefixCls = "".concat(prefixCls.value, "-simple");
    var mergeCls = (0, _vue.computed)(function () {
      var _classNames;
      return (0, _classNames2.default)((_classNames = {}, (0, _defineProperty2.default)(_classNames, simpleScrollbarPrefixCls, true), (0, _defineProperty2.default)(_classNames, "".concat(simpleScrollbarPrefixCls, "-rtl"), direction.value === 'rtl'), (0, _defineProperty2.default)(_classNames, "".concat(simpleScrollbarPrefixCls, "-x"), props.xScrollable), (0, _defineProperty2.default)(_classNames, "".concat(simpleScrollbarPrefixCls, "-y"), props.yScrollable), (0, _defineProperty2.default)(_classNames, "".concat(simpleScrollbarPrefixCls, "-x-hover"), props.trigger === 'hover' && !props.isAlwaysExist && props.xScrollable), (0, _defineProperty2.default)(_classNames, "".concat(simpleScrollbarPrefixCls, "-y-hover"), props.trigger === 'hover' && !props.isAlwaysExist && props.yScrollable), (0, _defineProperty2.default)(_classNames, "".concat(simpleScrollbarPrefixCls, "-trigger-hover"), props.trigger === 'hover' && props.isAlwaysExist), _classNames));
    });
    return function () {
      var _slots$default;
      return (0, _vue.createVNode)("div", {
        "class": mergeCls.value
      }, [slots === null || slots === void 0 ? void 0 : (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]);
    };
  }
});
var _default = SimpleScrollbar;
exports.default = _default;