/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

'use strict';

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

var VueCompositionAPI = require('@vue/composition-api');
var hooks_useCommonClassname = require('../../../hooks/use-common-classname.js');
var components_table_hooks_useClassName = require('./useClassName.js');
require('../../config-provider/useConfig.js');
require('../../config-provider/context.js');
require('lodash');
require('../../../chunks/zh_CN.js');

function formatCSSUnit(unit) {
  if (!unit) return unit;
  return isNaN(Number(unit)) ? unit : `${unit}px`;
}
function useStyle(props) {
  const {
    bordered,
    stripe,
    hover,
    verticalAlign,
    height,
    maxHeight,
    tableContentWidth
  } = VueCompositionAPI.toRefs(props);
  const {
    tableBaseClass,
    tableAlignClasses
  } = components_table_hooks_useClassName["default"]();
  const {
    sizeClassNames
  } = hooks_useCommonClassname["default"]();
  const tableClasses = VueCompositionAPI.computed(() => [tableBaseClass.table, {
    [sizeClassNames[props.size]]: props.size !== "medium",
    [tableBaseClass.bordered]: bordered.value,
    [tableBaseClass.striped]: stripe.value,
    [tableBaseClass.hover]: hover.value,
    [tableBaseClass.loading]: props.loading,
    [tableBaseClass.affixedHeader]: props.headerAffixedTop,
    [tableBaseClass.rowspanAndColspan]: props.rowspanAndColspan,
    [tableBaseClass.horizontalBarAffixed]: props.horizontalScrollAffixedBottom,
    [tableBaseClass.footerAffixed]: props.footerAffixedBottom,
    [tableAlignClasses[verticalAlign.value]]: verticalAlign.value !== "middle"
  }]);
  const tableContentStyles = VueCompositionAPI.computed(() => ({
    height: formatCSSUnit(height.value),
    maxHeight: formatCSSUnit(maxHeight.value)
  }));
  const tableElementStyles = VueCompositionAPI.computed(() => ({
    width: formatCSSUnit(tableContentWidth.value)
  }));
  return {
    sizeClassNames,
    tableClasses,
    tableElementStyles,
    tableContentStyles
  };
}

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