@ditari/bsui 1.0.61 → 1.0.62
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.
|
@@ -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"),L={name:"DSelect"},w=e.defineComponent({...L,props:{value:{default:null},name:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"请填写默认占位符啊!老铁"},include:{default:[]}},emits:["update:value","change","select"],setup(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),_=require("../../store/modules/DataDictionary.cjs.js"),L={name:"DSelect"},w=e.defineComponent({...L,props:{value:{default:null},name:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"请填写默认占位符啊!老铁"},include:{default:[]}},emits:["update:value","change","select"],setup(r,{emit:o}){const t=r,{getDicByKey:f}=_.useDataDicStore(),{modelValue:s,data:v,onSearch:h,onSelect:p,onChange:S}=g();function g(){const d=[...f(t.name)],n=e.ref([]),l=e.ref(t.value);e.watch(()=>t.include,()=>{u(l.value)}),e.watch(()=>t.value,a=>{l.value=a,u(l.value)}),u(l.value);const i=a=>{u(a)};function u(a){a=a??"",n.value=d.filter(c=>c.value.toLowerCase().indexOf(a.toLowerCase())!==-1||c.label.toLowerCase().includes(a.toLowerCase())).splice(0,10),n.value.length===0&&(n.value=[...d].splice(0,10))}const C=a=>{o("update:value",a),b()},m=()=>{o("update:value",l.value),o("change",l.value)};function b(){const c=f(t.name).find(D=>D.value===l.value);o("select",c)}return{data:n,modelValue:l,onSearch:i,onSelect:C,onChange:m}}return(d,n)=>{const l=e.resolveComponent("a-select");return e.openBlock(),e.createBlock(l,{value:e.unref(s),"onUpdate:value":n[0]||(n[0]=i=>e.isRef(s)?s.value=i:null),"allow-clear":"","show-search":"","filter-option":!1,options:e.unref(v),placeholder:r.placeholder,disabled:r.disabled,onSelect:e.unref(p),onSearch:e.unref(h),onChange:e.unref(S)},null,8,["value","options","placeholder","disabled","onSelect","onSearch","onChange"])}}});exports.default=w;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as w, ref as
|
|
1
|
+
import { defineComponent as w, ref as v, watch as p, resolveComponent as B, openBlock as x, createBlock as V, unref as o, isRef as H } from "vue";
|
|
2
2
|
import { useDataDicStore as K } from "../../store/modules/DataDictionary.esm.js";
|
|
3
3
|
const O = {
|
|
4
4
|
name: "DSelect"
|
|
@@ -12,26 +12,26 @@ const O = {
|
|
|
12
12
|
include: { default: [] }
|
|
13
13
|
},
|
|
14
14
|
emits: ["update:value", "change", "select"],
|
|
15
|
-
setup(
|
|
16
|
-
const n =
|
|
15
|
+
setup(s, { emit: t }) {
|
|
16
|
+
const n = s, { getDicByKey: f } = K(), { modelValue: d, data: h, onSearch: S, onSelect: m, onChange: C } = g();
|
|
17
17
|
function g() {
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const r = [...f(n.name)], l = v([]), a = v(n.value);
|
|
19
|
+
p(
|
|
20
20
|
() => n.include,
|
|
21
21
|
() => {
|
|
22
|
-
|
|
22
|
+
c(a.value);
|
|
23
23
|
}
|
|
24
|
-
),
|
|
24
|
+
), p(
|
|
25
25
|
() => n.value,
|
|
26
26
|
(e) => {
|
|
27
|
-
a.value = e;
|
|
27
|
+
a.value = e, c(a.value);
|
|
28
28
|
}
|
|
29
|
-
),
|
|
30
|
-
const
|
|
31
|
-
|
|
29
|
+
), c(a.value);
|
|
30
|
+
const i = (e) => {
|
|
31
|
+
c(e);
|
|
32
32
|
};
|
|
33
|
-
function
|
|
34
|
-
e = e ?? "", l.value =
|
|
33
|
+
function c(e) {
|
|
34
|
+
e = e ?? "", l.value = r.filter((u) => u.value.toLowerCase().indexOf(e.toLowerCase()) !== -1 || u.label.toLowerCase().includes(e.toLowerCase())).splice(0, 10), l.value.length === 0 && (l.value = [...r].splice(0, 10));
|
|
35
35
|
}
|
|
36
36
|
const L = (e) => {
|
|
37
37
|
t("update:value", e), D();
|
|
@@ -39,28 +39,28 @@ const O = {
|
|
|
39
39
|
t("update:value", a.value), t("change", a.value);
|
|
40
40
|
};
|
|
41
41
|
function D() {
|
|
42
|
-
const
|
|
43
|
-
t("select",
|
|
42
|
+
const u = f(n.name).find((_) => _.value === a.value);
|
|
43
|
+
t("select", u);
|
|
44
44
|
}
|
|
45
45
|
return {
|
|
46
46
|
data: l,
|
|
47
47
|
modelValue: a,
|
|
48
|
-
onSearch:
|
|
48
|
+
onSearch: i,
|
|
49
49
|
onSelect: L,
|
|
50
50
|
onChange: b
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
return (
|
|
53
|
+
return (r, l) => {
|
|
54
54
|
const a = B("a-select");
|
|
55
55
|
return x(), V(a, {
|
|
56
|
-
value: o(
|
|
57
|
-
"onUpdate:value": l[0] || (l[0] = (
|
|
56
|
+
value: o(d),
|
|
57
|
+
"onUpdate:value": l[0] || (l[0] = (i) => H(d) ? d.value = i : null),
|
|
58
58
|
"allow-clear": "",
|
|
59
59
|
"show-search": "",
|
|
60
60
|
"filter-option": !1,
|
|
61
61
|
options: o(h),
|
|
62
|
-
placeholder:
|
|
63
|
-
disabled:
|
|
62
|
+
placeholder: s.placeholder,
|
|
63
|
+
disabled: s.disabled,
|
|
64
64
|
onSelect: o(m),
|
|
65
65
|
onSearch: o(S),
|
|
66
66
|
onChange: o(C)
|
package/package.json
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineComponent,
|
|
3
|
-
h,
|
|
4
|
-
inject,
|
|
5
|
-
resolveComponent,
|
|
6
|
-
watchEffect
|
|
7
|
-
} from "vue";
|
|
1
|
+
import { defineComponent, h, inject, resolveComponent, watchEffect } from "vue";
|
|
8
2
|
import { useRouter, useRoute } from "vue-router";
|
|
9
3
|
|
|
10
4
|
import { storeToRefs } from "pinia";
|
|
@@ -13,8 +13,6 @@ interface Props {
|
|
|
13
13
|
include?: Array<string | number>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
16
|
const props = withDefaults(defineProps<Props>(), {
|
|
19
17
|
value: null,
|
|
20
18
|
name: "",
|
|
@@ -76,6 +74,7 @@ function useSelect() {
|
|
|
76
74
|
() => props.value,
|
|
77
75
|
(val) => {
|
|
78
76
|
modelValue.value = val;
|
|
77
|
+
sendWorkerSearch(modelValue.value);
|
|
79
78
|
}
|
|
80
79
|
);
|
|
81
80
|
|
|
@@ -89,11 +88,6 @@ function useSelect() {
|
|
|
89
88
|
|
|
90
89
|
// 发送搜索到webworker
|
|
91
90
|
function sendWorkerSearch(keywords: string) {
|
|
92
|
-
// workerInstance.postMessage({
|
|
93
|
-
// list: JSON.stringify(list[props.name]),
|
|
94
|
-
// keywords: keywords,
|
|
95
|
-
// include: JSON.stringify(props.include ?? [])
|
|
96
|
-
// });
|
|
97
91
|
keywords = keywords ?? "";
|
|
98
92
|
data.value = dicData
|
|
99
93
|
.filter((item: any) => {
|