@ditari/bsui 1.0.27 → 1.0.29

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 n=require("vue"),b=require("ant-design-vue"),P=require("../../utils/html.cjs.js"),A=require("../theme/index.cjs.js"),J=()=>({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:()=>({})}}),y={defaultPageSize:20,hideOnSinglePage:!1,pageSizeOptions:["10","20","30","40"],responsive:!0,showQuickJumper:!0,showLessItems:!0,showTotal:t=>`总共 ${t} 条`},T=`${A.prefixName}-pagination`,M=n.defineComponent({name:"DTable",props:J(),emits:["update:keys"],setup:function(t,{emit:S,slots:C}){const a=n.ref(t.keys||[]),R=n.computed(()=>t.data),z=n.computed(()=>{var e;return((e=t.config)==null?void 0:e.columns)??[]}),v=n.computed(()=>{var e;return((e=t.config)==null?void 0:e.pagination)??{}}),{tableRef:x,tableRootRef:E,tableHeight:O,onPageChange:H,onRowClassName:q}=B();function B(){const{rowClassName:e,keepSelected:l,onPageChange:i}=t.config,f=t.config.selection??"N",r=n.ref(),c=n.ref(null),o=n.ref(),u=n.ref(null),g=m=>{var h,k;try{const w=(h=c==null?void 0:c.value)==null?void 0:h.$el,_=P.useEleHeight(w.getElementsByClassName("ant-table-header")[0]);let N=0;if(t.config.pagination){const $=(k=r.value)==null?void 0:k.getElementsByClassName(T)[0];N=P.useEleHeight($)??0}o.value=m-(_+N),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 n.watchEffect(()=>{t.height!==0&&n.nextTick(()=>{g(t.height)})}),{tableRef:c,tableRootRef:r,tableHeight:o,onPageChange:(m,h)=>{i&&i({page:m,size:h}),u.value.scrollTop=0,(f==="S"||!l)&&(a.value=[],S("update:keys",a.value))},onRowClassName:(m,h)=>e?e(m,h):void 0}}const D=V();function V(){const{rowKey:e,config:{getCheckboxProps:l}}=t;let i=t.config.selection??"N";const f=(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]),S("update:keys",a.value)},r=(o,u,g)=>{const d=g.map(s=>s[e]);a.value=o?a.value.concat(d):a.value.filter(s=>!d.includes(s)),S("update:keys",a.value)};n.watch(()=>t.keys,o=>{a.value=o});const c=n.ref(void 0);return n.watchEffect(()=>{const{selection:o}=t.config;i=o,i!=="N"?c.value={selectedRowKeys:a,onSelect:f,onSelectAll:r,fixed:!0,columnTitle:i==="S"?"选择":null,columnWidth:i==="S"?60:40,getCheckboxProps:l}:c.value=void 0}),c}const j=K();function K(){return e=>{let l;const{rowKey:i,config:{click:f,dbClick:r,selection:c,getCheckboxProps:o}}=t,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)),S("update:keys",a.value)};return{onClick:()=>{const d=o?o(e):null;d&&d.value===u||(clearTimeout(l),l=setTimeout(()=>{g(),f&&f(e)},200))},onDblclick:()=>{clearTimeout(l),r&&r(e)}}}}const p=e=>{e.stopPropagation()};return()=>{var e;return n.createVNode("div",{ref:E},[n.createVNode(b.Table,{ref:x,"row-key":t.rowKey,bordered:t.config.bordered,columns:z.value,dataSource:R.value,loading:t.loading,size:((e=t.config)==null?void 0:e.size)??"small",scroll:{scrollToFirstRowOnChange:!0,x:"100%",y:O.value+"px"},pagination:!1,customRow:j,rowSelection:D.value,rowClassName:q},{bodyCell:({column:l,record:i})=>{if(l.slot==="action")return n.createVNode("div",{onClick:p,onDblclick:p},[n.createVNode(b.Space,null,{default:()=>[C.action&&C.action(i)]})])}}),n.withDirectives(n.createVNode(b.Pagination,{class:[T],current:v.value.current,"onUpdate:current":l=>v.value.current=l,pageSize:v.value.pageSize,"onUpdate:pageSize":l=>v.value.pageSize=l,disabled:t.loading,"show-size-changer":!0,size:"default","hide-on-single-page":y.hideOnSinglePage,"show-quick-jumper":y.showQuickJumper,"default-page-size":y.defaultPageSize,"page-size-options":y.pageSizeOptions,"show-total":y.showTotal,total:v.value.total,onChange:H},null),[[n.vShow,t.config.pagination]])])}}});exports.default=M;
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;
@@ -29,6 +29,10 @@ declare const DXTable: import("vue").DefineComponent<{
29
29
  type: PropType<Config>;
30
30
  default: () => {};
31
31
  };
32
+ expandedRowKeys: {
33
+ type: PropType<string[] | undefined>;
34
+ default: () => never[];
35
+ };
32
36
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:keys"[], "update:keys", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
33
37
  data: {
34
38
  type: PropType<any>;
@@ -55,6 +59,10 @@ declare const DXTable: import("vue").DefineComponent<{
55
59
  type: PropType<Config>;
56
60
  default: () => {};
57
61
  };
62
+ expandedRowKeys: {
63
+ type: PropType<string[] | undefined>;
64
+ default: () => never[];
65
+ };
58
66
  }>> & {
59
67
  "onUpdate:keys"?: ((...args: any[]) => any) | undefined;
60
68
  }, {
@@ -63,5 +71,6 @@ declare const DXTable: import("vue").DefineComponent<{
63
71
  rowKey: string;
64
72
  pagination: any;
65
73
  config: Config;
74
+ expandedRowKeys: string[] | undefined;
66
75
  }>;
67
76
  export default DXTable;
@@ -24,6 +24,10 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
24
24
  type: import("vue").PropType<import("./interface/table").Config>;
25
25
  default: () => {};
26
26
  };
27
+ expandedRowKeys: {
28
+ type: import("vue").PropType<string[] | undefined>;
29
+ default: () => never[];
30
+ };
27
31
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:keys"[], "update:keys", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
28
32
  data: {
29
33
  type: import("vue").PropType<any>;
@@ -50,6 +54,10 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
50
54
  type: import("vue").PropType<import("./interface/table").Config>;
51
55
  default: () => {};
52
56
  };
57
+ expandedRowKeys: {
58
+ type: import("vue").PropType<string[] | undefined>;
59
+ default: () => never[];
60
+ };
53
61
  }>> & {
54
62
  "onUpdate:keys"?: ((...args: any[]) => any) | undefined;
55
63
  }, {
@@ -58,5 +66,6 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
58
66
  rowKey: string;
59
67
  pagination: any;
60
68
  config: import("./interface/table").Config;
69
+ expandedRowKeys: string[] | undefined;
61
70
  }>>;
62
71
  export default DTable;
@@ -27,6 +27,7 @@ export interface TableProps {
27
27
  keys?: Key[];
28
28
  data: any;
29
29
  rowKey: string;
30
+ expandedRowKeys?: string[];
30
31
  loading?: false;
31
32
  height: number;
32
33
  pagination?: any;
@@ -29,6 +29,10 @@ declare const DXTable: import("vue").DefineComponent<{
29
29
  type: PropType<Config>;
30
30
  default: () => {};
31
31
  };
32
+ expandedRowKeys: {
33
+ type: PropType<string[] | undefined>;
34
+ default: () => never[];
35
+ };
32
36
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:keys"[], "update:keys", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
33
37
  data: {
34
38
  type: PropType<any>;
@@ -55,6 +59,10 @@ declare const DXTable: import("vue").DefineComponent<{
55
59
  type: PropType<Config>;
56
60
  default: () => {};
57
61
  };
62
+ expandedRowKeys: {
63
+ type: PropType<string[] | undefined>;
64
+ default: () => never[];
65
+ };
58
66
  }>> & {
59
67
  "onUpdate:keys"?: ((...args: any[]) => any) | undefined;
60
68
  }, {
@@ -63,5 +71,6 @@ declare const DXTable: import("vue").DefineComponent<{
63
71
  rowKey: string;
64
72
  pagination: any;
65
73
  config: Config;
74
+ expandedRowKeys: string[] | undefined;
66
75
  }>;
67
76
  export default DXTable;
@@ -1,8 +1,8 @@
1
- import { defineComponent as F, ref as h, computed as p, watchEffect as R, nextTick as I, watch as L, createVNode as y, withDirectives as V, vShow as W } from "vue";
2
- import { Table as X, Space as _, Pagination as G } from "ant-design-vue";
3
- import { useEleHeight as T } from "../../utils/html.esm.js";
4
- import { prefixName as M } from "../theme/index.esm.js";
5
- const Y = () => ({
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 = () => ({
6
6
  data: {
7
7
  type: Object,
8
8
  required: !0
@@ -27,8 +27,12 @@ const Y = () => ({
27
27
  config: {
28
28
  type: Object,
29
29
  default: () => ({})
30
+ },
31
+ expandedRowKeys: {
32
+ type: Object,
33
+ default: () => []
30
34
  }
31
- }), S = {
35
+ }), b = {
32
36
  defaultPageSize: 20,
33
37
  hideOnSinglePage: !1,
34
38
  pageSizeOptions: ["10", "20", "30", "40"],
@@ -36,126 +40,133 @@ const Y = () => ({
36
40
  showQuickJumper: !0,
37
41
  showLessItems: !0,
38
42
  showTotal: (t) => `总共 ${t} 条`
39
- }, z = `${M}-pagination`, ne = /* @__PURE__ */ F({
43
+ }, K = `${te}-pagination`, ue = /* @__PURE__ */ W({
40
44
  name: "DTable",
41
- props: Y(),
45
+ props: ne(),
42
46
  // emits: { "update:keys": (keys: []) => void }
43
47
  // TODO 需要做调整
44
48
  emits: ["update:keys"],
45
49
  setup: function(t, {
46
- emit: b,
47
- slots: C
50
+ emit: S,
51
+ slots: h
48
52
  }) {
49
- const a = h(t.keys || []), x = p(() => t.data), E = p(() => {
53
+ const n = f(t.keys || []), O = R(() => t.data), E = R(() => {
50
54
  var e;
51
55
  return ((e = t.config) == null ? void 0 : e.columns) ?? [];
52
- }), v = p(() => {
56
+ }), y = R(() => {
53
57
  var e;
54
58
  return ((e = t.config) == null ? void 0 : e.pagination) ?? {};
55
- }), {
56
- tableRef: O,
57
- tableRootRef: B,
58
- tableHeight: H,
59
+ }), C = f(t.expandedRowKeys);
60
+ k(() => {
61
+ const {
62
+ expandedRowKeys: e
63
+ } = t;
64
+ C.value = e;
65
+ });
66
+ const {
67
+ tableRef: B,
68
+ tableRootRef: H,
69
+ tableHeight: j,
59
70
  onPageChange: D,
60
- onRowClassName: K
61
- } = j();
62
- function j() {
71
+ onRowClassName: U
72
+ } = $();
73
+ function $() {
63
74
  const {
64
75
  rowClassName: e,
65
- keepSelected: o,
76
+ keepSelected: a,
66
77
  onPageChange: l
67
- } = t.config, f = t.config.selection ?? "N", s = h(), u = h(null), n = h(), i = h(null), g = (m) => {
68
- var d, N;
78
+ } = t.config, c = t.config.selection ?? "N", d = f(), u = f(null), o = f(), i = f(null), r = (w) => {
79
+ var v, N;
69
80
  try {
70
- const w = (d = u == null ? void 0 : u.value) == null ? void 0 : d.$el, Q = T(w.getElementsByClassName("ant-table-header")[0]);
81
+ const p = (v = u == null ? void 0 : u.value) == null ? void 0 : v.$el, L = z(p.getElementsByClassName("ant-table-header")[0]);
71
82
  let P = 0;
72
83
  if (t.config.pagination) {
73
- const U = (N = s.value) == null ? void 0 : N.getElementsByClassName(z)[0];
74
- P = T(U) ?? 0;
84
+ const V = (N = d.value) == null ? void 0 : N.getElementsByClassName(K)[0];
85
+ P = z(V) ?? 0;
75
86
  }
76
- n.value = m - (Q + P), w.getElementsByClassName("ant-table-body")[0].style.height = n.value - 10 + "px", i.value = w.getElementsByClassName("ant-table-body")[0];
77
- } catch (w) {
78
- console.warn(w);
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];
88
+ } catch (p) {
89
+ console.warn(p);
79
90
  }
80
91
  };
81
- return R(() => {
82
- t.height !== 0 && I(() => {
83
- g(t.height);
92
+ return k(() => {
93
+ t.height !== 0 && X(() => {
94
+ r(t.height);
84
95
  });
85
96
  }), {
86
97
  tableRef: u,
87
- tableRootRef: s,
88
- tableHeight: n,
89
- onPageChange: (m, d) => {
98
+ tableRootRef: d,
99
+ tableHeight: o,
100
+ onPageChange: (w, v) => {
90
101
  l && l({
91
- page: m,
92
- size: d
93
- }), i.value.scrollTop = 0, (f === "S" || !o) && (a.value = [], b("update:keys", a.value));
102
+ page: w,
103
+ size: v
104
+ }), i.value.scrollTop = 0, (c === "S" || !a) && (n.value = [], S("update:keys", n.value));
94
105
  },
95
- onRowClassName: (m, d) => e ? e(m, d) : void 0
106
+ onRowClassName: (w, v) => e ? e(w, v) : void 0
96
107
  };
97
108
  }
98
- const $ = q();
99
- function q() {
109
+ const q = A();
110
+ function A() {
100
111
  const {
101
112
  rowKey: e,
102
113
  config: {
103
- getCheckboxProps: o
114
+ getCheckboxProps: a
104
115
  }
105
116
  } = t;
106
117
  let l = t.config.selection ?? "N";
107
- const f = (n, i) => {
108
- l === "S" ? (a.value = [], a.value = i ? [n[e]] : []) : a.value = i ? a.value.concat(n[e]) : a.value.filter((g) => g !== n[e]), b("update:keys", a.value);
109
- }, s = (n, i, g) => {
110
- const r = g.map((c) => c[e]);
111
- a.value = n ? a.value.concat(r) : a.value.filter((c) => !r.includes(c)), b("update:keys", a.value);
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);
112
123
  };
113
- L(() => t.keys, (n) => {
114
- a.value = n;
124
+ _(() => t.keys, (o) => {
125
+ n.value = o;
115
126
  });
116
- const u = h(void 0);
117
- return R(() => {
127
+ const u = f(void 0);
128
+ return k(() => {
118
129
  const {
119
- selection: n
130
+ selection: o
120
131
  } = t.config;
121
- l = n, l !== "N" ? u.value = {
122
- selectedRowKeys: a,
123
- onSelect: f,
124
- onSelectAll: s,
132
+ l = o, l !== "N" ? u.value = {
133
+ selectedRowKeys: n,
134
+ onSelect: c,
135
+ onSelectAll: d,
125
136
  fixed: !0,
126
137
  columnTitle: l === "S" ? "选择" : null,
127
138
  columnWidth: l === "S" ? 60 : 40,
128
- getCheckboxProps: o
139
+ getCheckboxProps: a
129
140
  } : u.value = void 0;
130
141
  }), u;
131
142
  }
132
- const A = J();
143
+ const F = J();
133
144
  function J() {
134
145
  return (e) => {
135
- let o;
146
+ let a;
136
147
  const {
137
148
  rowKey: l,
138
149
  config: {
139
- click: f,
140
- dbClick: s,
150
+ click: c,
151
+ dbClick: d,
141
152
  selection: u,
142
- getCheckboxProps: n
153
+ getCheckboxProps: o
143
154
  }
144
- } = t, i = e[l], g = () => {
155
+ } = t, i = e[l], r = () => {
145
156
  if (u === "N")
146
157
  return;
147
- a.value.some((c) => c === i) ? a.value = a.value.filter((c) => c !== i) : (u === "S" && (a.value = []), a.value.push(i)), b("update:keys", a.value);
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);
148
159
  };
149
160
  return {
150
161
  onClick: () => {
151
- const r = n ? n(e) : null;
152
- r && r.value === i || (clearTimeout(o), o = setTimeout(() => {
153
- g(), f && f(e);
162
+ const g = o ? o(e) : null;
163
+ g && g.value === i || (clearTimeout(a), a = setTimeout(() => {
164
+ r(), c && c(e);
154
165
  }, 200));
155
166
  },
156
167
  // 点击行
157
168
  onDblclick: () => {
158
- clearTimeout(o), s && s(e);
169
+ clearTimeout(a), d && d(e);
159
170
  }
160
171
  // onContextmenu: (event) => {
161
172
  // //TODO
@@ -169,63 +180,75 @@ const Y = () => ({
169
180
  };
170
181
  };
171
182
  }
172
- const k = (e) => {
183
+ const x = (e) => {
173
184
  e.stopPropagation();
174
- };
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()]);
175
191
  return () => {
176
192
  var e;
177
- return y("div", {
178
- ref: B
179
- }, [y(X, {
180
- ref: O,
193
+ return m("div", {
194
+ ref: H
195
+ }, [m(Y, {
196
+ ref: B,
181
197
  "row-key": t.rowKey,
182
198
  bordered: t.config.bordered,
183
199
  columns: E.value,
184
- dataSource: x.value,
200
+ dataSource: O.value,
185
201
  loading: t.loading,
186
202
  size: ((e = t.config) == null ? void 0 : e.size) ?? "small",
187
203
  scroll: {
188
204
  scrollToFirstRowOnChange: !0,
189
205
  x: "100%",
190
- y: H.value + "px"
206
+ y: j.value + "px"
191
207
  },
208
+ expandedRowKeys: C.value,
209
+ "onUpdate:expandedRowKeys": (a) => C.value = a,
210
+ expandRowByClick: !0,
192
211
  pagination: !1,
193
- customRow: A,
194
- rowSelection: $.value,
195
- rowClassName: K
212
+ customRow: F,
213
+ rowSelection: q.value,
214
+ rowClassName: U
196
215
  }, {
197
216
  bodyCell: ({
198
- column: o,
217
+ column: a,
199
218
  record: l
200
219
  }) => {
201
- if (o.slot === "action")
202
- return y("div", {
203
- onClick: k,
204
- onDblclick: k
205
- }, [y(_, null, {
206
- default: () => [C.action && C.action(l)]
220
+ if (a.slot === "action")
221
+ return m("div", {
222
+ onClick: x,
223
+ onDblclick: x
224
+ }, [m(Z, null, {
225
+ default: () => [h.action && h.action(l)]
207
226
  })]);
208
- }
209
- }), V(y(G, {
210
- class: [z],
211
- current: v.value.current,
212
- "onUpdate:current": (o) => v.value.current = o,
213
- pageSize: v.value.pageSize,
214
- "onUpdate:pageSize": (o) => v.value.pageSize = o,
227
+ },
228
+ // 展开插槽
229
+ expandedRowRender: Q,
230
+ // 总结栏插槽
231
+ summary: I
232
+ }), G(m(ee, {
233
+ class: [K],
234
+ current: y.value.current,
235
+ "onUpdate:current": (a) => y.value.current = a,
236
+ pageSize: y.value.pageSize,
237
+ "onUpdate:pageSize": (a) => y.value.pageSize = a,
215
238
  disabled: t.loading,
216
239
  "show-size-changer": !0,
217
240
  size: "default",
218
- "hide-on-single-page": S.hideOnSinglePage,
219
- "show-quick-jumper": S.showQuickJumper,
220
- "default-page-size": S.defaultPageSize,
221
- "page-size-options": S.pageSizeOptions,
222
- "show-total": S.showTotal,
223
- total: v.value.total,
241
+ "hide-on-single-page": b.hideOnSinglePage,
242
+ "show-quick-jumper": b.showQuickJumper,
243
+ "default-page-size": b.defaultPageSize,
244
+ "page-size-options": b.pageSizeOptions,
245
+ "show-total": b.showTotal,
246
+ total: y.value.total,
224
247
  onChange: D
225
- }, null), [[W, t.config.pagination]])]);
248
+ }, null), [[M, t.config.pagination]])]);
226
249
  };
227
250
  }
228
251
  });
229
252
  export {
230
- ne as default
253
+ ue as default
231
254
  };
@@ -24,6 +24,10 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
24
24
  type: import("vue").PropType<import("./interface/table").Config>;
25
25
  default: () => {};
26
26
  };
27
+ expandedRowKeys: {
28
+ type: import("vue").PropType<string[] | undefined>;
29
+ default: () => never[];
30
+ };
27
31
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:keys"[], "update:keys", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
28
32
  data: {
29
33
  type: import("vue").PropType<any>;
@@ -50,6 +54,10 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
50
54
  type: import("vue").PropType<import("./interface/table").Config>;
51
55
  default: () => {};
52
56
  };
57
+ expandedRowKeys: {
58
+ type: import("vue").PropType<string[] | undefined>;
59
+ default: () => never[];
60
+ };
53
61
  }>> & {
54
62
  "onUpdate:keys"?: ((...args: any[]) => any) | undefined;
55
63
  }, {
@@ -58,5 +66,6 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
58
66
  rowKey: string;
59
67
  pagination: any;
60
68
  config: import("./interface/table").Config;
69
+ expandedRowKeys: string[] | undefined;
61
70
  }>>;
62
71
  export default DTable;
@@ -27,6 +27,7 @@ export interface TableProps {
27
27
  keys?: Key[];
28
28
  data: any;
29
29
  rowKey: string;
30
+ expandedRowKeys?: string[];
30
31
  loading?: false;
31
32
  height: number;
32
33
  pagination?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "files": [
5
5
  "dist/**",
6
6
  "src"
@@ -108,6 +108,7 @@ function useSelect() {
108
108
 
109
109
  // 监听数据改变
110
110
  const onChange = () => {
111
+ //TODO 变化的时候 需要发送字典的所有数据
111
112
  emits("update:value", modelValue.value);
112
113
  emits("change", modelValue.value);
113
114
  };
@@ -42,6 +42,10 @@ const tableProps = () => {
42
42
  config: {
43
43
  type: Object as PropType<TableProps["config"]>,
44
44
  default: () => ({})
45
+ },
46
+ expandedRowKeys: {
47
+ type: Object as PropType<TableProps["expandedRowKeys"]>,
48
+ default: () => []
45
49
  }
46
50
  };
47
51
  };
@@ -95,6 +99,12 @@ const DXTable = defineComponent({
95
99
  const paginationState = computed(
96
100
  () => props.config?.pagination ?? ({} as any)
97
101
  );
102
+ // 展开行
103
+ const expandedKeys = ref<any>(props.expandedRowKeys);
104
+ watchEffect(() => {
105
+ const { expandedRowKeys } = props;
106
+ expandedKeys.value = expandedRowKeys;
107
+ });
98
108
 
99
109
  // 初始化表格
100
110
  const {
@@ -341,6 +351,24 @@ const DXTable = defineComponent({
341
351
  const actionStop = (event: MouseEvent) => {
342
352
  event.stopPropagation();
343
353
  };
354
+
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
+
369
+ const summary = () => {
370
+ return <>{slots.summary && slots.summary()}</>;
371
+ };
344
372
  return () => (
345
373
  <div ref={tableRootRef}>
346
374
  <Table
@@ -356,6 +384,8 @@ const DXTable = defineComponent({
356
384
  x: "100%",
357
385
  y: tableHeight.value + "px"
358
386
  }}
387
+ v-model:expandedRowKeys={expandedKeys.value}
388
+ expandRowByClick={true}
359
389
  pagination={false}
360
390
  customRow={customRow}
361
391
  rowSelection={rowSelection.value}
@@ -370,7 +400,11 @@ const DXTable = defineComponent({
370
400
  </div>
371
401
  );
372
402
  }
373
- }
403
+ },
404
+ // 展开插槽
405
+ expandedRowRender: expandedRowRender,
406
+ // 总结栏插槽
407
+ summary: summary
374
408
  }}
375
409
  </Table>
376
410
  <Pagination
@@ -42,6 +42,8 @@ export interface TableProps {
42
42
  data: any;
43
43
  //主键id
44
44
  rowKey: string;
45
+ // 展开行的ID
46
+ expandedRowKeys?: string[];
45
47
  //加载状态
46
48
  loading?: false;
47
49
  //表格高度