@ditari/bsui 1.0.15 → 1.0.17
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/Select.vue.d.ts +11 -0
- package/dist/cjs/components/select/dic.worker.cjs.js +1 -1
- package/dist/cjs/components/select/index.d.ts +11 -0
- package/dist/esm/components/select/Select.vue.d.ts +11 -0
- package/dist/esm/components/select/Select.vue.esm.js +21 -19
- package/dist/esm/components/select/dic.worker.esm.js +6 -6
- package/dist/esm/components/select/index.d.ts +11 -0
- package/package.json +1 -1
- package/src/components/select/Select.vue +6 -16
- package/src/components/select/dic.worker.ts +10 -3
|
@@ -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"},
|
|
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"},y=e.defineComponent({...D,props:{value:{default:null},name:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"请填写默认占位符啊!老铁"},include:{default:[]}},emits:["update:value","change"],setup(u,{emit:r}){const o=u,{getDicByKey:p,list:S}=_.useDataDicStore(),{modelValue:c,data:h,onSearch:v,onSelect:g,onChange:m}=C();function C(){let s=!0,n=[];const t=e.ref(n),l=e.ref(o.value),d=new b.default;d.onerror=()=>{s=!1,n=p(o.name)},d.onmessage=a=>{t.value=[...a.data]},i(l.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(S[o.name]),keywords:a,include:JSON.stringify(o.include??[])})}return{data:t,modelValue:l,onSearch:w,onSelect:a=>{r("update:value",a)},onChange:()=>{r("update:value",l.value),r("change",l.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]=l=>e.isRef(c)?c.value=l:null),"allow-clear":"","show-search":"","filter-option":!1,options:e.unref(h),placeholder:u.placeholder,disabled:u.disabled,onSelect:e.unref(g),onSearch:e.unref(v),onChange:e.unref(m)},null,8,["value","options","placeholder","disabled","onSelect","onSearch","onChange"])}}});exports.default=y;
|
|
@@ -20,6 +20,11 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
20
20
|
required: false;
|
|
21
21
|
default: string;
|
|
22
22
|
};
|
|
23
|
+
include: {
|
|
24
|
+
type: __PropType<(string | number)[] | undefined>;
|
|
25
|
+
required: false;
|
|
26
|
+
default: any;
|
|
27
|
+
};
|
|
23
28
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "change")[], "update:value" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
29
|
value: {
|
|
25
30
|
type: __PropType<any>;
|
|
@@ -41,6 +46,11 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
41
46
|
required: false;
|
|
42
47
|
default: string;
|
|
43
48
|
};
|
|
49
|
+
include: {
|
|
50
|
+
type: __PropType<(string | number)[] | undefined>;
|
|
51
|
+
required: false;
|
|
52
|
+
default: any;
|
|
53
|
+
};
|
|
44
54
|
}>> & {
|
|
45
55
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
46
56
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
@@ -49,5 +59,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
49
59
|
value: any;
|
|
50
60
|
disabled: boolean | undefined;
|
|
51
61
|
placeholder: string | undefined;
|
|
62
|
+
include: (string | number)[] | undefined;
|
|
52
63
|
}>;
|
|
53
64
|
export default _sfc_main;
|
|
@@ -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="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24odCl7Y29uc3QgbD10LmRhdGEua2V5d29yZHM/PyIiO2xldCBlPUpTT04ucGFyc2UodC5kYXRhLmxpc3QpPz9bXTtjb25zdCBhPUpTT04ucGFyc2UodC5kYXRhLmluY2x1ZGUpO2EubGVuZ3RoPjAmJihlPWUuZmlsdGVyKHM9PmEuc29tZShpPT5pPT09cy52YWx1ZSkpKTtjb25zdCBvPWUuZmlsdGVyKHM9PnMudmFsdWUudG9Mb3dlckNhc2UoKS5pbmRleE9mKGwudG9Mb3dlckNhc2UoKSkhPT0tMXx8cy5sYWJlbC50b0xvd2VyQ2FzZSgpLmluY2x1ZGVzKGwudG9Mb3dlckNhc2UoKSkpO28ubGVuZ3RoPT09MD9zZWxmLnBvc3RNZXNzYWdlKGUuc3BsaWNlKDAsMTApKTpzZWxmLnBvc3RNZXNzYWdlKG8uc3BsaWNlKDAsMTApKX0sITEpfSkoKTsK",d=typeof window<"u"&&window.Blob&&new Blob([atob(o)],{type:"text/javascript;charset=utf-8"});function c(){const e=d&&(window.URL||window.webkitURL).createObjectURL(d);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+o)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}exports.default=c;
|
|
@@ -19,6 +19,11 @@ export declare const DSelect: import("../../utils/install").SFCWithInstall<impor
|
|
|
19
19
|
required: false;
|
|
20
20
|
default: string;
|
|
21
21
|
};
|
|
22
|
+
include: {
|
|
23
|
+
type: import("vue").PropType<(string | number)[] | undefined>;
|
|
24
|
+
required: false;
|
|
25
|
+
default: any;
|
|
26
|
+
};
|
|
22
27
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "change")[], "update:value" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
28
|
value: {
|
|
24
29
|
type: import("vue").PropType<any>;
|
|
@@ -40,6 +45,11 @@ export declare const DSelect: import("../../utils/install").SFCWithInstall<impor
|
|
|
40
45
|
required: false;
|
|
41
46
|
default: string;
|
|
42
47
|
};
|
|
48
|
+
include: {
|
|
49
|
+
type: import("vue").PropType<(string | number)[] | undefined>;
|
|
50
|
+
required: false;
|
|
51
|
+
default: any;
|
|
52
|
+
};
|
|
43
53
|
}>> & {
|
|
44
54
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
45
55
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
@@ -48,5 +58,6 @@ export declare const DSelect: import("../../utils/install").SFCWithInstall<impor
|
|
|
48
58
|
value: any;
|
|
49
59
|
disabled: boolean | undefined;
|
|
50
60
|
placeholder: string | undefined;
|
|
61
|
+
include: (string | number)[] | undefined;
|
|
51
62
|
}>>;
|
|
52
63
|
export default DSelect;
|
|
@@ -20,6 +20,11 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
20
20
|
required: false;
|
|
21
21
|
default: string;
|
|
22
22
|
};
|
|
23
|
+
include: {
|
|
24
|
+
type: __PropType<(string | number)[] | undefined>;
|
|
25
|
+
required: false;
|
|
26
|
+
default: any;
|
|
27
|
+
};
|
|
23
28
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "change")[], "update:value" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
29
|
value: {
|
|
25
30
|
type: __PropType<any>;
|
|
@@ -41,6 +46,11 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
41
46
|
required: false;
|
|
42
47
|
default: string;
|
|
43
48
|
};
|
|
49
|
+
include: {
|
|
50
|
+
type: __PropType<(string | number)[] | undefined>;
|
|
51
|
+
required: false;
|
|
52
|
+
default: any;
|
|
53
|
+
};
|
|
44
54
|
}>> & {
|
|
45
55
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
46
56
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
@@ -49,5 +59,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
49
59
|
value: any;
|
|
50
60
|
disabled: boolean | undefined;
|
|
51
61
|
placeholder: string | undefined;
|
|
62
|
+
include: (string | number)[] | undefined;
|
|
52
63
|
}>;
|
|
53
64
|
export default _sfc_main;
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { defineComponent as D, ref as
|
|
1
|
+
import { defineComponent as D, ref as p, 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
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import y from "./dic.worker.esm.js";
|
|
4
|
+
const O = {
|
|
5
5
|
name: "DSelect"
|
|
6
|
-
},
|
|
7
|
-
...
|
|
6
|
+
}, M = /* @__PURE__ */ D({
|
|
7
|
+
...O,
|
|
8
8
|
props: {
|
|
9
9
|
value: { default: null },
|
|
10
10
|
name: { default: "" },
|
|
11
11
|
disabled: { type: Boolean, default: !1 },
|
|
12
|
-
placeholder: { default: "请填写默认占位符啊!老铁" }
|
|
12
|
+
placeholder: { default: "请填写默认占位符啊!老铁" },
|
|
13
|
+
include: { default: [] }
|
|
13
14
|
},
|
|
14
15
|
emits: ["update:value", "change"],
|
|
15
|
-
setup(
|
|
16
|
-
const
|
|
16
|
+
setup(r, { emit: c }) {
|
|
17
|
+
const t = r, { getDicByKey: h, list: S } = x(), { modelValue: s, data: m, onSearch: v, onSelect: g, onChange: C } = w();
|
|
17
18
|
function w() {
|
|
18
19
|
let u = !0, a = [];
|
|
19
|
-
const l =
|
|
20
|
+
const l = p(a), o = p(t.value), d = new y();
|
|
20
21
|
d.onerror = () => {
|
|
21
|
-
u = !1, a = h(
|
|
22
|
+
u = !1, a = h(t.name);
|
|
22
23
|
}, d.onmessage = (e) => {
|
|
23
24
|
l.value = [...e.data];
|
|
24
25
|
}, i(o.value);
|
|
25
26
|
const b = (e) => {
|
|
26
|
-
u ? i(e) : l.value = a.filter((
|
|
27
|
+
u ? i(e) : l.value = a.filter((f) => f.value.toLowerCase().indexOf(e.toLowerCase()) !== -1 || f.label.toLowerCase().includes(e.toLowerCase())).splice(0, 10);
|
|
27
28
|
};
|
|
28
29
|
function i(e) {
|
|
29
30
|
d.postMessage({
|
|
30
|
-
list: JSON.stringify(
|
|
31
|
-
keywords: e
|
|
31
|
+
list: JSON.stringify(S[t.name]),
|
|
32
|
+
keywords: e,
|
|
33
|
+
include: JSON.stringify(t.include ?? [])
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
return {
|
|
@@ -36,10 +38,10 @@ const W = {
|
|
|
36
38
|
modelValue: o,
|
|
37
39
|
onSearch: b,
|
|
38
40
|
onSelect: (e) => {
|
|
39
|
-
|
|
41
|
+
c("update:value", e);
|
|
40
42
|
},
|
|
41
43
|
onChange: () => {
|
|
42
|
-
|
|
44
|
+
c("update:value", o.value), c("change", o.value);
|
|
43
45
|
}
|
|
44
46
|
};
|
|
45
47
|
}
|
|
@@ -51,9 +53,9 @@ const W = {
|
|
|
51
53
|
"allow-clear": "",
|
|
52
54
|
"show-search": "",
|
|
53
55
|
"filter-option": !1,
|
|
54
|
-
options: n(
|
|
55
|
-
placeholder:
|
|
56
|
-
disabled:
|
|
56
|
+
options: n(m),
|
|
57
|
+
placeholder: r.placeholder,
|
|
58
|
+
disabled: r.disabled,
|
|
57
59
|
onSelect: n(g),
|
|
58
60
|
onSearch: n(v),
|
|
59
61
|
onChange: n(C)
|
|
@@ -62,5 +64,5 @@ const W = {
|
|
|
62
64
|
}
|
|
63
65
|
});
|
|
64
66
|
export {
|
|
65
|
-
|
|
67
|
+
M as default
|
|
66
68
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
const
|
|
1
|
+
const o = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24odCl7Y29uc3QgbD10LmRhdGEua2V5d29yZHM/PyIiO2xldCBlPUpTT04ucGFyc2UodC5kYXRhLmxpc3QpPz9bXTtjb25zdCBhPUpTT04ucGFyc2UodC5kYXRhLmluY2x1ZGUpO2EubGVuZ3RoPjAmJihlPWUuZmlsdGVyKHM9PmEuc29tZShpPT5pPT09cy52YWx1ZSkpKTtjb25zdCBvPWUuZmlsdGVyKHM9PnMudmFsdWUudG9Mb3dlckNhc2UoKS5pbmRleE9mKGwudG9Mb3dlckNhc2UoKSkhPT0tMXx8cy5sYWJlbC50b0xvd2VyQ2FzZSgpLmluY2x1ZGVzKGwudG9Mb3dlckNhc2UoKSkpO28ubGVuZ3RoPT09MD9zZWxmLnBvc3RNZXNzYWdlKGUuc3BsaWNlKDAsMTApKTpzZWxmLnBvc3RNZXNzYWdlKG8uc3BsaWNlKDAsMTApKX0sITEpfSkoKTsK", c = typeof window < "u" && window.Blob && new Blob([atob(o)], { type: "text/javascript;charset=utf-8" });
|
|
2
|
+
function b() {
|
|
3
|
+
const d = c && (window.URL || window.webkitURL).createObjectURL(c);
|
|
4
4
|
try {
|
|
5
|
-
return
|
|
5
|
+
return d ? new Worker(d) : new Worker("data:application/javascript;base64," + o);
|
|
6
6
|
} finally {
|
|
7
|
-
|
|
7
|
+
d && (window.URL || window.webkitURL).revokeObjectURL(d);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
b as default
|
|
12
12
|
};
|
|
@@ -19,6 +19,11 @@ export declare const DSelect: import("../../utils/install").SFCWithInstall<impor
|
|
|
19
19
|
required: false;
|
|
20
20
|
default: string;
|
|
21
21
|
};
|
|
22
|
+
include: {
|
|
23
|
+
type: import("vue").PropType<(string | number)[] | undefined>;
|
|
24
|
+
required: false;
|
|
25
|
+
default: any;
|
|
26
|
+
};
|
|
22
27
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "change")[], "update:value" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
28
|
value: {
|
|
24
29
|
type: import("vue").PropType<any>;
|
|
@@ -40,6 +45,11 @@ export declare const DSelect: import("../../utils/install").SFCWithInstall<impor
|
|
|
40
45
|
required: false;
|
|
41
46
|
default: string;
|
|
42
47
|
};
|
|
48
|
+
include: {
|
|
49
|
+
type: import("vue").PropType<(string | number)[] | undefined>;
|
|
50
|
+
required: false;
|
|
51
|
+
default: any;
|
|
52
|
+
};
|
|
43
53
|
}>> & {
|
|
44
54
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
45
55
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
@@ -48,5 +58,6 @@ export declare const DSelect: import("../../utils/install").SFCWithInstall<impor
|
|
|
48
58
|
value: any;
|
|
49
59
|
disabled: boolean | undefined;
|
|
50
60
|
placeholder: string | undefined;
|
|
61
|
+
include: (string | number)[] | undefined;
|
|
51
62
|
}>>;
|
|
52
63
|
export default DSelect;
|
package/package.json
CHANGED
|
@@ -10,13 +10,15 @@ interface Props {
|
|
|
10
10
|
name: string; //字典名字
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
placeholder?: string;
|
|
13
|
+
include?: Array<string | number>;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const props = withDefaults(defineProps<Props>(), {
|
|
16
17
|
value: null,
|
|
17
18
|
name: "",
|
|
18
19
|
disabled: false,
|
|
19
|
-
placeholder: "请填写默认占位符啊!老铁"
|
|
20
|
+
placeholder: "请填写默认占位符啊!老铁",
|
|
21
|
+
include: [] as any
|
|
20
22
|
});
|
|
21
23
|
|
|
22
24
|
interface Emits {
|
|
@@ -24,10 +26,10 @@ interface Emits {
|
|
|
24
26
|
(e: "change", value: any): void;
|
|
25
27
|
}
|
|
26
28
|
const emits = defineEmits<Emits>();
|
|
29
|
+
|
|
27
30
|
const { getDicByKey, list } = useDataDicStore();
|
|
28
31
|
|
|
29
32
|
const { modelValue, data, onSearch, onSelect, onChange } = useSelect();
|
|
30
|
-
|
|
31
33
|
function useSelect() {
|
|
32
34
|
// 保存worker启动状态
|
|
33
35
|
let workerStatus = true;
|
|
@@ -37,19 +39,6 @@ function useSelect() {
|
|
|
37
39
|
const modelValue = ref(props.value);
|
|
38
40
|
// 创建worker
|
|
39
41
|
const worker = new DicWorker();
|
|
40
|
-
// const worker = new Worker(
|
|
41
|
-
// new URL("./worker?worker&inline", import.meta.url),
|
|
42
|
-
// {
|
|
43
|
-
// type: "module",
|
|
44
|
-
// credentials: "include"
|
|
45
|
-
// }
|
|
46
|
-
// );
|
|
47
|
-
// const worker = new Worker(
|
|
48
|
-
// new URL("./replace.worker.ts?worker&inline", import.meta.url),
|
|
49
|
-
// {
|
|
50
|
-
// type: "module"
|
|
51
|
-
// }
|
|
52
|
-
// );
|
|
53
42
|
/**
|
|
54
43
|
* web worker 启动失败
|
|
55
44
|
*/
|
|
@@ -90,7 +79,8 @@ function useSelect() {
|
|
|
90
79
|
function sendWorkerSearch(keywords: string) {
|
|
91
80
|
worker.postMessage({
|
|
92
81
|
list: JSON.stringify(list[props.name]),
|
|
93
|
-
keywords: keywords
|
|
82
|
+
keywords: keywords,
|
|
83
|
+
include: JSON.stringify(props.include ?? [])
|
|
94
84
|
});
|
|
95
85
|
}
|
|
96
86
|
|
|
@@ -7,15 +7,22 @@ self.addEventListener(
|
|
|
7
7
|
"message",
|
|
8
8
|
function (e) {
|
|
9
9
|
const keyword = e.data.keywords ?? "";
|
|
10
|
-
|
|
11
|
-
const
|
|
10
|
+
let dicList = JSON.parse(e.data.list) ?? [];
|
|
11
|
+
const include = JSON.parse(e.data.include);
|
|
12
|
+
if (include.length > 0) {
|
|
13
|
+
// 只过滤出来include包含的数据
|
|
14
|
+
dicList = dicList.filter((item: any) => {
|
|
15
|
+
return include.some((i: any) => i === item.value);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const filterRs = dicList.filter((item: any) => {
|
|
12
19
|
return (
|
|
13
20
|
item.value.toLowerCase().indexOf(keyword.toLowerCase()) !== -1 ||
|
|
14
21
|
item.label.toLowerCase().includes(keyword.toLowerCase())
|
|
15
22
|
);
|
|
16
23
|
});
|
|
17
24
|
if (filterRs.length === 0) {
|
|
18
|
-
self.postMessage(
|
|
25
|
+
self.postMessage(dicList.splice(0, 10));
|
|
19
26
|
} else {
|
|
20
27
|
self.postMessage(filterRs.splice(0, 10));
|
|
21
28
|
}
|