@ditari/bsui 1.0.13 → 1.0.15
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/select/Select.vue.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/select/Select.vue.esm.js +22 -22
- package/dist/esm/components/table/Table.esm.js +88 -85
- package/package.json +1 -1
- package/src/components/dic/DicReplace.tsx +0 -2
- package/src/components/select/Select.vue +3 -0
- package/src/components/table/Table.tsx +29 -17
|
@@ -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 e=require("vue"),_=require("../../store/modules/DataDictionary.cjs.js"),b=require("./dic.worker.cjs.js"),D={name:"DSelect"},k=e.defineComponent({...D,props:{value:{default:null},name:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"请填写默认占位符啊!老铁"}},emits:["update:value","change"],setup(l,{emit:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),_=require("../../store/modules/DataDictionary.cjs.js"),b=require("./dic.worker.cjs.js"),D={name:"DSelect"},k=e.defineComponent({...D,props:{value:{default:null},name:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"请填写默认占位符啊!老铁"}},emits:["update:value","change"],setup(l,{emit:r}){const u=l,{getDicByKey:p,list:h}=_.useDataDicStore(),{modelValue:c,data:v,onSearch:S,onSelect:g,onChange:m}=C();function C(){let s=!0,n=[];const t=e.ref(n),o=e.ref(u.value),d=new b.default;d.onerror=()=>{s=!1,n=p(u.name)},d.onmessage=a=>{t.value=[...a.data]},i(o.value);const w=a=>{s?i(a):t.value=n.filter(f=>f.value.toLowerCase().indexOf(a.toLowerCase())!==-1||f.label.toLowerCase().includes(a.toLowerCase())).splice(0,10)};function i(a){d.postMessage({list:JSON.stringify(h[u.name]),keywords:a})}return{data:t,modelValue:o,onSearch:w,onSelect:a=>{r("update:value",a)},onChange:()=>{r("update:value",o.value),r("change",o.value)}}}return(s,n)=>{const t=e.resolveComponent("a-select");return e.openBlock(),e.createBlock(t,{value:e.unref(c),"onUpdate:value":n[0]||(n[0]=o=>e.isRef(c)?c.value=o:null),"allow-clear":"","show-search":"","filter-option":!1,options:e.unref(v),placeholder:l.placeholder,disabled:l.disabled,onSelect:e.unref(g),onSearch:e.unref(S),onChange:e.unref(m)},null,8,["value","options","placeholder","disabled","onSelect","onSearch","onChange"])}}});exports.default=k;
|
|
@@ -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:()=>{const s=u?u(t):null;s&&s.value===i||(clearTimeout(l),l=setTimeout(()=>{g(),c&&c(t)},200))},onDblclick:()=>{clearTimeout(l),r&&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,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as D, ref as
|
|
1
|
+
import { defineComponent as D, ref as f, resolveComponent as _, openBlock as k, createBlock as B, unref as n, isRef as L } from "vue";
|
|
2
2
|
import { useDataDicStore as x } from "../../store/modules/DataDictionary.esm.js";
|
|
3
3
|
import V from "./dic.worker.esm.js";
|
|
4
4
|
const W = {
|
|
@@ -12,42 +12,42 @@ const W = {
|
|
|
12
12
|
placeholder: { default: "请填写默认占位符啊!老铁" }
|
|
13
13
|
},
|
|
14
14
|
emits: ["update:value", "change"],
|
|
15
|
-
setup(t, { emit:
|
|
16
|
-
const
|
|
15
|
+
setup(t, { emit: r }) {
|
|
16
|
+
const c = t, { getDicByKey: h, list: m } = x(), { modelValue: s, data: S, onSearch: v, onSelect: g, onChange: C } = w();
|
|
17
17
|
function w() {
|
|
18
|
-
let
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
}, i(
|
|
18
|
+
let u = !0, a = [];
|
|
19
|
+
const l = f(a), o = f(c.value), d = new V();
|
|
20
|
+
d.onerror = () => {
|
|
21
|
+
u = !1, a = h(c.name);
|
|
22
|
+
}, d.onmessage = (e) => {
|
|
23
|
+
l.value = [...e.data];
|
|
24
|
+
}, i(o.value);
|
|
25
25
|
const b = (e) => {
|
|
26
|
-
|
|
26
|
+
u ? i(e) : l.value = a.filter((p) => p.value.toLowerCase().indexOf(e.toLowerCase()) !== -1 || p.label.toLowerCase().includes(e.toLowerCase())).splice(0, 10);
|
|
27
27
|
};
|
|
28
28
|
function i(e) {
|
|
29
|
-
|
|
30
|
-
list: JSON.stringify(m[
|
|
29
|
+
d.postMessage({
|
|
30
|
+
list: JSON.stringify(m[c.name]),
|
|
31
31
|
keywords: e
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
|
-
data:
|
|
36
|
-
modelValue:
|
|
35
|
+
data: l,
|
|
36
|
+
modelValue: o,
|
|
37
37
|
onSearch: b,
|
|
38
38
|
onSelect: (e) => {
|
|
39
|
-
|
|
39
|
+
r("update:value", e);
|
|
40
40
|
},
|
|
41
41
|
onChange: () => {
|
|
42
|
-
|
|
42
|
+
r("update:value", o.value), r("change", o.value);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
return (
|
|
47
|
-
const
|
|
48
|
-
return k(), B(
|
|
49
|
-
value: n(
|
|
50
|
-
"onUpdate:value": a[0] || (a[0] = (
|
|
46
|
+
return (u, a) => {
|
|
47
|
+
const l = _("a-select");
|
|
48
|
+
return k(), B(l, {
|
|
49
|
+
value: n(s),
|
|
50
|
+
"onUpdate:value": a[0] || (a[0] = (o) => L(s) ? s.value = o : null),
|
|
51
51
|
"allow-clear": "",
|
|
52
52
|
"show-search": "",
|
|
53
53
|
"filter-option": !1,
|
|
@@ -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,121 +37,122 @@ 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:
|
|
46
|
+
setup: function(a, {
|
|
47
|
+
emit: w,
|
|
48
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
|
-
selection:
|
|
67
|
-
onPageChange:
|
|
68
|
-
} = a.config,
|
|
69
|
-
var
|
|
67
|
+
selection: d,
|
|
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
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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];
|
|
79
|
+
} catch (m) {
|
|
80
|
+
console.warn(m);
|
|
79
81
|
}
|
|
80
82
|
};
|
|
81
|
-
return
|
|
82
|
-
a.height !== 0 &&
|
|
83
|
-
|
|
83
|
+
return U(() => {
|
|
84
|
+
a.height !== 0 && F(() => {
|
|
85
|
+
r(a.height);
|
|
84
86
|
});
|
|
85
87
|
}), {
|
|
86
|
-
tableRef:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
tableRef: o,
|
|
89
|
+
tableRootRef: c,
|
|
90
|
+
tableHeight: i,
|
|
91
|
+
onPageChange: (h, g) => {
|
|
92
|
+
s && s({
|
|
93
|
+
page: h,
|
|
94
|
+
size: g
|
|
95
|
+
}), l.value.scrollTop = 0, (d === "S" || !n) && (e.value = [], w("update:keys", e.value));
|
|
93
96
|
},
|
|
94
|
-
onRowClassName: (
|
|
97
|
+
onRowClassName: (h, g) => t ? t(h, g) : void 0
|
|
95
98
|
};
|
|
96
99
|
}
|
|
97
|
-
const
|
|
98
|
-
function
|
|
100
|
+
const j = D();
|
|
101
|
+
function D() {
|
|
99
102
|
const {
|
|
100
103
|
rowKey: t,
|
|
101
104
|
config: {
|
|
102
105
|
selection: n,
|
|
103
|
-
getCheckboxProps:
|
|
106
|
+
getCheckboxProps: d
|
|
104
107
|
}
|
|
105
108
|
} = a;
|
|
106
109
|
if (n === "N")
|
|
107
110
|
return;
|
|
108
|
-
const
|
|
109
|
-
n === "S" ? (e.value = [], e.value = i ? [
|
|
110
|
-
},
|
|
111
|
-
const
|
|
112
|
-
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);
|
|
113
116
|
};
|
|
114
|
-
return
|
|
115
|
-
e.value =
|
|
117
|
+
return I(() => a.keys, (o) => {
|
|
118
|
+
e.value = o;
|
|
116
119
|
}), {
|
|
117
120
|
selectedRowKeys: e,
|
|
118
|
-
onSelect:
|
|
119
|
-
onSelectAll:
|
|
121
|
+
onSelect: s,
|
|
122
|
+
onSelectAll: c,
|
|
120
123
|
fixed: !0,
|
|
121
124
|
columnTitle: n === "S" ? "选择" : null,
|
|
122
125
|
columnWidth: n === "S" ? 60 : 40,
|
|
123
|
-
getCheckboxProps:
|
|
126
|
+
getCheckboxProps: d
|
|
124
127
|
};
|
|
125
128
|
}
|
|
126
|
-
const
|
|
127
|
-
function
|
|
129
|
+
const q = $();
|
|
130
|
+
function $() {
|
|
128
131
|
return (t) => {
|
|
129
132
|
let n;
|
|
130
133
|
const {
|
|
131
|
-
rowKey:
|
|
134
|
+
rowKey: d,
|
|
132
135
|
config: {
|
|
133
|
-
click:
|
|
134
|
-
dbClick:
|
|
135
|
-
selection:
|
|
136
|
+
click: s,
|
|
137
|
+
dbClick: c,
|
|
138
|
+
selection: o,
|
|
136
139
|
getCheckboxProps: i
|
|
137
140
|
}
|
|
138
|
-
} = a,
|
|
139
|
-
if (
|
|
141
|
+
} = a, l = t[d], r = () => {
|
|
142
|
+
if (o === "N")
|
|
140
143
|
return;
|
|
141
|
-
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);
|
|
142
145
|
};
|
|
143
146
|
return {
|
|
144
147
|
onClick: () => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
c && c.value === o || (clearTimeout(n), n = setTimeout(() => {
|
|
149
|
-
m(), g(t);
|
|
148
|
+
const u = i ? i(t) : null;
|
|
149
|
+
u && u.value === l || (clearTimeout(n), n = setTimeout(() => {
|
|
150
|
+
r(), s && s(t);
|
|
150
151
|
}, 200));
|
|
151
152
|
},
|
|
152
153
|
// 点击行
|
|
153
154
|
onDblclick: () => {
|
|
154
|
-
|
|
155
|
+
clearTimeout(n), c && c(t);
|
|
155
156
|
}
|
|
156
157
|
// onContextmenu: (event) => {
|
|
157
158
|
// //TODO
|
|
@@ -167,8 +168,10 @@ const X = () => ({
|
|
|
167
168
|
}
|
|
168
169
|
return () => {
|
|
169
170
|
var t;
|
|
170
|
-
return b(
|
|
171
|
-
ref:
|
|
171
|
+
return b("div", {
|
|
172
|
+
ref: E
|
|
173
|
+
}, [b(W, {
|
|
174
|
+
ref: x,
|
|
172
175
|
"row-key": a.rowKey,
|
|
173
176
|
bordered: a.config.bordered,
|
|
174
177
|
columns: P.value,
|
|
@@ -178,23 +181,23 @@ const X = () => ({
|
|
|
178
181
|
scroll: {
|
|
179
182
|
scrollToFirstRowOnChange: !0,
|
|
180
183
|
x: "100%",
|
|
181
|
-
y:
|
|
184
|
+
y: O.value + "px"
|
|
182
185
|
},
|
|
183
186
|
pagination: !1,
|
|
184
|
-
customRow:
|
|
185
|
-
rowSelection:
|
|
186
|
-
rowClassName:
|
|
187
|
+
customRow: q,
|
|
188
|
+
rowSelection: j,
|
|
189
|
+
rowClassName: H
|
|
187
190
|
}, {
|
|
188
191
|
bodyCell: ({
|
|
189
192
|
column: n
|
|
190
193
|
}) => {
|
|
191
194
|
if (n.slot === "action")
|
|
192
|
-
return b(
|
|
195
|
+
return b(X, null, {
|
|
193
196
|
default: () => [C.action && C.action()]
|
|
194
197
|
});
|
|
195
198
|
}
|
|
196
|
-
}),
|
|
197
|
-
class: [
|
|
199
|
+
}), L(b(_, {
|
|
200
|
+
class: [T],
|
|
198
201
|
current: f.value.current,
|
|
199
202
|
"onUpdate:current": (n) => f.value.current = n,
|
|
200
203
|
pageSize: f.value.pageSize,
|
|
@@ -202,17 +205,17 @@ const X = () => ({
|
|
|
202
205
|
disabled: a.loading,
|
|
203
206
|
"show-size-changer": !0,
|
|
204
207
|
size: "default",
|
|
205
|
-
"hide-on-single-page":
|
|
206
|
-
"show-quick-jumper":
|
|
207
|
-
"default-page-size":
|
|
208
|
-
"page-size-options":
|
|
209
|
-
"show-total":
|
|
208
|
+
"hide-on-single-page": y.hideOnSinglePage,
|
|
209
|
+
"show-quick-jumper": y.showQuickJumper,
|
|
210
|
+
"default-page-size": y.defaultPageSize,
|
|
211
|
+
"page-size-options": y.pageSizeOptions,
|
|
212
|
+
"show-total": y.showTotal,
|
|
210
213
|
total: f.value.total,
|
|
211
|
-
onChange:
|
|
212
|
-
}, null), [[
|
|
214
|
+
onChange: B
|
|
215
|
+
}, null), [[V, a.config.pagination]])]);
|
|
213
216
|
};
|
|
214
217
|
}
|
|
215
218
|
});
|
|
216
219
|
export {
|
|
217
|
-
|
|
220
|
+
ae as default
|
|
218
221
|
};
|
package/package.json
CHANGED
|
@@ -86,6 +86,7 @@ function useSelect() {
|
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
// 发送搜索到webworker
|
|
89
90
|
function sendWorkerSearch(keywords: string) {
|
|
90
91
|
worker.postMessage({
|
|
91
92
|
list: JSON.stringify(list[props.name]),
|
|
@@ -99,7 +100,9 @@ function useSelect() {
|
|
|
99
100
|
emits("update:value", value);
|
|
100
101
|
};
|
|
101
102
|
|
|
103
|
+
// 监听数据改变
|
|
102
104
|
const onChange = () => {
|
|
105
|
+
emits("update:value", modelValue.value);
|
|
103
106
|
emits("change", modelValue.value);
|
|
104
107
|
};
|
|
105
108
|
return {
|
|
@@ -80,7 +80,7 @@ const DXTable = defineComponent({
|
|
|
80
80
|
// emits: { "update:keys": (keys: []) => void }
|
|
81
81
|
// TODO 需要做调整
|
|
82
82
|
emits: ["update:keys"],
|
|
83
|
-
setup(props, { emit, slots }) {
|
|
83
|
+
setup: function (props, { emit, slots }) {
|
|
84
84
|
// 保存选中的唯一id
|
|
85
85
|
const selectedRowKeys = ref<any>(props.keys);
|
|
86
86
|
// 数据源
|
|
@@ -92,7 +92,14 @@ const DXTable = defineComponent({
|
|
|
92
92
|
);
|
|
93
93
|
|
|
94
94
|
// 初始化表格
|
|
95
|
-
const {
|
|
95
|
+
const {
|
|
96
|
+
tableRef,
|
|
97
|
+
tableRootRef,
|
|
98
|
+
tableHeight,
|
|
99
|
+
onPageChange,
|
|
100
|
+
onRowClassName
|
|
101
|
+
} = useTable();
|
|
102
|
+
|
|
96
103
|
function useTable() {
|
|
97
104
|
const {
|
|
98
105
|
rowClassName,
|
|
@@ -100,6 +107,8 @@ const DXTable = defineComponent({
|
|
|
100
107
|
selection,
|
|
101
108
|
onPageChange: onChange
|
|
102
109
|
} = props.config;
|
|
110
|
+
// 表格根div
|
|
111
|
+
const tableRootRef = ref<HTMLElement>();
|
|
103
112
|
// 表格组件对象
|
|
104
113
|
const tableRef = ref<any>(null);
|
|
105
114
|
// 表格计算出来的高度
|
|
@@ -110,28 +119,24 @@ const DXTable = defineComponent({
|
|
|
110
119
|
const playHeight = (height: number) => {
|
|
111
120
|
try {
|
|
112
121
|
const tableEl = tableRef?.value?.$el;
|
|
113
|
-
|
|
122
|
+
|
|
114
123
|
const headerHeight = useEleHeight(
|
|
115
124
|
tableEl.getElementsByClassName("ant-table-header")[0]
|
|
116
125
|
);
|
|
117
|
-
console.log("headerHeight", headerHeight);
|
|
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
|
-
console.log("paginationHeight", paginationHeight);
|
|
126
133
|
tableHeight.value = height - (headerHeight + paginationHeight);
|
|
127
|
-
console.log("tableHeight", tableHeight);
|
|
128
134
|
// 设置body高度
|
|
129
135
|
tableEl.getElementsByClassName("ant-table-body")[0].style.height =
|
|
130
136
|
tableHeight.value - 10 + "px";
|
|
131
137
|
// 表格body对象 用于切换页码后滚动条置顶
|
|
132
138
|
antTableBodyRef.value =
|
|
133
139
|
tableEl.getElementsByClassName("ant-table-body")[0];
|
|
134
|
-
console.log("antTableBodyRef", antTableBodyRef);
|
|
135
140
|
} catch (e) {
|
|
136
141
|
console.warn(e);
|
|
137
142
|
}
|
|
@@ -161,11 +166,18 @@ const DXTable = defineComponent({
|
|
|
161
166
|
const onRowClassName = (record: any, index: number) => {
|
|
162
167
|
return rowClassName ? rowClassName(record, index) : undefined;
|
|
163
168
|
};
|
|
164
|
-
return {
|
|
169
|
+
return {
|
|
170
|
+
tableRef,
|
|
171
|
+
tableRootRef,
|
|
172
|
+
tableHeight,
|
|
173
|
+
onPageChange,
|
|
174
|
+
onRowClassName
|
|
175
|
+
};
|
|
165
176
|
}
|
|
166
177
|
|
|
167
178
|
//表格选中配置
|
|
168
179
|
const rowSelection = useRowSelection();
|
|
180
|
+
|
|
169
181
|
function useRowSelection() {
|
|
170
182
|
const {
|
|
171
183
|
rowKey,
|
|
@@ -220,6 +232,7 @@ const DXTable = defineComponent({
|
|
|
220
232
|
}
|
|
221
233
|
|
|
222
234
|
const customRow = useCustomRow();
|
|
235
|
+
|
|
223
236
|
//表格行配置
|
|
224
237
|
function useCustomRow() {
|
|
225
238
|
return (record: any) => {
|
|
@@ -264,7 +277,6 @@ const DXTable = defineComponent({
|
|
|
264
277
|
|
|
265
278
|
return {
|
|
266
279
|
onClick: () => {
|
|
267
|
-
if (!click) return;
|
|
268
280
|
const rs = getCheckboxProps ? getCheckboxProps(record) : null;
|
|
269
281
|
if (rs && rs.value === id) {
|
|
270
282
|
return;
|
|
@@ -274,14 +286,13 @@ const DXTable = defineComponent({
|
|
|
274
286
|
// 处理单击事件业务
|
|
275
287
|
onClick();
|
|
276
288
|
// 回传数据 自定义单击后的业务
|
|
277
|
-
click(record);
|
|
289
|
+
click ? click(record) : undefined;
|
|
278
290
|
}, 200);
|
|
279
291
|
}, // 点击行
|
|
280
292
|
onDblclick: () => {
|
|
281
|
-
if (!dbClick) return;
|
|
282
293
|
clearTimeout(clickTimeout);
|
|
283
294
|
// 回传数据 自定义单击后的业务
|
|
284
|
-
dbClick(record);
|
|
295
|
+
dbClick ? dbClick(record) : undefined;
|
|
285
296
|
}
|
|
286
297
|
// onContextmenu: (event) => {
|
|
287
298
|
// //TODO
|
|
@@ -295,8 +306,9 @@ const DXTable = defineComponent({
|
|
|
295
306
|
};
|
|
296
307
|
};
|
|
297
308
|
}
|
|
309
|
+
|
|
298
310
|
return () => (
|
|
299
|
-
|
|
311
|
+
<div ref={tableRootRef}>
|
|
300
312
|
<Table
|
|
301
313
|
ref={tableRef}
|
|
302
314
|
row-key={props.rowKey}
|
|
@@ -339,7 +351,7 @@ const DXTable = defineComponent({
|
|
|
339
351
|
total={paginationState.value.total}
|
|
340
352
|
onChange={onPageChange}
|
|
341
353
|
/>
|
|
342
|
-
|
|
354
|
+
</div>
|
|
343
355
|
);
|
|
344
356
|
}
|
|
345
357
|
});
|