@ditari/bsui 1.0.49 → 1.0.51
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/grid/Grid.cjs.js +1 -1
- package/dist/cjs/components/grid/Grid.d.ts +9 -0
- package/dist/cjs/components/grid/index.d.ts +9 -0
- package/dist/cjs/components/table/Table.cjs.js +1 -1
- package/dist/cjs/components/table/Table.d.ts +4 -0
- package/dist/cjs/components/table/index.d.ts +4 -0
- package/dist/cjs/components/table/interface/table.d.ts +1 -0
- package/dist/esm/components/grid/Grid.d.ts +9 -0
- package/dist/esm/components/grid/Grid.esm.js +28 -22
- package/dist/esm/components/grid/index.d.ts +9 -0
- package/dist/esm/components/table/Table.d.ts +4 -0
- package/dist/esm/components/table/Table.esm.js +81 -79
- package/dist/esm/components/table/index.d.ts +4 -0
- package/dist/esm/components/table/interface/table.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/grid/Grid.tsx +11 -2
- package/src/components/table/Table.tsx +6 -3
- 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 e=require("vue"),q=require("@vueuse/core"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),q=require("@vueuse/core"),y=require("pinia");require("../../store/modules/Breadcrumb.cjs.js");require("../../store/modules/DataDictionary.cjs.js");require("../../store/modules/KeepAlive.cjs.js");require("../../store/modules/Menu.cjs.js");require("../../store/modules/NavTab.cjs.js");const N=require("../../store/modules/Settings.cjs.js");require("../../store/modules/User.cjs.js");const S=require("../theme/index.cjs.js"),b=require("./GridItem.cjs.js"),h=`${S.prefixName}-grid`,V=e.defineComponent({name:"DGrid",props:{className:{type:String,default:""},fill:{type:Boolean,default:!0},grid:{type:String,default:""}},setup(t,{slots:r}){var c,o;if(!r.default)return()=>e.createVNode(e.Fragment,null,[e.createTextVNode("ok")]);const i=N.useSettingsStore(),{gridValue:u}=y.storeToRefs(i),n=((c=r==null?void 0:r.default()[0])==null?void 0:c.children.length)||(r==null?void 0:r.default().length),l=e.ref([]);u.value.value=t.grid!==""?t.grid:u.value.value;const d=e.ref({"grid-template-columns":((o=u.value)==null?void 0:o.value)??""});return q.useResizeObserver(document.body,()=>{var f,g;t.grid===""&&i.gridMatching(),d.value["grid-template-columns"]=((f=u.value)==null?void 0:f.value)??"";const a=(g=u.value)==null?void 0:g.col,m=Math.ceil(n/a),v=t.fill?m*a-n:0;l.value=Array.from({length:v},(p,s)=>s+1)}),()=>e.createVNode(e.Fragment,null,[e.createVNode("div",{class:[h,t.className],style:d.value},[r.default&&r.default(l.value),l.value.map(a=>e.createVNode(b.default,{key:a},null))])])}});exports.default=V;
|
|
@@ -7,6 +7,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7
7
|
type: BooleanConstructor;
|
|
8
8
|
default: boolean;
|
|
9
9
|
};
|
|
10
|
+
grid: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
10
14
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
15
|
className: {
|
|
12
16
|
type: StringConstructor;
|
|
@@ -16,8 +20,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
16
20
|
type: BooleanConstructor;
|
|
17
21
|
default: boolean;
|
|
18
22
|
};
|
|
23
|
+
grid: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
19
27
|
}>>, {
|
|
20
28
|
fill: boolean;
|
|
21
29
|
className: string;
|
|
30
|
+
grid: string;
|
|
22
31
|
}>;
|
|
23
32
|
export default _default;
|
|
@@ -7,6 +7,10 @@ export declare const DGrid: import("../../utils/install").SFCWithInstall<import(
|
|
|
7
7
|
type: BooleanConstructor;
|
|
8
8
|
default: boolean;
|
|
9
9
|
};
|
|
10
|
+
grid: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
10
14
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
15
|
className: {
|
|
12
16
|
type: StringConstructor;
|
|
@@ -16,8 +20,13 @@ export declare const DGrid: import("../../utils/install").SFCWithInstall<import(
|
|
|
16
20
|
type: BooleanConstructor;
|
|
17
21
|
default: boolean;
|
|
18
22
|
};
|
|
23
|
+
grid: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
19
27
|
}>>, {
|
|
20
28
|
fill: boolean;
|
|
21
29
|
className: string;
|
|
30
|
+
grid: string;
|
|
22
31
|
}>>;
|
|
23
32
|
export declare const DGridItem: import("../../utils/install").SFCWithInstall<import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),R=require("ant-design-vue"),T=require("../../utils/html.cjs.js"),M=require("../theme/index.cjs.js"),Q=()=>({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:()=>[]},defaultExpandAllRows:Boolean,default:()=>!0}),b={defaultPageSize:20,hideOnSinglePage:!1,pageSizeOptions:["10","20","30","40"],responsive:!0,showQuickJumper:!0,showLessItems:!0,showTotal:a=>`总共 ${a} 条`},P=`${M.prefixName}-pagination`,I=t.defineComponent({name:"DTable",props:Q(),emits:["update:keys"],setup:function(a,{emit:p,slots:d}){const n=t.ref(a.keys||[]),E=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:K,tableRootRef:O,tableHeight:B,onPageChange:V,onRowClassName:H}=j();function j(){const{rowClassName:e,keepSelected:l,onPageChange:i}=a.config,f=a.config.selection??"N",r=t.ref(),u=t.ref(null),o=t.ref(),c=t.ref(null),g=s=>{var h,x;try{const y=(h=u==null?void 0:u.value)==null?void 0:h.$el,$=T.useEleHeight(y.getElementsByClassName("ant-table-header")[0]);let N=0;if(a.config.pagination){const J=(x=r.value)==null?void 0:x.getElementsByClassName(P)[0];N=T.useEleHeight(J)??0}o.value=s-($+N),y.getElementsByClassName("ant-table-body")[0].style.height=o.value+"px",c.value=y.getElementsByClassName("ant-table-body")[0]}catch(y){console.warn(y)}};return t.watchEffect(()=>{a.height!==0&&t.nextTick(()=>{setTimeout(()=>{g(a.height)},10)})}),{tableRef:u,tableRootRef:r,tableHeight:o,onPageChange:(s,h)=>{i&&i({page:s,size:h}),c.value.scrollTop=0,(f==="S"||!l)&&(n.value=[],p("update:keys",n.value))},onRowClassName:(s,h)=>e?e(s,h):void 0}}const q=D();function D(){const{rowKey:e,config:{getCheckboxProps:l}}=a;let i=a.config.selection??"N";const f=(o,c)=>{i==="S"?(n.value=[],n.value=c?[o[e]]:[]):n.value=c?n.value.concat(o[e]):n.value.filter(g=>g!==o[e]),p("update:keys",n.value)},r=(o,c,g)=>{const v=g.map(w=>w[e]);n.value=o?n.value.concat(v):n.value.filter(w=>!v.includes(w)),p("update:keys",n.value)};t.watch(()=>a.keys,o=>{n.value=o});const u=t.ref(void 0);return t.watchEffect(()=>{const{selection:o}=a.config;i=o,i!=="N"?u.value={selectedRowKeys:n,onSelect:f,onSelectAll:r,fixed:!0,columnTitle:i==="S"?"选择":null,columnWidth:i==="S"?60:40,getCheckboxProps:l}:u.value=void 0}),u}const A=F();function F(){return e=>{let l;const{rowKey:i,config:{click:f,dbClick:r,selection:u,getCheckboxProps:o}}=a,c=e[i],g=()=>{const v=o===void 0?!1:o(e).disabled;if(u==="N"||v)return;n.value.some(s=>s===c)?n.value=n.value.filter(s=>s!==c):(u==="S"&&(n.value=[]),n.value.push(c)),p("update:keys",n.value)};return{onClick:()=>{clearTimeout(l),l=setTimeout(()=>{g(),f&&f(e)},200)},onDblclick:()=>{clearTimeout(l),r&&r(e)}}}}const C=e=>{e.stopPropagation()},U=t.computed(()=>{const{selection:e}=a.config;return e==="N"}),k={};d.expandedRowRender&&(k.expandedRowRender=e=>t.createVNode(t.Fragment,null,[d.expandedRowRender&&d.expandedRowRender(e)]));const _=()=>t.createVNode(t.Fragment,null,[d.summary&&d.summary()]);return()=>{var e;return t.createVNode("div",{ref:O,style:{height:"100%"}},[t.createVNode(R.Table,{ref:K,"row-key":a.rowKey,bordered:a.config.bordered,columns:z.value,dataSource:E.value,loading:a.loading,size:((e=a.config)==null?void 0:e.size)??"small",scroll:{scrollToFirstRowOnChange:!0,x:"100%",y:B.value+"px"},expandedRowKeys:S.value,"onUpdate:expandedRowKeys":l=>S.value=l,expandRowByClick:U.value,defaultExpandAllRows:a.defaultExpandAllRows,pagination:!1,customRow:A,rowSelection:q.value,rowClassName:H},{bodyCell:({column:l,record:i})=>{if(l.slot==="action")return t.createVNode("div",{onClick:C,onDblclick:C},[t.createVNode(R.Space,null,{default:()=>[d.action&&d.action(i)]})])},...k,summary:_}),t.withDirectives(t.createVNode(R.Pagination,{class:[P],current:m.value.current,"onUpdate:current":l=>m.value.current=l,pageSize:m.value.pageSize,"onUpdate:pageSize":l=>m.value.pageSize=l,disabled:a.loading,"show-size-changer":!0,size:"default","hide-on-single-page":b.hideOnSinglePage,"show-quick-jumper":b.showQuickJumper,"default-page-size":b.defaultPageSize,"page-size-options":b.pageSizeOptions,"show-total":b.showTotal,total:m.value.total,onChange:V},null),[[t.vShow,a.config.pagination]])])}}});exports.default=I;
|
|
@@ -33,6 +33,8 @@ declare const DXTable: import("vue").DefineComponent<{
|
|
|
33
33
|
type: PropType<string[] | undefined>;
|
|
34
34
|
default: () => never[];
|
|
35
35
|
};
|
|
36
|
+
defaultExpandAllRows: PropType<boolean | undefined>;
|
|
37
|
+
default: () => boolean;
|
|
36
38
|
}, () => 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<{
|
|
37
39
|
data: {
|
|
38
40
|
type: PropType<any>;
|
|
@@ -63,6 +65,8 @@ declare const DXTable: import("vue").DefineComponent<{
|
|
|
63
65
|
type: PropType<string[] | undefined>;
|
|
64
66
|
default: () => never[];
|
|
65
67
|
};
|
|
68
|
+
defaultExpandAllRows: PropType<boolean | undefined>;
|
|
69
|
+
default: () => boolean;
|
|
66
70
|
}>> & {
|
|
67
71
|
"onUpdate:keys"?: ((...args: any[]) => any) | undefined;
|
|
68
72
|
}, {
|
|
@@ -28,6 +28,8 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
|
|
|
28
28
|
type: import("vue").PropType<string[] | undefined>;
|
|
29
29
|
default: () => never[];
|
|
30
30
|
};
|
|
31
|
+
defaultExpandAllRows: import("vue").PropType<boolean | undefined>;
|
|
32
|
+
default: () => boolean;
|
|
31
33
|
}, () => 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<{
|
|
32
34
|
data: {
|
|
33
35
|
type: import("vue").PropType<any>;
|
|
@@ -58,6 +60,8 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
|
|
|
58
60
|
type: import("vue").PropType<string[] | undefined>;
|
|
59
61
|
default: () => never[];
|
|
60
62
|
};
|
|
63
|
+
defaultExpandAllRows: import("vue").PropType<boolean | undefined>;
|
|
64
|
+
default: () => boolean;
|
|
61
65
|
}>> & {
|
|
62
66
|
"onUpdate:keys"?: ((...args: any[]) => any) | undefined;
|
|
63
67
|
}, {
|
|
@@ -7,6 +7,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7
7
|
type: BooleanConstructor;
|
|
8
8
|
default: boolean;
|
|
9
9
|
};
|
|
10
|
+
grid: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
10
14
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
15
|
className: {
|
|
12
16
|
type: StringConstructor;
|
|
@@ -16,8 +20,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
16
20
|
type: BooleanConstructor;
|
|
17
21
|
default: boolean;
|
|
18
22
|
};
|
|
23
|
+
grid: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
19
27
|
}>>, {
|
|
20
28
|
fill: boolean;
|
|
21
29
|
className: string;
|
|
30
|
+
grid: string;
|
|
22
31
|
}>;
|
|
23
32
|
export default _default;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as s, createVNode as l, Fragment as g, createTextVNode as N, ref as p } from "vue";
|
|
2
2
|
import { useResizeObserver as b } from "@vueuse/core";
|
|
3
|
-
import { storeToRefs as
|
|
3
|
+
import { storeToRefs as S } from "pinia";
|
|
4
4
|
import "../../store/modules/Breadcrumb.esm.js";
|
|
5
5
|
import "../../store/modules/DataDictionary.esm.js";
|
|
6
6
|
import "../../store/modules/KeepAlive.esm.js";
|
|
7
7
|
import "../../store/modules/Menu.esm.js";
|
|
8
8
|
import "../../store/modules/NavTab.esm.js";
|
|
9
|
-
import { useSettingsStore as
|
|
9
|
+
import { useSettingsStore as C } from "../../store/modules/Settings.esm.js";
|
|
10
10
|
import "../../store/modules/User.esm.js";
|
|
11
|
-
import { prefixName as
|
|
11
|
+
import { prefixName as G } from "../theme/index.esm.js";
|
|
12
12
|
import x from "./GridItem.esm.js";
|
|
13
|
-
const V = `${
|
|
13
|
+
const V = `${G}-grid`, $ = /* @__PURE__ */ s({
|
|
14
14
|
name: "DGrid",
|
|
15
15
|
props: {
|
|
16
16
|
// css class
|
|
@@ -22,31 +22,37 @@ const V = `${S}-grid`, $ = /* @__PURE__ */ y({
|
|
|
22
22
|
fill: {
|
|
23
23
|
type: Boolean,
|
|
24
24
|
default: !0
|
|
25
|
+
},
|
|
26
|
+
grid: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: ""
|
|
25
29
|
}
|
|
26
30
|
},
|
|
27
|
-
setup(
|
|
31
|
+
setup(t, {
|
|
28
32
|
slots: e
|
|
29
33
|
}) {
|
|
30
|
-
var
|
|
34
|
+
var o, d;
|
|
31
35
|
if (!e.default)
|
|
32
|
-
return () =>
|
|
33
|
-
const
|
|
34
|
-
gridValue:
|
|
35
|
-
} =
|
|
36
|
-
|
|
36
|
+
return () => l(g, null, [N("ok")]);
|
|
37
|
+
const u = C(), {
|
|
38
|
+
gridValue: r
|
|
39
|
+
} = S(u), n = ((o = e == null ? void 0 : e.default()[0]) == null ? void 0 : o.children.length) || (e == null ? void 0 : e.default().length), i = p([]);
|
|
40
|
+
r.value.value = t.grid !== "" ? t.grid : r.value.value;
|
|
41
|
+
const m = p({
|
|
42
|
+
"grid-template-columns": ((d = r.value) == null ? void 0 : d.value) ?? ""
|
|
37
43
|
});
|
|
38
44
|
return b(document.body, () => {
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
length:
|
|
45
|
+
var f, c;
|
|
46
|
+
t.grid === "" && u.gridMatching(), m.value["grid-template-columns"] = ((f = r.value) == null ? void 0 : f.value) ?? "";
|
|
47
|
+
const a = (c = r.value) == null ? void 0 : c.col, v = Math.ceil(n / a), y = t.fill ? v * a - n : 0;
|
|
48
|
+
i.value = Array.from({
|
|
49
|
+
length: y
|
|
44
50
|
}, (k, h) => h + 1);
|
|
45
|
-
}), () =>
|
|
46
|
-
class: [V,
|
|
47
|
-
style:
|
|
48
|
-
}, [e.default && e.default(
|
|
49
|
-
key:
|
|
51
|
+
}), () => l(g, null, [l("div", {
|
|
52
|
+
class: [V, t.className],
|
|
53
|
+
style: m.value
|
|
54
|
+
}, [e.default && e.default(i.value), i.value.map((a) => l(x, {
|
|
55
|
+
key: a
|
|
50
56
|
}, null))])]);
|
|
51
57
|
}
|
|
52
58
|
});
|
|
@@ -7,6 +7,10 @@ export declare const DGrid: import("../../utils/install").SFCWithInstall<import(
|
|
|
7
7
|
type: BooleanConstructor;
|
|
8
8
|
default: boolean;
|
|
9
9
|
};
|
|
10
|
+
grid: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
10
14
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
15
|
className: {
|
|
12
16
|
type: StringConstructor;
|
|
@@ -16,8 +20,13 @@ export declare const DGrid: import("../../utils/install").SFCWithInstall<import(
|
|
|
16
20
|
type: BooleanConstructor;
|
|
17
21
|
default: boolean;
|
|
18
22
|
};
|
|
23
|
+
grid: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
19
27
|
}>>, {
|
|
20
28
|
fill: boolean;
|
|
21
29
|
className: string;
|
|
30
|
+
grid: string;
|
|
22
31
|
}>>;
|
|
23
32
|
export declare const DGridItem: import("../../utils/install").SFCWithInstall<import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>>;
|
|
@@ -33,6 +33,8 @@ declare const DXTable: import("vue").DefineComponent<{
|
|
|
33
33
|
type: PropType<string[] | undefined>;
|
|
34
34
|
default: () => never[];
|
|
35
35
|
};
|
|
36
|
+
defaultExpandAllRows: PropType<boolean | undefined>;
|
|
37
|
+
default: () => boolean;
|
|
36
38
|
}, () => 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<{
|
|
37
39
|
data: {
|
|
38
40
|
type: PropType<any>;
|
|
@@ -63,6 +65,8 @@ declare const DXTable: import("vue").DefineComponent<{
|
|
|
63
65
|
type: PropType<string[] | undefined>;
|
|
64
66
|
default: () => never[];
|
|
65
67
|
};
|
|
68
|
+
defaultExpandAllRows: PropType<boolean | undefined>;
|
|
69
|
+
default: () => boolean;
|
|
66
70
|
}>> & {
|
|
67
71
|
"onUpdate:keys"?: ((...args: any[]) => any) | undefined;
|
|
68
72
|
}, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as X, ref as r, computed as
|
|
1
|
+
import { defineComponent as X, ref as r, computed as S, watchEffect as k, nextTick as _, watch as G, createVNode as f, withDirectives as M, vShow as Y, Fragment as z } from "vue";
|
|
2
2
|
import { Table as Z, Space as ee, Pagination as te } from "ant-design-vue";
|
|
3
3
|
import { useEleHeight as E } from "../../utils/html.esm.js";
|
|
4
|
-
import { prefixName as
|
|
5
|
-
const
|
|
4
|
+
import { prefixName as ae } from "../theme/index.esm.js";
|
|
5
|
+
const ne = () => ({
|
|
6
6
|
data: {
|
|
7
7
|
type: Object,
|
|
8
8
|
required: !0
|
|
@@ -31,8 +31,10 @@ const ae = () => ({
|
|
|
31
31
|
expandedRowKeys: {
|
|
32
32
|
type: Object,
|
|
33
33
|
default: () => []
|
|
34
|
-
}
|
|
35
|
-
|
|
34
|
+
},
|
|
35
|
+
defaultExpandAllRows: Boolean,
|
|
36
|
+
default: () => !0
|
|
37
|
+
}), b = {
|
|
36
38
|
defaultPageSize: 20,
|
|
37
39
|
hideOnSinglePage: !1,
|
|
38
40
|
pageSizeOptions: ["10", "20", "30", "40"],
|
|
@@ -40,54 +42,53 @@ const ae = () => ({
|
|
|
40
42
|
showQuickJumper: !0,
|
|
41
43
|
showLessItems: !0,
|
|
42
44
|
showTotal: (t) => `总共 ${t} 条`
|
|
43
|
-
},
|
|
45
|
+
}, K = `${ae}-pagination`, ce = /* @__PURE__ */ X({
|
|
44
46
|
name: "DTable",
|
|
45
|
-
props:
|
|
47
|
+
props: ne(),
|
|
46
48
|
// emits: { "update:keys": (keys: []) => void }
|
|
47
49
|
// TODO 需要做调整
|
|
48
50
|
emits: ["update:keys"],
|
|
49
51
|
setup: function(t, {
|
|
50
|
-
emit:
|
|
52
|
+
emit: R,
|
|
51
53
|
slots: s
|
|
52
54
|
}) {
|
|
53
|
-
const
|
|
55
|
+
const a = r(t.keys || []), B = S(() => t.data), O = S(() => {
|
|
54
56
|
var e;
|
|
55
57
|
return ((e = t.config) == null ? void 0 : e.columns) ?? [];
|
|
56
|
-
}),
|
|
58
|
+
}), v = S(() => {
|
|
57
59
|
var e;
|
|
58
60
|
return ((e = t.config) == null ? void 0 : e.pagination) ?? {};
|
|
59
|
-
}),
|
|
61
|
+
}), C = r(t.expandedRowKeys);
|
|
60
62
|
k(() => {
|
|
61
63
|
const {
|
|
62
64
|
expandedRowKeys: e
|
|
63
65
|
} = t;
|
|
64
|
-
|
|
66
|
+
C.value = e;
|
|
65
67
|
});
|
|
66
68
|
const {
|
|
67
|
-
tableRef:
|
|
68
|
-
tableRootRef:
|
|
69
|
-
tableHeight:
|
|
70
|
-
onPageChange:
|
|
71
|
-
onRowClassName:
|
|
72
|
-
} =
|
|
73
|
-
function
|
|
69
|
+
tableRef: H,
|
|
70
|
+
tableRootRef: j,
|
|
71
|
+
tableHeight: A,
|
|
72
|
+
onPageChange: D,
|
|
73
|
+
onRowClassName: U
|
|
74
|
+
} = $();
|
|
75
|
+
function $() {
|
|
74
76
|
const {
|
|
75
77
|
rowClassName: e,
|
|
76
78
|
keepSelected: o,
|
|
77
79
|
onPageChange: l
|
|
78
|
-
} = t.config, m = t.config.selection ?? "N", d = r(), i = r(null),
|
|
80
|
+
} = t.config, m = t.config.selection ?? "N", d = r(), i = r(null), n = r(), u = r(null), g = (c) => {
|
|
79
81
|
var h, T;
|
|
80
82
|
try {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
let z = 0;
|
|
83
|
+
const p = (h = i == null ? void 0 : i.value) == null ? void 0 : h.$el, V = E(p.getElementsByClassName("ant-table-header")[0]);
|
|
84
|
+
let P = 0;
|
|
84
85
|
if (t.config.pagination) {
|
|
85
|
-
const W = (T = d.value) == null ? void 0 : T.getElementsByClassName(
|
|
86
|
-
|
|
86
|
+
const W = (T = d.value) == null ? void 0 : T.getElementsByClassName(K)[0];
|
|
87
|
+
P = E(W) ?? 0;
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
-
} catch (
|
|
90
|
-
console.warn(
|
|
89
|
+
n.value = c - (V + P), p.getElementsByClassName("ant-table-body")[0].style.height = n.value + "px", u.value = p.getElementsByClassName("ant-table-body")[0];
|
|
90
|
+
} catch (p) {
|
|
91
|
+
console.warn(p);
|
|
91
92
|
}
|
|
92
93
|
};
|
|
93
94
|
return k(() => {
|
|
@@ -99,18 +100,18 @@ const ae = () => ({
|
|
|
99
100
|
}), {
|
|
100
101
|
tableRef: i,
|
|
101
102
|
tableRootRef: d,
|
|
102
|
-
tableHeight:
|
|
103
|
-
onPageChange: (
|
|
103
|
+
tableHeight: n,
|
|
104
|
+
onPageChange: (c, h) => {
|
|
104
105
|
l && l({
|
|
105
|
-
page:
|
|
106
|
+
page: c,
|
|
106
107
|
size: h
|
|
107
|
-
}),
|
|
108
|
+
}), u.value.scrollTop = 0, (m === "S" || !o) && (a.value = [], R("update:keys", a.value));
|
|
108
109
|
},
|
|
109
|
-
onRowClassName: (
|
|
110
|
+
onRowClassName: (c, h) => e ? e(c, h) : void 0
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
|
-
const
|
|
113
|
-
function
|
|
113
|
+
const q = F();
|
|
114
|
+
function F() {
|
|
114
115
|
const {
|
|
115
116
|
rowKey: e,
|
|
116
117
|
config: {
|
|
@@ -118,22 +119,22 @@ const ae = () => ({
|
|
|
118
119
|
}
|
|
119
120
|
} = t;
|
|
120
121
|
let l = t.config.selection ?? "N";
|
|
121
|
-
const m = (
|
|
122
|
-
l === "S" ? (
|
|
123
|
-
}, d = (
|
|
124
|
-
const w = g.map((
|
|
125
|
-
|
|
122
|
+
const m = (n, u) => {
|
|
123
|
+
l === "S" ? (a.value = [], a.value = u ? [n[e]] : []) : a.value = u ? a.value.concat(n[e]) : a.value.filter((g) => g !== n[e]), R("update:keys", a.value);
|
|
124
|
+
}, d = (n, u, g) => {
|
|
125
|
+
const w = g.map((y) => y[e]);
|
|
126
|
+
a.value = n ? a.value.concat(w) : a.value.filter((y) => !w.includes(y)), R("update:keys", a.value);
|
|
126
127
|
};
|
|
127
|
-
G(() => t.keys, (
|
|
128
|
-
|
|
128
|
+
G(() => t.keys, (n) => {
|
|
129
|
+
a.value = n;
|
|
129
130
|
});
|
|
130
131
|
const i = r(void 0);
|
|
131
132
|
return k(() => {
|
|
132
133
|
const {
|
|
133
|
-
selection:
|
|
134
|
+
selection: n
|
|
134
135
|
} = t.config;
|
|
135
|
-
l =
|
|
136
|
-
selectedRowKeys:
|
|
136
|
+
l = n, l !== "N" ? i.value = {
|
|
137
|
+
selectedRowKeys: a,
|
|
137
138
|
onSelect: m,
|
|
138
139
|
onSelectAll: d,
|
|
139
140
|
fixed: !0,
|
|
@@ -143,8 +144,8 @@ const ae = () => ({
|
|
|
143
144
|
} : i.value = void 0;
|
|
144
145
|
}), i;
|
|
145
146
|
}
|
|
146
|
-
const
|
|
147
|
-
function
|
|
147
|
+
const J = Q();
|
|
148
|
+
function Q() {
|
|
148
149
|
return (e) => {
|
|
149
150
|
let o;
|
|
150
151
|
const {
|
|
@@ -153,13 +154,13 @@ const ae = () => ({
|
|
|
153
154
|
click: m,
|
|
154
155
|
dbClick: d,
|
|
155
156
|
selection: i,
|
|
156
|
-
getCheckboxProps:
|
|
157
|
+
getCheckboxProps: n
|
|
157
158
|
}
|
|
158
|
-
} = t,
|
|
159
|
-
const w =
|
|
159
|
+
} = t, u = e[l], g = () => {
|
|
160
|
+
const w = n === void 0 ? !1 : n(e).disabled;
|
|
160
161
|
if (i === "N" || w)
|
|
161
162
|
return;
|
|
162
|
-
|
|
163
|
+
a.value.some((c) => c === u) ? a.value = a.value.filter((c) => c !== u) : (i === "S" && (a.value = []), a.value.push(u)), R("update:keys", a.value);
|
|
163
164
|
};
|
|
164
165
|
return {
|
|
165
166
|
onClick: () => {
|
|
@@ -185,41 +186,42 @@ const ae = () => ({
|
|
|
185
186
|
}
|
|
186
187
|
const x = (e) => {
|
|
187
188
|
e.stopPropagation();
|
|
188
|
-
},
|
|
189
|
+
}, I = S(() => {
|
|
189
190
|
const {
|
|
190
191
|
selection: e
|
|
191
192
|
} = t.config;
|
|
192
193
|
return e === "N";
|
|
193
194
|
}), N = {};
|
|
194
|
-
s.expandedRowRender && (N.expandedRowRender = (e) => f(
|
|
195
|
-
const
|
|
195
|
+
s.expandedRowRender && (N.expandedRowRender = (e) => f(z, null, [s.expandedRowRender && s.expandedRowRender(e)]));
|
|
196
|
+
const L = () => f(z, null, [s.summary && s.summary()]);
|
|
196
197
|
return () => {
|
|
197
198
|
var e;
|
|
198
199
|
return f("div", {
|
|
199
|
-
ref:
|
|
200
|
+
ref: j,
|
|
200
201
|
style: {
|
|
201
202
|
height: "100%"
|
|
202
203
|
}
|
|
203
204
|
}, [f(Z, {
|
|
204
|
-
ref:
|
|
205
|
+
ref: H,
|
|
205
206
|
"row-key": t.rowKey,
|
|
206
207
|
bordered: t.config.bordered,
|
|
207
|
-
columns:
|
|
208
|
-
dataSource:
|
|
208
|
+
columns: O.value,
|
|
209
|
+
dataSource: B.value,
|
|
209
210
|
loading: t.loading,
|
|
210
211
|
size: ((e = t.config) == null ? void 0 : e.size) ?? "small",
|
|
211
212
|
scroll: {
|
|
212
213
|
scrollToFirstRowOnChange: !0,
|
|
213
214
|
x: "100%",
|
|
214
|
-
y:
|
|
215
|
+
y: A.value + "px"
|
|
215
216
|
},
|
|
216
|
-
expandedRowKeys:
|
|
217
|
-
"onUpdate:expandedRowKeys": (o) =>
|
|
218
|
-
expandRowByClick:
|
|
217
|
+
expandedRowKeys: C.value,
|
|
218
|
+
"onUpdate:expandedRowKeys": (o) => C.value = o,
|
|
219
|
+
expandRowByClick: I.value,
|
|
220
|
+
defaultExpandAllRows: t.defaultExpandAllRows,
|
|
219
221
|
pagination: !1,
|
|
220
|
-
customRow:
|
|
221
|
-
rowSelection:
|
|
222
|
-
rowClassName:
|
|
222
|
+
customRow: J,
|
|
223
|
+
rowSelection: q.value,
|
|
224
|
+
rowClassName: U
|
|
223
225
|
}, {
|
|
224
226
|
bodyCell: ({
|
|
225
227
|
column: o,
|
|
@@ -235,27 +237,27 @@ const ae = () => ({
|
|
|
235
237
|
},
|
|
236
238
|
...N,
|
|
237
239
|
// 总结栏插槽
|
|
238
|
-
summary:
|
|
240
|
+
summary: L
|
|
239
241
|
}), M(f(te, {
|
|
240
|
-
class: [
|
|
241
|
-
current:
|
|
242
|
-
"onUpdate:current": (o) =>
|
|
243
|
-
pageSize:
|
|
244
|
-
"onUpdate:pageSize": (o) =>
|
|
242
|
+
class: [K],
|
|
243
|
+
current: v.value.current,
|
|
244
|
+
"onUpdate:current": (o) => v.value.current = o,
|
|
245
|
+
pageSize: v.value.pageSize,
|
|
246
|
+
"onUpdate:pageSize": (o) => v.value.pageSize = o,
|
|
245
247
|
disabled: t.loading,
|
|
246
248
|
"show-size-changer": !0,
|
|
247
249
|
size: "default",
|
|
248
|
-
"hide-on-single-page":
|
|
249
|
-
"show-quick-jumper":
|
|
250
|
-
"default-page-size":
|
|
251
|
-
"page-size-options":
|
|
252
|
-
"show-total":
|
|
253
|
-
total:
|
|
254
|
-
onChange:
|
|
250
|
+
"hide-on-single-page": b.hideOnSinglePage,
|
|
251
|
+
"show-quick-jumper": b.showQuickJumper,
|
|
252
|
+
"default-page-size": b.defaultPageSize,
|
|
253
|
+
"page-size-options": b.pageSizeOptions,
|
|
254
|
+
"show-total": b.showTotal,
|
|
255
|
+
total: v.value.total,
|
|
256
|
+
onChange: D
|
|
255
257
|
}, null), [[Y, t.config.pagination]])]);
|
|
256
258
|
};
|
|
257
259
|
}
|
|
258
260
|
});
|
|
259
261
|
export {
|
|
260
|
-
|
|
262
|
+
ce as default
|
|
261
263
|
};
|
|
@@ -28,6 +28,8 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
|
|
|
28
28
|
type: import("vue").PropType<string[] | undefined>;
|
|
29
29
|
default: () => never[];
|
|
30
30
|
};
|
|
31
|
+
defaultExpandAllRows: import("vue").PropType<boolean | undefined>;
|
|
32
|
+
default: () => boolean;
|
|
31
33
|
}, () => 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<{
|
|
32
34
|
data: {
|
|
33
35
|
type: import("vue").PropType<any>;
|
|
@@ -58,6 +60,8 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
|
|
|
58
60
|
type: import("vue").PropType<string[] | undefined>;
|
|
59
61
|
default: () => never[];
|
|
60
62
|
};
|
|
63
|
+
defaultExpandAllRows: import("vue").PropType<boolean | undefined>;
|
|
64
|
+
default: () => boolean;
|
|
61
65
|
}>> & {
|
|
62
66
|
"onUpdate:keys"?: ((...args: any[]) => any) | undefined;
|
|
63
67
|
}, {
|
package/package.json
CHANGED
|
@@ -22,6 +22,10 @@ export default defineComponent({
|
|
|
22
22
|
fill: {
|
|
23
23
|
type: Boolean,
|
|
24
24
|
default: true
|
|
25
|
+
},
|
|
26
|
+
grid: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: ""
|
|
25
29
|
}
|
|
26
30
|
},
|
|
27
31
|
setup(props, { slots }: any) {
|
|
@@ -40,6 +44,9 @@ export default defineComponent({
|
|
|
40
44
|
// 要填充空白的网格数
|
|
41
45
|
const fillGridItems = ref<number[]>([]);
|
|
42
46
|
|
|
47
|
+
gridValue.value.value =
|
|
48
|
+
props.grid !== "" ? props.grid : gridValue.value.value;
|
|
49
|
+
|
|
43
50
|
// 网格列
|
|
44
51
|
const baseStyle = ref<any>({
|
|
45
52
|
"grid-template-columns": gridValue.value?.value ?? ""
|
|
@@ -48,8 +55,10 @@ export default defineComponent({
|
|
|
48
55
|
//监听屏幕尺寸变化,一般只有人工拉大屏幕尺寸才会触发(默认执行一次)
|
|
49
56
|
useResizeObserver(document.body, () => {
|
|
50
57
|
//TODO 检测浏览器是否被缩放
|
|
51
|
-
//
|
|
52
|
-
|
|
58
|
+
// TODO 使用store 会存在所有的配置均有一个对象bug
|
|
59
|
+
if (props.grid === "") {
|
|
60
|
+
store.gridMatching();
|
|
61
|
+
}
|
|
53
62
|
baseStyle.value["grid-template-columns"] = gridValue.value?.value ?? "";
|
|
54
63
|
// 获取当前设备匹配到显示的列数配置
|
|
55
64
|
const colCount = gridValue.value?.col;
|
|
@@ -47,7 +47,11 @@ const tableProps = () => {
|
|
|
47
47
|
expandedRowKeys: {
|
|
48
48
|
type: Object as PropType<TableProps["expandedRowKeys"]>,
|
|
49
49
|
default: () => []
|
|
50
|
-
}
|
|
50
|
+
},
|
|
51
|
+
defaultExpandAllRows: Boolean as PropType<
|
|
52
|
+
TableProps["defaultExpandAllRows"]
|
|
53
|
+
>,
|
|
54
|
+
default: () => true
|
|
51
55
|
};
|
|
52
56
|
};
|
|
53
57
|
|
|
@@ -141,8 +145,6 @@ const DXTable = defineComponent({
|
|
|
141
145
|
const headerHeight = useEleHeight(
|
|
142
146
|
tableEl.getElementsByClassName("ant-table-header")[0]
|
|
143
147
|
);
|
|
144
|
-
console.log(tableEl.getElementsByClassName("ant-table-header")[0]);
|
|
145
|
-
console.log(headerHeight);
|
|
146
148
|
// 获取分页组件高度
|
|
147
149
|
let paginationHeight = 0;
|
|
148
150
|
if (props.config.pagination) {
|
|
@@ -398,6 +400,7 @@ const DXTable = defineComponent({
|
|
|
398
400
|
}}
|
|
399
401
|
v-model:expandedRowKeys={expandedKeys.value}
|
|
400
402
|
expandRowByClick={expandRowByClick.value}
|
|
403
|
+
defaultExpandAllRows={props.defaultExpandAllRows}
|
|
401
404
|
pagination={false}
|
|
402
405
|
customRow={customRow}
|
|
403
406
|
rowSelection={rowSelection.value}
|