/**
 * ldesign v0.4.2
 * (c) 2023 ldesign
 * @license MIT
 */

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var vue = require('vue');
var hooks_useCommonClassName = require('../../hooks/useCommonClassName.js');
var table_hooks_useClassName = require('./useClassName.js');
require('../../config-provider/useConfig.js');
require('lodash/cloneDeep');
require('lodash/isFunction');
require('lodash/isString');
require('../../config-provider/context.js');
require('lodash/mergeWith');
require('lodash/merge');
require('lodash/isArray');
require('../../_common/js/global-config/default-config.js');
require('../../_common/js/global-config/locale/zh_CN.js');
require('@babel/runtime/helpers/typeof');
require('../../_chunks/dep-7f0559c3.js');
require('dayjs');
require('../../hooks/useConfig.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 = vue.toRefs(props),
    size = _toRefs.size,
    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 = vue.computed(function () {
    var _ref;
    return [tableBaseClass.table, (_ref = {}, _defineProperty__default["default"](_ref, sizeClassNames[size.value], size.value !== "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, tableAlignClasses[verticalAlign.value], verticalAlign.value !== "middle"), _ref)];
  });
  var tableContentStyles = vue.computed(function () {
    return {
      height: formatCSSUnit(height.value),
      maxHeight: formatCSSUnit(maxHeight.value)
    };
  });
  var tableElementStyles = vue.computed(function () {
    return {
      width: formatCSSUnit(tableContentWidth.value)
    };
  });
  return {
    tableClasses: tableClasses,
    sizeClassNames: sizeClassNames,
    tableElementStyles: tableElementStyles,
    tableContentStyles: tableContentStyles
  };
}

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