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

import { _ as _defineProperty } from '../../_chunks/dep-2db7b3ec.mjs';
import { toRefs, computed } from 'vue';
import useCommonClassName from '../../hooks/useCommonClassName.mjs';
import useClassName from './useClassName.mjs';
import '../../_chunks/dep-255303ba.mjs';
import '../../hooks/useConfig.mjs';
import '../../config-provider/useConfig.mjs';
import '../../_chunks/dep-095107f7.mjs';
import '../../_chunks/dep-eba0ea6e.mjs';
import '../../_chunks/dep-c989dff3.mjs';
import '../../_chunks/dep-9cf86cf1.mjs';
import '../../_chunks/dep-bc1d737a.mjs';
import '../../_chunks/dep-4d7a675b.mjs';
import '../../_chunks/dep-5717e263.mjs';
import '../../_chunks/dep-469b4ae0.mjs';
import '../../_chunks/dep-a8bcacea.mjs';
import '../../_chunks/dep-2e7f59b1.mjs';
import '../../_chunks/dep-855db8bc.mjs';
import '../../_chunks/dep-a87f3e4c.mjs';
import '../../_chunks/dep-1e566bb5.mjs';
import '../../_chunks/dep-1434aa15.mjs';
import '../../_chunks/dep-3da99438.mjs';
import '../../_chunks/dep-b57180d0.mjs';
import '../../_chunks/dep-c8d7b6b4.mjs';
import '../../_chunks/dep-e5eb9f23.mjs';
import '../../_chunks/dep-9fe2ef12.mjs';
import '../../_chunks/dep-672e7d1a.mjs';
import '../../_chunks/dep-42a19209.mjs';
import '../../_chunks/dep-9262ee2f.mjs';
import '../../_chunks/dep-334a4f6b.mjs';
import '../../_chunks/dep-8d3e9aa3.mjs';
import '../../_chunks/dep-876fb3ec.mjs';
import '../../_chunks/dep-40d69a9c.mjs';
import '../../_chunks/dep-dcc83161.mjs';
import '../../_chunks/dep-0fc02184.mjs';
import '../../_chunks/dep-f1994936.mjs';
import '../../_chunks/dep-345e1be3.mjs';
import '../../_common/js/global-config/default-config.mjs';
import '../../_common/js/global-config/locale/zh_CN.mjs';
import '../../_chunks/dep-9888611c.mjs';
import '../../_chunks/dep-697a1365.mjs';
import '../../config-provider/type.mjs';

function formatCSSUnit(unit) {
  if (!unit) return unit;
  return isNaN(Number(unit)) ? unit : "".concat(unit, "px");
}
function useStyle(props) {
  var _toRefs = 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 = useClassName(),
    tableBaseClass = _useClassName.tableBaseClass,
    tableAlignClasses = _useClassName.tableAlignClasses;
  var _useCommonClassName = useCommonClassName(),
    sizeClassNames = _useCommonClassName.sizeClassNames;
  var tableClasses = computed(function () {
    var _ref;
    return [tableBaseClass.table, (_ref = {}, _defineProperty(_ref, sizeClassNames[size.value], size.value !== "medium"), _defineProperty(_ref, tableBaseClass.bordered, bordered.value), _defineProperty(_ref, tableBaseClass.striped, stripe.value), _defineProperty(_ref, tableBaseClass.hover, hover.value), _defineProperty(_ref, tableBaseClass.loading, props.loading), _defineProperty(_ref, tableBaseClass.affixedHeader, props.headerAffixedTop), _defineProperty(_ref, tableBaseClass.rowspanAndColspan, props.rowspanAndColspan), _defineProperty(_ref, tableAlignClasses[verticalAlign.value], verticalAlign.value !== "middle"), _ref)];
  });
  var tableContentStyles = computed(function () {
    return {
      height: formatCSSUnit(height.value),
      maxHeight: formatCSSUnit(maxHeight.value)
    };
  });
  var tableElementStyles = computed(function () {
    return {
      width: formatCSSUnit(tableContentWidth.value)
    };
  });
  return {
    tableClasses: tableClasses,
    sizeClassNames: sizeClassNames,
    tableElementStyles: tableElementStyles,
    tableContentStyles: tableContentStyles
  };
}

export { useStyle as default, formatCSSUnit };
//# sourceMappingURL=useStyle.mjs.map
