/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var helper = require('../../../../chunks/helper.js');
var VueCompositionAPI = require('@vue/composition-api');
var upperCase = require('lodash/upperCase');
var components_colorPicker_props = require('../../props.js');
var components_colorPicker_const = require('../../const.js');
var components_select_index = require('../../../select/index.js');
var components_input_index = require('../../../input/index.js');
var components_colorPicker_hooks_index = require('../../hooks/index.js');
var components_colorPicker_panel_format_inputs = require('./inputs.js');
require('../../../../chunks/constants.js');
require('../../../../utils/with-install.js');
require('vue');
require('lodash');
require('../../../../config.js');
require('../../../select/select.js');
require('lodash/isFunction');
require('lodash/debounce');
require('lodash/get');
require('lodash/cloneDeep');
require('lodash/isArray');
require('lodash/isObject');
require('../../../../chunks/log.js');
require('../../../../chunks/_commonjsHelpers-2e6815bd.js');
require('../../../../hooks/use-default-value.js');
require('../../../../hooks/use-vmodel.js');
require('lodash/kebabCase');
require('../../../../hooks/lnode.js');
require('lodash/isEmpty');
require('lodash/camelCase');
require('../../../../hooks/render-lnode.js');
require('../../../config-provider/useConfig.js');
require('../../../config-provider/context.js');
require('../../../../chunks/zh_CN.js');
require('../../../loading/index.js');
require('../../../loading/loading.js');
require('../../../../utils/dom.js');
require('raf');
require('lodash/isString');
require('../../../../utils/easing.js');
require('../../../../utils/render-node.js');
require('../../../../utils/transfer-dom.js');
require('../../../config-provider/config-receiver.js');
require('lodash/mergeWith');
require('../../../../utils/mixins.js');
require('../../../loading/props.js');
require('../../../loading/icon/gradient.js');
require('../../../../chunks/defineProperty-838e4192.js');
require('../../../../chunks/set-style.js');
require('../../../../chunks/helper2.js');
require('../../../loading/plugin.js');
require('../../../popup/index.js');
require('../../../../utils/map-props.js');
require('../../../popup/popup.js');
require('@popperjs/core');
require('../../../../utils/helper.js');
require('../../../popup/props.js');
require('../../../popup/container.js');
require('../../../tag/index.js');
require('../../../tag/tag.js');
require('@ldesign/icons-vue');
require('../../../../utils/event.js');
require('../../../tag/props.js');
require('../../../tag/check-tag.js');
require('../../../select-input/index.js');
require('../../../select-input/select-input.js');
require('../../../select-input/props.js');
require('../../../select-input/hooks/use-single.js');
require('lodash/pick');
require('../../../../hooks/use-config.js');
require('../../../input/input.js');
require('../../../input/props.js');
require('../../../input/group.js');
require('../../../select-input/hooks/use-multiple.js');
require('../../../tag-input/index.js');
require('../../../tag-input/tag-input.js');
require('../../../../hooks/use-global-icon.js');
require('../../../tag-input/props.js');
require('../../../tag-input/hooks/use-tag-scroll.js');
require('../../../tag-input/hooks/use-tag-list.js');
require('../../../tag-input/hooks/use-hover.js');
require('../../../tag-input/hooks/use-drag-sorter.js');
require('../../../select-input/hooks/use-overlay-innerstyle.js');
require('../../../common/fake-arrow.js');
require('../../../../hooks/use-form-disabled.js');
require('../../../select/option.js');
require('../../../../utils/ripple.js');
require('../../../checkbox/index.js');
require('../../../checkbox/group.js');
require('lodash/intersection');
require('../../../checkbox/checkbox.js');
require('../../../checkbox/props.js');
require('../../../../hooks/use-lazy-load.js');
require('../../../../chunks/observe.js');
require('../../../../hooks/use-common-classname.js');
require('../../../select/utils.js');
require('../../../select/props.js');
require('../../../select/select-panel.js');
require('../../../../hooks/use-virtual-scroll.js');
require('../../../select/hooks/use-select-options.js');
require('../../../select/option-group.js');
require('lodash/throttle');
require('../../../../chunks/color.js');
require('../../../input-number/index.js');
require('../../../input-number/input-number.js');
require('../../../button/index.js');
require('../../../button/button.js');
require('../../../button/props.js');
require('../../../input-number/props.js');
require('../../../input-number/hooks/use-input-number.js');
require('../../../../chunks/isObjectLike-c22c7e3b.js');
require('../../../../chunks/isArray-cd7357b9.js');
require('../../../../chunks/isNumber-c4eb560e.js');
require('./config.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var upperCase__default = /*#__PURE__*/_interopDefaultLegacy(upperCase);

var FormatPanel = VueCompositionAPI.defineComponent({
  name: "FormatPanel",
  components: {
    LSelect: components_select_index.Select,
    LInput: components_input_index.Input,
    LOption: components_select_index.Option,
    FormatInputs: components_colorPicker_panel_format_inputs["default"]
  },
  inheritAttrs: false,
  props: {
    ...components_colorPicker_props["default"],
    color: {
      type: Object
    },
    handleFormatModeChange: {
      type: Function,
      default: () => () => {}
    },
    handleFormatInputChange: {
      type: Function,
      default: () => () => {}
    }
  },
  setup(props2) {
    const baseClassName = components_colorPicker_hooks_index.useBaseClassName();
    const formatModel = VueCompositionAPI.ref(props2.format);
    VueCompositionAPI.watch(() => [props2.format], () => formatModel.value = props2.format);
    const handleModeChange = v => {
      formatModel.value = v;
      props2.handleFormatModeChange(v);
    };
    return {
      formatModel,
      baseClassName,
      handleModeChange
    };
  },
  render(h) {
    const formats = [...components_colorPicker_const.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("l-select", helper.helper([{
      "attrs": {
        "size": "small"
      },
      "class": `${baseClassName}__format-mode-select`
    }, selectInputProps, {
      "attrs": {
        "popupProps": {
          overlayClassName: `${baseClassName}__select-options`
        }
      },
      "on": {
        "change": handleModeChange
      },
      "model": {
        value: this.formatModel,
        callback: $$v => {
          this.formatModel = $$v;
        }
      }
    }]), [formats.map(item => h("l-option", {
      "key": item,
      "attrs": {
        "value": item,
        "label": upperCase__default["default"](item)
      },
      "style": {
        fontSize: "12px"
      }
    }))])]), h("div", {
      "class": `${baseClassName}__format--item`
    }, [h("format-inputs", {
      props: newProps
    })])]);
  }
});

exports["default"] = FormatPanel;
//# sourceMappingURL=index.js.map
