@ditari/bsui 1.0.71 → 1.0.72

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 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),m=require("vue-router"),N=require("@ant-design/icons-vue"),q=require("pinia"),y=require("../../store/modules/NavTab.cjs.js"),S=require("../../store/modules/KeepAlive.cjs.js"),g=require("../../store/modules/Menu.cjs.js"),T=require("../theme/index.cjs.js"),B=e.createElementVNode("div",{class:"tab-dividers"},null,-1),K={key:0,class:"tab-close"},E={name:"DNavTabs"},V=e.defineComponent({...E,setup(x){const l=m.useRoute(),p=m.useRouter(),c=y.useNavTabsStore(),v=S.useKeepAliveStore(),f=g.useMenuStore(),_=`${T.prefixName}-nav`,n=e.computed(()=>c.getList),{selectedMenuKeys:u}=q.storeToRefs(f),r=e.ref("");e.watchEffect(()=>{r.value=u.value.length>0?u.value[0]:""}),d(),e.watch(()=>l.path,()=>{d()});function d(){c.save(l),u.value=[l.path],v.save(l)}const h=a=>{if(a!==l.path){const t=n.value.filter(s=>s.path===a)[0];p.push({path:t.path,query:t.query,params:t.params})}},b=(a,t)=>{const s=n.value.find(i=>i.fullPath===t);a.stopPropagation(),c.deleteTabs(t),p.push(n.value[n.value.length-1].fullPath),s.name&&v.deleteKeepAlive(s.name)},C=a=>{var t;return(t=a.meta)!=null&&t.keepOpen?!1:n.value.length!==1};return(a,t)=>{const s=e.resolveComponent("a-tab-pane"),i=e.resolveComponent("a-tabs");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(_)},[e.createVNode(i,{activeKey:r.value,"onUpdate:activeKey":t[0]||(t[0]=o=>r.value=o),type:"card",onTabClick:h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),o=>(e.openBlock(),e.createBlock(s,{key:o.path},{tab:e.withCtx(()=>[B,e.createElementVNode("div",{class:e.normalizeClass(["tab-item",{active:r.value===o.path}])},e.toDisplayString(o.meta.title),3),C(o)?(e.openBlock(),e.createElementBlock("div",K,[e.createVNode(e.unref(N.CloseOutlined),{onClick:k=>b(k,o.fullPath)},null,8,["onClick"])])):e.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])])}}});exports.default=V;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("vue-router"),N=require("@ant-design/icons-vue"),q=require("pinia"),y=require("../../store/modules/NavTab.cjs.js"),S=require("../../store/modules/KeepAlive.cjs.js"),g=require("../../store/modules/Menu.cjs.js"),T=require("../theme/index.cjs.js"),B=e.createElementVNode("div",{class:"tab-dividers"},null,-1),K={key:0,class:"tab-close"},P={name:"DNavTabs"},E=e.defineComponent({...P,setup(V){const l=f.useRoute(),p=f.useRouter(),u=y.useNavTabsStore(),v=S.useKeepAliveStore(),m=g.useMenuStore(),h=`${T.prefixName}-nav`,n=e.computed(()=>u.getList),{selectedMenuKeys:c}=q.storeToRefs(m),r=e.ref("");e.watchEffect(()=>{r.value=c.value.length>0?c.value[0]:""}),d(),e.watch(()=>l.path,()=>{d()});function d(){u.save(l),c.value=[l.path],v.save(l)}const _=a=>{if(a!==l.path){const t=n.value.filter(s=>s.path===a)[0];p.push({path:t.path,query:t.query,params:t.params,fullPath:t.fullPath})}},b=(a,t)=>{const s=n.value.find(i=>i.fullPath===t);a.stopPropagation(),u.deleteTabs(t),p.push(n.value[n.value.length-1].fullPath),s.name&&v.deleteKeepAlive(s.name)},C=a=>{var t;return(t=a.meta)!=null&&t.keepOpen?!1:n.value.length!==1};return(a,t)=>{const s=e.resolveComponent("a-tab-pane"),i=e.resolveComponent("a-tabs");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(h)},[e.createVNode(i,{activeKey:r.value,"onUpdate:activeKey":t[0]||(t[0]=o=>r.value=o),type:"card",onTabClick:_},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),o=>(e.openBlock(),e.createBlock(s,{key:o.path},{tab:e.withCtx(()=>[B,e.createElementVNode("div",{class:e.normalizeClass(["tab-item",{active:r.value===o.path}])},e.toDisplayString(o.meta.title),3),C(o)?(e.openBlock(),e.createElementBlock("div",K,[e.createVNode(e.unref(N.CloseOutlined),{onClick:k=>b(k,o.fullPath)},null,8,["onClick"])])):e.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])])}}});exports.default=E;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("pinia"),r=require("../types.cjs.js"),h=l.defineStore(r.NAV_TAB_ID,{state:()=>({list:[],activeKey:""}),getters:{getList:t=>t.list,getActiveKey:t=>t.activeKey},actions:{setActiveKey(t){this.activeKey=t},save(t){var i;if(!((i=t.meta)!=null&&i.title))return;if(this.list.some(e=>e.path===t.path)){this.list.forEach(e=>{e.path===t.path&&(e.query=t.query,e.params=t.params,e.meta=t.meta,e.name=t.name||"")});return}const a={path:t.path,fullPath:t.fullPath,query:t.query,params:t.params,meta:t.meta,name:t.name||""};this.list.push(a)},deleteTabs(t){this.list.splice(this.list.findIndex(s=>s.fullPath===t),1)},setNavTitle(t,s){for(let a=0;a<this.list.length;a++)if(this.list[a].fullPath===s){this.list[a].meta.title=t;break}}},persist:!0});exports.useNavTabsStore=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("pinia"),h=require("../types.cjs.js"),n=l.defineStore(h.NAV_TAB_ID,{state:()=>({list:[],activeKey:""}),getters:{getList:t=>t.list,getActiveKey:t=>t.activeKey},actions:{setActiveKey(t){this.activeKey=t},save(t){var i;if(!((i=t.meta)!=null&&i.title))return;if(this.list.some(e=>e.path===t.path)){this.list.forEach(e=>{e.path===t.path&&(e.query=t.query,e.fullPath=t.fullPath,e.params=t.params,e.meta=t.meta,e.name=t.name||"")});return}const a={path:t.path,fullPath:t.fullPath,query:t.query,params:t.params,meta:t.meta,name:t.name||""};this.list.push(a)},deleteTabs(t){this.list.splice(this.list.findIndex(s=>s.fullPath===t),1)},setNavTitle(t,s){for(let a=0;a<this.list.length;a++)if(this.list[a].fullPath===s){this.list[a].meta.title=t;break}}},persist:!0});exports.useNavTabsStore=n;
@@ -1,4 +1,4 @@
1
- import { defineComponent as x, computed as P, ref as w, watchEffect as A, watch as B, resolveComponent as d, openBlock as l, createElementBlock as p, normalizeClass as _, createVNode as h, withCtx as b, Fragment as E, renderList as R, unref as C, createBlock as V, createElementVNode as k, toDisplayString as q, createCommentVNode as D } from "vue";
1
+ import { defineComponent as P, computed as x, ref as w, watchEffect as A, watch as B, resolveComponent as d, openBlock as r, createElementBlock as p, normalizeClass as h, createVNode as _, withCtx as b, Fragment as E, renderList as R, unref as C, createBlock as V, createElementVNode as k, toDisplayString as q, createCommentVNode as D } from "vue";
2
2
  import { useRoute as L, useRouter as M } from "vue-router";
3
3
  import { CloseOutlined as O } from "@ant-design/icons-vue";
4
4
  import { storeToRefs as z } from "pinia";
@@ -11,12 +11,12 @@ const G = /* @__PURE__ */ k("div", { class: "tab-dividers" }, null, -1), H = {
11
11
  class: "tab-close"
12
12
  }, I = {
13
13
  name: "DNavTabs"
14
- }, oe = /* @__PURE__ */ x({
14
+ }, oe = /* @__PURE__ */ P({
15
15
  ...I,
16
16
  setup(J) {
17
- const n = L(), m = M(), c = F(), v = U(), y = $(), N = `${j}-nav`, o = P(() => c.getList), { selectedMenuKeys: u } = z(y), r = w("");
17
+ const n = L(), m = M(), u = F(), v = U(), y = $(), N = `${j}-nav`, o = x(() => u.getList), { selectedMenuKeys: c } = z(y), l = w("");
18
18
  A(() => {
19
- r.value = u.value.length > 0 ? u.value[0] : "";
19
+ l.value = c.value.length > 0 ? c.value[0] : "";
20
20
  }), f(), B(
21
21
  () => n.path,
22
22
  () => {
@@ -24,7 +24,7 @@ const G = /* @__PURE__ */ k("div", { class: "tab-dividers" }, null, -1), H = {
24
24
  }
25
25
  );
26
26
  function f() {
27
- c.save(n), u.value = [n.path], v.save(n);
27
+ u.save(n), c.value = [n.path], v.save(n);
28
28
  }
29
29
  const S = (t) => {
30
30
  if (t !== n.path) {
@@ -32,38 +32,39 @@ const G = /* @__PURE__ */ k("div", { class: "tab-dividers" }, null, -1), H = {
32
32
  m.push({
33
33
  path: e.path,
34
34
  query: e.query,
35
- params: e.params
35
+ params: e.params,
36
+ fullPath: e.fullPath
36
37
  });
37
38
  }
38
39
  }, g = (t, e) => {
39
40
  const s = o.value.find((i) => i.fullPath === e);
40
- t.stopPropagation(), c.deleteTabs(e), m.push(o.value[o.value.length - 1].fullPath), s.name && v.deleteKeepAlive(s.name);
41
+ t.stopPropagation(), u.deleteTabs(e), m.push(o.value[o.value.length - 1].fullPath), s.name && v.deleteKeepAlive(s.name);
41
42
  }, K = (t) => {
42
43
  var e;
43
44
  return (e = t.meta) != null && e.keepOpen ? !1 : o.value.length !== 1;
44
45
  };
45
46
  return (t, e) => {
46
47
  const s = d("a-tab-pane"), i = d("a-tabs");
47
- return l(), p("div", {
48
- class: _(N)
48
+ return r(), p("div", {
49
+ class: h(N)
49
50
  }, [
50
- h(i, {
51
- activeKey: r.value,
52
- "onUpdate:activeKey": e[0] || (e[0] = (a) => r.value = a),
51
+ _(i, {
52
+ activeKey: l.value,
53
+ "onUpdate:activeKey": e[0] || (e[0] = (a) => l.value = a),
53
54
  type: "card",
54
55
  onTabClick: S
55
56
  }, {
56
57
  default: b(() => [
57
- (l(!0), p(E, null, R(C(o), (a) => (l(), V(s, {
58
+ (r(!0), p(E, null, R(C(o), (a) => (r(), V(s, {
58
59
  key: a.path
59
60
  }, {
60
61
  tab: b(() => [
61
62
  G,
62
63
  k("div", {
63
- class: _(["tab-item", { active: r.value === a.path }])
64
+ class: h(["tab-item", { active: l.value === a.path }])
64
65
  }, q(a.meta.title), 3),
65
- K(a) ? (l(), p("div", H, [
66
- h(C(O), {
66
+ K(a) ? (r(), p("div", H, [
67
+ _(C(O), {
67
68
  onClick: (T) => g(T, a.fullPath)
68
69
  }, null, 8, ["onClick"])
69
70
  ])) : D("", !0)
@@ -1,6 +1,6 @@
1
1
  import { defineStore as l } from "pinia";
2
2
  import { NAV_TAB_ID as h } from "../types.esm.js";
3
- const f = l(h, {
3
+ const n = l(h, {
4
4
  state: () => ({
5
5
  // 多标签列表
6
6
  list: [],
@@ -29,11 +29,11 @@ const f = l(h, {
29
29
  return;
30
30
  if (this.list.some((a) => a.path === t.path)) {
31
31
  this.list.forEach((a) => {
32
- a.path === t.path && (a.query = t.query, a.params = t.params, a.meta = t.meta, a.name = t.name || "");
32
+ a.path === t.path && (a.query = t.query, a.fullPath = t.fullPath, a.params = t.params, a.meta = t.meta, a.name = t.name || "");
33
33
  });
34
34
  return;
35
35
  }
36
- const e = {
36
+ const s = {
37
37
  path: t.path,
38
38
  fullPath: t.fullPath,
39
39
  query: t.query,
@@ -41,7 +41,7 @@ const f = l(h, {
41
41
  meta: t.meta,
42
42
  name: t.name || ""
43
43
  };
44
- this.list.push(e);
44
+ this.list.push(s);
45
45
  },
46
46
  /**
47
47
  * 删除标签
@@ -49,7 +49,7 @@ const f = l(h, {
49
49
  */
50
50
  deleteTabs(t) {
51
51
  this.list.splice(
52
- this.list.findIndex((s) => s.fullPath === t),
52
+ this.list.findIndex((e) => e.fullPath === t),
53
53
  1
54
54
  );
55
55
  },
@@ -58,10 +58,10 @@ const f = l(h, {
58
58
  * @param title 标题
59
59
  * @param path url
60
60
  */
61
- setNavTitle(t, s) {
62
- for (let e = 0; e < this.list.length; e++)
63
- if (this.list[e].fullPath === s) {
64
- this.list[e].meta.title = t;
61
+ setNavTitle(t, e) {
62
+ for (let s = 0; s < this.list.length; s++)
63
+ if (this.list[s].fullPath === e) {
64
+ this.list[s].meta.title = t;
65
65
  break;
66
66
  }
67
67
  }
@@ -69,5 +69,5 @@ const f = l(h, {
69
69
  persist: !0
70
70
  });
71
71
  export {
72
- f as useNavTabsStore
72
+ n as useNavTabsStore
73
73
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.0.71",
3
+ "version": "1.0.72",
4
4
  "files": [
5
5
  "dist/**",
6
6
  "src"
@@ -66,8 +66,9 @@ const onClick = (key: string) => {
66
66
  router.push({
67
67
  path: rs.path,
68
68
  query: rs.query,
69
- params: rs.params
70
- });
69
+ params: rs.params,
70
+ fullPath: rs.fullPath
71
+ } as any);
71
72
  }
72
73
  };
73
74
 
@@ -60,6 +60,7 @@ export const useNavTabsStore = defineStore(NAV_TAB_ID, {
60
60
  this.list.forEach((item: INavTab) => {
61
61
  if (item.path === route.path) {
62
62
  item.query = route.query;
63
+ item.fullPath = route.fullPath;
63
64
  item.params = route.params;
64
65
  item.meta = route.meta;
65
66
  item.name = <string>route.name || "";