import { createVNode as _createVNode } from "vue";
import { funcType, objectType, stringType } from "@antdv/pro-utils";
import { List, Switch } from "ant-design-vue";
import { defineComponent } from "vue";
import { getFormatMessage } from "./index.mjs";
import { renderLayoutSettingItem } from "./LayoutChange.mjs";
const regionalSettingProps = {
  settings: objectType().isRequired,
  changeSetting: funcType().isRequired,
  hashId: stringType().isRequired,
  prefixCls: stringType().isRequired
};
const RegionalSetting = defineComponent({
  name: "RegionalSetting",
  props: regionalSettingProps,
  setup(props) {
    const formatMessage = getFormatMessage();
    return () => {
      const {
        settings,
        prefixCls,
        changeSetting,
        hashId
      } = props;
      const regionalSetting = ["header", "footer", "menu", "menuHeader"];
      return _createVNode(List, {
        "class": `${prefixCls}-list ${hashId}`.trim(),
        "split": false,
        "renderItem": renderLayoutSettingItem,
        "dataSource": regionalSetting.map((key) => {
          return {
            title: formatMessage({
              id: `app.setting.regionalsettings.${key}`
            }),
            action: _createVNode(Switch, {
              "size": "small",
              "class": `regional-${key} ${hashId}`.trim(),
              "checked": settings[`${key}Render`] || settings[`${key}Render`] === void 0,
              "onChange": (checked) => changeSetting(`${key}Render`, checked === true ? void 0 : false)
            }, null)
          };
        })
      }, null);
    };
  }
});
export {
  RegionalSetting
};
