import { defineComponent as S, ref as k, toRef as w, openBlock as l, createBlock as u, unref as e, withCtx as t, createVNode as o, normalizeClass as p, withDirectives as R, createElementVNode as f, toDisplayString as d, vShow as _, createElementBlock as D, Fragment as L, renderList as N, resolveDynamicComponent as I, createTextVNode as b } from "vue";
import { Popover as P, Tooltip as T, Button as g, Row as V, Col as $, Divider as z, Flex as A } from "@aplus-frontend/antdv";
import { IconApFilterOutlined as E } from "@aplus-frontend/icon";
import "../../../config-provider/index.mjs";
import j from "../../style/search-form.mjs";
import { useCollapseInputCount as O } from "../hooks/use-collapse-input-count.mjs";
import { useNamespace as U } from "../../../config-provider/hooks/use-namespace.mjs";
import { useLocale as q } from "../../../config-provider/hooks/use-locale.mjs";
const Y = /* @__PURE__ */ S({
  name: "ApFormSearchFormPopoverFilter",
  __name: "popover-filter",
  props: {
    config: {},
    onSubmit: { type: Function },
    submitLoading: { type: Boolean }
  },
  setup(n) {
    const C = n, F = k(), { e: s, b: c } = U("ap-form-search-form"), h = j("ap-form-search-form"), { t: m } = q(), a = k(!1), x = w(() => C.config), { count: v } = O(x);
    function B(y) {
      return y?.closest(".ant-form") || document.body;
    }
    return (y, i) => (l(), u(e(P), {
      open: a.value,
      "onUpdate:open": i[1] || (i[1] = (r) => a.value = r),
      "overlay-class-name": `${e(s)("popover")} ${e(h)}`,
      trigger: "click",
      placement: "bottom",
      mask: "",
      "mask-style": { backgroundColor: "transparent" },
      "get-popup-container": B,
      "force-render": !0
    }, {
      content: t(() => [
        f("div", {
          class: p([e(s)("popover-content")]),
          style: { paddingBottom: "4px", width: "825px" }
        }, [
          o(e(V), { gutter: 8 }, {
            default: t(() => [
              (l(!0), D(L, null, N(n.config, (r) => (l(), u(e($), {
                key: r.key,
                span: 8
              }, {
                default: t(() => [
                  (l(), u(I(r.node)))
                ]),
                _: 2
              }, 1024))), 128))
            ]),
            _: 1
          })
        ], 2),
        o(e(z), { style: { margin: "0" } }),
        f("div", {
          class: p(e(s)("popover-footer"))
        }, [
          o(e(A), {
            justify: "end",
            gap: 10
          }, {
            default: t(() => [
              o(e(g), {
                onClick: i[0] || (i[0] = (r) => a.value = !1)
              }, {
                default: t(() => [
                  b(d(e(m)("ap.common.cancelText")), 1)
                ]),
                _: 1
              }),
              o(e(g), {
                type: "primary",
                loading: n.submitLoading,
                onClick: n.onSubmit
              }, {
                default: t(() => [
                  b(d(e(m)("ap.apForm.search.search")), 1)
                ]),
                _: 1
              }, 8, ["loading", "onClick"])
            ]),
            _: 1
          })
        ], 2)
      ]),
      default: t(() => [
        o(e(T), {
          title: e(m)("ap.apForm.search.moreFilter"),
          placement: "top"
        }, {
          default: t(() => [
            o(e(g), {
              ref_key: "triggerBtnRef",
              ref: F,
              class: p([e(c)("trigger-btn"), { [e(c)("trigger-btn-active")]: a.value }])
            }, {
              icon: t(() => [
                R(f("sup", {
                  class: p(e(c)("trigger-btn-badge"))
                }, d(e(v)), 3), [
                  [_, e(v) !== 0]
                ]),
                o(e(E), { size: 14 })
              ]),
              _: 1
            }, 8, ["class"])
          ]),
          _: 1
        }, 8, ["title"])
      ]),
      _: 1
    }, 8, ["open", "overlay-class-name"]));
  }
});
export {
  Y as default
};
