@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.
- package/dist/cjs/components/table/Table.cjs.js +1 -1
- package/dist/cjs/components/table/Table.d.ts +9 -0
- package/dist/cjs/components/table/index.d.ts +9 -0
- package/dist/cjs/components/table/interface/table.d.ts +1 -0
- package/dist/esm/components/table/Table.d.ts +9 -0
- package/dist/esm/components/table/Table.esm.js +123 -100
- package/dist/esm/components/table/index.d.ts +9 -0
- package/dist/esm/components/table/interface/table.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/select/Select.vue +1 -0
- package/src/components/table/Table.tsx +35 -1
- package/src/components/table/interface/table.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
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;
|
|
@@ -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
|
|
2
|
-
import { Table as
|
|
3
|
-
import { useEleHeight as
|
|
4
|
-
import { prefixName as
|
|
5
|
-
const
|
|
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
|
-
}),
|
|
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
|
-
},
|
|
43
|
+
}, K = `${te}-pagination`, ue = /* @__PURE__ */ W({
|
|
40
44
|
name: "DTable",
|
|
41
|
-
props:
|
|
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:
|
|
47
|
-
slots:
|
|
50
|
+
emit: S,
|
|
51
|
+
slots: h
|
|
48
52
|
}) {
|
|
49
|
-
const
|
|
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
|
-
}),
|
|
56
|
+
}), y = R(() => {
|
|
53
57
|
var e;
|
|
54
58
|
return ((e = t.config) == null ? void 0 : e.pagination) ?? {};
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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:
|
|
61
|
-
} =
|
|
62
|
-
function
|
|
71
|
+
onRowClassName: U
|
|
72
|
+
} = $();
|
|
73
|
+
function $() {
|
|
63
74
|
const {
|
|
64
75
|
rowClassName: e,
|
|
65
|
-
keepSelected:
|
|
76
|
+
keepSelected: a,
|
|
66
77
|
onPageChange: l
|
|
67
|
-
} = t.config,
|
|
68
|
-
var
|
|
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
|
|
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
|
|
74
|
-
P =
|
|
84
|
+
const V = (N = d.value) == null ? void 0 : N.getElementsByClassName(K)[0];
|
|
85
|
+
P = z(V) ?? 0;
|
|
75
86
|
}
|
|
76
|
-
|
|
77
|
-
} catch (
|
|
78
|
-
console.warn(
|
|
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
|
|
82
|
-
t.height !== 0 &&
|
|
83
|
-
|
|
92
|
+
return k(() => {
|
|
93
|
+
t.height !== 0 && X(() => {
|
|
94
|
+
r(t.height);
|
|
84
95
|
});
|
|
85
96
|
}), {
|
|
86
97
|
tableRef: u,
|
|
87
|
-
tableRootRef:
|
|
88
|
-
tableHeight:
|
|
89
|
-
onPageChange: (
|
|
98
|
+
tableRootRef: d,
|
|
99
|
+
tableHeight: o,
|
|
100
|
+
onPageChange: (w, v) => {
|
|
90
101
|
l && l({
|
|
91
|
-
page:
|
|
92
|
-
size:
|
|
93
|
-
}), i.value.scrollTop = 0, (
|
|
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: (
|
|
106
|
+
onRowClassName: (w, v) => e ? e(w, v) : void 0
|
|
96
107
|
};
|
|
97
108
|
}
|
|
98
|
-
const
|
|
99
|
-
function
|
|
109
|
+
const q = A();
|
|
110
|
+
function A() {
|
|
100
111
|
const {
|
|
101
112
|
rowKey: e,
|
|
102
113
|
config: {
|
|
103
|
-
getCheckboxProps:
|
|
114
|
+
getCheckboxProps: a
|
|
104
115
|
}
|
|
105
116
|
} = t;
|
|
106
117
|
let l = t.config.selection ?? "N";
|
|
107
|
-
const
|
|
108
|
-
l === "S" ? (
|
|
109
|
-
},
|
|
110
|
-
const
|
|
111
|
-
|
|
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
|
-
|
|
114
|
-
|
|
124
|
+
_(() => t.keys, (o) => {
|
|
125
|
+
n.value = o;
|
|
115
126
|
});
|
|
116
|
-
const u =
|
|
117
|
-
return
|
|
127
|
+
const u = f(void 0);
|
|
128
|
+
return k(() => {
|
|
118
129
|
const {
|
|
119
|
-
selection:
|
|
130
|
+
selection: o
|
|
120
131
|
} = t.config;
|
|
121
|
-
l =
|
|
122
|
-
selectedRowKeys:
|
|
123
|
-
onSelect:
|
|
124
|
-
onSelectAll:
|
|
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:
|
|
139
|
+
getCheckboxProps: a
|
|
129
140
|
} : u.value = void 0;
|
|
130
141
|
}), u;
|
|
131
142
|
}
|
|
132
|
-
const
|
|
143
|
+
const F = J();
|
|
133
144
|
function J() {
|
|
134
145
|
return (e) => {
|
|
135
|
-
let
|
|
146
|
+
let a;
|
|
136
147
|
const {
|
|
137
148
|
rowKey: l,
|
|
138
149
|
config: {
|
|
139
|
-
click:
|
|
140
|
-
dbClick:
|
|
150
|
+
click: c,
|
|
151
|
+
dbClick: d,
|
|
141
152
|
selection: u,
|
|
142
|
-
getCheckboxProps:
|
|
153
|
+
getCheckboxProps: o
|
|
143
154
|
}
|
|
144
|
-
} = t, i = e[l],
|
|
155
|
+
} = t, i = e[l], r = () => {
|
|
145
156
|
if (u === "N")
|
|
146
157
|
return;
|
|
147
|
-
|
|
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
|
|
152
|
-
|
|
153
|
-
|
|
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(
|
|
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
|
|
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
|
|
178
|
-
ref:
|
|
179
|
-
}, [
|
|
180
|
-
ref:
|
|
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:
|
|
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:
|
|
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:
|
|
194
|
-
rowSelection:
|
|
195
|
-
rowClassName:
|
|
212
|
+
customRow: F,
|
|
213
|
+
rowSelection: q.value,
|
|
214
|
+
rowClassName: U
|
|
196
215
|
}, {
|
|
197
216
|
bodyCell: ({
|
|
198
|
-
column:
|
|
217
|
+
column: a,
|
|
199
218
|
record: l
|
|
200
219
|
}) => {
|
|
201
|
-
if (
|
|
202
|
-
return
|
|
203
|
-
onClick:
|
|
204
|
-
onDblclick:
|
|
205
|
-
}, [
|
|
206
|
-
default: () => [
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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":
|
|
219
|
-
"show-quick-jumper":
|
|
220
|
-
"default-page-size":
|
|
221
|
-
"page-size-options":
|
|
222
|
-
"show-total":
|
|
223
|
-
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), [[
|
|
248
|
+
}, null), [[M, t.config.pagination]])]);
|
|
226
249
|
};
|
|
227
250
|
}
|
|
228
251
|
});
|
|
229
252
|
export {
|
|
230
|
-
|
|
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;
|
package/package.json
CHANGED
|
@@ -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
|