"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const types = require("../../../utils/types.js");
const index = require("../../../hooks/use-locale/index.js");
const index$1 = require("../../../hooks/use-namespace/index.js");
const index$3 = require("../../input/index.js");
const index$2 = require("../../checkbox/index.js");
const transferPanel = require("./transfer-panel.js");
const usePropsAlias = require("./composables/use-props-alias.js");
const useCheck = require("./composables/use-check.js");
const index$4 = require("../../../../../@element-plus/icons-vue/dist/index.js");
const Vue = require("vue");
var transfer_panel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElTransferPanel",
  __name: "transfer-panel",
  props: transferPanel.transferPanelProps,
  emits: transferPanel.transferPanelEmits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const slots = Vue.useSlots();
    const OptionContent = ({ option }) => option;
    const { t } = index.useLocale();
    const ns = index$1.useNamespace("transfer");
    const panelState = Vue.reactive({
      checked: [],
      allChecked: false,
      query: "",
      checkChangeByUser: true
    });
    const propsAlias = usePropsAlias.usePropsAlias(props);
    const { filteredData, checkedSummary, isIndeterminate, handleAllCheckedChange } = useCheck.useCheck(props, panelState, emit);
    const hasNoMatch = Vue.computed(() => !types.isEmpty(panelState.query) && types.isEmpty(filteredData.value));
    const hasFooter = Vue.computed(() => !types.isEmpty(slots.default()[0].children));
    const { checked, allChecked, query } = Vue.toRefs(panelState);
    __expose({ query });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", { class: Vue.normalizeClass(Vue.unref(ns).b("panel")) }, [
        Vue.createElementVNode("p", { class: Vue.normalizeClass(Vue.unref(ns).be("panel", "header")) }, [Vue.createVNode(Vue.unref(index$2.ElCheckbox), {
          modelValue: Vue.unref(allChecked),
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => Vue.isRef(allChecked) ? allChecked.value = $event : null),
          indeterminate: Vue.unref(isIndeterminate),
          "validate-event": false,
          onChange: Vue.unref(handleAllCheckedChange)
        }, {
          default: Vue.withCtx(() => [Vue.createElementVNode("span", { class: Vue.normalizeClass(Vue.unref(ns).be("panel", "header-title")) }, Vue.toDisplayString(__props.title), 3), Vue.createElementVNode("span", { class: Vue.normalizeClass(Vue.unref(ns).be("panel", "header-count")) }, Vue.toDisplayString(Vue.unref(checkedSummary)), 3)]),
          _: 1
        }, 8, [
          "modelValue",
          "indeterminate",
          "onChange"
        ])], 2),
        Vue.createElementVNode("div", { class: Vue.normalizeClass([Vue.unref(ns).be("panel", "body"), Vue.unref(ns).is("with-footer", hasFooter.value)]) }, [
          __props.filterable ? (Vue.openBlock(), Vue.createBlock(Vue.unref(index$3.ElInput), {
            key: 0,
            modelValue: Vue.unref(query),
            "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => Vue.isRef(query) ? query.value = $event : null),
            class: Vue.normalizeClass(Vue.unref(ns).be("panel", "filter")),
            size: "default",
            placeholder: __props.placeholder,
            "prefix-icon": Vue.unref(index$4.Search),
            clearable: "",
            "validate-event": false
          }, null, 8, [
            "modelValue",
            "class",
            "placeholder",
            "prefix-icon"
          ])) : Vue.createCommentVNode("v-if", true),
          Vue.withDirectives(Vue.createVNode(Vue.unref(index$2.ElCheckboxGroup), {
            modelValue: Vue.unref(checked),
            "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => Vue.isRef(checked) ? checked.value = $event : null),
            "validate-event": false,
            class: Vue.normalizeClass([Vue.unref(ns).is("filterable", __props.filterable), Vue.unref(ns).be("panel", "list")])
          }, {
            default: Vue.withCtx(() => [(Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(filteredData), (item) => {
              return Vue.openBlock(), Vue.createBlock(Vue.unref(index$2.ElCheckbox), {
                key: item[Vue.unref(propsAlias).key],
                class: Vue.normalizeClass(Vue.unref(ns).be("panel", "item")),
                value: item[Vue.unref(propsAlias).key],
                disabled: item[Vue.unref(propsAlias).disabled],
                "validate-event": false
              }, {
                default: Vue.withCtx(() => {
                  var _a;
                  return [Vue.createVNode(OptionContent, { option: (_a = __props.optionRender) == null ? void 0 : _a.call(__props, item) }, null, 8, ["option"])];
                }),
                _: 2
              }, 1032, [
                "class",
                "value",
                "disabled"
              ]);
            }), 128))]),
            _: 1
          }, 8, ["modelValue", "class"]), [[Vue.vShow, !hasNoMatch.value && !Vue.unref(types.isEmpty)(__props.data)]]),
          Vue.withDirectives(Vue.createElementVNode("div", { class: Vue.normalizeClass(Vue.unref(ns).be("panel", "empty")) }, [Vue.renderSlot(_ctx.$slots, "empty", {}, () => [Vue.createTextVNode(Vue.toDisplayString(hasNoMatch.value ? Vue.unref(t)("el.transfer.noMatch") : Vue.unref(t)("el.transfer.noData")), 1)])], 2), [[Vue.vShow, hasNoMatch.value || Vue.unref(types.isEmpty)(__props.data)]])
        ], 2),
        hasFooter.value ? (Vue.openBlock(), Vue.createElementBlock("p", {
          key: 0,
          class: Vue.normalizeClass(Vue.unref(ns).be("panel", "footer"))
        }, [Vue.renderSlot(_ctx.$slots, "default")], 2)) : Vue.createCommentVNode("v-if", true)
      ], 2);
    };
  }
});
exports.default = transfer_panel_vue_vue_type_script_setup_true_lang_default;
