@ditari/bsui 1.0.29 → 1.0.30

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 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,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.30",
4
4
  "files": [
5
5
  "dist/**",
6
6
  "src"
@@ -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
  }}