/**
 * ldesign v0.2.2
 * (c) 2022年9月20日 swimly
 * @license MIT
 */

'use strict';

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

var helper = require('../../../../chunks/helper.js');
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
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_panel_format_inputs = require('./inputs.js');
var components_colorPicker_hooks_index = require('../../hooks/index.js');
require('../../../../chunks/constants.js');
require('../../../select/select.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('@babel/runtime/helpers/slicedToArray');
require('lodash/isFunction');
require('lodash/debounce');
require('lodash/get');
require('lodash/cloneDeep');
require('lodash/isArray');
require('../../../../hooks/use-default-value.js');
require('../../../../hooks/use-vmodel.js');
require('../../../../hooks/lnode.js');
require('lodash/isEmpty');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../../../../hooks/render-lnode.js');
require('lodash/isString');
require('lodash/isObject');
require('../../../config-provider/useConfig.js');
require('../../../config-provider/context.js');
require('lodash');
require('../../../../chunks/zh_CN.js');
require('../../../select/props.js');
require('../../../loading/index.js');
require('../../../loading/loading.js');
require('../../../loading/icon/gradient.js');
require('vue');
require('../../../../chunks/defineProperty-28395935.js');
require('../../../../chunks/set-style.js');
require('../../../../chunks/helper2.js');
require('../../../../config.js');
require('../../../../utils/dom.js');
require('raf');
require('../../../../utils/easing.js');
require('../../../../utils/render-node.js');
require('@babel/runtime/helpers/typeof');
require('../../../../utils/transfer-dom.js');
require('../../../loading/props.js');
require('../../../config-provider/config-receiver.js');
require('lodash/mergeWith');
require('../../../../utils/mixins.js');
require('../../../../utils/with-install.js');
require('../../../loading/plugin.js');
require('../../../popup/index.js');
require('../../../popup/popup.js');
require('@popperjs/core');
require('../../../../utils/helper.js');
require('../../../popup/props.js');
require('../../../popup/container.js');
require('../../../../utils/map-props.js');
require('../../../tag/index.js');
require('../../../tag/tag.js');
require('@ldesign/icons-vue');
require('../../../tag/props.js');
require('../../../../utils/event.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('../../../select-input/hooks/use-multiple.js');
require('../../../select-input/hooks/use-overlay-innerstyle.js');
require('../../../common/fake-arrow.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('../../../select/utils.js');
require('../../../../hooks/use-common-classname.js');
require('../../../select/select-panel.js');
require('../../../../hooks/use-virtual-scroll.js');
require('../../../select/hooks/use-select-options.js');
require('../../../input/input.js');
require('../../../input/props.js');
require('../../../input/group.js');
require('../../../select/option-group.js');
require('lodash/throttle');
require('../../../../chunks/color.js');
require('@babel/runtime/helpers/classCallCheck');
require('@babel/runtime/helpers/createClass');
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-2443c6ff.js');
require('../../../../chunks/_commonjsHelpers-ea2bee21.js');
require('../../../../chunks/isArray-b0f0e351.js');
require('../../../../chunks/log.js');
require('../../../../hooks/use-form-disabled.js');
require('../../../../hooks/use-global-icon.js');
require('./config.js');

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

var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
var upperCase__default = /*#__PURE__*/_interopDefaultLegacy(upperCase);

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__default["default"](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 = 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: _objectSpread(_objectSpread({}, components_colorPicker_props["default"]), {}, {
    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 = components_colorPicker_hooks_index.useBaseClassName();
    var formatModel = VueCompositionAPI.ref(props2.format);
    VueCompositionAPI.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__default["default"](components_colorPicker_const.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("l-select", helper.helper([{
      "attrs": {
        "size": "small"
      },
      "class": "".concat(baseClassName, "__format-mode-select")
    }, 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("l-option", {
        "key": item,
        "attrs": {
          "value": item,
          "label": upperCase__default["default"](item)
        },
        "style": {
          fontSize: "12px"
        }
      });
    })])]), h("div", {
      "class": "".concat(baseClassName, "__format--item")
    }, [h("format-inputs", {
      props: newProps
    })])]);
  }
});

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