import { F as n, g2 as g, f0 as w, ah as h, a6 as f, gL as b, G as C, Y as i, a3 as v, w as S, S as V, L as d, a5 as B, al as D } from "./603b75d9.js";
import { C as T } from "./4963ac97.js";
import { ButtonTypeOptions as k } from "./62f393ec.js";
import { Button100 as L } from "./26dac75c.js";
import "react";
import "react-dom";
import "./ffcffc16.js";
const M = {
  buttonType: v(k, "primary"),
  label: S(V, "Menu"),
  prefixIcon: d,
  suffixIcon: d,
  options: B
}, F = (t) => t.label, Y = function() {
  return new T(M, (t) => {
    var p, c;
    const m = t.options.findIndex((e) => {
      var o;
      return (o = e.prefixIcon) == null ? void 0 : o.props.value;
    }) > -1, s = t.options.filter((e) => !e.hidden).map((e, o) => ({
      title: e.label,
      label: e.label,
      key: e.label + " - " + o,
      disabled: e.disabled,
      icon: m && /* @__PURE__ */ n("span", {
        children: e.prefixIcon
      }),
      index: o
    })), l = (p = t.prefixIcon) == null ? void 0 : p.props.value, a = (c = t.suffixIcon) == null ? void 0 : c.props.value, x = g(w), y = /* @__PURE__ */ n(D, {
      items: s,
      onClick: ({
        key: e
      }) => {
        var u;
        const o = s.find((r) => r.key === e), I = t.options.findIndex((r) => r.label === (o == null ? void 0 : o.label));
        o && ((u = t.options[I]) == null || u.onEvent("click"));
      },
      onMouseDown: (e) => {
        e.stopPropagation(), e.preventDefault();
      }
    });
    return /* @__PURE__ */ n(h, {
      trigger: ["click"],
      placement: "bottomRight",
      dropdownRender: () => y,
      children: /* @__PURE__ */ f(L, {
        type: t.buttonType,
        style: {
          display: "flex",
          alignItems: "center",
          gap: "0",
          minWidth: "30px",
          width: "auto"
        },
        $buttonStyle: t.buttonType === "primary" ? x : void 0,
        children: [
          l && /* @__PURE__ */ n(b, {
            style: {
              margin: "0px",
              marginRight: t.label || a ? "3px" : "0x"
            },
            children: t.prefixIcon
          }),
          t.label || (l || a ? void 0 : " "),
          a && /* @__PURE__ */ n(b, {
            style: {
              margin: "0px",
              marginLeft: t.label || l ? "3px" : "0x"
            },
            children: t.suffixIcon
          })
        ]
      })
    });
  }, (t) => t.label.value, F).setPropertyViewFn((t) => /* @__PURE__ */ f(C, {
    children: [t.buttonType.propertyView({
      label: i("table.type"),
      radioButton: !0
    }), t.label.propertyView({
      label: i("text")
    }), t.prefixIcon.propertyView({
      label: i("button.prefixIcon")
    }), t.suffixIcon.propertyView({
      label: i("button.suffixIcon")
    }), t.options.propertyView({
      title: i("optionsControl.optionList")
    })]
  })).build();
}();
export {
  Y as ColumnDropdownComp
};
