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

'use strict';

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

var Vue = require('vue');
var utils_renderNode = require('../../utils/render-node.js');
var hooks_useDestroyOnclose = require('../../hooks/use-destroy-onclose.js');
var components_configProvider_configReceiver = require('../config-provider/config-receiver.js');
var utils_mixins = require('../../utils/mixins.js');
var components_tabs_props = require('./props.js');
require('lodash');
require('lodash/mergeWith');
require('../config-provider/context.js');
require('../../chunks/zh_CN.js');

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

var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);

const classPrefixMixins = components_configProvider_configReceiver.getClassPrefixMixins("tab-panel");
var _TabPanel = utils_mixins["default"](Vue__default["default"], classPrefixMixins).extend({
  name: "LTabPanel",
  props: {
    ...components_tabs_props.TabsPanelProps
  },
  inject: {
    parent: {
      default: null
    }
  },
  computed: {
    active() {
      const {
        value
      } = this.parent || {};
      return this.value === value;
    }
  },
  updated() {
    var _this$parent, _this$parent$updatePa;
    (_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) {
      const timer = setTimeout(() => {
        hooks_useDestroyOnclose.updateElement(this);
        clearTimeout(timer);
      }, 0);
    }
  },
  render() {
    const h = arguments[0];
    const {
      destroyOnHide,
      active
    } = this;
    if (destroyOnHide && !active) return null;
    return h("div", {
      "class": this.componentName,
      "directives": [{
        name: "show",
        value: active
      }]
    }, [utils_renderNode.renderContent(this, "default", "panel")]);
  }
});

exports["default"] = _TabPanel;
//# sourceMappingURL=tab-panel.js.map
