@ditari/bsui 1.0.29 → 1.0.31

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"),N=require("pinia"),S=require("../../store/modules/Menu.cjs.js"),h=require("../../store/modules/Settings.cjs.js");function V(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!e.isVNode(o)}const y=e.defineComponent({name:"DMenu",setup(){const{componentName:o,prop:C}=e.inject("menuIcon"),{list:i}=S.useMenuStore(),a=h.useSettingsStore(),{getCollapsed:d}=N.storeToRefs(a),l=e.ref([]),c=e.ref([]),p=({item:t,key:n,keyPath:r})=>{console.log(t,n,r),l.value=r,c.value=[n]},v=t=>e.createVNode(e.Fragment,null,[e.createVNode(e.resolveComponent("a-menu-item"),{key:t.url},{icon:()=>s(t),default:()=>t.title})]),m=["anticon","anticon-menu","ant-menu-item-icon"],s=t=>e.createVNode(e.Fragment,null,[t.icon?f(t.icon):e.withDirectives(e.createVNode("div",{className:m},[t.title.substring(0,1)]),[[e.vShow,d.value]])]),f=t=>o==="nativeHtml"?e.createVNode("span",{innerHTML:t},null):e.h(e.resolveComponent(o),{prop:t}),u=t=>e.createVNode(e.Fragment,null,[e.createVNode(e.resolveComponent("a-sub-menu"),{key:t.url},{title:()=>t.title,icon:()=>s(t),default:()=>t.children.map(n=>!n.children||n.children.length===0?g(n):u(n))})]),g=t=>e.createVNode(e.Fragment,null,[e.createVNode(e.resolveComponent("a-menu-item"),{key:t.url},{default:()=>t.title})]);return()=>{let t;return e.createVNode(e.resolveComponent("a-menu"),{mode:"inline",theme:"dark",openKeys:l.value,"onUpdate:openKeys":n=>l.value=n,selectedKeys:c.value,"onUpdate:selectedKeys":n=>c.value=n,onClick:p},V(t=i.map(n=>{var r;return!n.children||((r=n.children)==null?void 0:r.length)===0?v(n):u(n)}))?t:{default:()=>[t]})}}});exports.default=y;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),S=require("vue-router"),V=require("pinia"),C=require("../../store/modules/Menu.cjs.js"),b=require("../../store/modules/Settings.cjs.js");function y(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!e.isVNode(o)}const M=e.defineComponent({name:"DMenu",setup(){const o=S.useRouter(),{componentName:s,prop:K}=e.inject("menuIcon"),{list:d}=C.useMenuStore(),p=b.useSettingsStore(),{getCollapsed:v}=V.storeToRefs(p),l=e.ref([]),c=e.ref([]),m=({item:t,key:n,keyPath:r})=>{console.log(t,n,r),l.value=r,c.value=[n],o.push(n).then(a=>a?console.warn(a):null)},f=t=>e.createVNode(e.Fragment,null,[e.createVNode(e.resolveComponent("a-menu-item"),{key:t.url},{icon:()=>u(t),default:()=>t.title})]),g=["anticon","anticon-menu","ant-menu-item-icon"],u=t=>e.createVNode(e.Fragment,null,[t.icon?h(t.icon):e.withDirectives(e.createVNode("div",{className:g},[t.title.substring(0,1)]),[[e.vShow,v.value]])]),h=t=>s==="nativeHtml"?e.createVNode("span",{innerHTML:t},null):e.h(e.resolveComponent(s),{prop:t}),i=t=>e.createVNode(e.Fragment,null,[e.createVNode(e.resolveComponent("a-sub-menu"),{key:t.url},{title:()=>t.title,icon:()=>u(t),default:()=>t.children.map(n=>!n.children||n.children.length===0?N(n):i(n))})]),N=t=>e.createVNode(e.Fragment,null,[e.createVNode(e.resolveComponent("a-menu-item"),{key:t.url},{default:()=>t.title})]);return()=>{let t;return e.createVNode(e.resolveComponent("a-menu"),{mode:"inline",theme:"dark",openKeys:l.value,"onUpdate:openKeys":n=>l.value=n,selectedKeys:c.value,"onUpdate:selectedKeys":n=>c.value=n,onClick:m},y(t=d.map(n=>{var r;return!n.children||((r=n.children)==null?void 0:r.length)===0?f(n):i(n)}))?t:{default:()=>[t]})}}});exports.default=M;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24odCl7Y29uc3QgbD10LmRhdGEua2V5d29yZHM/PyIiO2xldCBlPUpTT04ucGFyc2UodC5kYXRhLmxpc3QpPz9bXTtjb25zdCBhPUpTT04ucGFyc2UodC5kYXRhLmluY2x1ZGUpO2EubGVuZ3RoPjAmJihlPWUuZmlsdGVyKHM9PmEuc29tZShpPT5pPT09cy52YWx1ZSkpKTtjb25zdCBvPWUuZmlsdGVyKHM9PnMudmFsdWUudG9Mb3dlckNhc2UoKS5pbmRleE9mKGwudG9Mb3dlckNhc2UoKSkhPT0tMXx8cy5sYWJlbC50b0xvd2VyQ2FzZSgpLmluY2x1ZGVzKGwudG9Mb3dlckNhc2UoKSkpO28ubGVuZ3RoPT09MD9zZWxmLnBvc3RNZXNzYWdlKGUuc3BsaWNlKDAsMTApKTpzZWxmLnBvc3RNZXNzYWdlKG8uc3BsaWNlKDAsMTApKX0sITEpfSkoKTsK",d=typeof window<"u"&&window.Blob&&new Blob([atob(o)],{type:"text/javascript;charset=utf-8"});function c(){const e=d&&(window.URL||window.webkitURL).createObjectURL(d);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+o)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}exports.default=c;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24odCl7dmFyIGk7Y29uc3QgbD10LmRhdGEua2V5d29yZHM/PyIiO2xldCBlPUpTT04ucGFyc2UoKChpPXQuZGF0YSk9PW51bGw/dm9pZCAwOmkubGlzdCl8fFtdKT8/W107Y29uc3QgYT1KU09OLnBhcnNlKHQuZGF0YS5pbmNsdWRlKTthLmxlbmd0aD4wJiYoZT1lLmZpbHRlcihzPT5hLnNvbWUobj0+bj09PXMudmFsdWUpKSk7Y29uc3Qgbz1lLmZpbHRlcihzPT5zLnZhbHVlLnRvTG93ZXJDYXNlKCkuaW5kZXhPZihsLnRvTG93ZXJDYXNlKCkpIT09LTF8fHMubGFiZWwudG9Mb3dlckNhc2UoKS5pbmNsdWRlcyhsLnRvTG93ZXJDYXNlKCkpKTtvLmxlbmd0aD09PTA/c2VsZi5wb3N0TWVzc2FnZShlLnNwbGljZSgwLDEwKSk6c2VsZi5wb3N0TWVzc2FnZShvLnNwbGljZSgwLDEwKSl9LCExKX0pKCk7Cg==",b=typeof window<"u"&&window.Blob&&new Blob([atob(e)],{type:"text/javascript;charset=utf-8"});function n(){const l=b&&(window.URL||window.webkitURL).createObjectURL(b);try{return l?new Worker(l):new Worker("data:application/javascript;base64,"+e)}finally{l&&(window.URL||window.webkitURL).revokeObjectURL(l)}}exports.default=n;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),C=require("ant-design-vue"),x=require("../../utils/html.cjs.js"),J=require("../theme/index.cjs.js"),M=()=>({data:{type:Object,required:!0},height:{type:Number,default:300},keys:Array,rowKey:{type:String,default:"id"},loading:{type:Boolean,default:!1},pagination:{type:Object,default:()=>({})},config:{type:Object,default:()=>({})},expandedRowKeys:{type:Object,default:()=>[]}}),p={defaultPageSize:20,hideOnSinglePage:!1,pageSizeOptions:["10","20","30","40"],responsive:!0,showQuickJumper:!0,showLessItems:!0,showTotal:a=>`总共 ${a} 条`},P=`${J.prefixName}-pagination`,Q=t.defineComponent({name:"DTable",props:M(),emits:["update:keys"],setup:function(a,{emit:b,slots:h}){const n=t.ref(a.keys||[]),T=t.computed(()=>a.data),z=t.computed(()=>{var e;return((e=a.config)==null?void 0:e.columns)??[]}),m=t.computed(()=>{var e;return((e=a.config)==null?void 0:e.pagination)??{}}),S=t.ref(a.expandedRowKeys);t.watchEffect(()=>{const{expandedRowKeys:e}=a;S.value=e});const{tableRef:E,tableRootRef:K,tableHeight:O,onPageChange:V,onRowClassName:B}=H();function H(){const{rowClassName:e,keepSelected:o,onPageChange:i}=a.config,s=a.config.selection??"N",r=t.ref(),c=t.ref(null),l=t.ref(),u=t.ref(null),g=y=>{var v,k;try{const w=(v=c==null?void 0:c.value)==null?void 0:v.$el,$=x.useEleHeight(w.getElementsByClassName("ant-table-header")[0]);let N=0;if(a.config.pagination){const A=(k=r.value)==null?void 0:k.getElementsByClassName(P)[0];N=x.useEleHeight(A)??0}l.value=y-($+N),w.getElementsByClassName("ant-table-body")[0].style.height=l.value-10+"px",u.value=w.getElementsByClassName("ant-table-body")[0]}catch(w){console.warn(w)}};return t.watchEffect(()=>{a.height!==0&&t.nextTick(()=>{g(a.height)})}),{tableRef:c,tableRootRef:r,tableHeight:l,onPageChange:(y,v)=>{i&&i({page:y,size:v}),u.value.scrollTop=0,(s==="S"||!o)&&(n.value=[],b("update:keys",n.value))},onRowClassName:(y,v)=>e?e(y,v):void 0}}const j=q();function q(){const{rowKey:e,config:{getCheckboxProps:o}}=a;let i=a.config.selection??"N";const s=(l,u)=>{i==="S"?(n.value=[],n.value=u?[l[e]]:[]):n.value=u?n.value.concat(l[e]):n.value.filter(g=>g!==l[e]),b("update:keys",n.value)},r=(l,u,g)=>{const f=g.map(d=>d[e]);n.value=l?n.value.concat(f):n.value.filter(d=>!f.includes(d)),b("update:keys",n.value)};t.watch(()=>a.keys,l=>{n.value=l});const c=t.ref(void 0);return t.watchEffect(()=>{const{selection:l}=a.config;i=l,i!=="N"?c.value={selectedRowKeys:n,onSelect:s,onSelectAll:r,fixed:!0,columnTitle:i==="S"?"选择":null,columnWidth:i==="S"?60:40,getCheckboxProps:o}:c.value=void 0}),c}const D=F();function F(){return e=>{let o;const{rowKey:i,config:{click:s,dbClick:r,selection:c,getCheckboxProps:l}}=a,u=e[i],g=()=>{if(c==="N")return;n.value.some(d=>d===u)?n.value=n.value.filter(d=>d!==u):(c==="S"&&(n.value=[]),n.value.push(u)),b("update:keys",n.value)};return{onClick:()=>{const f=l?l(e):null;f&&f.value===u||(clearTimeout(o),o=setTimeout(()=>{g(),s&&s(e)},200))},onDblclick:()=>{clearTimeout(o),r&&r(e)}}}}const R=e=>{e.stopPropagation()},U=(e,o,i,s)=>t.createVNode(t.Fragment,null,[h.expandedRowRender&&h.expandedRowRender({record:e,index:o,indent:i,expanded:s})]),_=()=>t.createVNode(t.Fragment,null,[h.summary&&h.summary()]);return()=>{var e;return t.createVNode("div",{ref:K},[t.createVNode(C.Table,{ref:E,"row-key":a.rowKey,bordered:a.config.bordered,columns:z.value,dataSource:T.value,loading:a.loading,size:((e=a.config)==null?void 0:e.size)??"small",scroll:{scrollToFirstRowOnChange:!0,x:"100%",y:O.value+"px"},expandedRowKeys:S.value,"onUpdate:expandedRowKeys":o=>S.value=o,expandRowByClick:!0,pagination:!1,customRow:D,rowSelection:j.value,rowClassName:B},{bodyCell:({column:o,record:i})=>{if(o.slot==="action")return t.createVNode("div",{onClick:R,onDblclick:R},[t.createVNode(C.Space,null,{default:()=>[h.action&&h.action(i)]})])},expandedRowRender:U,summary:_}),t.withDirectives(t.createVNode(C.Pagination,{class:[P],current:m.value.current,"onUpdate:current":o=>m.value.current=o,pageSize:m.value.pageSize,"onUpdate:pageSize":o=>m.value.pageSize=o,disabled:a.loading,"show-size-changer":!0,size:"default","hide-on-single-page":p.hideOnSinglePage,"show-quick-jumper":p.showQuickJumper,"default-page-size":p.defaultPageSize,"page-size-options":p.pageSizeOptions,"show-total":p.showTotal,total:m.value.total,onChange:V},null),[[t.vShow,a.config.pagination]])])}}});exports.default=Q;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),C=require("ant-design-vue"),P=require("../../utils/html.cjs.js"),M=require("../theme/index.cjs.js"),Q=()=>({data:{type:Object,required:!0},height:{type:Number,default:300},keys:Array,rowKey:{type:String,default:"id"},loading:{type:Boolean,default:!1},pagination:{type:Object,default:()=>({})},config:{type:Object,default:()=>({})},expandedRowKeys:{type:Object,default:()=>[]}}),b={defaultPageSize:20,hideOnSinglePage:!1,pageSizeOptions:["10","20","30","40"],responsive:!0,showQuickJumper:!0,showLessItems:!0,showTotal:n=>`总共 ${n} 条`},T=`${M.prefixName}-pagination`,I=t.defineComponent({name:"DTable",props:Q(),emits:["update:keys"],setup:function(n,{emit:p,slots:d}){const a=t.ref(n.keys||[]),z=t.computed(()=>n.data),E=t.computed(()=>{var e;return((e=n.config)==null?void 0:e.columns)??[]}),m=t.computed(()=>{var e;return((e=n.config)==null?void 0:e.pagination)??{}}),S=t.ref(n.expandedRowKeys);t.watchEffect(()=>{const{expandedRowKeys:e}=n;S.value=e});const{tableRef:K,tableRootRef:O,tableHeight:B,onPageChange:V,onRowClassName:H}=j();function j(){const{rowClassName:e,keepSelected:l,onPageChange:i}=n.config,h=n.config.selection??"N",r=t.ref(),c=t.ref(null),o=t.ref(),u=t.ref(null),g=y=>{var v,N;try{const w=(v=c==null?void 0:c.value)==null?void 0:v.$el,A=P.useEleHeight(w.getElementsByClassName("ant-table-header")[0]);let x=0;if(n.config.pagination){const J=(N=r.value)==null?void 0:N.getElementsByClassName(T)[0];x=P.useEleHeight(J)??0}o.value=y-(A+x),w.getElementsByClassName("ant-table-body")[0].style.height=o.value-10+"px",u.value=w.getElementsByClassName("ant-table-body")[0]}catch(w){console.warn(w)}};return t.watchEffect(()=>{n.height!==0&&t.nextTick(()=>{g(n.height)})}),{tableRef:c,tableRootRef:r,tableHeight:o,onPageChange:(y,v)=>{i&&i({page:y,size:v}),u.value.scrollTop=0,(h==="S"||!l)&&(a.value=[],p("update:keys",a.value))},onRowClassName:(y,v)=>e?e(y,v):void 0}}const q=D();function D(){const{rowKey:e,config:{getCheckboxProps:l}}=n;let i=n.config.selection??"N";const h=(o,u)=>{i==="S"?(a.value=[],a.value=u?[o[e]]:[]):a.value=u?a.value.concat(o[e]):a.value.filter(g=>g!==o[e]),p("update:keys",a.value)},r=(o,u,g)=>{const f=g.map(s=>s[e]);a.value=o?a.value.concat(f):a.value.filter(s=>!f.includes(s)),p("update:keys",a.value)};t.watch(()=>n.keys,o=>{a.value=o});const c=t.ref(void 0);return t.watchEffect(()=>{const{selection:o}=n.config;i=o,i!=="N"?c.value={selectedRowKeys:a,onSelect:h,onSelectAll:r,fixed:!0,columnTitle:i==="S"?"选择":null,columnWidth:i==="S"?60:40,getCheckboxProps:l}:c.value=void 0}),c}const F=U();function U(){return e=>{let l;const{rowKey:i,config:{click:h,dbClick:r,selection:c,getCheckboxProps:o}}=n,u=e[i],g=()=>{if(c==="N")return;a.value.some(s=>s===u)?a.value=a.value.filter(s=>s!==u):(c==="S"&&(a.value=[]),a.value.push(u)),p("update:keys",a.value)};return{onClick:()=>{const f=o?o(e):null;f&&f.value===u||(clearTimeout(l),l=setTimeout(()=>{g(),h&&h(e)},200))},onDblclick:()=>{clearTimeout(l),r&&r(e)}}}}const R=e=>{e.stopPropagation()},_=t.computed(()=>{const{selection:e}=n.config;return e==="N"}),k={};d.expandedRowRender&&(k.expandedRowRender=e=>t.createVNode(t.Fragment,null,[d.expandedRowRender&&d.expandedRowRender(e)]));const $=()=>t.createVNode(t.Fragment,null,[d.summary&&d.summary()]);return()=>{var e;return t.createVNode("div",{ref:O},[t.createVNode(C.Table,{ref:K,"row-key":n.rowKey,bordered:n.config.bordered,columns:E.value,dataSource:z.value,loading:n.loading,size:((e=n.config)==null?void 0:e.size)??"small",scroll:{scrollToFirstRowOnChange:!0,x:"100%",y:B.value+"px"},expandedRowKeys:S.value,"onUpdate:expandedRowKeys":l=>S.value=l,expandRowByClick:_.value,pagination:!1,customRow:F,rowSelection:q.value,rowClassName:H},{bodyCell:({column:l,record:i})=>{if(l.slot==="action")return t.createVNode("div",{onClick:R,onDblclick:R},[t.createVNode(C.Space,null,{default:()=>[d.action&&d.action(i)]})])},...k,summary:$}),t.withDirectives(t.createVNode(C.Pagination,{class:[T],current:m.value.current,"onUpdate:current":l=>m.value.current=l,pageSize:m.value.pageSize,"onUpdate:pageSize":l=>m.value.pageSize=l,disabled:n.loading,"show-size-changer":!0,size:"default","hide-on-single-page":b.hideOnSinglePage,"show-quick-jumper":b.showQuickJumper,"default-page-size":b.defaultPageSize,"page-size-options":b.pageSizeOptions,"show-total":b.showTotal,total:m.value.total,onChange:V},null),[[t.vShow,n.config.pagination]])])}}});exports.default=I;
@@ -1,47 +1,48 @@
1
- import { defineComponent as b, inject as C, ref as d, createVNode as n, resolveComponent as l, isVNode as K, Fragment as s, withDirectives as M, vShow as j, h as k } from "vue";
2
- import { storeToRefs as N } from "pinia";
3
- import { useMenuStore as w } from "../../store/modules/Menu.esm.js";
4
- import { useSettingsStore as I } from "../../store/modules/Settings.esm.js";
5
- function D(o) {
6
- return typeof o == "function" || Object.prototype.toString.call(o) === "[object Object]" && !K(o);
1
+ import { defineComponent as K, inject as M, ref as f, createVNode as n, resolveComponent as l, isVNode as j, Fragment as s, withDirectives as w, vShow as N, h as k } from "vue";
2
+ import { useRouter as I } from "vue-router";
3
+ import { storeToRefs as D } from "pinia";
4
+ import { useMenuStore as H } from "../../store/modules/Menu.esm.js";
5
+ import { useSettingsStore as O } from "../../store/modules/Settings.esm.js";
6
+ function R(o) {
7
+ return typeof o == "function" || Object.prototype.toString.call(o) === "[object Object]" && !j(o);
7
8
  }
8
- const _ = /* @__PURE__ */ b({
9
+ const L = /* @__PURE__ */ K({
9
10
  name: "DMenu",
10
11
  setup() {
11
- const {
12
- componentName: o,
13
- prop: H
14
- } = C("menuIcon"), {
15
- list: p
16
- } = w(), f = I(), {
17
- getCollapsed: m
18
- } = N(f), c = d([]), i = d([]), v = ({
12
+ const o = I(), {
13
+ componentName: i,
14
+ prop: T
15
+ } = M("menuIcon"), {
16
+ list: m
17
+ } = H(), h = O(), {
18
+ getCollapsed: v
19
+ } = D(h), c = f([]), u = f([]), S = ({
19
20
  item: e,
20
21
  key: t,
21
22
  keyPath: r
22
23
  }) => {
23
- console.log(e, t, r), c.value = r, i.value = [t];
24
- }, h = (e) => n(s, null, [n(l("a-menu-item"), {
24
+ console.log(e, t, r), c.value = r, u.value = [t], o.push(t).then((p) => p ? console.warn(p) : null);
25
+ }, g = (e) => n(s, null, [n(l("a-menu-item"), {
25
26
  key: e.url
26
27
  }, {
27
- icon: () => u(e),
28
+ icon: () => a(e),
28
29
  default: () => e.title
29
- })]), S = ["anticon", "anticon-menu", "ant-menu-item-icon"], u = (e) => n(s, null, [e.icon ? g(e.icon) : M(n("div", {
30
- className: S
31
- }, [e.title.substring(0, 1)]), [[j, m.value]])]), g = (e) => o === "nativeHtml" ? n("span", {
30
+ })]), y = ["anticon", "anticon-menu", "ant-menu-item-icon"], a = (e) => n(s, null, [e.icon ? b(e.icon) : w(n("div", {
31
+ className: y
32
+ }, [e.title.substring(0, 1)]), [[N, v.value]])]), b = (e) => i === "nativeHtml" ? n("span", {
32
33
  innerHTML: e
33
- }, null) : k(l(o), {
34
+ }, null) : k(l(i), {
34
35
  prop: e
35
- }), a = (e) => n(s, null, [n(l("a-sub-menu"), {
36
+ }), d = (e) => n(s, null, [n(l("a-sub-menu"), {
36
37
  key: e.url
37
38
  }, {
38
39
  title: () => e.title,
39
- icon: () => u(e),
40
+ icon: () => a(e),
40
41
  default: () => e.children.map(
41
- (t) => !t.children || t.children.length === 0 ? y(t) : a(t)
42
+ (t) => !t.children || t.children.length === 0 ? C(t) : d(t)
42
43
  // 递归调用
43
44
  )
44
- })]), y = (e) => n(s, null, [n(l("a-menu-item"), {
45
+ })]), C = (e) => n(s, null, [n(l("a-menu-item"), {
45
46
  key: e.url
46
47
  }, {
47
48
  default: () => e.title
@@ -53,12 +54,12 @@ const _ = /* @__PURE__ */ b({
53
54
  theme: "dark",
54
55
  openKeys: c.value,
55
56
  "onUpdate:openKeys": (t) => c.value = t,
56
- selectedKeys: i.value,
57
- "onUpdate:selectedKeys": (t) => i.value = t,
58
- onClick: v
59
- }, D(e = p.map((t) => {
57
+ selectedKeys: u.value,
58
+ "onUpdate:selectedKeys": (t) => u.value = t,
59
+ onClick: S
60
+ }, R(e = m.map((t) => {
60
61
  var r;
61
- return !t.children || ((r = t.children) == null ? void 0 : r.length) === 0 ? h(t) : a(t);
62
+ return !t.children || ((r = t.children) == null ? void 0 : r.length) === 0 ? g(t) : d(t);
62
63
  })) ? e : {
63
64
  default: () => [e]
64
65
  });
@@ -66,5 +67,5 @@ const _ = /* @__PURE__ */ b({
66
67
  }
67
68
  });
68
69
  export {
69
- _ as default
70
+ L as default
70
71
  };
@@ -1,12 +1,12 @@
1
- const o = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24odCl7Y29uc3QgbD10LmRhdGEua2V5d29yZHM/PyIiO2xldCBlPUpTT04ucGFyc2UodC5kYXRhLmxpc3QpPz9bXTtjb25zdCBhPUpTT04ucGFyc2UodC5kYXRhLmluY2x1ZGUpO2EubGVuZ3RoPjAmJihlPWUuZmlsdGVyKHM9PmEuc29tZShpPT5pPT09cy52YWx1ZSkpKTtjb25zdCBvPWUuZmlsdGVyKHM9PnMudmFsdWUudG9Mb3dlckNhc2UoKS5pbmRleE9mKGwudG9Mb3dlckNhc2UoKSkhPT0tMXx8cy5sYWJlbC50b0xvd2VyQ2FzZSgpLmluY2x1ZGVzKGwudG9Mb3dlckNhc2UoKSkpO28ubGVuZ3RoPT09MD9zZWxmLnBvc3RNZXNzYWdlKGUuc3BsaWNlKDAsMTApKTpzZWxmLnBvc3RNZXNzYWdlKG8uc3BsaWNlKDAsMTApKX0sITEpfSkoKTsK", c = typeof window < "u" && window.Blob && new Blob([atob(o)], { type: "text/javascript;charset=utf-8" });
2
- function b() {
3
- const d = c && (window.URL || window.webkitURL).createObjectURL(c);
1
+ const l = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24odCl7dmFyIGk7Y29uc3QgbD10LmRhdGEua2V5d29yZHM/PyIiO2xldCBlPUpTT04ucGFyc2UoKChpPXQuZGF0YSk9PW51bGw/dm9pZCAwOmkubGlzdCl8fFtdKT8/W107Y29uc3QgYT1KU09OLnBhcnNlKHQuZGF0YS5pbmNsdWRlKTthLmxlbmd0aD4wJiYoZT1lLmZpbHRlcihzPT5hLnNvbWUobj0+bj09PXMudmFsdWUpKSk7Y29uc3Qgbz1lLmZpbHRlcihzPT5zLnZhbHVlLnRvTG93ZXJDYXNlKCkuaW5kZXhPZihsLnRvTG93ZXJDYXNlKCkpIT09LTF8fHMubGFiZWwudG9Mb3dlckNhc2UoKS5pbmNsdWRlcyhsLnRvTG93ZXJDYXNlKCkpKTtvLmxlbmd0aD09PTA/c2VsZi5wb3N0TWVzc2FnZShlLnNwbGljZSgwLDEwKSk6c2VsZi5wb3N0TWVzc2FnZShvLnNwbGljZSgwLDEwKSl9LCExKX0pKCk7Cg==", n = typeof window < "u" && window.Blob && new Blob([atob(l)], { type: "text/javascript;charset=utf-8" });
2
+ function c() {
3
+ const b = n && (window.URL || window.webkitURL).createObjectURL(n);
4
4
  try {
5
- return d ? new Worker(d) : new Worker("data:application/javascript;base64," + o);
5
+ return b ? new Worker(b) : new Worker("data:application/javascript;base64," + l);
6
6
  } finally {
7
- d && (window.URL || window.webkitURL).revokeObjectURL(d);
7
+ b && (window.URL || window.webkitURL).revokeObjectURL(b);
8
8
  }
9
9
  }
10
10
  export {
11
- b as default
11
+ c as default
12
12
  };
@@ -1,8 +1,8 @@
1
- import { defineComponent as W, ref as f, computed as R, watchEffect as k, nextTick as X, watch as _, createVNode as m, withDirectives as G, vShow as M, Fragment as T } from "vue";
2
- import { Table as Y, Space as Z, Pagination as ee } from "ant-design-vue";
3
- import { useEleHeight as z } from "../../utils/html.esm.js";
4
- import { prefixName as te } from "../theme/index.esm.js";
5
- const ne = () => ({
1
+ import { defineComponent as X, ref as f, computed as C, watchEffect as k, nextTick as _, watch as G, createVNode as m, withDirectives as M, vShow as Y, Fragment as z } from "vue";
2
+ import { Table as Z, Space as ee, Pagination as te } from "ant-design-vue";
3
+ import { useEleHeight as K } from "../../utils/html.esm.js";
4
+ import { prefixName as ne } from "../theme/index.esm.js";
5
+ const ae = () => ({
6
6
  data: {
7
7
  type: Object,
8
8
  required: !0
@@ -40,133 +40,133 @@ const ne = () => ({
40
40
  showQuickJumper: !0,
41
41
  showLessItems: !0,
42
42
  showTotal: (t) => `总共 ${t} 条`
43
- }, K = `${te}-pagination`, ue = /* @__PURE__ */ W({
43
+ }, O = `${ne}-pagination`, ce = /* @__PURE__ */ X({
44
44
  name: "DTable",
45
- props: ne(),
45
+ props: ae(),
46
46
  // emits: { "update:keys": (keys: []) => void }
47
47
  // TODO 需要做调整
48
48
  emits: ["update:keys"],
49
49
  setup: function(t, {
50
50
  emit: S,
51
- slots: h
51
+ slots: s
52
52
  }) {
53
- const n = f(t.keys || []), O = R(() => t.data), E = R(() => {
53
+ const n = f(t.keys || []), B = C(() => t.data), E = C(() => {
54
54
  var e;
55
55
  return ((e = t.config) == null ? void 0 : e.columns) ?? [];
56
- }), y = R(() => {
56
+ }), y = C(() => {
57
57
  var e;
58
58
  return ((e = t.config) == null ? void 0 : e.pagination) ?? {};
59
- }), C = f(t.expandedRowKeys);
59
+ }), R = f(t.expandedRowKeys);
60
60
  k(() => {
61
61
  const {
62
62
  expandedRowKeys: e
63
63
  } = t;
64
- C.value = e;
64
+ R.value = e;
65
65
  });
66
66
  const {
67
- tableRef: B,
68
- tableRootRef: H,
69
- tableHeight: j,
70
- onPageChange: D,
71
- onRowClassName: U
72
- } = $();
73
- function $() {
67
+ tableRef: H,
68
+ tableRootRef: j,
69
+ tableHeight: D,
70
+ onPageChange: U,
71
+ onRowClassName: $
72
+ } = q();
73
+ function q() {
74
74
  const {
75
75
  rowClassName: e,
76
- keepSelected: a,
76
+ keepSelected: o,
77
77
  onPageChange: l
78
- } = t.config, c = t.config.selection ?? "N", d = f(), u = f(null), o = f(), i = f(null), r = (w) => {
79
- var v, N;
78
+ } = t.config, v = t.config.selection ?? "N", d = f(), u = f(null), a = f(), i = f(null), r = (w) => {
79
+ var h, P;
80
80
  try {
81
- const p = (v = u == null ? void 0 : u.value) == null ? void 0 : v.$el, L = z(p.getElementsByClassName("ant-table-header")[0]);
82
- let P = 0;
81
+ const p = (h = u == null ? void 0 : u.value) == null ? void 0 : h.$el, V = K(p.getElementsByClassName("ant-table-header")[0]);
82
+ let T = 0;
83
83
  if (t.config.pagination) {
84
- const V = (N = d.value) == null ? void 0 : N.getElementsByClassName(K)[0];
85
- P = z(V) ?? 0;
84
+ const W = (P = d.value) == null ? void 0 : P.getElementsByClassName(O)[0];
85
+ T = K(W) ?? 0;
86
86
  }
87
- o.value = w - (L + P), p.getElementsByClassName("ant-table-body")[0].style.height = o.value - 10 + "px", i.value = p.getElementsByClassName("ant-table-body")[0];
87
+ a.value = w - (V + T), p.getElementsByClassName("ant-table-body")[0].style.height = a.value - 10 + "px", i.value = p.getElementsByClassName("ant-table-body")[0];
88
88
  } catch (p) {
89
89
  console.warn(p);
90
90
  }
91
91
  };
92
92
  return k(() => {
93
- t.height !== 0 && X(() => {
93
+ t.height !== 0 && _(() => {
94
94
  r(t.height);
95
95
  });
96
96
  }), {
97
97
  tableRef: u,
98
98
  tableRootRef: d,
99
- tableHeight: o,
100
- onPageChange: (w, v) => {
99
+ tableHeight: a,
100
+ onPageChange: (w, h) => {
101
101
  l && l({
102
102
  page: w,
103
- size: v
104
- }), i.value.scrollTop = 0, (c === "S" || !a) && (n.value = [], S("update:keys", n.value));
103
+ size: h
104
+ }), i.value.scrollTop = 0, (v === "S" || !o) && (n.value = [], S("update:keys", n.value));
105
105
  },
106
- onRowClassName: (w, v) => e ? e(w, v) : void 0
106
+ onRowClassName: (w, h) => e ? e(w, h) : void 0
107
107
  };
108
108
  }
109
- const q = A();
110
- function A() {
109
+ const A = F();
110
+ function F() {
111
111
  const {
112
112
  rowKey: e,
113
113
  config: {
114
- getCheckboxProps: a
114
+ getCheckboxProps: o
115
115
  }
116
116
  } = t;
117
117
  let l = t.config.selection ?? "N";
118
- const c = (o, i) => {
119
- l === "S" ? (n.value = [], n.value = i ? [o[e]] : []) : n.value = i ? n.value.concat(o[e]) : n.value.filter((r) => r !== o[e]), S("update:keys", n.value);
120
- }, d = (o, i, r) => {
121
- const g = r.map((s) => s[e]);
122
- n.value = o ? n.value.concat(g) : n.value.filter((s) => !g.includes(s)), S("update:keys", n.value);
118
+ const v = (a, i) => {
119
+ l === "S" ? (n.value = [], n.value = i ? [a[e]] : []) : n.value = i ? n.value.concat(a[e]) : n.value.filter((r) => r !== a[e]), S("update:keys", n.value);
120
+ }, d = (a, i, r) => {
121
+ const g = r.map((c) => c[e]);
122
+ n.value = a ? n.value.concat(g) : n.value.filter((c) => !g.includes(c)), S("update:keys", n.value);
123
123
  };
124
- _(() => t.keys, (o) => {
125
- n.value = o;
124
+ G(() => t.keys, (a) => {
125
+ n.value = a;
126
126
  });
127
127
  const u = f(void 0);
128
128
  return k(() => {
129
129
  const {
130
- selection: o
130
+ selection: a
131
131
  } = t.config;
132
- l = o, l !== "N" ? u.value = {
132
+ l = a, l !== "N" ? u.value = {
133
133
  selectedRowKeys: n,
134
- onSelect: c,
134
+ onSelect: v,
135
135
  onSelectAll: d,
136
136
  fixed: !0,
137
137
  columnTitle: l === "S" ? "选择" : null,
138
138
  columnWidth: l === "S" ? 60 : 40,
139
- getCheckboxProps: a
139
+ getCheckboxProps: o
140
140
  } : u.value = void 0;
141
141
  }), u;
142
142
  }
143
- const F = J();
144
- function J() {
143
+ const J = Q();
144
+ function Q() {
145
145
  return (e) => {
146
- let a;
146
+ let o;
147
147
  const {
148
148
  rowKey: l,
149
149
  config: {
150
- click: c,
150
+ click: v,
151
151
  dbClick: d,
152
152
  selection: u,
153
- getCheckboxProps: o
153
+ getCheckboxProps: a
154
154
  }
155
155
  } = t, i = e[l], r = () => {
156
156
  if (u === "N")
157
157
  return;
158
- n.value.some((s) => s === i) ? n.value = n.value.filter((s) => s !== i) : (u === "S" && (n.value = []), n.value.push(i)), S("update:keys", n.value);
158
+ n.value.some((c) => c === i) ? n.value = n.value.filter((c) => c !== i) : (u === "S" && (n.value = []), n.value.push(i)), S("update:keys", n.value);
159
159
  };
160
160
  return {
161
161
  onClick: () => {
162
- const g = o ? o(e) : null;
163
- g && g.value === i || (clearTimeout(a), a = setTimeout(() => {
164
- r(), c && c(e);
162
+ const g = a ? a(e) : null;
163
+ g && g.value === i || (clearTimeout(o), o = setTimeout(() => {
164
+ r(), v && v(e);
165
165
  }, 200));
166
166
  },
167
167
  // 点击行
168
168
  onDblclick: () => {
169
- clearTimeout(a), d && d(e);
169
+ clearTimeout(o), d && d(e);
170
170
  }
171
171
  // onContextmenu: (event) => {
172
172
  // //TODO
@@ -182,59 +182,60 @@ const ne = () => ({
182
182
  }
183
183
  const x = (e) => {
184
184
  e.stopPropagation();
185
- }, Q = (e, a, l, c) => m(T, null, [h.expandedRowRender && h.expandedRowRender({
186
- record: e,
187
- index: a,
188
- indent: l,
189
- expanded: c
190
- })]), I = () => m(T, null, [h.summary && h.summary()]);
185
+ }, I = C(() => {
186
+ const {
187
+ selection: e
188
+ } = t.config;
189
+ return e === "N";
190
+ }), N = {};
191
+ s.expandedRowRender && (N.expandedRowRender = (e) => m(z, null, [s.expandedRowRender && s.expandedRowRender(e)]));
192
+ const L = () => m(z, null, [s.summary && s.summary()]);
191
193
  return () => {
192
194
  var e;
193
195
  return m("div", {
194
- ref: H
195
- }, [m(Y, {
196
- ref: B,
196
+ ref: j
197
+ }, [m(Z, {
198
+ ref: H,
197
199
  "row-key": t.rowKey,
198
200
  bordered: t.config.bordered,
199
201
  columns: E.value,
200
- dataSource: O.value,
202
+ dataSource: B.value,
201
203
  loading: t.loading,
202
204
  size: ((e = t.config) == null ? void 0 : e.size) ?? "small",
203
205
  scroll: {
204
206
  scrollToFirstRowOnChange: !0,
205
207
  x: "100%",
206
- y: j.value + "px"
208
+ y: D.value + "px"
207
209
  },
208
- expandedRowKeys: C.value,
209
- "onUpdate:expandedRowKeys": (a) => C.value = a,
210
- expandRowByClick: !0,
210
+ expandedRowKeys: R.value,
211
+ "onUpdate:expandedRowKeys": (o) => R.value = o,
212
+ expandRowByClick: I.value,
211
213
  pagination: !1,
212
- customRow: F,
213
- rowSelection: q.value,
214
- rowClassName: U
214
+ customRow: J,
215
+ rowSelection: A.value,
216
+ rowClassName: $
215
217
  }, {
216
218
  bodyCell: ({
217
- column: a,
219
+ column: o,
218
220
  record: l
219
221
  }) => {
220
- if (a.slot === "action")
222
+ if (o.slot === "action")
221
223
  return m("div", {
222
224
  onClick: x,
223
225
  onDblclick: x
224
- }, [m(Z, null, {
225
- default: () => [h.action && h.action(l)]
226
+ }, [m(ee, null, {
227
+ default: () => [s.action && s.action(l)]
226
228
  })]);
227
229
  },
228
- // 展开插槽
229
- expandedRowRender: Q,
230
+ ...N,
230
231
  // 总结栏插槽
231
- summary: I
232
- }), G(m(ee, {
233
- class: [K],
232
+ summary: L
233
+ }), M(m(te, {
234
+ class: [O],
234
235
  current: y.value.current,
235
- "onUpdate:current": (a) => y.value.current = a,
236
+ "onUpdate:current": (o) => y.value.current = o,
236
237
  pageSize: y.value.pageSize,
237
- "onUpdate:pageSize": (a) => y.value.pageSize = a,
238
+ "onUpdate:pageSize": (o) => y.value.pageSize = o,
238
239
  disabled: t.loading,
239
240
  "show-size-changer": !0,
240
241
  size: "default",
@@ -244,11 +245,11 @@ const ne = () => ({
244
245
  "page-size-options": b.pageSizeOptions,
245
246
  "show-total": b.showTotal,
246
247
  total: y.value.total,
247
- onChange: D
248
- }, null), [[M, t.config.pagination]])]);
248
+ onChange: U
249
+ }, null), [[Y, t.config.pagination]])]);
249
250
  };
250
251
  }
251
252
  });
252
253
  export {
253
- ue as default
254
+ ce as default
254
255
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "files": [
5
5
  "dist/**",
6
6
  "src"
@@ -1,4 +1,6 @@
1
1
  import { defineComponent, h, inject, ref, resolveComponent } from "vue";
2
+ import { useRouter } from "vue-router";
3
+
2
4
  import { storeToRefs } from "pinia";
3
5
 
4
6
  import { useMenuStore } from "../../store/modules/Menu";
@@ -7,6 +9,7 @@ import { useSettingsStore } from "../../store/modules/Settings";
7
9
  export default defineComponent({
8
10
  name: "DMenu",
9
11
  setup() {
12
+ const router = useRouter();
10
13
  const { componentName, prop } = inject("menuIcon");
11
14
  const { list } = useMenuStore();
12
15
  const settingsStore = useSettingsStore();
@@ -27,6 +30,7 @@ export default defineComponent({
27
30
  console.log(item, key, keyPath);
28
31
  openKeys.value = keyPath;
29
32
  selectedKeys.value = [key];
33
+ router.push(key).then((r) => (r ? console.warn(r) : null));
30
34
  };
31
35
  /**
32
36
  * 监听菜单展开事件
@@ -7,7 +7,7 @@ self.addEventListener(
7
7
  "message",
8
8
  function (e) {
9
9
  const keyword = e.data.keywords ?? "";
10
- let dicList = JSON.parse(e.data.list) ?? [];
10
+ let dicList = JSON.parse(e.data?.list || []) ?? [];
11
11
  const include = JSON.parse(e.data.include);
12
12
  if (include.length > 0) {
13
13
  // 只过滤出来include包含的数据
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  computed,
3
+ createVNode,
3
4
  defineComponent,
4
5
  nextTick,
5
6
  PropType,
@@ -8,7 +9,7 @@ import {
8
9
  watch,
9
10
  watchEffect
10
11
  } from "vue";
11
- import { Pagination, Space, Table } from "ant-design-vue";
12
+ import { Pagination, Space, Table, Card } from "ant-design-vue";
12
13
  import { useEleHeight } from "../../utils/html";
13
14
  import { prefixName } from "../theme";
14
15
 
@@ -352,20 +353,18 @@ const DXTable = defineComponent({
352
353
  event.stopPropagation();
353
354
  };
354
355
 
355
- const expandedRowRender = (
356
- record: any,
357
- index: number,
358
- indent: number,
359
- expanded: any
360
- ) => {
361
- return (
362
- <>
363
- {slots.expandedRowRender &&
364
- slots.expandedRowRender({ record, index, indent, expanded })}
365
- </>
366
- );
367
- };
368
-
356
+ const expandRowByClick = computed(() => {
357
+ const { selection } = props.config;
358
+ return selection === "N";
359
+ });
360
+ const tableSlots: any = {};
361
+ if (slots.expandedRowRender) {
362
+ tableSlots.expandedRowRender = (record: any) => {
363
+ return (
364
+ <>{slots.expandedRowRender && slots.expandedRowRender(record)}</>
365
+ );
366
+ };
367
+ }
369
368
  const summary = () => {
370
369
  return <>{slots.summary && slots.summary()}</>;
371
370
  };
@@ -385,7 +384,7 @@ const DXTable = defineComponent({
385
384
  y: tableHeight.value + "px"
386
385
  }}
387
386
  v-model:expandedRowKeys={expandedKeys.value}
388
- expandRowByClick={true}
387
+ expandRowByClick={expandRowByClick.value}
389
388
  pagination={false}
390
389
  customRow={customRow}
391
390
  rowSelection={rowSelection.value}
@@ -401,8 +400,7 @@ const DXTable = defineComponent({
401
400
  );
402
401
  }
403
402
  },
404
- // 展开插槽
405
- expandedRowRender: expandedRowRender,
403
+ ...tableSlots,
406
404
  // 总结栏插槽
407
405
  summary: summary
408
406
  }}