@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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g=require("../../store/modules/DataDictionary.cjs.js"),D={name:"DSelect"},_=e.defineComponent({...D,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}=g.useDataDicStore(),{modelValue:s,data:v,onSearch:m,onSelect:h}=w();function w(){let c=!0,a=[];const l=e.ref(a),o=e.ref(r.value),u=new Worker(new URL("/assets/dic-worker-3d338b91.js",self.location),{type:"module"});u.onerror=()=>{c=!1,a=p(r.name)},u.onmessage=t=>{l.value=[...t.data]},i(o.value);const b=t=>{c?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(c,a)=>{const l=e.resolveComponent("a-select");return e.openBlock(),e.createBlock(l,{value:e.unref(s),"onUpdate:value":a[0]||(a[0]=o=>e.isRef(s)?s.value=o:null),"allow-clear":"","show-search":"","filter-option":!1,options:e.unref(v),placeholder:n.placeholder,disabled:n.disabled,onSelect:e.unref(h),onSearch:e.unref(m)},null,8,["value","options","placeholder","disabled","onSelect","onSearch"])}}});exports.default=_;
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
- defineComponent as C,
3
- ref as p,
4
- resolveComponent as k,
5
- openBlock as D,
6
- createBlock as L,
7
- unref as t,
8
- isRef as _
9
- } from "vue";
10
- import { useDataDicStore as B } from "../../store/modules/DataDictionary.esm.js";
11
- const x = {
12
- name: "DSelect"
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
- R = /* @__PURE__ */ C({
15
- ...x,
16
- props: {
17
- value: { default: null },
18
- name: { default: "" },
19
- disabled: { type: Boolean, default: !1 },
20
- placeholder: { default: "请填写默认占位符啊!老铁" }
21
- },
22
- emits: ["update:value", "change"],
23
- setup(n, { emit: d }) {
24
- const s = n,
25
- { getDicByKey: m, list: S } = B(),
26
- { modelValue: r, data: h, onSearch: v, onSelect: w } = b();
27
- function b() {
28
- let c = !0,
29
- a = [];
30
- const o = p(a),
31
- l = p(s.value),
32
- u = new Worker(
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 (c, a) => {
72
- const o = k("a-select");
73
- return (
74
- D(),
75
- L(
76
- o,
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
- export { R as default };
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<import("vue").DefineComponent<{
2
- value: {
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
- name: {
8
+ };
9
+ name: {
8
10
  type: import("vue").PropType<string>;
9
11
  required: true;
10
12
  default: string;
11
- };
12
- disabled: {
13
+ };
14
+ disabled: {
13
15
  type: import("vue").PropType<boolean | undefined>;
14
16
  required: false;
15
17
  default: boolean;
16
- };
17
- placeholder: {
18
+ };
19
+ placeholder: {
18
20
  type: import("vue").PropType<string | undefined>;
19
21
  required: false;
20
22
  default: string;
21
- };
22
- }, {}, 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
- value: {
24
- type: import("vue").PropType<any>;
25
- required: true;
26
- default: null;
27
- };
28
- name: {
29
- type: import("vue").PropType<string>;
30
- required: true;
31
- default: string;
32
- };
33
- disabled: {
34
- type: import("vue").PropType<boolean | undefined>;
35
- required: false;
36
- default: boolean;
37
- };
38
- placeholder: {
39
- type: import("vue").PropType<string | undefined>;
40
- required: false;
41
- default: string;
42
- };
43
- }>> & {
44
- onChange?: ((...args: any[]) => any) | undefined;
45
- "onUpdate:value"?: ((...args: any[]) => any) | undefined;
46
- }, {
47
- name: string;
48
- value: any;
49
- disabled: boolean | undefined;
50
- placeholder: string | undefined;
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,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "files": [
5
5
  "dist/**",
6
6
  "src"
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
- import { watch, ref } from "vue";
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 Worker(new URL("./dic-worker", import.meta.url), {
37
- type: "module"
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)})();