tdesign-vue
Version:
87 lines (83 loc) • 3.17 kB
JavaScript
/**
* tdesign v1.15.0
* (c) 2026 tdesign
* @license MIT
*/
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import Vue from 'vue';
import tabPanelProps from './tab-panel-props.js';
import { renderContent } from '../utils/render-tnode.js';
import { updateElement } from '../hooks/useDestroyOnClose.js';
import { getClassPrefixMixins } from '../config-provider/config-receiver.js';
import mixins from '../utils/mixins.js';
import '@babel/runtime/helpers/readOnlyError';
import '@babel/runtime/helpers/typeof';
import '@vue/composition-api';
import 'lodash-es';
import '../config-provider/context.js';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '../_chunks/dep-e5d497fb.js';
import '../_chunks/dep-1618e1d6.js';
import 'dayjs';
import '../_common/js/global-config/t.js';
import '@babel/runtime/helpers/slicedToArray';
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var classPrefixMixins = getClassPrefixMixins("tab-panel");
var _TabPanel = mixins(Vue, classPrefixMixins).extend({
name: "TTabPanel",
props: _objectSpread({}, tabPanelProps),
data: function data() {
return {
loaded: false
};
},
inject: {
parent: {
"default": null
}
},
computed: {
active: function active() {
var _ref = this.parent || {},
value = _ref.value;
var result = this.value === value;
if (result) {
this.loaded = true;
}
return result;
}
},
updated: function updated() {
var _this$parent,
_this$parent$updatePa,
_this = this;
(_this$parent = this.parent) === null || _this$parent === void 0 || (_this$parent$updatePa = _this$parent.updatePanels) === null || _this$parent$updatePa === 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,
lazy = this.lazy,
loaded = this.loaded;
if (destroyOnHide && !active || lazy && !loaded) 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