@ditari/bsui 1.0.54 → 1.0.56

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.
Files changed (28) hide show
  1. package/dist/cjs/components/components.cjs.js +1 -1
  2. package/dist/cjs/components/components.d.ts +0 -16
  3. package/dist/cjs/components/dic/DicReplace.cjs.js +1 -1
  4. package/dist/cjs/components/index.cjs.js +1 -1
  5. package/dist/cjs/components/select/Select.vue.cjs.js +1 -1
  6. package/dist/esm/components/components.d.ts +0 -16
  7. package/dist/esm/components/components.esm.js +19 -24
  8. package/dist/esm/components/dic/DicReplace.esm.js +10 -18
  9. package/dist/esm/components/index.esm.js +36 -45
  10. package/dist/esm/components/select/Select.vue.esm.js +45 -54
  11. package/package.json +1 -1
  12. package/src/components/components.ts +0 -6
  13. package/src/components/dic/DicReplace.tsx +15 -14
  14. package/src/components/index.ts +12 -13
  15. package/src/components/select/Select.vue +32 -32
  16. package/dist/cjs/components/dic/replace.worker.cjs.js +0 -1
  17. package/dist/cjs/components/select/DemoSelect.vue.cjs.js +0 -1
  18. package/dist/cjs/components/select/DemoSelect.vue.cjs2.js +0 -1
  19. package/dist/cjs/components/select/DemoSelect.vue.d.ts +0 -17
  20. package/dist/cjs/components/select/dic.worker.cjs.js +0 -1
  21. package/dist/cjs/components/worker-pool.cjs.js +0 -1
  22. package/dist/esm/components/dic/replace.worker.esm.js +0 -12
  23. package/dist/esm/components/select/DemoSelect.vue.d.ts +0 -17
  24. package/dist/esm/components/select/DemoSelect.vue.esm.js +0 -29
  25. package/dist/esm/components/select/DemoSelect.vue.esm2.js +0 -4
  26. package/dist/esm/components/select/dic.worker.esm.js +0 -12
  27. package/dist/esm/components/worker-pool.esm.js +0 -29
  28. package/src/components/select/DemoSelect.vue +0 -49
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../utils/install.cjs.js"),D=require("./form/index.cjs.js"),e=require("./layout/index.cjs.js"),n=require("./table/index.cjs.js"),i=require("./grid/index.cjs.js"),s=require("./select/index.cjs.js"),o=require("./desensitize/index.cjs.js"),u=require("./dic/index.cjs.js"),c=require("./modal/index.cjs.js"),l=require("./select/DemoSelect.vue.cjs.js"),t=r.default(l.default);exports.DForm=D.default;exports.DList=e.DList;exports.DMain=e.DMain;exports.DNavTabs=e.DNavTabs;exports.DShow=e.DShow;exports.DTable=n.DTable;exports.DGrid=i.DGrid;exports.DGridItem=i.DGridItem;exports.DSelect=s.DSelect;exports.DDesensitize=o.DDesensitize;exports.DicReplace=u.DDicReplace;exports.DModal=c.DModal;exports.DemoSelect=t;exports.default=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("./form/index.cjs.js"),e=require("./layout/index.cjs.js"),r=require("./table/index.cjs.js"),i=require("./grid/index.cjs.js"),t=require("./select/index.cjs.js"),n=require("./desensitize/index.cjs.js"),s=require("./dic/index.cjs.js"),d=require("./modal/index.cjs.js");exports.DForm=D.default;exports.DList=e.DList;exports.DMain=e.DMain;exports.DNavTabs=e.DNavTabs;exports.DShow=e.DShow;exports.DTable=r.DTable;exports.DGrid=i.DGrid;exports.DGridItem=i.DGridItem;exports.DSelect=t.DSelect;exports.DDesensitize=n.DDesensitize;exports.DicReplace=s.DDicReplace;exports.DModal=d.DModal;
@@ -6,19 +6,3 @@ export { default as DSelect } from "./select";
6
6
  export { default as DDesensitize } from "./desensitize";
7
7
  export { default as DicReplace } from "./dic";
8
8
  export { default as DModal } from "./modal";
9
- export declare const DemoSelect: import("../utils/install").SFCWithInstall<import("vue").DefineComponent<{
10
- name: {
11
- type: import("vue").PropType<string>;
12
- required: true;
13
- default: string;
14
- };
15
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
16
- name: {
17
- type: import("vue").PropType<string>;
18
- required: true;
19
- default: string;
20
- };
21
- }>>, {
22
- name: string;
23
- }>>;
24
- export default DemoSelect;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("../../store/modules/DataDictionary.cjs.js"),c=e.defineComponent({name:"DicReplace",props:{name:{type:String,default:""},value:{type:String,default:""}},setup(o){const{list:n}=u.useDataDicStore(),s=e.ref(!0),a=e.ref(""),t=e.inject("repWorkerPool").getWorker();return t.onerror=()=>{s.value=!1},t.onmessage=r=>{a.value=r.data},e.watchEffect(()=>{const r=o.value,l=o.name;t.postMessage({list:JSON.stringify(n),name:l,value:r})}),()=>e.createVNode(e.Fragment,null,[a.value])}});exports.default=c;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),l=require("../../store/modules/DataDictionary.cjs.js"),r=e.defineComponent({name:"DicReplace",props:{name:{type:String,default:""},value:{type:String,default:""}},setup(t){const{getDicTextByValue:u}=l.useDataDicStore(),a=e.ref("");return e.watchEffect(()=>{const n=t.value,c=t.name;a.value=u(c,n)}),()=>e.createVNode(e.Fragment,null,[a.value])}});exports.default=r;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const q=require("pinia"),m=require("pinia-plugin-persistedstate"),s=require("./worker-pool.cjs.js"),f=require("./dic/replace.worker.cjs.js"),P=require("./select/dic.worker.cjs.js"),l=require("./components.cjs.js"),S=require("../directive/trim.cjs.js"),$=require("./table/index.cjs.js"),x=require("./select/index.cjs.js"),k=require("./desensitize/index.cjs.js"),v=require("./dic/index.cjs.js"),w=require("./modal/index.cjs.js"),b=require("./form/index.cjs.js"),u=require("./grid/index.cjs.js"),i=require("./layout/index.cjs.js"),c=l,a=function(e,d){Object.keys(c).forEach(D=>{const n=c[D];n.install&&e.use(n)});const r=q.createPinia();r.use(m.createPersistedState({storage:sessionStorage})),e.use(r),e.directive("trim",S.default),e.provide("menuIcon",d.menuIcon||{});const t=new s.default(P.default,2);t.initialize(),e.provide("dicWorkerPool",t);const o=new s.default(f.default,2);o.initialize(),e.provide("repWorkerPool",o)},M={install:a};exports.DemoSelect=l.DemoSelect;exports.DTable=$.DTable;exports.DSelect=x.DSelect;exports.DDesensitize=k.DDesensitize;exports.DicReplace=v.DDicReplace;exports.DModal=w.DModal;exports.DForm=b.default;exports.DGrid=u.DGrid;exports.DGridItem=u.DGridItem;exports.DList=i.DList;exports.DMain=i.DMain;exports.DNavTabs=i.DNavTabs;exports.DShow=i.DShow;exports.default=M;exports.install=a;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("pinia"),D=require("pinia-plugin-persistedstate"),d=require("./components.cjs.js"),l=require("../directive/trim.cjs.js"),q=require("./table/index.cjs.js"),m=require("./select/index.cjs.js"),x=require("./desensitize/index.cjs.js"),$=require("./dic/index.cjs.js"),S=require("./modal/index.cjs.js"),b=require("./form/index.cjs.js"),r=require("./grid/index.cjs.js"),i=require("./layout/index.cjs.js"),s=d,o=function(e,c){Object.keys(s).forEach(a=>{const n=s[a];n.install&&e.use(n)});const t=u.createPinia();t.use(D.createPersistedState({storage:sessionStorage})),e.use(t),e.directive("trim",l.default),e.provide("menuIcon",c.menuIcon||{})},f={install:o};exports.DTable=q.DTable;exports.DSelect=m.DSelect;exports.DDesensitize=x.DDesensitize;exports.DicReplace=$.DDicReplace;exports.DModal=S.DModal;exports.DForm=b.default;exports.DGrid=r.DGrid;exports.DGridItem=r.DGridItem;exports.DList=i.DList;exports.DMain=i.DMain;exports.DNavTabs=i.DNavTabs;exports.DShow=i.DShow;exports.default=f;exports.install=o;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),L=require("../../store/modules/DataDictionary.cjs.js"),y={name:"DSelect"},B=e.defineComponent({...y,props:{value:{default:null},name:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"请填写默认占位符啊!老铁"},include:{default:[]}},emits:["update:value","change","select"],setup(u,{emit:c}){const n=u,{getDicByKey:v,list:h}=L.useDataDicStore(),s=e.inject("dicWorkerPool").getWorker(),{modelValue:i,data:p,onSearch:S,onSelect:g,onChange:m}=C();function C(){let d=!0,t=[];const o=e.ref([]),l=e.ref(n.value);s.onerror=()=>{d=!1,t=v(n.name)},s.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.list=t.filter(r=>r.value.toLowerCase().indexOf(a.toLowerCase())!==-1||r.label.toLowerCase().includes(a.toLowerCase())).splice(0,10)};function f(a){s.postMessage({list:JSON.stringify(h[n.name]),keywords:a,include:JSON.stringify(n.include??[])})}const b=a=>{c("update:value",a),D()},k=()=>{c("update:value",l.value),c("change",l.value)};function D(){const r=v(n.name).find(_=>_.value===l.value);c("select",r)}return{data:o,modelValue:l,onSearch:w,onSelect:b,onChange:k}}return(d,t)=>{const o=e.resolveComponent("a-select");return e.openBlock(),e.createBlock(o,{value:e.unref(i),"onUpdate:value":t[0]||(t[0]=l=>e.isRef(i)?i.value=l:null),"allow-clear":"","show-search":"","filter-option":!1,options:e.unref(p),placeholder:u.placeholder,disabled:u.disabled,onSelect:e.unref(g),onSearch:e.unref(S),onChange:e.unref(m)},null,8,["value","options","placeholder","disabled","onSelect","onSearch","onChange"])}}});exports.default=B;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),D=require("../../store/modules/DataDictionary.cjs.js"),_={name:"DSelect"},L=e.defineComponent({..._,props:{value:{default:null},name:{default:""},disabled:{type:Boolean,default:!1},placeholder:{default:"请填写默认占位符啊!老铁"},include:{default:[]}},emits:["update:value","change","select"],setup(u,{emit:o}){const t=u,{getDicByKey:f}=D.useDataDicStore(),{modelValue:r,data:v,onSearch:h,onSelect:p,onChange:S}=g();function g(){const s=[...f(t.name)],n=e.ref([]),a=e.ref(t.value);e.watch(()=>t.include,()=>{i(a.value)}),e.watch(()=>t.value,l=>{a.value=l}),i(a.value);const d=l=>{i(l)};function i(l){n.value=s.filter(c=>c.value.toLowerCase().indexOf(l.toLowerCase())!==-1||c.label.toLowerCase().includes(l.toLowerCase())).splice(0,10),n.value.length===0&&(n.value=[...s].splice(0,10))}const C=l=>{o("update:value",l),b()},m=()=>{o("update:value",a.value),o("change",a.value)};function b(){const c=f(t.name).find(w=>w.value===a.value);o("select",c)}return{data:n,modelValue:a,onSearch:d,onSelect:C,onChange:m}}return(s,n)=>{const a=e.resolveComponent("a-select");return e.openBlock(),e.createBlock(a,{value:e.unref(r),"onUpdate:value":n[0]||(n[0]=d=>e.isRef(r)?r.value=d:null),"allow-clear":"","show-search":"","filter-option":!1,options:e.unref(v),placeholder:u.placeholder,disabled:u.disabled,onSelect:e.unref(p),onSearch:e.unref(h),onChange:e.unref(S)},null,8,["value","options","placeholder","disabled","onSelect","onSearch","onChange"])}}});exports.default=L;
@@ -6,19 +6,3 @@ export { default as DSelect } from "./select";
6
6
  export { default as DDesensitize } from "./desensitize";
7
7
  export { default as DicReplace } from "./dic";
8
8
  export { default as DModal } from "./modal";
9
- export declare const DemoSelect: import("../utils/install").SFCWithInstall<import("vue").DefineComponent<{
10
- name: {
11
- type: import("vue").PropType<string>;
12
- required: true;
13
- default: string;
14
- };
15
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
16
- name: {
17
- type: import("vue").PropType<string>;
18
- required: true;
19
- default: string;
20
- };
21
- }>>, {
22
- name: string;
23
- }>>;
24
- export default DemoSelect;
@@ -1,27 +1,22 @@
1
- import o from "../utils/install.esm.js";
2
- import { default as f } from "./form/index.esm.js";
3
- import { DList as i, DMain as l, DNavTabs as s, DShow as x } from "./layout/index.esm.js";
4
- import { DTable as d } from "./table/index.esm.js";
5
- import { DGrid as S, DGridItem as b } from "./grid/index.esm.js";
6
- import { DSelect as u } from "./select/index.esm.js";
7
- import { DDesensitize as G } from "./desensitize/index.esm.js";
1
+ import { default as r } from "./form/index.esm.js";
2
+ import { DList as t, DMain as a, DNavTabs as m, DShow as p } from "./layout/index.esm.js";
3
+ import { DTable as i } from "./table/index.esm.js";
4
+ import { DGrid as l, DGridItem as s } from "./grid/index.esm.js";
5
+ import { DSelect as d } from "./select/index.esm.js";
6
+ import { DDesensitize as n } from "./desensitize/index.esm.js";
8
7
  import { DDicReplace as M } from "./dic/index.esm.js";
9
- import { DModal as T } from "./modal/index.esm.js";
10
- import e from "./select/DemoSelect.vue.esm.js";
11
- const m = o(e);
8
+ import { DModal as S } from "./modal/index.esm.js";
12
9
  export {
13
- G as DDesensitize,
14
- f as DForm,
15
- S as DGrid,
16
- b as DGridItem,
17
- i as DList,
18
- l as DMain,
19
- T as DModal,
20
- s as DNavTabs,
21
- u as DSelect,
22
- x as DShow,
23
- d as DTable,
24
- m as DemoSelect,
25
- M as DicReplace,
26
- m as default
10
+ n as DDesensitize,
11
+ r as DForm,
12
+ l as DGrid,
13
+ s as DGridItem,
14
+ t as DList,
15
+ a as DMain,
16
+ S as DModal,
17
+ m as DNavTabs,
18
+ d as DSelect,
19
+ p as DShow,
20
+ i as DTable,
21
+ M as DicReplace
27
22
  };
@@ -1,6 +1,6 @@
1
- import { defineComponent as c, ref as a, inject as u, watchEffect as i, createVNode as p, Fragment as f } from "vue";
1
+ import { defineComponent as l, ref as o, watchEffect as u, createVNode as r, Fragment as i } from "vue";
2
2
  import { useDataDicStore as m } from "../../store/modules/DataDictionary.esm.js";
3
- const v = /* @__PURE__ */ c({
3
+ const s = /* @__PURE__ */ l({
4
4
  name: "DicReplace",
5
5
  props: {
6
6
  // 字典名称
@@ -14,24 +14,16 @@ const v = /* @__PURE__ */ c({
14
14
  default: ""
15
15
  }
16
16
  },
17
- setup(o) {
17
+ setup(e) {
18
18
  const {
19
- list: n
20
- } = m(), s = a(!0), r = a(""), e = u("repWorkerPool").getWorker();
21
- return e.onerror = () => {
22
- s.value = !1;
23
- }, e.onmessage = (t) => {
24
- r.value = t.data;
25
- }, i(() => {
26
- const t = o.value, l = o.name;
27
- e.postMessage({
28
- list: JSON.stringify(n),
29
- name: l,
30
- value: t
31
- });
32
- }), () => p(f, null, [r.value]);
19
+ getDicTextByValue: a
20
+ } = m(), t = o("");
21
+ return u(() => {
22
+ const n = e.value, c = e.name;
23
+ t.value = a(c, n);
24
+ }), () => r(i, null, [t.value]);
33
25
  }
34
26
  });
35
27
  export {
36
- v as default
28
+ s as default
37
29
  };
@@ -1,51 +1,42 @@
1
- import { createPinia as a } from "pinia";
2
- import { createPersistedState as f } from "pinia-plugin-persistedstate";
3
- import m from "./worker-pool.esm.js";
4
- import p from "./dic/replace.worker.esm.js";
5
- import l from "./select/dic.worker.esm.js";
6
- import * as D from "./components.esm.js";
7
- import { DemoSelect as I } from "./components.esm.js";
8
- import d from "../directive/trim.esm.js";
9
- import { DTable as g } from "./table/index.esm.js";
10
- import { DSelect as G } from "./select/index.esm.js";
11
- import { DDesensitize as R } from "./desensitize/index.esm.js";
12
- import { DDicReplace as y } from "./dic/index.esm.js";
13
- import { DModal as F } from "./modal/index.esm.js";
14
- import { default as N } from "./form/index.esm.js";
15
- import { DGrid as $, DGridItem as q } from "./grid/index.esm.js";
16
- import { DList as B, DMain as C, DNavTabs as H, DShow as J } from "./layout/index.esm.js";
17
- const n = D, x = function(o, s) {
18
- Object.keys(n).forEach((c) => {
19
- const i = n[c];
20
- i.install && o.use(i);
1
+ import { createPinia as m } from "pinia";
2
+ import { createPersistedState as n } from "pinia-plugin-persistedstate";
3
+ import * as c from "./components.esm.js";
4
+ import a from "../directive/trim.esm.js";
5
+ import { DTable as v } from "./table/index.esm.js";
6
+ import { DSelect as b } from "./select/index.esm.js";
7
+ import { DDesensitize as T } from "./desensitize/index.esm.js";
8
+ import { DDicReplace as h } from "./dic/index.esm.js";
9
+ import { DModal as M } from "./modal/index.esm.js";
10
+ import { default as R } from "./form/index.esm.js";
11
+ import { DGrid as k, DGridItem as w } from "./grid/index.esm.js";
12
+ import { DList as z, DMain as E, DNavTabs as F, DShow as L } from "./layout/index.esm.js";
13
+ const r = c, f = function(e, i) {
14
+ Object.keys(r).forEach((s) => {
15
+ const t = r[s];
16
+ t.install && e.use(t);
21
17
  });
22
- const r = a();
23
- r.use(
24
- f({
18
+ const o = m();
19
+ o.use(
20
+ n({
25
21
  storage: sessionStorage
26
22
  })
27
- ), o.use(r), o.directive("trim", d), o.provide("menuIcon", s.menuIcon || {});
28
- const e = new m(l, 2);
29
- e.initialize(), o.provide("dicWorkerPool", e);
30
- const t = new m(p, 2);
31
- t.initialize(), o.provide("repWorkerPool", t);
32
- }, w = {
33
- install: x
23
+ ), e.use(o), e.directive("trim", a), e.provide("menuIcon", i.menuIcon || {});
24
+ }, x = {
25
+ install: f
34
26
  };
35
27
  export {
36
- R as DDesensitize,
37
- N as DForm,
38
- $ as DGrid,
39
- q as DGridItem,
40
- B as DList,
41
- C as DMain,
42
- F as DModal,
43
- H as DNavTabs,
44
- G as DSelect,
45
- J as DShow,
46
- g as DTable,
47
- I as DemoSelect,
48
- y as DicReplace,
49
- w as default,
50
- x as install
28
+ T as DDesensitize,
29
+ R as DForm,
30
+ k as DGrid,
31
+ w as DGridItem,
32
+ z as DList,
33
+ E as DMain,
34
+ M as DModal,
35
+ F as DNavTabs,
36
+ b as DSelect,
37
+ L as DShow,
38
+ v as DTable,
39
+ h as DicReplace,
40
+ x as default,
41
+ f as install
51
42
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as x, inject as y, ref as v, watch as h, resolveComponent as O, openBlock as P, createBlock as V, unref as t, isRef as W } from "vue";
2
- import { useDataDicStore as J } from "../../store/modules/DataDictionary.esm.js";
3
- const N = {
1
+ import { defineComponent as _, ref as p, watch as v, resolveComponent as B, openBlock as x, createBlock as V, unref as o, isRef as k } from "vue";
2
+ import { useDataDicStore as y } from "../../store/modules/DataDictionary.esm.js";
3
+ const H = {
4
4
  name: "DSelect"
5
- }, K = /* @__PURE__ */ x({
6
- ...N,
5
+ }, R = /* @__PURE__ */ _({
6
+ ...H,
7
7
  props: {
8
8
  value: { default: null },
9
9
  name: { default: "" },
@@ -12,71 +12,62 @@ const N = {
12
12
  include: { default: [] }
13
13
  },
14
14
  emits: ["update:value", "change", "select"],
15
- setup(s, { emit: c }) {
16
- const l = s, { getDicByKey: p, list: S } = J(), u = y("dicWorkerPool").getWorker(), { modelValue: d, data: m, onSearch: g, onSelect: C, onChange: w } = k();
17
- function k() {
18
- let i = !0, o = [];
19
- const n = v([]), a = v(l.value);
20
- u.onerror = () => {
21
- i = !1, o = p(l.name);
22
- }, u.onmessage = (e) => {
23
- n.value = e.data;
24
- }, h(
25
- () => l.include,
15
+ setup(u, { emit: t }) {
16
+ const n = u, { getDicByKey: f } = y(), { modelValue: s, data: h, onSearch: S, onSelect: m, onChange: C } = g();
17
+ function g() {
18
+ const d = [...f(n.name)], l = p([]), e = p(n.value);
19
+ v(
20
+ () => n.include,
26
21
  () => {
27
- f(a.value);
22
+ i(e.value);
28
23
  }
29
- ), h(
30
- () => l.value,
31
- (e) => {
32
- a.value = e;
24
+ ), v(
25
+ () => n.value,
26
+ (a) => {
27
+ e.value = a;
33
28
  }
34
- ), f(a.value);
35
- const L = (e) => {
36
- i ? f(e) : n.list = o.filter((r) => r.value.toLowerCase().indexOf(e.toLowerCase()) !== -1 || r.label.toLowerCase().includes(e.toLowerCase())).splice(0, 10);
29
+ ), i(e.value);
30
+ const r = (a) => {
31
+ i(a);
37
32
  };
38
- function f(e) {
39
- u.postMessage({
40
- list: JSON.stringify(S[l.name]),
41
- keywords: e,
42
- include: JSON.stringify(l.include ?? [])
43
- });
33
+ function i(a) {
34
+ l.value = d.filter((c) => c.value.toLowerCase().indexOf(a.toLowerCase()) !== -1 || c.label.toLowerCase().includes(a.toLowerCase())).splice(0, 10), l.value.length === 0 && (l.value = [...d].splice(0, 10));
44
35
  }
45
- const b = (e) => {
46
- c("update:value", e), _();
47
- }, D = () => {
48
- c("update:value", a.value), c("change", a.value);
36
+ const w = (a) => {
37
+ t("update:value", a), b();
38
+ }, L = () => {
39
+ t("update:value", e.value), t("change", e.value);
49
40
  };
50
- function _() {
51
- const r = p(l.name).find((B) => B.value === a.value);
52
- c("select", r);
41
+ function b() {
42
+ const c = f(n.name).find((D) => D.value === e.value);
43
+ t("select", c);
53
44
  }
54
45
  return {
55
- data: n,
56
- modelValue: a,
57
- onSearch: L,
58
- onSelect: b,
59
- onChange: D
46
+ data: l,
47
+ modelValue: e,
48
+ onSearch: r,
49
+ onSelect: w,
50
+ onChange: L
60
51
  };
61
52
  }
62
- return (i, o) => {
63
- const n = O("a-select");
64
- return P(), V(n, {
65
- value: t(d),
66
- "onUpdate:value": o[0] || (o[0] = (a) => W(d) ? d.value = a : null),
53
+ return (d, l) => {
54
+ const e = B("a-select");
55
+ return x(), V(e, {
56
+ value: o(s),
57
+ "onUpdate:value": l[0] || (l[0] = (r) => k(s) ? s.value = r : null),
67
58
  "allow-clear": "",
68
59
  "show-search": "",
69
60
  "filter-option": !1,
70
- options: t(m),
71
- placeholder: s.placeholder,
72
- disabled: s.disabled,
73
- onSelect: t(C),
74
- onSearch: t(g),
75
- onChange: t(w)
61
+ options: o(h),
62
+ placeholder: u.placeholder,
63
+ disabled: u.disabled,
64
+ onSelect: o(m),
65
+ onSearch: o(S),
66
+ onChange: o(C)
76
67
  }, null, 8, ["value", "options", "placeholder", "disabled", "onSelect", "onSearch", "onChange"]);
77
68
  };
78
69
  }
79
70
  });
80
71
  export {
81
- K as default
72
+ R as default
82
73
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "files": [
5
5
  "dist/**",
6
6
  "src"
@@ -1,5 +1,3 @@
1
- import { withInstall } from "../utils";
2
-
3
1
  export { default as DForm } from "./form";
4
2
  export * from "./layout";
5
3
  export { default as DTable } from "./table";
@@ -8,7 +6,3 @@ export { default as DSelect } from "./select";
8
6
  export { default as DDesensitize } from "./desensitize";
9
7
  export { default as DicReplace } from "./dic";
10
8
  export { default as DModal } from "./modal";
11
-
12
- import Select from "./select/DemoSelect.vue";
13
- export const DemoSelect = withInstall(Select);
14
- export default DemoSelect;
@@ -24,31 +24,32 @@ export default defineComponent({
24
24
  }
25
25
  },
26
26
  setup(props) {
27
- const { list } = useDataDicStore();
28
-
29
- const workerStatus = ref(true);
27
+ const { getDicTextByValue } = useDataDicStore();
28
+ //TODO 使用webworker存在一定的问题
29
+ //const workerStatus = ref(true);
30
30
  const dicValueTxt = ref<any>("");
31
- const repWorkerPool: any = inject("repWorkerPool");
32
- // 获取worker
33
- const workerInstance: any = repWorkerPool.getWorker();
31
+ // const repWorkerPool: any = inject("repWorkerPool");
32
+ // // 获取worker
33
+ // const workerInstance: any = repWorkerPool.getWorker();
34
34
  /**
35
35
  * web worker 启动失败
36
36
  */
37
- workerInstance.onerror = () => {
38
- workerStatus.value = false;
39
- };
37
+ // workerInstance.onerror = () => {
38
+ // workerStatus.value = false;
39
+ // };
40
40
  /**
41
41
  * 监听web worker发送的数据
42
42
  * @param e
43
43
  */
44
- workerInstance.onmessage = (e: any) => {
45
- // 赋值给下拉选择数据变量
46
- dicValueTxt.value = e.data;
47
- };
44
+ // workerInstance.onmessage = (e: any) => {
45
+ // // 赋值给下拉选择数据变量
46
+ // dicValueTxt.value = e.data;
47
+ // };
48
48
  watchEffect(() => {
49
49
  const value = props.value;
50
50
  const name = props.name;
51
- workerInstance.postMessage({ list: JSON.stringify(list), name, value });
51
+ dicValueTxt.value = getDicTextByValue(name, value);
52
+ // workerInstance.postMessage({ list: JSON.stringify(list), name, value });
52
53
  });
53
54
 
54
55
  return () => <>{dicValueTxt.value}</>;
@@ -3,8 +3,8 @@ import { createPinia } from "pinia";
3
3
  import { createPersistedState } from "pinia-plugin-persistedstate";
4
4
  import WorkerPool from "./worker-pool";
5
5
 
6
- import ReplaceWorker from "./dic/replace.worker?worker&inline";
7
- import DicWorker from "./select/dic.worker?worker&inline";
6
+ // import ReplaceWorker from "./dic/replace.worker?worker&inline";
7
+ // import DicWorker from "./select/dic.worker?worker&inline";
8
8
 
9
9
  import * as components from "./components";
10
10
  export * from "./components";
@@ -40,17 +40,16 @@ export const install = function (app: App, opts: Options) {
40
40
  app.directive("trim", vTrim);
41
41
  app.provide("menuIcon", opts.menuIcon || {});
42
42
 
43
- // 创建 Web Worker 连接池实例
44
- const workerPool = new WorkerPool(DicWorker, 2); // 这里设置连接池的大小为 5
45
- workerPool.initialize();
46
- // 注入连接池实例
47
- app.provide("dicWorkerPool", workerPool);
48
- // 创建 Web Worker 连接池实例
49
- const repWorkerPool = new WorkerPool(ReplaceWorker, 2); // 这里设置连接池的大小为 5
50
- repWorkerPool.initialize();
51
- // 注入连接池实例
52
- app.provide("repWorkerPool", repWorkerPool);
53
-
43
+ // // 创建 Web Worker 连接池实例
44
+ // const workerPool = new WorkerPool(DicWorker, 2); // 这里设置连接池的大小为 5
45
+ // workerPool.initialize();
46
+ // // 注入连接池实例
47
+ // app.provide("dicWorkerPool", workerPool);
48
+ // // 创建 Web Worker 连接池实例
49
+ // const repWorkerPool = new WorkerPool(ReplaceWorker, 2); // 这里设置连接池的大小为 5
50
+ // repWorkerPool.initialize();
51
+ // // 注入连接池实例
52
+ // app.provide("repWorkerPool", repWorkerPool);
54
53
  };
55
54
 
56
55
  export default {
@@ -28,18 +28,18 @@ interface Emits {
28
28
  }
29
29
  const emits = defineEmits<Emits>();
30
30
 
31
- const { getDicByKey, list } = useDataDicStore();
31
+ const { getDicByKey } = useDataDicStore();
32
32
 
33
- const workerPool: any = inject("dicWorkerPool");
34
- // 获取worker
35
- const workerInstance: any = workerPool.getWorker();
33
+ // const workerPool: any = inject("dicWorkerPool");
34
+ // // 获取worker
35
+ // const workerInstance: any = workerPool.getWorker();
36
36
 
37
37
  const { modelValue, data, onSearch, onSelect, onChange } = useSelect();
38
38
 
39
39
  function useSelect() {
40
40
  // 保存worker启动状态
41
- let workerStatus = true;
42
- let dicData: any[] = [];
41
+ // let workerStatus = true;
42
+ const dicData: any[] = [...getDicByKey(props.name)];
43
43
  const data = ref<any>([]);
44
44
  // 取值
45
45
  const modelValue = ref(props.value);
@@ -47,19 +47,19 @@ function useSelect() {
47
47
  /**
48
48
  * web worker 启动失败
49
49
  */
50
- workerInstance.onerror = () => {
51
- workerStatus = false;
52
- // 启动失败使用store
53
- dicData = getDicByKey(props.name);
54
- };
50
+ // workerInstance.onerror = () => {
51
+ // workerStatus = false;
52
+ // // 启动失败使用store
53
+ // dicData = getDicByKey(props.name);
54
+ // };
55
55
  /**
56
56
  * 监听web worker发送的数据
57
57
  * @param e
58
58
  */
59
- workerInstance.onmessage = (e: any) => {
60
- // 赋值给下拉选择数据变量
61
- data.value = e.data;
62
- };
59
+ // workerInstance.onmessage = (e: any) => {
60
+ // // 赋值给下拉选择数据变量
61
+ // data.value = e.data;
62
+ // };
63
63
 
64
64
  // 当include变化的时候,需要重新发送搜索事件 返回对应的下拉数据
65
65
  watch(
@@ -82,27 +82,27 @@ function useSelect() {
82
82
 
83
83
  //监听用户搜索事件
84
84
  const onSearch = (keywords: string) => {
85
- if (workerStatus) {
86
- sendWorkerSearch(keywords);
87
- } else {
88
- data.list = dicData
89
- .filter((item: any) => {
90
- return (
91
- item.value.toLowerCase().indexOf(keywords.toLowerCase()) !== -1 ||
92
- item.label.toLowerCase().includes(keywords.toLowerCase())
93
- );
94
- })
95
- .splice(0, 10);
96
- }
85
+ sendWorkerSearch(keywords);
97
86
  };
98
87
 
99
88
  // 发送搜索到webworker
100
89
  function sendWorkerSearch(keywords: string) {
101
- workerInstance.postMessage({
102
- list: JSON.stringify(list[props.name]),
103
- keywords: keywords,
104
- include: JSON.stringify(props.include ?? [])
105
- });
90
+ // workerInstance.postMessage({
91
+ // list: JSON.stringify(list[props.name]),
92
+ // keywords: keywords,
93
+ // include: JSON.stringify(props.include ?? [])
94
+ // });
95
+ data.value = dicData
96
+ .filter((item: any) => {
97
+ return (
98
+ item.value.toLowerCase().indexOf(keywords.toLowerCase()) !== -1 ||
99
+ item.label.toLowerCase().includes(keywords.toLowerCase())
100
+ );
101
+ })
102
+ .splice(0, 10);
103
+ if (data.value.length === 0) {
104
+ data.value = [...dicData].splice(0, 10);
105
+ }
106
106
  }
107
107
 
108
108
  //监听下拉选择事件
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24oYSl7Y29uc3QgdD1hLmRhdGEubmFtZT8/IiIsZT1hLmRhdGEudmFsdWU/PyIiLG49KChKU09OLnBhcnNlKGEuZGF0YS5saXN0KT8/W10pW3RdfHxbXSkuZmlsdGVyKHM9PnMudmFsdWU9PT1lKS5tYXAocz0+cy5sYWJlbCkuam9pbigiIik7c2VsZi5wb3N0TWVzc2FnZShuKX0sITEpfSkoKTsK",t=typeof window<"u"&&window.Blob&&new Blob([atob(n)],{type:"text/javascript;charset=utf-8"});function o(){const e=t&&(window.URL||window.webkitURL).createObjectURL(t);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+n)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}exports.default=o;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("../../store/modules/DataDictionary.cjs.js"),c={name:"DemoSelect"},u=e.defineComponent({...c,props:{name:{default:""}},setup(s){const n=s,t=e.inject("dicWorkerInstance"),o=e.ref([]);t.onmessage=a=>{o.value=a.data};const{list:r}=i.useDataDicStore();return e.onMounted(()=>{t.postMessage({list:JSON.stringify(r[n.name]),keywords:"",include:JSON.stringify([])})}),e.onUnmounted(()=>{t.terminate()}),(a,l)=>(e.openBlock(),e.createElementBlock("div",null,e.toDisplayString(n.name)+" "+e.toDisplayString(o.value),1))}});exports.default=u;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./DemoSelect.vue.cjs.js");exports.default=e.default;
@@ -1,17 +0,0 @@
1
- import type { PropType as __PropType } from 'vue';
2
- declare const _sfc_main: import("vue").DefineComponent<{
3
- name: {
4
- type: __PropType<string>;
5
- required: true;
6
- default: string;
7
- };
8
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
9
- name: {
10
- type: __PropType<string>;
11
- required: true;
12
- default: string;
13
- };
14
- }>>, {
15
- name: string;
16
- }>;
17
- export default _sfc_main;
@@ -1 +0,0 @@
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;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class t{constructor(e,o){this.workerClass=e,this.poolSize=o,this.pool=[],this.activeWorkers=new Set}initialize(){for(let e=0;e<this.poolSize;e++){const o=new this.workerClass;this.pool.push(o)}}getWorker(){if(this.pool.length>0){const e=this.pool.pop();return this.activeWorkers.add(e),e}return null}releaseWorker(e){this.pool.push(e),this.activeWorkers.delete(e)}cleanup(){for(const e of this.activeWorkers)e.terminate();this.pool=[],this.activeWorkers.clear()}}exports.default=t;
@@ -1,12 +0,0 @@
1
- const o = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24oYSl7Y29uc3QgdD1hLmRhdGEubmFtZT8/IiIsZT1hLmRhdGEudmFsdWU/PyIiLG49KChKU09OLnBhcnNlKGEuZGF0YS5saXN0KT8/W10pW3RdfHxbXSkuZmlsdGVyKHM9PnMudmFsdWU9PT1lKS5tYXAocz0+cy5sYWJlbCkuam9pbigiIik7c2VsZi5wb3N0TWVzc2FnZShuKX0sITEpfSkoKTsK", e = typeof window < "u" && window.Blob && new Blob([atob(o)], { type: "text/javascript;charset=utf-8" });
2
- function t() {
3
- const n = e && (window.URL || window.webkitURL).createObjectURL(e);
4
- try {
5
- return n ? new Worker(n) : new Worker("data:application/javascript;base64," + o);
6
- } finally {
7
- n && (window.URL || window.webkitURL).revokeObjectURL(n);
8
- }
9
- }
10
- export {
11
- t as default
12
- };
@@ -1,17 +0,0 @@
1
- import type { PropType as __PropType } from 'vue';
2
- declare const _sfc_main: import("vue").DefineComponent<{
3
- name: {
4
- type: __PropType<string>;
5
- required: true;
6
- default: string;
7
- };
8
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
9
- name: {
10
- type: __PropType<string>;
11
- required: true;
12
- default: string;
13
- };
14
- }>>, {
15
- name: string;
16
- }>;
17
- export default _sfc_main;
@@ -1,29 +0,0 @@
1
- import { defineComponent as c, inject as i, ref as l, onMounted as m, onUnmounted as u, openBlock as d, createElementBlock as p, toDisplayString as a } from "vue";
2
- import { useDataDicStore as f } from "../../store/modules/DataDictionary.esm.js";
3
- const _ = {
4
- name: "DemoSelect"
5
- }, y = /* @__PURE__ */ c({
6
- ..._,
7
- props: {
8
- name: { default: "" }
9
- },
10
- setup(s) {
11
- const t = s, e = i("dicWorkerInstance"), n = l([]);
12
- e.onmessage = (o) => {
13
- n.value = o.data;
14
- };
15
- const { list: r } = f();
16
- return m(() => {
17
- e.postMessage({
18
- list: JSON.stringify(r[t.name]),
19
- keywords: "",
20
- include: JSON.stringify([])
21
- });
22
- }), u(() => {
23
- e.terminate();
24
- }), (o, g) => (d(), p("div", null, a(t.name) + " " + a(n.value), 1));
25
- }
26
- });
27
- export {
28
- y as default
29
- };
@@ -1,4 +0,0 @@
1
- import f from "./DemoSelect.vue.esm.js";
2
- export {
3
- f as default
4
- };
@@ -1,12 +0,0 @@
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
- function c() {
3
- const l = n && (window.URL || window.webkitURL).createObjectURL(n);
4
- try {
5
- return l ? new Worker(l) : new Worker("data:application/javascript;base64," + b);
6
- } finally {
7
- l && (window.URL || window.webkitURL).revokeObjectURL(l);
8
- }
9
- }
10
- export {
11
- c as default
12
- };
@@ -1,29 +0,0 @@
1
- class r {
2
- constructor(e, o) {
3
- this.workerClass = e, this.poolSize = o, this.pool = [], this.activeWorkers = /* @__PURE__ */ new Set();
4
- }
5
- initialize() {
6
- for (let e = 0; e < this.poolSize; e++) {
7
- const o = new this.workerClass();
8
- this.pool.push(o);
9
- }
10
- }
11
- getWorker() {
12
- if (this.pool.length > 0) {
13
- const e = this.pool.pop();
14
- return this.activeWorkers.add(e), e;
15
- }
16
- return null;
17
- }
18
- releaseWorker(e) {
19
- this.pool.push(e), this.activeWorkers.delete(e);
20
- }
21
- cleanup() {
22
- for (const e of this.activeWorkers)
23
- e.terminate();
24
- this.pool = [], this.activeWorkers.clear();
25
- }
26
- }
27
- export {
28
- r as default
29
- };
@@ -1,49 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref, onMounted, onUnmounted, inject } from "vue";
3
- import { useDataDicStore } from "../../store/modules/DataDictionary";
4
-
5
- interface Props {
6
- name: string; //字典名字
7
- }
8
-
9
- const props = withDefaults(defineProps<Props>(), {
10
- name: ""
11
- });
12
-
13
- const workerInstance: any = inject("dicWorkerInstance");
14
-
15
- const data = ref([]);
16
-
17
- // 监听 Web Worker 的消息
18
- workerInstance.onmessage = (event: any) => {
19
- data.value = event.data;
20
- };
21
- const { list } = useDataDicStore();
22
-
23
- onMounted(() => {
24
- workerInstance.postMessage({
25
- list: JSON.stringify(list[props.name]),
26
- keywords: "",
27
- include: JSON.stringify([])
28
- });
29
- });
30
-
31
- onUnmounted(() => {
32
- // 组件销毁时终止 Web Worker
33
- workerInstance.terminate();
34
- });
35
-
36
- // 其他组件逻辑...
37
- </script>
38
- <script lang="ts">
39
- export default {
40
- name: "DemoSelect"
41
- };
42
- </script>
43
- <template>
44
- <div>
45
- {{ props.name }}
46
- {{ data }}
47
- </div>
48
- </template>
49
- <style scoped></style>