@ditari/bsui 1.0.27 → 1.0.28

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 e=require("vue"),C=require("ant-design-vue"),N=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:n=>`总共 ${n} 条`},P=`${J.prefixName}-pagination`,Q=e.defineComponent({name:"DTable",props:M(),emits:["update:keys"],setup:function(n,{emit:b,slots:h}){const a=e.ref(n.keys||[]),T=e.computed(()=>n.data),z=e.computed(()=>{var t;return((t=n.config)==null?void 0:t.columns)??[]}),m=e.computed(()=>{var t;return((t=n.config)==null?void 0:t.pagination)??{}}),S=e.ref(n.expandedRowKeys);e.watchEffect(()=>{const{expandedRowKeys:t}=n;S.value=t});const{tableRef:E,tableRootRef:K,tableHeight:O,onPageChange:V,onRowClassName:B}=H();function H(){const{rowClassName:t,keepSelected:o,onPageChange:i}=n.config,d=n.config.selection??"N",r=e.ref(),c=e.ref(null),l=e.ref(),u=e.ref(null),g=y=>{var v,k;try{const w=(v=c==null?void 0:c.value)==null?void 0:v.$el,$=N.useEleHeight(w.getElementsByClassName("ant-table-header")[0]);let x=0;if(n.config.pagination){const A=(k=r.value)==null?void 0:k.getElementsByClassName(P)[0];x=N.useEleHeight(A)??0}l.value=y-($+x),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 e.watchEffect(()=>{n.height!==0&&e.nextTick(()=>{g(n.height)})}),{tableRef:c,tableRootRef:r,tableHeight:l,onPageChange:(y,v)=>{i&&i({page:y,size:v}),u.value.scrollTop=0,(d==="S"||!o)&&(a.value=[],b("update:keys",a.value))},onRowClassName:(y,v)=>t?t(y,v):void 0}}const j=q();function q(){const{rowKey:t,config:{getCheckboxProps:o}}=n;let i=n.config.selection??"N";const d=(l,u)=>{i==="S"?(a.value=[],a.value=u?[l[t]]:[]):a.value=u?a.value.concat(l[t]):a.value.filter(g=>g!==l[t]),b("update:keys",a.value)},r=(l,u,g)=>{const f=g.map(s=>s[t]);a.value=l?a.value.concat(f):a.value.filter(s=>!f.includes(s)),b("update:keys",a.value)};e.watch(()=>n.keys,l=>{a.value=l});const c=e.ref(void 0);return e.watchEffect(()=>{const{selection:l}=n.config;i=l,i!=="N"?c.value={selectedRowKeys:a,onSelect:d,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 t=>{let o;const{rowKey:i,config:{click:d,dbClick:r,selection:c,getCheckboxProps:l}}=n,u=t[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)),b("update:keys",a.value)};return{onClick:()=>{const f=l?l(t):null;f&&f.value===u||(clearTimeout(o),o=setTimeout(()=>{g(),d&&d(t)},200))},onDblclick:()=>{clearTimeout(o),r&&r(t)}}}}const R=t=>{t.stopPropagation()},U=(t,o,i,d)=>e.createVNode(e.Fragment,null,[h.expandedRowRender&&h.expandedRowRender()]),_=()=>e.createVNode(e.Fragment,null,[h.summary&&h.summary()]);return()=>{var t;return e.createVNode("div",{ref:K},[e.createVNode(C.Table,{ref:E,"row-key":n.rowKey,bordered:n.config.bordered,columns:z.value,dataSource:T.value,loading:n.loading,size:((t=n.config)==null?void 0:t.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 e.createVNode("div",{onClick:R,onDblclick:R},[e.createVNode(C.Space,null,{default:()=>[h.action&&h.action(i)]})])},expandedRowRender:U,summary:_}),e.withDirectives(e.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:n.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),[[e.vShow,n.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 ne } from "../theme/index.esm.js";
5
+ const te = () => ({
6
6
  data: {
7
7
  type: Object,
8
8
  required: !0
@@ -27,135 +27,146 @@ 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"],
35
39
  responsive: !0,
36
40
  showQuickJumper: !0,
37
41
  showLessItems: !0,
38
- showTotal: (t) => `总共 ${t} 条`
39
- }, z = `${M}-pagination`, ne = /* @__PURE__ */ F({
42
+ showTotal: (n) => `总共 ${n} 条`
43
+ }, K = `${ne}-pagination`, ue = /* @__PURE__ */ W({
40
44
  name: "DTable",
41
- props: Y(),
45
+ props: te(),
42
46
  // emits: { "update:keys": (keys: []) => void }
43
47
  // TODO 需要做调整
44
48
  emits: ["update:keys"],
45
- setup: function(t, {
46
- emit: b,
47
- slots: C
49
+ setup: function(n, {
50
+ emit: S,
51
+ slots: h
48
52
  }) {
49
- const a = h(t.keys || []), x = p(() => t.data), E = p(() => {
53
+ const t = f(n.keys || []), O = R(() => n.data), E = R(() => {
50
54
  var e;
51
- return ((e = t.config) == null ? void 0 : e.columns) ?? [];
52
- }), v = p(() => {
55
+ return ((e = n.config) == null ? void 0 : e.columns) ?? [];
56
+ }), y = R(() => {
53
57
  var e;
54
- return ((e = t.config) == null ? void 0 : e.pagination) ?? {};
55
- }), {
56
- tableRef: O,
57
- tableRootRef: B,
58
- tableHeight: H,
58
+ return ((e = n.config) == null ? void 0 : e.pagination) ?? {};
59
+ }), C = f(n.expandedRowKeys);
60
+ k(() => {
61
+ const {
62
+ expandedRowKeys: e
63
+ } = n;
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
+ } = n.config, s = n.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
- if (t.config.pagination) {
73
- const U = (N = s.value) == null ? void 0 : N.getElementsByClassName(z)[0];
74
- P = T(U) ?? 0;
83
+ if (n.config.pagination) {
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
+ n.height !== 0 && X(() => {
94
+ r(n.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, (s === "S" || !a) && (t.value = [], S("update:keys", t.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
- } = t;
106
- 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);
116
+ } = n;
117
+ let l = n.config.selection ?? "N";
118
+ const s = (o, i) => {
119
+ l === "S" ? (t.value = [], t.value = i ? [o[e]] : []) : t.value = i ? t.value.concat(o[e]) : t.value.filter((r) => r !== o[e]), S("update:keys", t.value);
120
+ }, d = (o, i, r) => {
121
+ const g = r.map((c) => c[e]);
122
+ t.value = o ? t.value.concat(g) : t.value.filter((c) => !g.includes(c)), S("update:keys", t.value);
112
123
  };
113
- L(() => t.keys, (n) => {
114
- a.value = n;
124
+ _(() => n.keys, (o) => {
125
+ t.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
120
- } = t.config;
121
- l = n, l !== "N" ? u.value = {
122
- selectedRowKeys: a,
123
- onSelect: f,
124
- onSelectAll: s,
130
+ selection: o
131
+ } = n.config;
132
+ l = o, l !== "N" ? u.value = {
133
+ selectedRowKeys: t,
134
+ onSelect: s,
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: s,
151
+ dbClick: d,
141
152
  selection: u,
142
- getCheckboxProps: n
153
+ getCheckboxProps: o
143
154
  }
144
- } = t, i = e[l], g = () => {
155
+ } = n, 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
+ t.value.some((c) => c === i) ? t.value = t.value.filter((c) => c !== i) : (u === "S" && (t.value = []), t.value.push(i)), S("update:keys", t.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(), s && s(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,70 @@ 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, s) => m(T, null, [h.expandedRowRender && h.expandedRowRender()]), I = () => m(T, null, [h.summary && h.summary()]);
175
186
  return () => {
176
187
  var e;
177
- return y("div", {
178
- ref: B
179
- }, [y(X, {
180
- ref: O,
181
- "row-key": t.rowKey,
182
- bordered: t.config.bordered,
188
+ return m("div", {
189
+ ref: H
190
+ }, [m(Y, {
191
+ ref: B,
192
+ "row-key": n.rowKey,
193
+ bordered: n.config.bordered,
183
194
  columns: E.value,
184
- dataSource: x.value,
185
- loading: t.loading,
186
- size: ((e = t.config) == null ? void 0 : e.size) ?? "small",
195
+ dataSource: O.value,
196
+ loading: n.loading,
197
+ size: ((e = n.config) == null ? void 0 : e.size) ?? "small",
187
198
  scroll: {
188
199
  scrollToFirstRowOnChange: !0,
189
200
  x: "100%",
190
- y: H.value + "px"
201
+ y: j.value + "px"
191
202
  },
203
+ expandedRowKeys: C.value,
204
+ "onUpdate:expandedRowKeys": (a) => C.value = a,
205
+ expandRowByClick: !0,
192
206
  pagination: !1,
193
- customRow: A,
194
- rowSelection: $.value,
195
- rowClassName: K
207
+ customRow: F,
208
+ rowSelection: q.value,
209
+ rowClassName: U
196
210
  }, {
197
211
  bodyCell: ({
198
- column: o,
212
+ column: a,
199
213
  record: l
200
214
  }) => {
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)]
215
+ if (a.slot === "action")
216
+ return m("div", {
217
+ onClick: x,
218
+ onDblclick: x
219
+ }, [m(Z, null, {
220
+ default: () => [h.action && h.action(l)]
207
221
  })]);
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,
215
- disabled: t.loading,
222
+ },
223
+ // 展开插槽
224
+ expandedRowRender: Q,
225
+ // 总结栏插槽
226
+ summary: I
227
+ }), G(m(ee, {
228
+ class: [K],
229
+ current: y.value.current,
230
+ "onUpdate:current": (a) => y.value.current = a,
231
+ pageSize: y.value.pageSize,
232
+ "onUpdate:pageSize": (a) => y.value.pageSize = a,
233
+ disabled: n.loading,
216
234
  "show-size-changer": !0,
217
235
  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,
236
+ "hide-on-single-page": b.hideOnSinglePage,
237
+ "show-quick-jumper": b.showQuickJumper,
238
+ "default-page-size": b.defaultPageSize,
239
+ "page-size-options": b.pageSizeOptions,
240
+ "show-total": b.showTotal,
241
+ total: y.value.total,
224
242
  onChange: D
225
- }, null), [[W, t.config.pagination]])]);
243
+ }, null), [[M, n.config.pagination]])]);
226
244
  };
227
245
  }
228
246
  });
229
247
  export {
230
- ne as default
248
+ ue as default
231
249
  };
@@ -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.28",
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,19 @@ 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 <>{slots.expandedRowRender && slots.expandedRowRender()}</>;
362
+ };
363
+
364
+ const summary = () => {
365
+ return <>{slots.summary && slots.summary()}</>;
366
+ };
344
367
  return () => (
345
368
  <div ref={tableRootRef}>
346
369
  <Table
@@ -356,6 +379,8 @@ const DXTable = defineComponent({
356
379
  x: "100%",
357
380
  y: tableHeight.value + "px"
358
381
  }}
382
+ v-model:expandedRowKeys={expandedKeys.value}
383
+ expandRowByClick={true}
359
384
  pagination={false}
360
385
  customRow={customRow}
361
386
  rowSelection={rowSelection.value}
@@ -370,7 +395,11 @@ const DXTable = defineComponent({
370
395
  </div>
371
396
  );
372
397
  }
373
- }
398
+ },
399
+ // 展开插槽
400
+ expandedRowRender: expandedRowRender,
401
+ // 总结栏插槽
402
+ summary: summary
374
403
  }}
375
404
  </Table>
376
405
  <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
  //表格高度