@v-c/tabs 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { useTabContext } from "../TabContext.js";
2
2
  import TabPane_default from "./TabPane.js";
3
- import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, normalizeStyle, openBlock, renderList, toRefs, unref, vShow, withCtx, withDirectives } from "vue";
3
+ import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, normalizeStyle, openBlock, reactive, renderList, toRefs, unref, vShow, watch, withCtx, withDirectives } from "vue";
4
4
  import RenderComponent from "@v-c/util/dist/RenderComponent";
5
5
  import { getTransitionProps } from "@v-c/util/dist/utils/transition";
6
6
  //#region src/TabPanelList/index.vue?vue&type=script&setup=true&lang.ts
@@ -30,6 +30,16 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
30
30
  function shouldDestroyOnHidden(item) {
31
31
  return !!(!item.forceRender && (destroyOnHidden.value ?? item.destroyOnHidden) === true);
32
32
  }
33
+ const visitedKeys = reactive(/* @__PURE__ */ new Set());
34
+ watch(activeKey, (key) => {
35
+ if (key != null) visitedKeys.add(key);
36
+ }, { immediate: true });
37
+ function shouldRender(item) {
38
+ if (item.key === activeKey.value) return true;
39
+ if (item.forceRender) return true;
40
+ if ((destroyOnHidden.value ?? item.destroyOnHidden) === true) return false;
41
+ return visitedKeys.has(item.key);
42
+ }
33
43
  return (_ctx, _cache) => {
34
44
  return openBlock(), createElementBlock("div", { class: normalizeClass([`${prefixCls.value}-content-holder`]) }, [createElementVNode("div", { class: normalizeClass([
35
45
  `${prefixCls.value}-content`,
@@ -40,7 +50,7 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
40
50
  key: 0,
41
51
  ref_for: true
42
52
  }, transitionProps.value), {
43
- default: withCtx(() => [(shouldDestroyOnHidden(item) ? item.key === unref(activeKey) : true) ? withDirectives((openBlock(), createBlock(TabPane_default, {
53
+ default: withCtx(() => [shouldRender(item) ? withDirectives((openBlock(), createBlock(TabPane_default, {
44
54
  key: 0,
45
55
  id: unref(id),
46
56
  "prefix-cls": tabPanePrefixCls.value,
@@ -69,7 +79,7 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
69
79
  "class-name"
70
80
  ])), [[vShow, shouldDestroyOnHidden(item) ? true : item.key === unref(activeKey) || item.forceRender]]) : createCommentVNode("", true)]),
71
81
  _: 2
72
- }, 1040)) : createCommentVNode("", true), !tabPaneAnimated.value && (shouldDestroyOnHidden(item) ? item.key === unref(activeKey) : true) ? withDirectives((openBlock(), createBlock(TabPane_default, {
82
+ }, 1040)) : createCommentVNode("", true), !tabPaneAnimated.value && shouldRender(item) ? withDirectives((openBlock(), createBlock(TabPane_default, {
73
83
  key: 1,
74
84
  id: unref(id),
75
85
  "prefix-cls": tabPanePrefixCls.value,
package/package.json CHANGED
@@ -1,13 +1,18 @@
1
1
  {
2
2
  "name": "@v-c/tabs",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "description": "tabs ui component for react",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
9
  "author": "",
10
10
  "license": "MIT",
11
+ "homepage": "https://github.com/antdv-next/vue-components/tree/next/packages/tabs",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/antdv-next/vue-components.git"
15
+ },
11
16
  "keywords": [
12
17
  "tabs",
13
18
  "vue-components",
@@ -32,10 +37,10 @@
32
37
  "vue": "^3.0.0"
33
38
  },
34
39
  "dependencies": {
35
- "@v-c/dropdown": "^1.0.2",
36
- "@v-c/menu": "^1.1.0",
40
+ "@v-c/menu": "^1.2.0",
37
41
  "@v-c/overflow": "^1.1.0",
38
- "@v-c/resize-observer": "^1.1.0",
42
+ "@v-c/dropdown": "^1.0.2",
43
+ "@v-c/resize-observer": "^1.1.2",
39
44
  "@v-c/util": "^1.0.19"
40
45
  },
41
46
  "scripts": {