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

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import Vue from 'vue';
import { TabsPanelProps } from './props.js';
import { renderContent } from '../../utils/render-node.js';
import { updateElement } from '../../hooks/use-destroy-onclose.js';
import { getClassPrefixMixins } from '../config-provider/config-receiver.js';
import mixins from '../../utils/mixins.js';
import '@babel/runtime/helpers/typeof';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import 'lodash/mergeWith';
import 'lodash';
import '../config-provider/context.js';
import '../../chunks/zh_CN.js';
import '../config-provider/type.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; }
var classPrefixMixins = getClassPrefixMixins("tab-panel");
var _TabPanel = mixins(Vue, classPrefixMixins).extend({
  name: "LTabPanel",
  props: _objectSpread({}, TabsPanelProps),
  inject: {
    parent: {
      "default": null
    }
  },
  computed: {
    active: function active() {
      var _ref = this.parent || {},
          value = _ref.value;

      return this.value === value;
    }
  },
  updated: function updated() {
    var _this$parent,
        _this$parent$updatePa,
        _this = this;

    (_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : (_this$parent$updatePa = _this$parent.updatePanels) === null || _this$parent$updatePa === void 0 ? void 0 : _this$parent$updatePa.call(_this$parent, {
      force: true
    });

    if (!this.destroyOnHide) {
      var timer = setTimeout(function () {
        updateElement(_this);
        clearTimeout(timer);
      }, 0);
    }
  },
  render: function render() {
    var h = arguments[0];
    var destroyOnHide = this.destroyOnHide,
        active = this.active;
    if (destroyOnHide && !active) return null;
    return h("div", {
      "class": this.componentName,
      "directives": [{
        name: "show",
        value: active
      }]
    }, [renderContent(this, "default", "panel")]);
  }
});

export { _TabPanel as default };
//# sourceMappingURL=tab-panel.js.map
