@ditari/bsui 1.0.36 → 1.0.37
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 +2 -1
- package/dist/cjs/components/select/dic.worker.cjs.js +1 -1
- package/dist/cjs/components/select/index.d.ts +2 -1
- package/dist/esm/components/select/Select.vue.d.ts +2 -1
- package/dist/esm/components/select/Select.vue.esm.js +43 -38
- package/dist/esm/components/select/dic.worker.esm.js +4 -4
- package/dist/esm/components/select/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/select/Select.vue +13 -0
- package/src/components/select/dic.worker.ts +2 -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"),y=require("../../store/modules/DataDictionary.cjs.js"),k=require("./dic.worker.cjs.js"),B={name:"DSelect"},O=e.defineComponent({...B,props:{value:{default:null},name:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"请填写默认占位符啊!老铁"},include:{default:[]}},emits:["update:value","change","select"],setup(r,{emit:u}){const n=r,{getDicByKey:v,list:h}=y.useDataDicStore(),{modelValue:s,data:p,onSearch:S,onSelect:g,onChange:m}=C();function C(){let d=!0,t=[];const o=e.ref(t),l=e.ref(n.value),i=new k.default;i.onerror=()=>{d=!1,t=v(n.name)},i.onmessage=a=>{o.value=[...a.data]},e.watch(()=>n.include,()=>{f(l.value)}),e.watch(()=>n.value,a=>{l.value=a}),f(l.value);const w=a=>{d?f(a):o.value=t.filter(c=>c.value.toLowerCase().indexOf(a.toLowerCase())!==-1||c.label.toLowerCase().includes(a.toLowerCase())).splice(0,10)};function f(a){i.postMessage({list:JSON.stringify(h[n.name]),keywords:a,include:JSON.stringify(n.include??[])})}const _=a=>{u("update:value",a),D()},b=()=>{u("update:value",l.value),u("change",l.value)};function D(){const c=v(n.name).find(L=>L.value===l.value);u("select",c)}return{data:o,modelValue:l,onSearch:w,onSelect:_,onChange:b}}return(d,t)=>{const o=e.resolveComponent("a-select");return e.openBlock(),e.createBlock(o,{value:e.unref(s),"onUpdate:value":t[0]||(t[0]=l=>e.isRef(s)?s.value=l:null),"allow-clear":"","show-search":"","filter-option":!1,options:e.unref(p),placeholder:r.placeholder,disabled:r.disabled,onSelect:e.unref(g),onSearch:e.unref(S),onChange:e.unref(m)},null,8,["value","options","placeholder","disabled","onSelect","onSearch","onChange"])}}});exports.default=O;
|
|
@@ -25,7 +25,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
25
25
|
required: false;
|
|
26
26
|
default: any;
|
|
27
27
|
};
|
|
28
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:value")[], "change" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "select" | "update:value")[], "change" | "select" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
29
|
value: {
|
|
30
30
|
type: __PropType<any>;
|
|
31
31
|
required: true;
|
|
@@ -53,6 +53,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
53
53
|
};
|
|
54
54
|
}>> & {
|
|
55
55
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
56
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
56
57
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
57
58
|
}, {
|
|
58
59
|
name: string;
|
|
@@ -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 n="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24odCl7dmFyIG87Y29uc3QgbD0odC5kYXRhLmtleXdvcmRzPz8iIikudHJpbSgpO2xldCBlPUpTT04ucGFyc2UoKChvPXQuZGF0YSk9PW51bGw/dm9pZCAwOm8ubGlzdCl8fFtdKT8/W107Y29uc3QgYT1KU09OLnBhcnNlKHQuZGF0YS5pbmNsdWRlKTthLmxlbmd0aD4wJiYoZT1lLmZpbHRlcihzPT5hLnNvbWUocj0+cj09PXMudmFsdWUpKSk7Y29uc3QgaT1lLmZpbHRlcihzPT5zLnZhbHVlLnRvTG93ZXJDYXNlKCkuaW5kZXhPZihsLnRvTG93ZXJDYXNlKCkpIT09LTF8fHMubGFiZWwudG9Mb3dlckNhc2UoKS5pbmNsdWRlcyhsLnRvTG93ZXJDYXNlKCkpKTtpLmxlbmd0aD09PTA/c2VsZi5wb3N0TWVzc2FnZShlLnNwbGljZSgwLDEwKSk6c2VsZi5wb3N0TWVzc2FnZShpLnNwbGljZSgwLDEwKSl9LCExKX0pKCk7Cg==",e=typeof window<"u"&&window.Blob&&new Blob([atob(n)],{type:"text/javascript;charset=utf-8"});function b(){const l=e&&(window.URL||window.webkitURL).createObjectURL(e);try{return l?new Worker(l):new Worker("data:application/javascript;base64,"+n)}finally{l&&(window.URL||window.webkitURL).revokeObjectURL(l)}}exports.default=b;
|
|
@@ -24,7 +24,7 @@ export declare const DSelect: import("../../utils/install").SFCWithInstall<impor
|
|
|
24
24
|
required: false;
|
|
25
25
|
default: any;
|
|
26
26
|
};
|
|
27
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:value")[], "change" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "select" | "update:value")[], "change" | "select" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
28
|
value: {
|
|
29
29
|
type: import("vue").PropType<any>;
|
|
30
30
|
required: true;
|
|
@@ -52,6 +52,7 @@ export declare const DSelect: import("../../utils/install").SFCWithInstall<impor
|
|
|
52
52
|
};
|
|
53
53
|
}>> & {
|
|
54
54
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
55
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
55
56
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
56
57
|
}, {
|
|
57
58
|
name: string;
|
|
@@ -25,7 +25,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
25
25
|
required: false;
|
|
26
26
|
default: any;
|
|
27
27
|
};
|
|
28
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:value")[], "change" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "select" | "update:value")[], "change" | "select" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
29
|
value: {
|
|
30
30
|
type: __PropType<any>;
|
|
31
31
|
required: true;
|
|
@@ -53,6 +53,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
53
53
|
};
|
|
54
54
|
}>> & {
|
|
55
55
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
56
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
56
57
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
57
58
|
}, {
|
|
58
59
|
name: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useDataDicStore as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as x, ref as v, watch as h, resolveComponent as y, openBlock as O, createBlock as V, unref as t, isRef as W } from "vue";
|
|
2
|
+
import { useDataDicStore as J } from "../../store/modules/DataDictionary.esm.js";
|
|
3
|
+
import N from "./dic.worker.esm.js";
|
|
4
|
+
const H = {
|
|
5
5
|
name: "DSelect"
|
|
6
|
-
},
|
|
7
|
-
...
|
|
6
|
+
}, U = /* @__PURE__ */ x({
|
|
7
|
+
...H,
|
|
8
8
|
props: {
|
|
9
9
|
value: { default: null },
|
|
10
10
|
name: { default: "" },
|
|
@@ -12,60 +12,65 @@ const V = {
|
|
|
12
12
|
placeholder: { default: "请填写默认占位符啊!老铁" },
|
|
13
13
|
include: { default: [] }
|
|
14
14
|
},
|
|
15
|
-
emits: ["update:value", "change"],
|
|
16
|
-
setup(
|
|
17
|
-
const l =
|
|
18
|
-
function
|
|
19
|
-
let
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
15
|
+
emits: ["update:value", "change", "select"],
|
|
16
|
+
setup(u, { emit: c }) {
|
|
17
|
+
const l = u, { getDicByKey: p, list: S } = J(), { modelValue: s, data: m, onSearch: g, onSelect: C, onChange: w } = L();
|
|
18
|
+
function L() {
|
|
19
|
+
let d = !0, n = [];
|
|
20
|
+
const o = v(n), a = v(l.value), i = new N();
|
|
21
|
+
i.onerror = () => {
|
|
22
|
+
d = !1, n = p(l.name);
|
|
23
|
+
}, i.onmessage = (e) => {
|
|
24
|
+
o.value = [...e.data];
|
|
25
25
|
}, h(
|
|
26
26
|
() => l.include,
|
|
27
27
|
() => {
|
|
28
|
-
|
|
28
|
+
f(a.value);
|
|
29
29
|
}
|
|
30
30
|
), h(
|
|
31
31
|
() => l.value,
|
|
32
32
|
(e) => {
|
|
33
33
|
a.value = e;
|
|
34
34
|
}
|
|
35
|
-
),
|
|
36
|
-
const
|
|
37
|
-
|
|
35
|
+
), f(a.value);
|
|
36
|
+
const b = (e) => {
|
|
37
|
+
d ? f(e) : o.value = n.filter((r) => r.value.toLowerCase().indexOf(e.toLowerCase()) !== -1 || r.label.toLowerCase().includes(e.toLowerCase())).splice(0, 10);
|
|
38
38
|
};
|
|
39
|
-
function
|
|
40
|
-
|
|
39
|
+
function f(e) {
|
|
40
|
+
i.postMessage({
|
|
41
41
|
list: JSON.stringify(S[l.name]),
|
|
42
42
|
keywords: e,
|
|
43
43
|
include: JSON.stringify(l.include ?? [])
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
+
const D = (e) => {
|
|
47
|
+
c("update:value", e), k();
|
|
48
|
+
}, _ = () => {
|
|
49
|
+
c("update:value", a.value), c("change", a.value);
|
|
50
|
+
};
|
|
51
|
+
function k() {
|
|
52
|
+
const r = p(l.name).find((B) => B.value === a.value);
|
|
53
|
+
c("select", r);
|
|
54
|
+
}
|
|
46
55
|
return {
|
|
47
|
-
data:
|
|
56
|
+
data: o,
|
|
48
57
|
modelValue: a,
|
|
49
|
-
onSearch:
|
|
50
|
-
onSelect:
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
onChange: () => {
|
|
54
|
-
r("update:value", a.value), r("change", a.value);
|
|
55
|
-
}
|
|
58
|
+
onSearch: b,
|
|
59
|
+
onSelect: D,
|
|
60
|
+
onChange: _
|
|
56
61
|
};
|
|
57
62
|
}
|
|
58
|
-
return (
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
value: t(
|
|
62
|
-
"onUpdate:value":
|
|
63
|
+
return (d, n) => {
|
|
64
|
+
const o = y("a-select");
|
|
65
|
+
return O(), V(o, {
|
|
66
|
+
value: t(s),
|
|
67
|
+
"onUpdate:value": n[0] || (n[0] = (a) => W(s) ? s.value = a : null),
|
|
63
68
|
"allow-clear": "",
|
|
64
69
|
"show-search": "",
|
|
65
70
|
"filter-option": !1,
|
|
66
71
|
options: t(m),
|
|
67
|
-
placeholder:
|
|
68
|
-
disabled:
|
|
72
|
+
placeholder: u.placeholder,
|
|
73
|
+
disabled: u.disabled,
|
|
69
74
|
onSelect: t(C),
|
|
70
75
|
onSearch: t(g),
|
|
71
76
|
onChange: t(w)
|
|
@@ -74,5 +79,5 @@ const V = {
|
|
|
74
79
|
}
|
|
75
80
|
});
|
|
76
81
|
export {
|
|
77
|
-
|
|
82
|
+
U as default
|
|
78
83
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
const b = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24odCl7dmFyIG87Y29uc3QgbD0odC5kYXRhLmtleXdvcmRzPz8iIikudHJpbSgpO2xldCBlPUpTT04ucGFyc2UoKChvPXQuZGF0YSk9PW51bGw/dm9pZCAwOm8ubGlzdCl8fFtdKT8/W107Y29uc3QgYT1KU09OLnBhcnNlKHQuZGF0YS5pbmNsdWRlKTthLmxlbmd0aD4wJiYoZT1lLmZpbHRlcihzPT5hLnNvbWUocj0+cj09PXMudmFsdWUpKSk7Y29uc3QgaT1lLmZpbHRlcihzPT5zLnZhbHVlLnRvTG93ZXJDYXNlKCkuaW5kZXhPZihsLnRvTG93ZXJDYXNlKCkpIT09LTF8fHMubGFiZWwudG9Mb3dlckNhc2UoKS5pbmNsdWRlcyhsLnRvTG93ZXJDYXNlKCkpKTtpLmxlbmd0aD09PTA/c2VsZi5wb3N0TWVzc2FnZShlLnNwbGljZSgwLDEwKSk6c2VsZi5wb3N0TWVzc2FnZShpLnNwbGljZSgwLDEwKSl9LCExKX0pKCk7Cg==", n = typeof window < "u" && window.Blob && new Blob([atob(b)], { type: "text/javascript;charset=utf-8" });
|
|
2
2
|
function c() {
|
|
3
|
-
const
|
|
3
|
+
const l = n && (window.URL || window.webkitURL).createObjectURL(n);
|
|
4
4
|
try {
|
|
5
|
-
return
|
|
5
|
+
return l ? new Worker(l) : new Worker("data:application/javascript;base64," + b);
|
|
6
6
|
} finally {
|
|
7
|
-
|
|
7
|
+
l && (window.URL || window.webkitURL).revokeObjectURL(l);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
@@ -24,7 +24,7 @@ export declare const DSelect: import("../../utils/install").SFCWithInstall<impor
|
|
|
24
24
|
required: false;
|
|
25
25
|
default: any;
|
|
26
26
|
};
|
|
27
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:value")[], "change" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "select" | "update:value")[], "change" | "select" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
28
|
value: {
|
|
29
29
|
type: import("vue").PropType<any>;
|
|
30
30
|
required: true;
|
|
@@ -52,6 +52,7 @@ export declare const DSelect: import("../../utils/install").SFCWithInstall<impor
|
|
|
52
52
|
};
|
|
53
53
|
}>> & {
|
|
54
54
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
55
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
55
56
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
56
57
|
}, {
|
|
57
58
|
name: string;
|
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
24
24
|
interface Emits {
|
|
25
25
|
(e: "update:value", value: any): void;
|
|
26
26
|
(e: "change", value: any): void;
|
|
27
|
+
(e: "select", value: any): void;
|
|
27
28
|
}
|
|
28
29
|
const emits = defineEmits<Emits>();
|
|
29
30
|
|
|
@@ -104,6 +105,8 @@ function useSelect() {
|
|
|
104
105
|
const onSelect = (value: any) => {
|
|
105
106
|
// 发射选择的数据
|
|
106
107
|
emits("update:value", value);
|
|
108
|
+
// 处理下拉后返回数据的
|
|
109
|
+
onSelectHandler();
|
|
107
110
|
};
|
|
108
111
|
|
|
109
112
|
// 监听数据改变
|
|
@@ -112,6 +115,16 @@ function useSelect() {
|
|
|
112
115
|
emits("update:value", modelValue.value);
|
|
113
116
|
emits("change", modelValue.value);
|
|
114
117
|
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 根据当前选中的value匹配对应的整条数据
|
|
121
|
+
* 然后返回给父组件
|
|
122
|
+
*/
|
|
123
|
+
function onSelectHandler() {
|
|
124
|
+
const dicList = getDicByKey(props.name);
|
|
125
|
+
const rs = dicList.find((obj: any) => obj.value === modelValue.value);
|
|
126
|
+
emits("select", rs);
|
|
127
|
+
}
|
|
115
128
|
return {
|
|
116
129
|
data,
|
|
117
130
|
modelValue,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
self.addEventListener(
|
|
7
7
|
"message",
|
|
8
8
|
function (e) {
|
|
9
|
-
const keyword = e.data.keywords ?? "";
|
|
9
|
+
const keyword = (e.data.keywords ?? "").trim();
|
|
10
10
|
let dicList = JSON.parse(e.data?.list || []) ?? [];
|
|
11
11
|
const include = JSON.parse(e.data.include);
|
|
12
12
|
if (include.length > 0) {
|
|
@@ -15,6 +15,7 @@ self.addEventListener(
|
|
|
15
15
|
return include.some((i: any) => i === item.value);
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
+
|
|
18
19
|
const filterRs = dicList.filter((item: any) => {
|
|
19
20
|
return (
|
|
20
21
|
item.value.toLowerCase().indexOf(keyword.toLowerCase()) !== -1 ||
|