import "../../../../node_modules/element-plus/es/index.mjs";
/* empty css                                                          */
/* empty css                                                                  */
/* empty css                                                               */
/* empty css                                                            */
/* empty css                                                               */
/* empty css                                                                     */
/* empty css                                                               */
import { computed, createBlock, openBlock, unref, isRef, withCtx, createElementBlock, Fragment, renderList } from "vue";
import { useVModel } from "../../../../node_modules/@vueuse/core/dist/index.mjs";
/* empty css              */
import _export_sfc from "../../../../_virtual/_plugin-vue_export-helper.mjs";
import { ElSelect, ElOption } from "../../../../node_modules/element-plus/es/components/select/index.mjs";
const _sfc_main = {
  __name: "Operator",
  props: {
    modelValue: String,
    fieldType: String,
    field: Object
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const $props = __props;
    const $emits = __emit;
    const data = useVModel($props, "modelValue", $emits);
    const getOperatorOptions = (type) => {
      const baseOperators = [
        { value: "eq", label: "等于" },
        { value: "ne", label: "不等于" }
      ];
      const commonOperators = [
        { value: "in_any", label: "等于任意一个" },
        { value: "ni_any", label: "不等于任意一个" },
        { value: "contains", label: "包含" },
        { value: "not_contains", label: "不包含" }
      ];
      const nullOperators = [
        { value: "is_null", label: "为空" },
        { value: "is_not_null", label: "不为空" }
      ];
      const compareOperators = [
        { value: "gt", label: "大于" },
        { value: "gte", label: "大于等于" },
        { value: "lt", label: "小于" },
        { value: "lte", label: "小于等于" },
        { value: "range", label: "选择范围" }
      ];
      switch (type) {
        case "number":
          return [...baseOperators, ...compareOperators, ...nullOperators];
        case "date":
        case "datetime":
          return [...baseOperators, ...compareOperators, ...nullOperators];
        case "boolean":
          return [...baseOperators, ...nullOperators];
        case "select":
          return [...baseOperators, ...commonOperators, ...nullOperators];
        case "input":
        default:
          return [...baseOperators, ...commonOperators, ...nullOperators];
      }
    };
    const operatorOptions = computed(() => {
      return getOperatorOptions($props.fieldType);
    });
    return (_ctx, _cache) => {
      const _component_el_option = ElOption;
      const _component_el_select = ElSelect;
      return openBlock(), createBlock(_component_el_select, {
        class: "operator-container",
        modelValue: unref(data),
        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(data) ? data.value = $event : null),
        filterable: "",
        placeholder: "筛选符"
      }, {
        default: withCtx(() => [
          (openBlock(true), createElementBlock(Fragment, null, renderList(unref(operatorOptions), (item) => {
            return openBlock(), createBlock(_component_el_option, {
              key: item.value,
              label: item.label,
              value: item.value
            }, null, 8, ["label", "value"]);
          }), 128))
        ]),
        _: 1
      }, 8, ["modelValue"]);
    };
  }
};
const Operator = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-159bbd99"]]);
export {
  Operator as default
};
