@ditari/bsui 1.0.6 → 1.0.7
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/select/dic-worker.cjs.js +1 -0
- package/dist/esm/components/select/Select.vue.esm.js +58 -101
- package/dist/esm/components/select/dic-worker.esm.js +12 -0
- package/dist/esm/components/select/index.d.ts +58 -39
- package/package.json +1 -1
- package/src/components/select/Select.vue +17 -5
- package/dist/esm/assets/dic-worker-3d338b91.js +0 -1
|
@@ -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"),w=require("../../store/modules/DataDictionary.cjs.js"),D=require("./dic-worker.cjs.js"),_={name:"DSelect"},C=e.defineComponent({..._,props:{value:{default:null},name:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"请填写默认占位符啊!老铁"}},emits:["update:value","change"],setup(n,{emit:d}){const r=n,{getDicByKey:p,list:S}=w.useDataDicStore(),{modelValue:c,data:v,onSearch:h,onSelect:m}=g();function g(){let s=!0,a=[];const l=e.ref(a),o=e.ref(r.value),u=new D.default;u.onerror=()=>{s=!1,a=p(r.name)},u.onmessage=t=>{l.value=[...t.data]},i(o.value);const b=t=>{s?i(t):l.value=a.filter(f=>f.value.toLowerCase().indexOf(t.toLowerCase())!==-1||f.label.toLowerCase().includes(t.toLowerCase())).splice(0,10)};function i(t){u.postMessage({list:JSON.stringify(S[r.name]),keywords:t})}return{data:l,modelValue:o,onSearch:b,onSelect:t=>{d("update:value",t),d("change",t)}}}return(s,a)=>{const l=e.resolveComponent("a-select");return e.openBlock(),e.createBlock(l,{value:e.unref(c),"onUpdate:value":a[0]||(a[0]=o=>e.isRef(c)?c.value=o:null),"allow-clear":"","show-search":"","filter-option":!1,options:e.unref(v),placeholder:n.placeholder,disabled:n.disabled,onSelect:e.unref(m),onSearch:e.unref(h)},null,8,["value","options","placeholder","disabled","onSelect","onSearch"])}}});exports.default=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24oZSl7Y29uc3Qgcz1lLmRhdGEua2V5d29yZHN8fCIiLHQ9SlNPTi5wYXJzZShlLmRhdGEubGlzdCksYT10LmZpbHRlcihvPT5vLnZhbHVlLnRvTG93ZXJDYXNlKCkuaW5kZXhPZihzLnRvTG93ZXJDYXNlKCkpIT09LTF8fG8ubGFiZWwudG9Mb3dlckNhc2UoKS5pbmNsdWRlcyhzLnRvTG93ZXJDYXNlKCkpKTthLmxlbmd0aD09PTA/c2VsZi5wb3N0TWVzc2FnZSh0LnNwbGljZSgwLDEwKSk6c2VsZi5wb3N0TWVzc2FnZShhLnNwbGljZSgwLDEwKSl9LCExKX0pKCk7Cg==",n=typeof window<"u"&&window.Blob&&new Blob([atob(l)],{type:"text/javascript;charset=utf-8"});function t(){const e=n&&(window.URL||window.webkitURL).createObjectURL(n);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+l)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}exports.default=t;
|
|
@@ -1,105 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { defineComponent as b, ref as p, resolveComponent as D, openBlock as _, createBlock as k, unref as l, isRef as B } from "vue";
|
|
2
|
+
import { useDataDicStore as L } from "../../store/modules/DataDictionary.esm.js";
|
|
3
|
+
import x from "./dic-worker.esm.js";
|
|
4
|
+
const V = {
|
|
5
|
+
name: "DSelect"
|
|
6
|
+
}, K = /* @__PURE__ */ b({
|
|
7
|
+
...V,
|
|
8
|
+
props: {
|
|
9
|
+
value: { default: null },
|
|
10
|
+
name: { default: "" },
|
|
11
|
+
disabled: { type: Boolean, default: !1 },
|
|
12
|
+
placeholder: { default: "请填写默认占位符啊!老铁" }
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
new URL("/assets/dic-worker-3d338b91.js", self.location),
|
|
34
|
-
{
|
|
35
|
-
type: "module"
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
(u.onerror = () => {
|
|
39
|
-
(c = !1), (a = m(s.name));
|
|
40
|
-
}),
|
|
41
|
-
(u.onmessage = (e) => {
|
|
42
|
-
o.value = [...e.data];
|
|
43
|
-
}),
|
|
44
|
-
i(l.value);
|
|
45
|
-
const g = (e) => {
|
|
46
|
-
c
|
|
47
|
-
? i(e)
|
|
48
|
-
: (o.value = a
|
|
49
|
-
.filter(
|
|
50
|
-
(f) =>
|
|
51
|
-
f.value.toLowerCase().indexOf(e.toLowerCase()) !== -1 ||
|
|
52
|
-
f.label.toLowerCase().includes(e.toLowerCase())
|
|
53
|
-
)
|
|
54
|
-
.splice(0, 10));
|
|
55
|
-
};
|
|
56
|
-
function i(e) {
|
|
57
|
-
u.postMessage({
|
|
58
|
-
list: JSON.stringify(S[s.name]),
|
|
59
|
-
keywords: e
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
data: o,
|
|
64
|
-
modelValue: l,
|
|
65
|
-
onSearch: g,
|
|
66
|
-
onSelect: (e) => {
|
|
67
|
-
d("update:value", e), d("change", e);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
14
|
+
emits: ["update:value", "change"],
|
|
15
|
+
setup(n, { emit: d }) {
|
|
16
|
+
const r = n, { getDicByKey: m, list: S } = L(), { modelValue: c, data: h, onSearch: v, onSelect: w } = g();
|
|
17
|
+
function g() {
|
|
18
|
+
let s = !0, a = [];
|
|
19
|
+
const o = p(a), t = p(r.value), u = new x();
|
|
20
|
+
u.onerror = () => {
|
|
21
|
+
s = !1, a = m(r.name);
|
|
22
|
+
}, u.onmessage = (e) => {
|
|
23
|
+
o.value = [...e.data];
|
|
24
|
+
}, i(t.value);
|
|
25
|
+
const C = (e) => {
|
|
26
|
+
s ? i(e) : o.value = a.filter((f) => f.value.toLowerCase().indexOf(e.toLowerCase()) !== -1 || f.label.toLowerCase().includes(e.toLowerCase())).splice(0, 10);
|
|
27
|
+
};
|
|
28
|
+
function i(e) {
|
|
29
|
+
u.postMessage({
|
|
30
|
+
list: JSON.stringify(S[r.name]),
|
|
31
|
+
keywords: e
|
|
32
|
+
});
|
|
70
33
|
}
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
value: t(r),
|
|
79
|
-
"onUpdate:value":
|
|
80
|
-
a[0] || (a[0] = (l) => (_(r) ? (r.value = l) : null)),
|
|
81
|
-
"allow-clear": "",
|
|
82
|
-
"show-search": "",
|
|
83
|
-
"filter-option": !1,
|
|
84
|
-
options: t(h),
|
|
85
|
-
placeholder: n.placeholder,
|
|
86
|
-
disabled: n.disabled,
|
|
87
|
-
onSelect: t(w),
|
|
88
|
-
onSearch: t(v)
|
|
89
|
-
},
|
|
90
|
-
null,
|
|
91
|
-
8,
|
|
92
|
-
[
|
|
93
|
-
"value",
|
|
94
|
-
"options",
|
|
95
|
-
"placeholder",
|
|
96
|
-
"disabled",
|
|
97
|
-
"onSelect",
|
|
98
|
-
"onSearch"
|
|
99
|
-
]
|
|
100
|
-
)
|
|
101
|
-
);
|
|
34
|
+
return {
|
|
35
|
+
data: o,
|
|
36
|
+
modelValue: t,
|
|
37
|
+
onSearch: C,
|
|
38
|
+
onSelect: (e) => {
|
|
39
|
+
d("update:value", e), d("change", e);
|
|
40
|
+
}
|
|
102
41
|
};
|
|
103
42
|
}
|
|
104
|
-
|
|
105
|
-
|
|
43
|
+
return (s, a) => {
|
|
44
|
+
const o = D("a-select");
|
|
45
|
+
return _(), k(o, {
|
|
46
|
+
value: l(c),
|
|
47
|
+
"onUpdate:value": a[0] || (a[0] = (t) => B(c) ? c.value = t : null),
|
|
48
|
+
"allow-clear": "",
|
|
49
|
+
"show-search": "",
|
|
50
|
+
"filter-option": !1,
|
|
51
|
+
options: l(h),
|
|
52
|
+
placeholder: n.placeholder,
|
|
53
|
+
disabled: n.disabled,
|
|
54
|
+
onSelect: l(w),
|
|
55
|
+
onSearch: l(v)
|
|
56
|
+
}, null, 8, ["value", "options", "placeholder", "disabled", "onSelect", "onSearch"]);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
K as default
|
|
62
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const e = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24oZSl7Y29uc3Qgcz1lLmRhdGEua2V5d29yZHN8fCIiLHQ9SlNPTi5wYXJzZShlLmRhdGEubGlzdCksYT10LmZpbHRlcihvPT5vLnZhbHVlLnRvTG93ZXJDYXNlKCkuaW5kZXhPZihzLnRvTG93ZXJDYXNlKCkpIT09LTF8fG8ubGFiZWwudG9Mb3dlckNhc2UoKS5pbmNsdWRlcyhzLnRvTG93ZXJDYXNlKCkpKTthLmxlbmd0aD09PTA/c2VsZi5wb3N0TWVzc2FnZSh0LnNwbGljZSgwLDEwKSk6c2VsZi5wb3N0TWVzc2FnZShhLnNwbGljZSgwLDEwKSl9LCExKX0pKCk7Cg==", b = typeof window < "u" && window.Blob && new Blob([atob(e)], { type: "text/javascript;charset=utf-8" });
|
|
2
|
+
function l() {
|
|
3
|
+
const n = b && (window.URL || window.webkitURL).createObjectURL(b);
|
|
4
|
+
try {
|
|
5
|
+
return n ? new Worker(n) : new Worker("data:application/javascript;base64," + e);
|
|
6
|
+
} finally {
|
|
7
|
+
n && (window.URL || window.webkitURL).revokeObjectURL(n);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
l as default
|
|
12
|
+
};
|
|
@@ -1,52 +1,71 @@
|
|
|
1
|
-
export declare const DSelect: import("../../utils/install").SFCWithInstall<
|
|
2
|
-
|
|
1
|
+
export declare const DSelect: import("../../utils/install").SFCWithInstall<
|
|
2
|
+
import("vue").DefineComponent<
|
|
3
|
+
{
|
|
4
|
+
value: {
|
|
3
5
|
type: import("vue").PropType<any>;
|
|
4
6
|
required: true;
|
|
5
7
|
default: null;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
};
|
|
9
|
+
name: {
|
|
8
10
|
type: import("vue").PropType<string>;
|
|
9
11
|
required: true;
|
|
10
12
|
default: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
};
|
|
14
|
+
disabled: {
|
|
13
15
|
type: import("vue").PropType<boolean | undefined>;
|
|
14
16
|
required: false;
|
|
15
17
|
default: boolean;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
};
|
|
19
|
+
placeholder: {
|
|
18
20
|
type: import("vue").PropType<string | undefined>;
|
|
19
21
|
required: false;
|
|
20
22
|
default: string;
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
{},
|
|
26
|
+
unknown,
|
|
27
|
+
{},
|
|
28
|
+
{},
|
|
29
|
+
import("vue").ComponentOptionsMixin,
|
|
30
|
+
import("vue").ComponentOptionsMixin,
|
|
31
|
+
("update:value" | "change")[],
|
|
32
|
+
"update:value" | "change",
|
|
33
|
+
import("vue").VNodeProps &
|
|
34
|
+
import("vue").AllowedComponentProps &
|
|
35
|
+
import("vue").ComponentCustomProps,
|
|
36
|
+
Readonly<
|
|
37
|
+
import("vue").ExtractPropTypes<{
|
|
38
|
+
value: {
|
|
39
|
+
type: import("vue").PropType<any>;
|
|
40
|
+
required: true;
|
|
41
|
+
default: null;
|
|
42
|
+
};
|
|
43
|
+
name: {
|
|
44
|
+
type: import("vue").PropType<string>;
|
|
45
|
+
required: true;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
disabled: {
|
|
49
|
+
type: import("vue").PropType<boolean | undefined>;
|
|
50
|
+
required: false;
|
|
51
|
+
default: boolean;
|
|
52
|
+
};
|
|
53
|
+
placeholder: {
|
|
54
|
+
type: import("vue").PropType<string | undefined>;
|
|
55
|
+
required: false;
|
|
56
|
+
default: string;
|
|
57
|
+
};
|
|
58
|
+
}>
|
|
59
|
+
> & {
|
|
60
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
61
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: string;
|
|
65
|
+
value: any;
|
|
66
|
+
disabled: boolean | undefined;
|
|
67
|
+
placeholder: string | undefined;
|
|
68
|
+
}
|
|
69
|
+
>
|
|
70
|
+
>;
|
|
52
71
|
export default DSelect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { ref } from "vue";
|
|
3
3
|
import { useDataDicStore } from "../../store/modules/DataDictionary";
|
|
4
|
+
import DicWorker from "./dic-worker?worker&inline";
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
value: any;
|
|
@@ -33,9 +34,20 @@ function useSelect() {
|
|
|
33
34
|
// 取值
|
|
34
35
|
const modelValue = ref(props.value);
|
|
35
36
|
// 创建worker
|
|
36
|
-
const worker = new
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const worker = new DicWorker();
|
|
38
|
+
// const worker = new Worker(
|
|
39
|
+
// new URL("./worker?worker&inline", import.meta.url),
|
|
40
|
+
// {
|
|
41
|
+
// type: "module",
|
|
42
|
+
// credentials: "include"
|
|
43
|
+
// }
|
|
44
|
+
// );
|
|
45
|
+
// const worker = new Worker(
|
|
46
|
+
// new URL("./dic-worker.ts?worker&inline", import.meta.url),
|
|
47
|
+
// {
|
|
48
|
+
// type: "module"
|
|
49
|
+
// }
|
|
50
|
+
// );
|
|
39
51
|
/**
|
|
40
52
|
* web worker 启动失败
|
|
41
53
|
*/
|
|
@@ -48,7 +60,7 @@ function useSelect() {
|
|
|
48
60
|
* 监听web worker发送的数据
|
|
49
61
|
* @param e
|
|
50
62
|
*/
|
|
51
|
-
worker.onmessage = (e) => {
|
|
63
|
+
worker.onmessage = (e: any) => {
|
|
52
64
|
// 赋值给下拉选择数据变量
|
|
53
65
|
data.value = [...e.data];
|
|
54
66
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(){"use strict";self.addEventListener("message",function(e){const s=e.data.keywords||"",t=JSON.parse(e.data.list),a=t.filter(o=>o.value.toLowerCase().indexOf(s.toLowerCase())!==-1||o.label.toLowerCase().includes(s.toLowerCase()));a.length===0?self.postMessage(t.splice(0,10)):self.postMessage(a.splice(0,10))},!1)})();
|