import { defineComponent, useModel, onMounted, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, createElementBlock, Fragment, renderList, normalizeStyle, toDisplayString, createCommentVNode, renderSlot, mergeModels } from 'vue';
import { ElDropdown, ElDropdownMenu, ElDropdownItem, ElButtonGroup } from 'element-plus';
import { MeSvgIcon } from '../../svg-icon/index.mjs';
import { MeIconButton } from '../../icon-button/index.mjs';

"use strict";
const _hoisted_1 = ["onClick"];
var script = /* @__PURE__ */ defineComponent({
  __name: "tree-menu-actions",
  props: /* @__PURE__ */ mergeModels({
    tree: { type: null, required: true },
    data: { type: Array, required: false },
    toggleExpandAllEvent: { type: Array, required: false }
  }, {
    "actions": { type: null },
    "actionsModifiers": {}
  }),
  emits: /* @__PURE__ */ mergeModels(["toggleExpandAllEvent", "actionItemEvent"], ["update:actions"]),
  setup(__props, { emit: __emit }) {
    const actions = useModel(__props, "actions");
    const props = __props;
    onMounted(() => {
      console.log(props.tree);
    });
    const emit = __emit;
    const handleTag = (item) => {
      item.status = !item.status;
    };
    const actionItemHandler = (item) => {
      emit("toggleExpandAllEvent", item);
    };
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(ElDropdown), {
        "hide-on-click": false,
        trigger: "hover",
        style: { "cursor": "pointer" }
      }, {
        dropdown: withCtx(() => [
          createVNode(unref(ElDropdownMenu), null, {
            default: withCtx(() => [
              createVNode(unref(ElDropdownItem), null, {
                default: withCtx(() => [
                  createVNode(unref(ElButtonGroup), null, {
                    default: withCtx(() => [
                      createVNode(unref(MeIconButton), {
                        icon: "ri-arrow-up-s-fill",
                        onClick: _cache[0] || (_cache[0] = ($event) => actionItemHandler(true))
                      }, {
                        default: withCtx(() => [..._cache[2] || (_cache[2] = [
                          createTextVNode(
                            "\u5C55\u5F00",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      }),
                      createVNode(unref(MeIconButton), {
                        icon: "ri-arrow-down-s-fill",
                        onClick: _cache[1] || (_cache[1] = ($event) => actionItemHandler(false))
                      }, {
                        default: withCtx(() => [..._cache[3] || (_cache[3] = [
                          createTextVNode(
                            "\u6298\u53E0 ",
                            -1
                            /* CACHED */
                          )
                        ])]),
                        _: 1
                        /* STABLE */
                      })
                    ]),
                    _: 1
                    /* STABLE */
                  })
                ]),
                _: 1
                /* STABLE */
              }),
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(actions.value, (item, index) => {
                  return openBlock(), createBlock(
                    unref(ElDropdownItem),
                    { key: index },
                    {
                      default: withCtx(() => [
                        createElementVNode("div", {
                          onClick: ($event) => handleTag(item),
                          style: { "display": "flex", "align-items": "center", "width": "100%", "justify-content": "space-between" }
                        }, [
                          createElementVNode(
                            "div",
                            {
                              style: normalizeStyle({
                                color: item.status ? "#409eff" : "",
                                fontWeight: item.status ? "bold" : ""
                              })
                            },
                            toDisplayString(item.label),
                            5
                            /* TEXT, STYLE */
                          ),
                          item.status ? (openBlock(), createBlock(unref(MeSvgIcon), {
                            key: 0,
                            color: "#409eff",
                            name: "ri-check-line"
                          })) : createCommentVNode("v-if", true)
                        ], 8, _hoisted_1)
                      ]),
                      _: 2
                      /* DYNAMIC */
                    },
                    1024
                    /* DYNAMIC_SLOTS */
                  );
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              renderSlot(_ctx.$slots, "dropdown-item")
            ]),
            _: 3
            /* FORWARDED */
          })
        ]),
        default: withCtx(() => [
          _cache[4] || (_cache[4] = createElementVNode(
            "span",
            { class: "el-dropdown-link" },
            " \u64CD\u4F5C ",
            -1
            /* CACHED */
          ))
        ]),
        _: 3
        /* FORWARDED */
      });
    };
  }
});

export { script as default };
//# sourceMappingURL=tree-menu-actions.vue2.mjs.map
