@ditari/bsui 1.0.12 → 1.0.14
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/dic/DicReplace.cjs.js +1 -1
- package/dist/cjs/components/table/Table.cjs.js +1 -1
- package/dist/esm/components/dic/DicReplace.esm.js +6 -6
- package/dist/esm/components/table/Table.esm.js +87 -79
- package/package.json +1 -1
- package/src/components/dic/DicReplace.tsx +0 -2
- package/src/components/table/Table.tsx +29 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),l=require("./replace.worker.cjs.js"),c=require("../../store/modules/DataDictionary.cjs.js"),i=e.defineComponent({name:"DicReplace",props:{name:{type:String,default:""},value:{type:String,default:""}},setup(r){const{list:o}=c.useDataDicStore(),u=e.ref(!0),n=e.ref(""),t=new l.default;return t.onerror=()=>{u.value=!1},t.onmessage=a=>{n.value=a.data},e.watchEffect(()=>{const a=r.value,s=r.name;t.postMessage({list:JSON.stringify(o),name:s,value:a})}),()=>e.createVNode(e.Fragment,null,[n.value])}});exports.default=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),S=require("ant-design-vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),S=require("ant-design-vue"),N=require("../../utils/html.cjs.js"),$=require("../theme/index.cjs.js"),A=()=>({data:{type:Object,required:!0},height:{type:Number,default:300},keys:Array,rowKey:{type:String,required:!0,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:a=>`总共 ${a} 条`},T=`${$.prefixName}-pagination`,J=n.defineComponent({name:"DTable",props:A(),emits:["update:keys"],setup:function(a,{emit:b,slots:p}){const e=n.ref(a.keys),P=n.computed(()=>a.data),R=n.computed(()=>{var t;return((t=a.config)==null?void 0:t.columns)??[]}),f=n.computed(()=>{var t;return((t=a.config)==null?void 0:t.pagination)??{}}),{tableRef:z,tableRootRef:x,tableHeight:E,onPageChange:O,onRowClassName:q}=H();function H(){const{rowClassName:t,keepSelected:l,selection:h,onPageChange:c}=a.config,r=n.ref(),o=n.ref(null),u=n.ref(),i=n.ref(null),g=v=>{var d,C;try{const m=(d=o==null?void 0:o.value)==null?void 0:d.$el,V=N.useEleHeight(m.getElementsByClassName("ant-table-header")[0]);let k=0;if(a.config.pagination){const _=(C=r.value)==null?void 0:C.getElementsByClassName(T)[0];k=N.useEleHeight(_)??0}u.value=v-(V+k),m.getElementsByClassName("ant-table-body")[0].style.height=u.value-10+"px",i.value=m.getElementsByClassName("ant-table-body")[0]}catch(m){console.warn(m)}};return n.watchEffect(()=>{a.height!==0&&n.nextTick(()=>{g(a.height)})}),{tableRef:o,tableRootRef:r,tableHeight:u,onPageChange:(v,d)=>{c&&c({page:v,size:d}),i.value.scrollTop=0,(h==="S"||!l)&&(e.value=[],b("update:keys",e.value))},onRowClassName:(v,d)=>t?t(v,d):void 0}}const B=j();function j(){const{rowKey:t,config:{selection:l,getCheckboxProps:h}}=a;if(l==="N")return;const c=(o,u)=>{l==="S"?(e.value=[],e.value=u?[o[t]]:[]):e.value=u?e.value.concat(o[t]):e.value.filter(i=>i!==o[t]),b("update:keys",e.value)},r=(o,u,i)=>{const g=i.map(s=>s[t]);e.value=o?e.value.concat(g):e.value.filter(s=>!g.includes(s)),b("update:keys",e.value)};return n.watch(()=>a.keys,o=>{e.value=o}),{selectedRowKeys:e,onSelect:c,onSelectAll:r,fixed:!0,columnTitle:l==="S"?"选择":null,columnWidth:l==="S"?60:40,getCheckboxProps:h}}const D=K();function K(){return t=>{let l;const{rowKey:h,config:{click:c,dbClick:r,selection:o,getCheckboxProps:u}}=a,i=t[h],g=()=>{if(o==="N")return;e.value.some(w=>w===i)?e.value=e.value.filter(w=>w!==i):(o==="S"&&(e.value=[]),e.value.push(i)),b("update:keys",e.value)};return{onClick:()=>{if(!c)return;const s=u?u(t):null;s&&s.value===i||(clearTimeout(l),l=setTimeout(()=>{g(),c(t)},200))},onDblclick:()=>{r&&(clearTimeout(l),r(t))}}}}return()=>{var t;return n.createVNode("div",{ref:x},[n.createVNode(S.Table,{ref:z,"row-key":a.rowKey,bordered:a.config.bordered,columns:R.value,dataSource:P.value,loading:a.loading,size:((t=a.config)==null?void 0:t.size)??"small",scroll:{scrollToFirstRowOnChange:!0,x:"100%",y:E.value+"px"},pagination:!1,customRow:D,rowSelection:B,rowClassName:q},{bodyCell:({column:l})=>{if(l.slot==="action")return n.createVNode(S.Space,null,{default:()=>[p.action&&p.action()]})}}),n.withDirectives(n.createVNode(S.Pagination,{class:[T],current:f.value.current,"onUpdate:current":l=>f.value.current=l,pageSize:f.value.pageSize,"onUpdate:pageSize":l=>f.value.pageSize=l,disabled:a.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:f.value.total,onChange:O},null),[[n.vShow,a.config.pagination]])])}}});exports.default=J;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as c, ref as
|
|
1
|
+
import { defineComponent as c, ref as o, watchEffect as u, createVNode as i, Fragment as m } from "vue";
|
|
2
2
|
import p from "./replace.worker.esm.js";
|
|
3
3
|
import { useDataDicStore as f } from "../../store/modules/DataDictionary.esm.js";
|
|
4
4
|
const S = /* @__PURE__ */ c({
|
|
@@ -17,16 +17,16 @@ const S = /* @__PURE__ */ c({
|
|
|
17
17
|
},
|
|
18
18
|
setup(a) {
|
|
19
19
|
const {
|
|
20
|
-
list:
|
|
21
|
-
} = f(),
|
|
20
|
+
list: n
|
|
21
|
+
} = f(), s = o(!0), r = o(""), e = new p();
|
|
22
22
|
return e.onerror = () => {
|
|
23
|
-
|
|
23
|
+
s.value = !1;
|
|
24
24
|
}, e.onmessage = (t) => {
|
|
25
25
|
r.value = t.data;
|
|
26
|
-
},
|
|
26
|
+
}, u(() => {
|
|
27
27
|
const t = a.value, l = a.name;
|
|
28
28
|
e.postMessage({
|
|
29
|
-
list: JSON.stringify(
|
|
29
|
+
list: JSON.stringify(n),
|
|
30
30
|
name: l,
|
|
31
31
|
value: t
|
|
32
32
|
});
|
|
@@ -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 Q, ref as v, computed as S, watchEffect as U, nextTick as F, watch as I, createVNode as b, withDirectives as L, vShow as V } from "vue";
|
|
2
|
+
import { Table as W, Space as X, Pagination as _ } from "ant-design-vue";
|
|
3
|
+
import { useEleHeight as R } from "../../utils/html.esm.js";
|
|
4
|
+
import { prefixName as G } from "../theme/index.esm.js";
|
|
5
|
+
const M = () => ({
|
|
6
6
|
data: {
|
|
7
7
|
type: Object,
|
|
8
8
|
required: !0
|
|
@@ -29,7 +29,7 @@ const X = () => ({
|
|
|
29
29
|
type: Object,
|
|
30
30
|
default: () => ({})
|
|
31
31
|
}
|
|
32
|
-
}),
|
|
32
|
+
}), y = {
|
|
33
33
|
defaultPageSize: 20,
|
|
34
34
|
hideOnSinglePage: !1,
|
|
35
35
|
pageSizeOptions: ["10", "20", "30", "40"],
|
|
@@ -37,62 +37,68 @@ const X = () => ({
|
|
|
37
37
|
showQuickJumper: !0,
|
|
38
38
|
showLessItems: !0,
|
|
39
39
|
showTotal: (a) => `总共 ${a} 条`
|
|
40
|
-
},
|
|
40
|
+
}, T = `${G}-pagination`, ae = /* @__PURE__ */ Q({
|
|
41
41
|
name: "DTable",
|
|
42
|
-
props:
|
|
42
|
+
props: M(),
|
|
43
43
|
// emits: { "update:keys": (keys: []) => void }
|
|
44
44
|
// TODO 需要做调整
|
|
45
45
|
emits: ["update:keys"],
|
|
46
|
-
setup(a, {
|
|
47
|
-
emit:
|
|
48
|
-
slots:
|
|
46
|
+
setup: function(a, {
|
|
47
|
+
emit: w,
|
|
48
|
+
slots: C
|
|
49
49
|
}) {
|
|
50
|
-
const e =
|
|
50
|
+
const e = v(a.keys), z = S(() => a.data), P = S(() => {
|
|
51
51
|
var t;
|
|
52
52
|
return ((t = a.config) == null ? void 0 : t.columns) ?? [];
|
|
53
53
|
}), f = S(() => {
|
|
54
54
|
var t;
|
|
55
55
|
return ((t = a.config) == null ? void 0 : t.pagination) ?? {};
|
|
56
56
|
}), {
|
|
57
|
-
tableRef:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
tableRef: x,
|
|
58
|
+
tableRootRef: E,
|
|
59
|
+
tableHeight: O,
|
|
60
|
+
onPageChange: B,
|
|
61
|
+
onRowClassName: H
|
|
62
|
+
} = K();
|
|
63
|
+
function K() {
|
|
63
64
|
const {
|
|
64
65
|
rowClassName: t,
|
|
65
66
|
keepSelected: n,
|
|
66
67
|
selection: d,
|
|
67
|
-
onPageChange:
|
|
68
|
-
} = a.config,
|
|
69
|
-
var g;
|
|
68
|
+
onPageChange: s
|
|
69
|
+
} = a.config, c = v(), o = v(null), i = v(), l = v(null), r = (h) => {
|
|
70
|
+
var g, k;
|
|
70
71
|
try {
|
|
71
|
-
const m = (g =
|
|
72
|
-
let
|
|
73
|
-
a.config.pagination
|
|
72
|
+
const m = (g = o == null ? void 0 : o.value) == null ? void 0 : g.$el, A = R(m.getElementsByClassName("ant-table-header")[0]);
|
|
73
|
+
let N = 0;
|
|
74
|
+
if (a.config.pagination) {
|
|
75
|
+
const J = (k = c.value) == null ? void 0 : k.getElementsByClassName(T)[0];
|
|
76
|
+
N = R(J) ?? 0;
|
|
77
|
+
}
|
|
78
|
+
i.value = h - (A + N), m.getElementsByClassName("ant-table-body")[0].style.height = i.value - 10 + "px", l.value = m.getElementsByClassName("ant-table-body")[0];
|
|
74
79
|
} catch (m) {
|
|
75
80
|
console.warn(m);
|
|
76
81
|
}
|
|
77
82
|
};
|
|
78
|
-
return
|
|
79
|
-
a.height !== 0 &&
|
|
80
|
-
|
|
83
|
+
return U(() => {
|
|
84
|
+
a.height !== 0 && F(() => {
|
|
85
|
+
r(a.height);
|
|
81
86
|
});
|
|
82
87
|
}), {
|
|
83
|
-
tableRef:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
tableRef: o,
|
|
89
|
+
tableRootRef: c,
|
|
90
|
+
tableHeight: i,
|
|
91
|
+
onPageChange: (h, g) => {
|
|
92
|
+
s && s({
|
|
93
|
+
page: h,
|
|
88
94
|
size: g
|
|
89
|
-
}),
|
|
95
|
+
}), l.value.scrollTop = 0, (d === "S" || !n) && (e.value = [], w("update:keys", e.value));
|
|
90
96
|
},
|
|
91
|
-
onRowClassName: (
|
|
97
|
+
onRowClassName: (h, g) => t ? t(h, g) : void 0
|
|
92
98
|
};
|
|
93
99
|
}
|
|
94
|
-
const
|
|
95
|
-
function
|
|
100
|
+
const j = D();
|
|
101
|
+
function D() {
|
|
96
102
|
const {
|
|
97
103
|
rowKey: t,
|
|
98
104
|
config: {
|
|
@@ -102,53 +108,53 @@ const X = () => ({
|
|
|
102
108
|
} = a;
|
|
103
109
|
if (n === "N")
|
|
104
110
|
return;
|
|
105
|
-
const
|
|
106
|
-
n === "S" ? (e.value = [], e.value =
|
|
107
|
-
},
|
|
108
|
-
const
|
|
109
|
-
e.value =
|
|
111
|
+
const s = (o, i) => {
|
|
112
|
+
n === "S" ? (e.value = [], e.value = i ? [o[t]] : []) : e.value = i ? e.value.concat(o[t]) : e.value.filter((l) => l !== o[t]), w("update:keys", e.value);
|
|
113
|
+
}, c = (o, i, l) => {
|
|
114
|
+
const r = l.map((u) => u[t]);
|
|
115
|
+
e.value = o ? e.value.concat(r) : e.value.filter((u) => !r.includes(u)), w("update:keys", e.value);
|
|
110
116
|
};
|
|
111
|
-
return
|
|
112
|
-
e.value =
|
|
117
|
+
return I(() => a.keys, (o) => {
|
|
118
|
+
e.value = o;
|
|
113
119
|
}), {
|
|
114
120
|
selectedRowKeys: e,
|
|
115
|
-
onSelect:
|
|
116
|
-
onSelectAll:
|
|
121
|
+
onSelect: s,
|
|
122
|
+
onSelectAll: c,
|
|
117
123
|
fixed: !0,
|
|
118
124
|
columnTitle: n === "S" ? "选择" : null,
|
|
119
125
|
columnWidth: n === "S" ? 60 : 40,
|
|
120
126
|
getCheckboxProps: d
|
|
121
127
|
};
|
|
122
128
|
}
|
|
123
|
-
const
|
|
124
|
-
function
|
|
129
|
+
const q = $();
|
|
130
|
+
function $() {
|
|
125
131
|
return (t) => {
|
|
126
132
|
let n;
|
|
127
133
|
const {
|
|
128
134
|
rowKey: d,
|
|
129
135
|
config: {
|
|
130
|
-
click:
|
|
131
|
-
dbClick:
|
|
132
|
-
selection:
|
|
133
|
-
getCheckboxProps:
|
|
136
|
+
click: s,
|
|
137
|
+
dbClick: c,
|
|
138
|
+
selection: o,
|
|
139
|
+
getCheckboxProps: i
|
|
134
140
|
}
|
|
135
|
-
} = a,
|
|
136
|
-
if (
|
|
141
|
+
} = a, l = t[d], r = () => {
|
|
142
|
+
if (o === "N")
|
|
137
143
|
return;
|
|
138
|
-
e.value.some((
|
|
144
|
+
e.value.some((p) => p === l) ? e.value = e.value.filter((p) => p !== l) : (o === "S" && (e.value = []), e.value.push(l)), w("update:keys", e.value);
|
|
139
145
|
};
|
|
140
146
|
return {
|
|
141
147
|
onClick: () => {
|
|
142
|
-
if (!
|
|
148
|
+
if (!s)
|
|
143
149
|
return;
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
150
|
+
const u = i ? i(t) : null;
|
|
151
|
+
u && u.value === l || (clearTimeout(n), n = setTimeout(() => {
|
|
152
|
+
r(), s(t);
|
|
147
153
|
}, 200));
|
|
148
154
|
},
|
|
149
155
|
// 点击行
|
|
150
156
|
onDblclick: () => {
|
|
151
|
-
|
|
157
|
+
c && (clearTimeout(n), c(t));
|
|
152
158
|
}
|
|
153
159
|
// onContextmenu: (event) => {
|
|
154
160
|
// //TODO
|
|
@@ -164,34 +170,36 @@ const X = () => ({
|
|
|
164
170
|
}
|
|
165
171
|
return () => {
|
|
166
172
|
var t;
|
|
167
|
-
return
|
|
168
|
-
ref:
|
|
173
|
+
return b("div", {
|
|
174
|
+
ref: E
|
|
175
|
+
}, [b(W, {
|
|
176
|
+
ref: x,
|
|
169
177
|
"row-key": a.rowKey,
|
|
170
178
|
bordered: a.config.bordered,
|
|
171
|
-
columns:
|
|
172
|
-
dataSource:
|
|
179
|
+
columns: P.value,
|
|
180
|
+
dataSource: z.value,
|
|
173
181
|
loading: a.loading,
|
|
174
182
|
size: ((t = a.config) == null ? void 0 : t.size) ?? "small",
|
|
175
183
|
scroll: {
|
|
176
184
|
scrollToFirstRowOnChange: !0,
|
|
177
185
|
x: "100%",
|
|
178
|
-
y:
|
|
186
|
+
y: O.value + "px"
|
|
179
187
|
},
|
|
180
188
|
pagination: !1,
|
|
181
|
-
customRow:
|
|
182
|
-
rowSelection:
|
|
183
|
-
rowClassName:
|
|
189
|
+
customRow: q,
|
|
190
|
+
rowSelection: j,
|
|
191
|
+
rowClassName: H
|
|
184
192
|
}, {
|
|
185
193
|
bodyCell: ({
|
|
186
194
|
column: n
|
|
187
195
|
}) => {
|
|
188
196
|
if (n.slot === "action")
|
|
189
|
-
return
|
|
190
|
-
default: () => [
|
|
197
|
+
return b(X, null, {
|
|
198
|
+
default: () => [C.action && C.action()]
|
|
191
199
|
});
|
|
192
200
|
}
|
|
193
|
-
}),
|
|
194
|
-
class: [
|
|
201
|
+
}), L(b(_, {
|
|
202
|
+
class: [T],
|
|
195
203
|
current: f.value.current,
|
|
196
204
|
"onUpdate:current": (n) => f.value.current = n,
|
|
197
205
|
pageSize: f.value.pageSize,
|
|
@@ -199,17 +207,17 @@ const X = () => ({
|
|
|
199
207
|
disabled: a.loading,
|
|
200
208
|
"show-size-changer": !0,
|
|
201
209
|
size: "default",
|
|
202
|
-
"hide-on-single-page":
|
|
203
|
-
"show-quick-jumper":
|
|
204
|
-
"default-page-size":
|
|
205
|
-
"page-size-options":
|
|
206
|
-
"show-total":
|
|
210
|
+
"hide-on-single-page": y.hideOnSinglePage,
|
|
211
|
+
"show-quick-jumper": y.showQuickJumper,
|
|
212
|
+
"default-page-size": y.defaultPageSize,
|
|
213
|
+
"page-size-options": y.pageSizeOptions,
|
|
214
|
+
"show-total": y.showTotal,
|
|
207
215
|
total: f.value.total,
|
|
208
|
-
onChange:
|
|
209
|
-
}, null), [[
|
|
216
|
+
onChange: B
|
|
217
|
+
}, null), [[V, a.config.pagination]])]);
|
|
210
218
|
};
|
|
211
219
|
}
|
|
212
220
|
});
|
|
213
221
|
export {
|
|
214
|
-
|
|
222
|
+
ae as default
|
|
215
223
|
};
|
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
computed,
|
|
3
3
|
defineComponent,
|
|
4
|
-
defineEmits,
|
|
5
4
|
nextTick,
|
|
6
5
|
PropType,
|
|
7
6
|
ref,
|
|
8
7
|
watch,
|
|
9
|
-
watchEffect
|
|
10
|
-
createSlots
|
|
8
|
+
watchEffect
|
|
11
9
|
} from "vue";
|
|
12
10
|
import { Pagination, Space, Table } from "ant-design-vue";
|
|
13
|
-
import { useEleHeight } from "../../utils";
|
|
11
|
+
import { useEleHeight } from "../../utils/html";
|
|
14
12
|
import { prefixName } from "../theme";
|
|
15
13
|
|
|
16
14
|
import type { TableProps, Key } from "./interface/table";
|
|
@@ -82,7 +80,7 @@ const DXTable = defineComponent({
|
|
|
82
80
|
// emits: { "update:keys": (keys: []) => void }
|
|
83
81
|
// TODO 需要做调整
|
|
84
82
|
emits: ["update:keys"],
|
|
85
|
-
setup(props, { emit, slots }) {
|
|
83
|
+
setup: function (props, { emit, slots }) {
|
|
86
84
|
// 保存选中的唯一id
|
|
87
85
|
const selectedRowKeys = ref<any>(props.keys);
|
|
88
86
|
// 数据源
|
|
@@ -94,7 +92,14 @@ const DXTable = defineComponent({
|
|
|
94
92
|
);
|
|
95
93
|
|
|
96
94
|
// 初始化表格
|
|
97
|
-
const {
|
|
95
|
+
const {
|
|
96
|
+
tableRef,
|
|
97
|
+
tableRootRef,
|
|
98
|
+
tableHeight,
|
|
99
|
+
onPageChange,
|
|
100
|
+
onRowClassName
|
|
101
|
+
} = useTable();
|
|
102
|
+
|
|
98
103
|
function useTable() {
|
|
99
104
|
const {
|
|
100
105
|
rowClassName,
|
|
@@ -102,6 +107,8 @@ const DXTable = defineComponent({
|
|
|
102
107
|
selection,
|
|
103
108
|
onPageChange: onChange
|
|
104
109
|
} = props.config;
|
|
110
|
+
// 表格根div
|
|
111
|
+
const tableRootRef = ref<HTMLElement>();
|
|
105
112
|
// 表格组件对象
|
|
106
113
|
const tableRef = ref<any>(null);
|
|
107
114
|
// 表格计算出来的高度
|
|
@@ -112,15 +119,16 @@ const DXTable = defineComponent({
|
|
|
112
119
|
const playHeight = (height: number) => {
|
|
113
120
|
try {
|
|
114
121
|
const tableEl = tableRef?.value?.$el;
|
|
122
|
+
|
|
115
123
|
const headerHeight = useEleHeight(
|
|
116
124
|
tableEl.getElementsByClassName("ant-table-header")[0]
|
|
117
125
|
);
|
|
118
126
|
// 获取分页组件高度
|
|
119
127
|
let paginationHeight = 0;
|
|
120
128
|
if (props.config.pagination) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
);
|
|
129
|
+
const paginationEl =
|
|
130
|
+
tableRootRef.value?.getElementsByClassName(basePageClassName)[0];
|
|
131
|
+
paginationHeight = useEleHeight(paginationEl as any) ?? 0;
|
|
124
132
|
}
|
|
125
133
|
tableHeight.value = height - (headerHeight + paginationHeight);
|
|
126
134
|
// 设置body高度
|
|
@@ -158,11 +166,18 @@ const DXTable = defineComponent({
|
|
|
158
166
|
const onRowClassName = (record: any, index: number) => {
|
|
159
167
|
return rowClassName ? rowClassName(record, index) : undefined;
|
|
160
168
|
};
|
|
161
|
-
return {
|
|
169
|
+
return {
|
|
170
|
+
tableRef,
|
|
171
|
+
tableRootRef,
|
|
172
|
+
tableHeight,
|
|
173
|
+
onPageChange,
|
|
174
|
+
onRowClassName
|
|
175
|
+
};
|
|
162
176
|
}
|
|
163
177
|
|
|
164
178
|
//表格选中配置
|
|
165
179
|
const rowSelection = useRowSelection();
|
|
180
|
+
|
|
166
181
|
function useRowSelection() {
|
|
167
182
|
const {
|
|
168
183
|
rowKey,
|
|
@@ -217,6 +232,7 @@ const DXTable = defineComponent({
|
|
|
217
232
|
}
|
|
218
233
|
|
|
219
234
|
const customRow = useCustomRow();
|
|
235
|
+
|
|
220
236
|
//表格行配置
|
|
221
237
|
function useCustomRow() {
|
|
222
238
|
return (record: any) => {
|
|
@@ -292,8 +308,9 @@ const DXTable = defineComponent({
|
|
|
292
308
|
};
|
|
293
309
|
};
|
|
294
310
|
}
|
|
311
|
+
|
|
295
312
|
return () => (
|
|
296
|
-
|
|
313
|
+
<div ref={tableRootRef}>
|
|
297
314
|
<Table
|
|
298
315
|
ref={tableRef}
|
|
299
316
|
row-key={props.rowKey}
|
|
@@ -336,7 +353,7 @@ const DXTable = defineComponent({
|
|
|
336
353
|
total={paginationState.value.total}
|
|
337
354
|
onChange={onPageChange}
|
|
338
355
|
/>
|
|
339
|
-
|
|
356
|
+
</div>
|
|
340
357
|
);
|
|
341
358
|
}
|
|
342
359
|
});
|