/**
 * tdesign v0.46.4
 * (c) 2022 tdesign
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var VueCompositionAPI = require('@vue/composition-api');
var table_hooks_useClassName = require('./useClassName.js');
var hooks_useCommonClassName = require('../../hooks/useCommonClassName.js');
require('../../config-provider/useConfig.js');
require('../../config-provider/context.js');
require('lodash/merge');
require('lodash/mergeWith');
require('../../_common/js/global-config/default-config.js');
require('../../_common/js/global-config/locale/zh_CN.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);

function formatCSSUnit(unit) {
  if (!unit) return unit;
  return isNaN(Number(unit)) ? unit : "".concat(unit, "px");
}
function useStyle(props) {
  var _toRefs = VueCompositionAPI.toRefs(props),
      bordered = _toRefs.bordered,
      stripe = _toRefs.stripe,
      hover = _toRefs.hover,
      verticalAlign = _toRefs.verticalAlign,
      height = _toRefs.height,
      maxHeight = _toRefs.maxHeight,
      tableContentWidth = _toRefs.tableContentWidth;

  var _useClassName = table_hooks_useClassName["default"](),
      tableBaseClass = _useClassName.tableBaseClass,
      tableAlignClasses = _useClassName.tableAlignClasses;

  var _useCommonClassName = hooks_useCommonClassName["default"](),
      sizeClassNames = _useCommonClassName.sizeClassNames;

  var tableClasses = VueCompositionAPI.computed(function () {
    var _ref;

    return [tableBaseClass.table, (_ref = {}, _defineProperty__default["default"](_ref, sizeClassNames[props.size], props.size !== "medium"), _defineProperty__default["default"](_ref, tableBaseClass.bordered, bordered.value), _defineProperty__default["default"](_ref, tableBaseClass.striped, stripe.value), _defineProperty__default["default"](_ref, tableBaseClass.hover, hover.value), _defineProperty__default["default"](_ref, tableBaseClass.loading, props.loading), _defineProperty__default["default"](_ref, tableBaseClass.affixedHeader, props.headerAffixedTop), _defineProperty__default["default"](_ref, tableBaseClass.rowspanAndColspan, props.rowspanAndColspan), _defineProperty__default["default"](_ref, tableBaseClass.horizontalBarAffixed, props.horizontalScrollAffixedBottom), _defineProperty__default["default"](_ref, tableBaseClass.footerAffixed, props.footerAffixedBottom), _defineProperty__default["default"](_ref, tableAlignClasses[verticalAlign.value], verticalAlign.value !== "middle"), _ref)];
  });
  var tableContentStyles = VueCompositionAPI.computed(function () {
    return {
      height: formatCSSUnit(height.value),
      maxHeight: formatCSSUnit(maxHeight.value)
    };
  });
  var tableElementStyles = VueCompositionAPI.computed(function () {
    return {
      width: formatCSSUnit(tableContentWidth.value)
    };
  });
  return {
    tableClasses: tableClasses,
    tableElementStyles: tableElementStyles,
    tableContentStyles: tableContentStyles
  };
}

exports["default"] = useStyle;
exports.formatCSSUnit = formatCSSUnit;
//# sourceMappingURL=useStyle.js.map
