'use strict';

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

var vue = require('vue');
require('../../../utils/index.js');
var advancedFiltering = require('./advanced-filtering.js');
require('../../index.js');
require('./components/advanced-filtering-params.vue.js');
require('./components/advanced-filtering-tags.vue.js');
var createNamespace = require('../../../utils/create-namespace.js');
var index = require('../../button/index.js');
var index$1 = require('../../icon/index.js');
var advancedFilteringTags_vue_vue_type_script_setup_true_lang = require('./components/advanced-filtering-tags.vue2.js');
var advancedFilteringParams_vue_vue_type_script_setup_true_lang = require('./components/advanced-filtering-params.vue2.js');

"use strict";
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{ name: "LlAdvancedFiltering" },
  __name: "advanced-filtering",
  props: advancedFiltering.advancedFilteringProps,
  emits: advancedFiltering.advancedFilteringEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const bem = createNamespace.createNamespace("advanced-filtering");
    const filterValue = vue.ref(props.value);
    const showSelectBox = vue.ref(false);
    const showValueBox = vue.ref(false);
    const handleHoverChange = (visible) => {
      if (showSelectBox.value) return;
      showValueBox.value = visible;
    };
    const handleClickChange = () => {
      showSelectBox.value = !showSelectBox.value;
      showValueBox.value = false;
    };
    const handleClose = () => {
      showSelectBox.value = false;
      showValueBox.value = false;
    };
    const handleChange = (val) => {
      filterValue.value = val;
    };
    vue.watch(
      filterValue,
      (n) => {
        emits("update:value", n);
        emits("change", n);
      },
      {
        deep: true
      }
    );
    return (_ctx, _cache) => {
      const _component_a_popover = vue.resolveComponent("a-popover");
      return vue.openBlock(), vue.createBlock(_component_a_popover, {
        "overlay-class-name": vue.unref(bem).b(),
        placement: "bottomRight",
        "overlay-style": props.overlayStyle,
        open: showSelectBox.value
      }, {
        content: vue.withCtx(() => [
          vue.createVNode(advancedFilteringParams_vue_vue_type_script_setup_true_lang.default, {
            value: filterValue.value,
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => filterValue.value = $event),
            "filter-columns": props.filterColumns,
            "form-options": props.formOptions,
            onClose: handleClose
          }, null, 8, ["value", "filter-columns", "form-options"])
        ]),
        default: vue.withCtx(() => [
          vue.createVNode(_component_a_popover, {
            "overlay-class-name": vue.unref(bem).b(),
            trigger: "hover",
            placement: "bottomRight",
            open: showValueBox.value,
            "overlay-style": props.overlayStyle,
            onOpenChange: handleHoverChange
          }, {
            content: vue.withCtx(() => [
              vue.createVNode(advancedFilteringTags_vue_vue_type_script_setup_true_lang.default, {
                value: filterValue.value,
                "filter-columns": props.filterColumns,
                onChange: handleChange
              }, null, 8, ["value", "filter-columns"])
            ]),
            default: vue.withCtx(() => [
              vue.createVNode(vue.unref(index.LlButton), {
                onClick: vue.withModifiers(handleClickChange, ["stop"])
              }, {
                default: vue.withCtx(() => [
                  vue.createVNode(vue.unref(index$1.LlIcon), {
                    "icon-name": "icon-a-shaixuan1x",
                    style: { "margin-right": "10px" }
                  }),
                  _cache[1] || (_cache[1] = vue.createElementVNode(
                    "span",
                    null,
                    "\u9AD8\u7EA7\u7B5B\u9009",
                    -1
                    /* CACHED */
                  ))
                ]),
                _: 1
                /* STABLE */
              })
            ]),
            _: 1
            /* STABLE */
          }, 8, ["overlay-class-name", "open", "overlay-style"])
        ]),
        _: 1
        /* STABLE */
      }, 8, ["overlay-class-name", "overlay-style", "open"]);
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=advanced-filtering.vue2.js.map
