/**
 * ldesign v0.3.13
 * (c) 2023 ldesign
 * @license MIT
 */

import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { defineComponent, ref, watch, createVNode, mergeProps, isVNode } from 'vue';
import upperCase from 'lodash/upperCase';
import props from '../../props.js';
import { FORMATS } from '../../const.js';
import { Select, Option } from '../../../select/index.js';
import { useBaseClassName } from '../../hooks.js';
import FormatInputs from './inputs.js';
import '../../../_common/js/color-picker/constants.js';
import '../../../utils/withInstall.js';
import '../../../select/select.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/helpers/slicedToArray';
import 'lodash/pick';
import 'lodash/isArray';
import 'lodash/isFunction';
import 'lodash/debounce';
import 'lodash/cloneDeep';
import 'lodash/get';
import 'lodash/intersection';
import '../../../common-components/fake-arrow.js';
import '../../../hooks/useConfig.js';
import '../../../config-provider/useConfig.js';
import 'lodash/isString';
import '../../../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import '../../../_common/js/global-config/default-config.js';
import '../../../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import '../../../_chunks/dep-e041f5b0.js';
import 'dayjs';
import '../../../select-input/index.js';
import '../../../select-input/select-input.js';
import '../../../popup/index.js';
import '../../../popup/popup.js';
import '@popperjs/core';
import 'lodash/isObject';
import '../../../utils/dom.js';
import '../../../utils/easing.js';
import '../../../utils/render-tnode.js';
import 'lodash/isEmpty';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../../../_common/js/utils/set-style.js';
import '../../../hooks/useVModel.js';
import '../../../popup/props.js';
import '../../../popup/container.js';
import 'lodash/isUndefined';
import '../../../hooks/useResizeObserver.js';
import '../../../select-input/props.js';
import '../../../select-input/useSingle.js';
import '../../../input/index.js';
import '../../../input/input.js';
import '@ldesign/icons-vue-next';
import '../../../form/hooks.js';
import '../../../hooks/useGlobalIcon.js';
import '../../../hooks/tnode.js';
import '../../../input/props.js';
import '../../../input/useInput.js';
import '../../../form/const.js';
import '../../../input/useLengthLimit.js';
import 'lodash/isNumber';
import '../../../_common/js/log/log.js';
import '../../../_common/js/utils/helper.js';
import 'lodash/isNull';
import '../../../input/useInputEventHandler.js';
import '../../../input/useInputWidth.js';
import '../../../input/input-group.js';
import '../../../input/input-group-props.js';
import '../../../loading/index.js';
import '../../../loading/directive.js';
import '../../../loading/plugin.js';
import '../../../loading/loading.js';
import '../../../hooks/useTeleport.js';
import '../../../loading/props.js';
import '../../../loading/icon/gradient.js';
import '../../../_common/js/loading/circle-adapter.js';
import '../../../hooks/useDefaultValue.js';
import '../../../select-input/useMultiple.js';
import '../../../tag-input/index.js';
import '../../../tag-input/tag-input.js';
import '../../../tag-input/props.js';
import '../../../tag-input/hooks/useTagScroll.js';
import '../../../tag-input/useTagList.js';
import '../../../tag/index.js';
import '../../../tag/tag.js';
import '../../../tag/props.js';
import '../../../tag/check-tag.js';
import '../../../tag/check-tag-props.js';
import '../../../tag-input/hooks/useHover.js';
import '../../../tag-input/hooks/useDragSorter.js';
import '../../../select-input/useOverlayInnerStyle.js';
import '../../../select/props.js';
import '../../../select/select-panel.js';
import 'lodash/omit';
import '../../../select/option.js';
import '../../../checkbox/index.js';
import '../../../checkbox/checkbox.js';
import '../../../hooks/useRipple.js';
import '../../../utils/set-style.js';
import '../../../hooks/useKeepAnimation.js';
import '../../../checkbox/props.js';
import '../../../checkbox/constants.js';
import '../../../checkbox/group.js';
import '../../../hooks/slot.js';
import '../../../checkbox/checkbox-group-props.js';
import '../../../select/option-props.js';
import '../../../select/helper.js';
import '../../../select/optionGroup.js';
import '../../../select/option-group-props.js';
import '../../../select/hooks/usePanelVirtualScroll.js';
import '../../../hooks/useVirtualScroll.js';
import '../../../select/hooks/useSelectOptions.js';
import 'lodash/throttle';
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/useInputNumber.js';
import '../../../hooks/useCommonClassName.js';
import '../../../_common/js/input-number/number.js';
import 'lodash/isNil';
import '../../../_common/js/input-number/large-number.js';
import './config.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/cmyk.js';
import '../../../_common/js/color-picker/gradient.js';

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; }
function _isSlot(s) {
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
}
var FormatPanel = defineComponent({
  name: "FormatPanel",
  inheritAttrs: false,
  props: _objectSpread(_objectSpread({}, props), {}, {
    color: {
      type: Object
    },
    onModeChange: {
      type: Function,
      "default": function _default() {
        return function () {};
      }
    },
    onInputChange: {
      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.onModeChange(v);
    };
    return {
      formatModel: formatModel,
      baseClassName: baseClassName,
      handleModeChange: handleModeChange
    };
  },
  render: function render() {
    var _this = this;
    var _slot;
    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 createVNode("div", {
      "class": "".concat(baseClassName, "__format")
    }, [createVNode("div", {
      "class": "".concat(baseClassName, "__format--item")
    }, [createVNode(Select, mergeProps({
      "size": "small",
      "class": "".concat(baseClassName, "__format-mode-select")
    }, selectInputProps, {
      "popupProps": {
        overlayClassName: "".concat(baseClassName, "__select-options")
      },
      "modelValue": _this.formatModel,
      "onUpdate:modelValue": function onUpdateModelValue($event) {
        return _this.formatModel = $event;
      },
      "onChange": handleModeChange
    }), _isSlot(_slot = formats.map(function (item) {
      return createVNode(Option, {
        "key": item,
        "value": item,
        "label": upperCase(item),
        "style": {
          fontSize: "12px"
        }
      }, null);
    })) ? _slot : {
      "default": function _default() {
        return [_slot];
      }
    })]), createVNode("div", {
      "class": "".concat(baseClassName, "__format--item")
    }, [createVNode(FormatInputs, newProps, null)])]);
  }
});

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