"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const AdvancedFilter = require("./AdvancedFilter.vue2.js");
const common = require("../utils/common.js");
const _sfc_main = {
  __name: "index",
  props: {
    filterConfigData: {
      type: Object,
      default: () => ({})
    }
  },
  setup(__props) {
    const props = __props;
    const filterConfigData = Vue.ref(
      props.filterConfigData || { operator: "and", conditions: [], groups: [] }
    );
    Vue.watch(
      () => props.filterConfigData,
      (newVal) => {
        if (newVal) {
          filterConfigData.value = newVal;
        }
      },
      { immediate: true, deep: true }
    );
    const fieldsData = Vue.computed(() => {
      return common.getEditConfigDataFields();
    });
    Vue.computed(() => {
      const editConfigData = common.getEditConfigData();
      return (editConfigData == null ? void 0 : editConfigData.hiddenFields) || [];
    });
    const fields = Vue.computed(() => {
      const formFields = fieldsData.value.map((item) => ({
        ...item,
        type: converFieldType(item.fieldType),
        value: "",
        options: item.options || [],
        isHidden: false
      }));
      return formFields;
    });
    function converFieldType(fieldType) {
      switch (fieldType) {
        case "text":
          return "input";
        case "radio":
        case "checkbox":
        case "multipleSelection":
          return "select";
        case "switch":
          return "boolean";
        default:
          return fieldType;
      }
    }
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createBlock(AdvancedFilter.default, {
        modelValue: props.filterConfigData,
        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => props.filterConfigData = $event),
        filterFields: Vue.unref(fields)
      }, null, 8, ["modelValue", "filterFields"]);
    };
  }
};
exports.default = _sfc_main;
