/**
 * tdesign v0.41.7
 * (c) 2022 tdesign
 * @license MIT
 */

import { h as helper } from '../../../_chunks/dep-37d5b9c4.js';
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
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 FormatInputs from './inputs.js';
import { useBaseClassName } from '../../hooks.js';
import '../../../_common/js/color-picker/constants.js';
import '../../../select/select.js';
import '@babel/runtime/helpers/typeof';
import 'vue';
import 'lodash/isFunction';
import 'lodash/debounce';
import 'lodash/get';
import 'lodash/set';
import 'tdesign-icons-vue';
import '../../../loading/index.js';
import '../../../loading/loading.js';
import '../../../loading/icon/gradient.js';
import '../../../config.js';
import '../../../_common/js/loading/circle-adapter.js';
import '../../../_common/js/utils/set-style.js';
import '../../../_common/js/utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/helpers/slicedToArray';
import '../../../utils/classnames.js';
import '../../../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../../../utils/easing.js';
import '../../../utils/render-tnode.js';
import '../../../utils/transfer-dom.js';
import '../../../loading/props.js';
import '../../../utils/withInstall.js';
import 'lodash/capitalize';
import './style/index.js';
import '../../../loading/type.js';
import '../../../loading/plugin.js';
import '../../../popup/index.js';
import '../../../popup/popup.js';
import '@popperjs/core';
import '../../../utils/helper.js';
import 'lodash/camelCase';
import '../../../popup/props.js';
import '../../../popup/container.js';
import '../../../utils/map-props.js';
import '../../../popup/type.js';
import '../../../utils/mixins.js';
import '../../../config-provider/config-receiver.js';
import 'lodash/mergeWith';
import '../../../config-provider/context.js';
import 'lodash/merge';
import '../../../_common/js/global-config/default-config.js';
import '../../../_common/js/global-config/locale/zh_CN.js';
import '../../../config-provider/type.js';
import '../../../tag/index.js';
import '../../../tag/tag.js';
import '../../../tag/props.js';
import '../../../utils/event.js';
import '../../../tag/check-tag.js';
import '../../../tag/check-tag-props.js';
import '../../../tag/type.js';
import '../../../common-components/fake-arrow.js';
import '../../../select/option.js';
import '../../../utils/ripple.js';
import '../../../select/option-props.js';
import '../../../checkbox/index.js';
import '../../../checkbox/group.js';
import 'lodash/intersection';
import '../../../checkbox/checkbox.js';
import '../../../checkbox/props.js';
import '../../../checkbox/checkbox-group-props.js';
import '../../../checkbox/type.js';
import '../../../select/props.js';
import '../../../input/addon.js';
import '../../../input/input.js';
import 'lodash/kebabCase';
import '../../../input/props.js';
import '../../../input/input-group.js';
import '../../../input/type.js';
import '../../../select/optionGroup.js';
import '../../../select/option-group-props.js';
import '../../../select/type.js';
import 'lodash/throttle';
import '../../utils/index.js';
import '../../../_common/js/color-picker/index.js';
import '../../../_common/js/color-picker/cmyk.js';
import '../../../_common/js/color-picker/color.js';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import 'tinycolor2';
import '../../../_common/js/color-picker/gradient.js';
import '../../../_common/js/color-picker/draggable.js';
import '../../../input-number/index.js';
import '../../../input-number/input-number.js';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/regenerator';
import '../../../button/index.js';
import '../../../button/button.js';
import '../../../button/props.js';
import '../../../button/type.js';
import '../../../input-number/props.js';
import '../../../input-number/type.js';
import './config.js';
import '../../../config-provider/index.js';
import '../../../config-provider/config-provider.js';
import '../../../config-provider/useConfig.js';
import 'lodash/cloneDeep';

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var FormatPanel = defineComponent({
  name: "FormatPanel",
  components: {
    TSelect: Select,
    TInput: Input,
    TOption: Option,
    FormatInputs: FormatInputs
  },
  inheritAttrs: false,
  props: _objectSpread(_objectSpread({}, props), {}, {
    color: {
      type: Object
    },
    handleFormatModeChange: {
      type: Function,
      "default": function _default() {
        return function () {};
      }
    },
    handleFormatInputChange: {
      type: Function,
      "default": function _default() {
        return function () {};
      }
    }
  }),
  setup: function setup(props2) {
    var baseClassName = useBaseClassName();
    var formatModel = ref(props2.format);
    watch(function () {
      return [props2.format];
    }, function () {
      return formatModel.value = props2.format;
    });

    var handleModeChange = function handleModeChange(v) {
      formatModel.value = v;
      props2.handleFormatModeChange(v);
    };

    return {
      formatModel: formatModel,
      baseClassName: baseClassName,
      handleModeChange: handleModeChange
    };
  },
  render: function render(h) {
    var _this = this;

    var formats = _toConsumableArray(FORMATS);

    var baseClassName = this.baseClassName,
        handleModeChange = this.handleModeChange;

    var newProps = _objectSpread(_objectSpread({}, this.$props), {}, {
      format: this.formatModel
    });

    var selectInputProps = _objectSpread({}, this.selectInputProps || {});

    return h("div", {
      "class": "".concat(baseClassName, "__format")
    }, [h("div", {
      "class": "".concat(baseClassName, "__format--item")
    }, [h("t-select", helper([{}, selectInputProps, {
      "attrs": {
        "popupProps": {
          overlayClassName: "".concat(baseClassName, "__select-options")
        }
      },
      "on": {
        "change": handleModeChange
      },
      "model": {
        value: _this.formatModel,
        callback: function callback($$v) {
          _this.formatModel = $$v;
        }
      }
    }]), [formats.map(function (item) {
      return h("t-option", {
        "key": item,
        "attrs": {
          "value": item,
          "label": upperCase(item)
        },
        "style": {
          fontSize: "12px"
        }
      });
    })])]), h("div", {
      "class": "".concat(baseClassName, "__format--item")
    }, [h("format-inputs", {
      props: newProps
    })])]);
  }
});

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