import { createVNode as _createVNode } from "vue";
import "./styles/table-th.css";
import { pick } from "@veno-ui/utils";
import { defineComponent } from "../../utils";
import { Button } from "../button";
import { Icon } from "../icon";
const TableTh = defineComponent({
  name: "VeTableTh",
  props: {
    /**
     * @zh 可排序
     */
    sortable: Boolean,
    /**
     * @zh 倒序是否倒序
     */
    sortDesc: Boolean,
    /**
     * @zh 排序的图标
     */
    sortIcon: {
      type: String,
      default: "$sort"
    },
    /**
     * @zh 排序激活时的颜色
     */
    sortActiveColor: {
      type: String,
      default: "primary"
    },
    /**
     * @zh 过滤器的图标
     */
    filterIcon: {
      type: String,
      default: "$filter"
    },
    /**
     * @zh 过滤器
     */
    filters: {
      type: Array,
      default: () => []
    },
    /**
     * @zh 固定方式
     */
    fixed: [Boolean, String],
    /**
     * @zh 对齐方式
     */
    align: {
      type: String,
      default: "start"
    }
  },
  setup(props, {
    slots
  }) {
    return () => {
      return _createVNode("th", {
        "class": ["ve-table-th", `text-${props.align}`, {
          "ve-table-th--sortable": props.sortable,
          "ve-table-th--sorted": props.sortDesc !== void 0,
          "ve-table-th--fixed-start": props.fixed === "start",
          "ve-table-th--fixed-end": props.fixed === "end"
        }]
      }, [_createVNode("div", {
        "class": "ve-table-th__wrapper"
      }, [slots.default?.(), props.sortable && _createVNode(Icon, {
        "class": {
          "ve-table-th__sorter": true,
          "ve-table-th__sorter--desc": props.sortDesc === true
        },
        "icon": props.sortIcon,
        "color": props.sortDesc !== void 0 ? props.sortActiveColor : void 0
      }, null)]), props.filters.length > 0 && _createVNode(Button, {
        "class": "ve-table-th__filter",
        "icon": props.filterIcon,
        "variant": "text",
        "onClick": (e) => {
          e.stopPropagation();
        }
      }, null)]);
    };
  }
});
function filterTableThProps(attrs) {
  return pick(attrs, Object.keys(TableTh.props));
}
export {
  TableTh,
  filterTableThProps
};
//# sourceMappingURL=table-th.mjs.map
