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

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var VueCompositionAPI = require('@vue/composition-api');
var components_select_props = require('./props.js');
var hooks_lnode = require('../../hooks/lnode.js');
var components_configProvider_useConfig = require('../config-provider/useConfig.js');
var hooks_useCommonClassname = require('../../hooks/use-common-classname.js');
require('lodash/isEmpty');
require('lodash/isFunction');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../../hooks/render-lnode.js');
require('lodash/isString');
require('lodash/isObject');
require('../config-provider/context.js');
require('lodash');
require('../../chunks/zh_CN.js');

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

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);

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 _OptionGroup = VueCompositionAPI.defineComponent({
  name: "LOptionGroup",
  props: _objectSpread({}, components_select_props.SelectOptionGroupProps),
  setup: function setup(props2) {
    var _toRefs = VueCompositionAPI.toRefs(props2),
        divider = _toRefs.divider;

    var ulRef = VueCompositionAPI.ref(null);
    var tSelect = VueCompositionAPI.inject("tSelect");

    var _useCommonClassName = hooks_useCommonClassname["default"](),
        sizeClassNames = _useCommonClassName.sizeClassNames;

    var COMPONENT_NAME = components_configProvider_useConfig.usePrefixClass("select");

    var _useConfig = components_configProvider_useConfig.useConfig("classPrefix"),
        classPrefix = _useConfig.classPrefix;

    var classes = VueCompositionAPI.computed(function () {
      var _ref;

      return ["".concat(COMPONENT_NAME.value, "-option-group"), (_ref = {}, _defineProperty__default["default"](_ref, sizeClassNames[tSelect.size], tSelect && tSelect.size), _defineProperty__default["default"](_ref, "".concat(COMPONENT_NAME.value, "-option-group__divider"), divider), _ref)];
    });
    return {
      classes: classes,
      ulRef: ulRef,
      classPrefix: classPrefix,
      componentName: COMPONENT_NAME
    };
  },
  render: function render() {
    var h = arguments[0];
    var renderTNode = hooks_lnode.useLNodeJSX();
    var children = renderTNode("default");
    return h("li", {
      "class": this.classes
    }, [h("div", {
      "class": "".concat(this.componentName, "-option-group__header")
    }, [this.label]), h("ul", {
      "class": "".concat(this.classPrefix, "-select__list"),
      "ref": "ulRef"
    }, [children])]);
  }
});

exports["default"] = _OptionGroup;
//# sourceMappingURL=option-group.js.map
