/**
 * ldesign v0.2.22
 * (c) 2022/12/7 16:21 built by swimly
 * @license MIT
 */

import { h as helper } from '../../../../_chunks/dep-b0f1ed22.js';
import { defineComponent, ref, watch } from '@vue/composition-api';
import upperCase from 'lodash/upperCase';
import props from '../../props.js';
import { FORMATS } from '../../const.js';
import { Select, Option } from '../../../select/index.js';
import { Input } from '../../../input/index.js';
import { useBaseClassName } from '../../hooks/index.js';
import FormatInputs from './inputs.js';
import '../../../../_chunks/dep-560aa956.js';
import '../../../../utils/withInstall.js';
import 'vue';
import 'lodash/capitalize';
import '../../../../config.js';
import '../../../select/select.js';
import 'lodash/isFunction';
import 'lodash/debounce';
import 'lodash/get';
import 'lodash/cloneDeep';
import 'lodash/isArray';
import 'lodash/isObject';
import '../../../../_chunks/dep-eaa95999.js';
import '../../../../_chunks/dep-102361be.js';
import '../../../../hooks/useDefaultValue.js';
import '../../../../hooks/useVModel.js';
import 'lodash/kebabCase';
import '../../../../hooks/lnode.js';
import 'lodash/isEmpty';
import 'lodash/camelCase';
import '../../../../hooks/render-lnode.js';
import 'lodash';
import '../../../config-provider/useConfig.js';
import '../../../config-provider/context.js';
import 'lodash/merge';
import 'lodash/mergeWith';
import '../../../../_chunks/dep-b4fd1955.js';
import '../../../loading/index.js';
import '../../../loading/loading.js';
import '../../../../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../../../../utils/easing.js';
import '../../../../utils/render-node.js';
import '../../../../utils/transfer-dom.js';
import '../../../config-provider/config-receiver.js';
import '../../../../utils/mixins.js';
import '../../../loading/props.js';
import '../../../loading/icon/gradient.js';
import '../../../../_chunks/dep-aacc31a3.js';
import '../../../../_chunks/dep-c68dc4b6.js';
import '../../../../_chunks/dep-1a6bca30.js';
import '../../../loading/plugin.js';
import '../../../popup/index.js';
import '../../../../utils/map-props.js';
import '../../../popup/popup.js';
import '@popperjs/core';
import '../../../../utils/helper.js';
import '../../../popup/props.js';
import '../../../popup/container.js';
import '../../../tag/index.js';
import '../../../tag/tag.js';
import '@ldesign/icons-vue';
import '../../../../utils/event.js';
import '../../../tag/props.js';
import '../../../tag/check-tag.js';
import '../../../select-input/index.js';
import '../../../select-input/select-input.js';
import '../../../select-input/props.js';
import '../../../select-input/hooks/use-single.js';
import 'lodash/pick';
import '../../../../hooks/useConfig.js';
import '../../../input/input.js';
import '../../../input/props.js';
import '../../../input/group.js';
import '../../../select-input/hooks/use-multiple.js';
import '../../../tag-input/index.js';
import '../../../tag-input/tag-input.js';
import '../../../../hooks/useGlobalIcon.js';
import '../../../tag-input/props.js';
import '../../../tag-input/hooks/use-tag-scroll.js';
import '../../../tag-input/hooks/use-tag-list.js';
import '../../../tag-input/hooks/use-hover.js';
import '../../../tag-input/hooks/use-drag-sorter.js';
import '../../../select-input/hooks/use-overlay-innerstyle.js';
import '../../../common/fake-arrow.js';
import '../../../../hooks/useFormDisabled.js';
import '../../../select/option.js';
import '../../../../utils/ripple.js';
import '../../../checkbox/index.js';
import '../../../checkbox/group.js';
import 'lodash/intersection';
import '../../../checkbox/checkbox.js';
import '../../../checkbox/props.js';
import '../../../../hooks/useLazyLoad.js';
import '../../../../_chunks/dep-62ed000f.js';
import '../../../../hooks/useCommonClassName.js';
import '../../../select/utils.js';
import '../../../select/props.js';
import '../../../select/select-panel.js';
import '../../../../hooks/useVirtualScroll.js';
import '../../../select/hooks/use-select-options.js';
import '../../../select/option-group.js';
import 'lodash/throttle';
import '../../../../_chunks/dep-836dea4a.js';
import '../../../input-number/index.js';
import '../../../input-number/input-number.js';
import '../../../button/index.js';
import '../../../button/button.js';
import '../../../button/props.js';
import '../../../input-number/props.js';
import '../../../input-number/hooks/use-input-number.js';
import '../../../../_chunks/dep-52c80d08.js';
import '../../../../_chunks/dep-25603871.js';
import '../../../../_chunks/dep-7b293b33.js';
import './config.js';

var FormatPanel = defineComponent({
  name: "FormatPanel",
  components: {
    TSelect: Select,
    TInput: Input,
    TOption: Option,
    FormatInputs
  },
  inheritAttrs: false,
  props: {
    ...props,
    color: {
      type: Object
    },
    handleFormatModeChange: {
      type: Function,
      default: () => () => {}
    },
    handleFormatInputChange: {
      type: Function,
      default: () => () => {}
    }
  },
  setup(props2) {
    const baseClassName = useBaseClassName();
    const formatModel = ref(props2.format);
    watch(() => [props2.format], () => formatModel.value = props2.format);
    const handleModeChange = v => {
      formatModel.value = v;
      props2.handleFormatModeChange(v);
    };
    return {
      formatModel,
      baseClassName,
      handleModeChange
    };
  },
  render(h) {
    const formats = [...FORMATS];
    const {
      baseClassName,
      handleModeChange
    } = this;
    const newProps = {
      ...this.$props,
      format: this.formatModel
    };
    const selectInputProps = {
      ...(this.selectInputProps || {})
    };
    return h("div", {
      "class": `${baseClassName}__format`
    }, [h("div", {
      "class": `${baseClassName}__format--item`
    }, [h("t-select", helper([{
      "attrs": {
        "size": "small"
      },
      "class": `${baseClassName}__format-mode-select`
    }, selectInputProps, {
      "attrs": {
        "popupProps": {
          overlayClassName: `${baseClassName}__select-options`
        },
        "disabled": this.disabled
      },
      "on": {
        "change": handleModeChange
      },
      "model": {
        value: this.formatModel,
        callback: $$v => {
          this.formatModel = $$v;
        }
      }
    }]), [formats.map(item => h("t-option", {
      "key": item,
      "attrs": {
        "value": item,
        "label": upperCase(item)
      },
      "style": {
        fontSize: "12px"
      }
    }))])]), h("div", {
      "class": `${baseClassName}__format--item`
    }, [h("format-inputs", {
      props: newProps
    })])]);
  }
});

export { FormatPanel as default };
//# sourceMappingURL=index.js.map
