@ditari/bsui 1.0.14 → 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/select/Select.vue.cjs.js +1 -1
- package/dist/cjs/components/table/Table.cjs.js +1 -1
- package/dist/esm/components/select/Select.vue.esm.js +22 -22
- package/dist/esm/components/table/Table.esm.js +2 -4
- package/package.json +1 -1
- package/src/components/select/Select.vue +3 -0
- package/src/components/table/Table.tsx +2 -4
|
@@ -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"),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:()=>{
|
|
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 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,
|
|
@@ -145,16 +145,14 @@ const M = () => ({
|
|
|
145
145
|
};
|
|
146
146
|
return {
|
|
147
147
|
onClick: () => {
|
|
148
|
-
if (!s)
|
|
149
|
-
return;
|
|
150
148
|
const u = i ? i(t) : null;
|
|
151
149
|
u && u.value === l || (clearTimeout(n), n = setTimeout(() => {
|
|
152
|
-
r(), s(t);
|
|
150
|
+
r(), s && s(t);
|
|
153
151
|
}, 200));
|
|
154
152
|
},
|
|
155
153
|
// 点击行
|
|
156
154
|
onDblclick: () => {
|
|
157
|
-
|
|
155
|
+
clearTimeout(n), c && c(t);
|
|
158
156
|
}
|
|
159
157
|
// onContextmenu: (event) => {
|
|
160
158
|
// //TODO
|
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 {
|
|
@@ -277,7 +277,6 @@ const DXTable = defineComponent({
|
|
|
277
277
|
|
|
278
278
|
return {
|
|
279
279
|
onClick: () => {
|
|
280
|
-
if (!click) return;
|
|
281
280
|
const rs = getCheckboxProps ? getCheckboxProps(record) : null;
|
|
282
281
|
if (rs && rs.value === id) {
|
|
283
282
|
return;
|
|
@@ -287,14 +286,13 @@ const DXTable = defineComponent({
|
|
|
287
286
|
// 处理单击事件业务
|
|
288
287
|
onClick();
|
|
289
288
|
// 回传数据 自定义单击后的业务
|
|
290
|
-
click(record);
|
|
289
|
+
click ? click(record) : undefined;
|
|
291
290
|
}, 200);
|
|
292
291
|
}, // 点击行
|
|
293
292
|
onDblclick: () => {
|
|
294
|
-
if (!dbClick) return;
|
|
295
293
|
clearTimeout(clickTimeout);
|
|
296
294
|
// 回传数据 自定义单击后的业务
|
|
297
|
-
dbClick(record);
|
|
295
|
+
dbClick ? dbClick(record) : undefined;
|
|
298
296
|
}
|
|
299
297
|
// onContextmenu: (event) => {
|
|
300
298
|
// //TODO
|