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

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 'lodash/camelCase';
import 'lodash/kebabCase';
import 'lodash/mergeWith';
import 'lodash';
import '../config-provider/context.js';
import '../../_chunks/dep-b1584b65.js';

const classPrefixMixins = getClassPrefixMixins("tab-panel");
var _TabPanel = mixins(Vue, classPrefixMixins).extend({
  name: "LTabPanel",
  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(() => {
        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
      }]
    }, [renderContent(this, "default", "panel")]);
  }

});

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