@ditari/bsui 1.0.21 → 1.0.22
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 +0 -2
- package/dist/cjs/components/table/index.d.ts +0 -2
- package/dist/cjs/directive/trim.cjs.js +1 -1
- package/dist/cjs/directive/trim.d.ts +2 -1
- package/dist/esm/components/table/Table.d.ts +0 -2
- package/dist/esm/components/table/Table.esm.js +14 -15
- package/dist/esm/components/table/index.d.ts +0 -2
- package/dist/esm/directive/trim.d.ts +2 -1
- package/dist/esm/directive/trim.esm.js +14 -5
- package/package.json +1 -1
- package/src/components/table/Table.tsx +0 -1
- package/src/directive/trim.ts +14 -4
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,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:H}=q();function q(){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:H},{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;
|
|
@@ -15,7 +15,6 @@ declare const DXTable: import("vue").DefineComponent<{
|
|
|
15
15
|
keys: PropType<Key[] | undefined>;
|
|
16
16
|
rowKey: {
|
|
17
17
|
type: PropType<string>;
|
|
18
|
-
required: boolean;
|
|
19
18
|
default: string;
|
|
20
19
|
};
|
|
21
20
|
loading: {
|
|
@@ -42,7 +41,6 @@ declare const DXTable: import("vue").DefineComponent<{
|
|
|
42
41
|
keys: PropType<Key[] | undefined>;
|
|
43
42
|
rowKey: {
|
|
44
43
|
type: PropType<string>;
|
|
45
|
-
required: boolean;
|
|
46
44
|
default: string;
|
|
47
45
|
};
|
|
48
46
|
loading: {
|
|
@@ -10,7 +10,6 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
|
|
|
10
10
|
keys: import("vue").PropType<import("./interface/table").Key[] | undefined>;
|
|
11
11
|
rowKey: {
|
|
12
12
|
type: import("vue").PropType<string>;
|
|
13
|
-
required: boolean;
|
|
14
13
|
default: string;
|
|
15
14
|
};
|
|
16
15
|
loading: {
|
|
@@ -37,7 +36,6 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
|
|
|
37
36
|
keys: import("vue").PropType<import("./interface/table").Key[] | undefined>;
|
|
38
37
|
rowKey: {
|
|
39
38
|
type: import("vue").PropType<string>;
|
|
40
|
-
required: boolean;
|
|
41
39
|
default: string;
|
|
42
40
|
};
|
|
43
41
|
loading: {
|
|
@@ -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 o={mounted(u,e){u.addEventListener("input",()=>{var t,l;const a=u.value.trim().replace(/\s+/g,"");u.value=a,e.value=a,(l=(t=e==null?void 0:e.instance)==null?void 0:t.$emit)==null||l.call(t,"update:modelValue",a)})}};exports.default=o;
|
|
@@ -15,7 +15,6 @@ declare const DXTable: import("vue").DefineComponent<{
|
|
|
15
15
|
keys: PropType<Key[] | undefined>;
|
|
16
16
|
rowKey: {
|
|
17
17
|
type: PropType<string>;
|
|
18
|
-
required: boolean;
|
|
19
18
|
default: string;
|
|
20
19
|
};
|
|
21
20
|
loading: {
|
|
@@ -42,7 +41,6 @@ declare const DXTable: import("vue").DefineComponent<{
|
|
|
42
41
|
keys: PropType<Key[] | undefined>;
|
|
43
42
|
rowKey: {
|
|
44
43
|
type: PropType<string>;
|
|
45
|
-
required: boolean;
|
|
46
44
|
default: string;
|
|
47
45
|
};
|
|
48
46
|
loading: {
|
|
@@ -14,7 +14,6 @@ const M = () => ({
|
|
|
14
14
|
keys: Array,
|
|
15
15
|
rowKey: {
|
|
16
16
|
type: String,
|
|
17
|
-
required: !0,
|
|
18
17
|
default: "id"
|
|
19
18
|
},
|
|
20
19
|
loading: {
|
|
@@ -66,10 +65,10 @@ const M = () => ({
|
|
|
66
65
|
keepSelected: n,
|
|
67
66
|
selection: d,
|
|
68
67
|
onPageChange: s
|
|
69
|
-
} = a.config, c = v(), o = v(null), i = v(), l = v(null),
|
|
70
|
-
var
|
|
68
|
+
} = a.config, c = v(), o = v(null), i = v(), l = v(null), g = (h) => {
|
|
69
|
+
var r, k;
|
|
71
70
|
try {
|
|
72
|
-
const m = (
|
|
71
|
+
const m = (r = o == null ? void 0 : o.value) == null ? void 0 : r.$el, A = R(m.getElementsByClassName("ant-table-header")[0]);
|
|
73
72
|
let N = 0;
|
|
74
73
|
if (a.config.pagination) {
|
|
75
74
|
const J = (k = c.value) == null ? void 0 : k.getElementsByClassName(T)[0];
|
|
@@ -82,19 +81,19 @@ const M = () => ({
|
|
|
82
81
|
};
|
|
83
82
|
return U(() => {
|
|
84
83
|
a.height !== 0 && F(() => {
|
|
85
|
-
|
|
84
|
+
g(a.height);
|
|
86
85
|
});
|
|
87
86
|
}), {
|
|
88
87
|
tableRef: o,
|
|
89
88
|
tableRootRef: c,
|
|
90
89
|
tableHeight: i,
|
|
91
|
-
onPageChange: (h,
|
|
90
|
+
onPageChange: (h, r) => {
|
|
92
91
|
s && s({
|
|
93
92
|
page: h,
|
|
94
|
-
size:
|
|
93
|
+
size: r
|
|
95
94
|
}), l.value.scrollTop = 0, (d === "S" || !n) && (e.value = [], w("update:keys", e.value));
|
|
96
95
|
},
|
|
97
|
-
onRowClassName: (h,
|
|
96
|
+
onRowClassName: (h, r) => t ? t(h, r) : void 0
|
|
98
97
|
};
|
|
99
98
|
}
|
|
100
99
|
const j = D();
|
|
@@ -111,8 +110,8 @@ const M = () => ({
|
|
|
111
110
|
const s = (o, i) => {
|
|
112
111
|
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
112
|
}, c = (o, i, l) => {
|
|
114
|
-
const
|
|
115
|
-
e.value = o ? e.value.concat(
|
|
113
|
+
const g = l.map((u) => u[t]);
|
|
114
|
+
e.value = o ? e.value.concat(g) : e.value.filter((u) => !g.includes(u)), w("update:keys", e.value);
|
|
116
115
|
};
|
|
117
116
|
return I(() => a.keys, (o) => {
|
|
118
117
|
e.value = o;
|
|
@@ -126,8 +125,8 @@ const M = () => ({
|
|
|
126
125
|
getCheckboxProps: d
|
|
127
126
|
};
|
|
128
127
|
}
|
|
129
|
-
const
|
|
130
|
-
function
|
|
128
|
+
const $ = q();
|
|
129
|
+
function q() {
|
|
131
130
|
return (t) => {
|
|
132
131
|
let n;
|
|
133
132
|
const {
|
|
@@ -138,7 +137,7 @@ const M = () => ({
|
|
|
138
137
|
selection: o,
|
|
139
138
|
getCheckboxProps: i
|
|
140
139
|
}
|
|
141
|
-
} = a, l = t[d],
|
|
140
|
+
} = a, l = t[d], g = () => {
|
|
142
141
|
if (o === "N")
|
|
143
142
|
return;
|
|
144
143
|
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);
|
|
@@ -147,7 +146,7 @@ const M = () => ({
|
|
|
147
146
|
onClick: () => {
|
|
148
147
|
const u = i ? i(t) : null;
|
|
149
148
|
u && u.value === l || (clearTimeout(n), n = setTimeout(() => {
|
|
150
|
-
|
|
149
|
+
g(), s && s(t);
|
|
151
150
|
}, 200));
|
|
152
151
|
},
|
|
153
152
|
// 点击行
|
|
@@ -184,7 +183,7 @@ const M = () => ({
|
|
|
184
183
|
y: O.value + "px"
|
|
185
184
|
},
|
|
186
185
|
pagination: !1,
|
|
187
|
-
customRow:
|
|
186
|
+
customRow: $,
|
|
188
187
|
rowSelection: j,
|
|
189
188
|
rowClassName: H
|
|
190
189
|
}, {
|
|
@@ -10,7 +10,6 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
|
|
|
10
10
|
keys: import("vue").PropType<import("./interface/table").Key[] | undefined>;
|
|
11
11
|
rowKey: {
|
|
12
12
|
type: import("vue").PropType<string>;
|
|
13
|
-
required: boolean;
|
|
14
13
|
default: string;
|
|
15
14
|
};
|
|
16
15
|
loading: {
|
|
@@ -37,7 +36,6 @@ export declare const DTable: import("../../utils/install").SFCWithInstall<import
|
|
|
37
36
|
keys: import("vue").PropType<import("./interface/table").Key[] | undefined>;
|
|
38
37
|
rowKey: {
|
|
39
38
|
type: import("vue").PropType<string>;
|
|
40
|
-
required: boolean;
|
|
41
39
|
default: string;
|
|
42
40
|
};
|
|
43
41
|
loading: {
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
const
|
|
2
|
-
mounted(
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const s = {
|
|
2
|
+
// mounted(el: HTMLInputElement) {
|
|
3
|
+
// // 监听 input 事件
|
|
4
|
+
// el.addEventListener("input", () => {
|
|
5
|
+
// // 修改 input 的值为去除空格后的值
|
|
6
|
+
// el.value = el.value.trim().replace(/\s+/g, "");
|
|
7
|
+
// });
|
|
8
|
+
// },
|
|
9
|
+
mounted(a, e) {
|
|
10
|
+
a.addEventListener("input", () => {
|
|
11
|
+
var t, l;
|
|
12
|
+
const u = a.value.trim().replace(/\s+/g, "");
|
|
13
|
+
a.value = u, e.value = u, (l = (t = e == null ? void 0 : e.instance) == null ? void 0 : t.$emit) == null || l.call(t, "update:modelValue", u);
|
|
5
14
|
});
|
|
6
15
|
}
|
|
7
16
|
};
|
|
8
17
|
export {
|
|
9
|
-
|
|
18
|
+
s as default
|
|
10
19
|
};
|
package/package.json
CHANGED
package/src/directive/trim.ts
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
import { DirectiveBinding } from "vue";
|
|
2
|
+
|
|
1
3
|
const vTrim = {
|
|
2
|
-
mounted(el: HTMLInputElement) {
|
|
3
|
-
|
|
4
|
+
// mounted(el: HTMLInputElement) {
|
|
5
|
+
// // 监听 input 事件
|
|
6
|
+
// el.addEventListener("input", () => {
|
|
7
|
+
// // 修改 input 的值为去除空格后的值
|
|
8
|
+
// el.value = el.value.trim().replace(/\s+/g, "");
|
|
9
|
+
// });
|
|
10
|
+
// },
|
|
11
|
+
mounted(el: HTMLInputElement, binding: DirectiveBinding<any>) {
|
|
4
12
|
el.addEventListener("input", () => {
|
|
5
|
-
|
|
6
|
-
el.value =
|
|
13
|
+
const value = el.value.trim().replace(/\s+/g, "");
|
|
14
|
+
el.value = value;
|
|
15
|
+
binding.value = value;
|
|
16
|
+
binding?.instance?.$emit?.("update:modelValue", value);
|
|
7
17
|
});
|
|
8
18
|
}
|
|
9
19
|
};
|