UNPKG

tdesign-vue-next

Version:
68 lines (64 loc) 2.27 kB
/** * tdesign v1.13.2 * (c) 2025 tdesign * @license MIT */ import _defineProperty from '@babel/runtime/helpers/defineProperty'; import { defineComponent, inject, computed, ref, watch, createVNode } from 'vue'; import tabPanelProps from './tab-panel-props.js'; import 'lodash-es'; import '@babel/runtime/helpers/toConsumableArray'; import '@babel/runtime/helpers/typeof'; import { a as useContent } from '../_chunks/dep-2b7081ce.js'; import { u as useCommonClassName } from '../_chunks/dep-ce96cd30.js'; import { u as usePrefixClass } from '../_chunks/dep-8da4c7ba.js'; import { u as useDestroyOnClose } from '../_chunks/dep-4bf5f951.js'; import '@babel/runtime/helpers/slicedToArray'; import '../_chunks/dep-17e50b35.js'; import '../_chunks/dep-cedcb3d0.js'; import '../utils/render-tnode.js'; import '../config-provider/hooks/useConfig.js'; import '../config-provider/utils/context.js'; import '../_chunks/dep-78c14980.js'; import '../_chunks/dep-09955460.js'; import 'dayjs'; import '@babel/runtime/helpers/createClass'; import '@babel/runtime/helpers/classCallCheck'; var _TabPanel = defineComponent({ name: "TTabPanel", props: tabPanelProps, setup: function setup(props2) { var COMPONENT_NAME = usePrefixClass("tab-panel"); var _useCommonClassName = useCommonClassName(), STATUS = _useCommonClassName.STATUS; var renderTNodeContent = useContent(); useDestroyOnClose(); var tabs = inject("tabs"); var isActive = computed(function () { return props2.value === tabs.value.value; }); var isMount = ref(props2.lazy ? isActive.value : true); watch(isActive, function () { if (isActive.value) { if (!isMount.value) { isMount.value = true; } } else if (props2.destroyOnHide) { isMount.value = false; } }, { immediate: true }); var tabPanelClass = computed(function () { return [COMPONENT_NAME.value, _defineProperty({}, STATUS.value.hidden, !isActive.value)]; }); return function () { if (!isMount.value) return null; return createVNode("div", { "class": tabPanelClass.value }, [renderTNodeContent("default", "panel")]); }; } }); export { _TabPanel as default }; //# sourceMappingURL=tab-panel.js.map