@ditari/bsui 1.0.44 → 1.0.45

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.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("pinia"),l=require("../types.cjs.js"),n=a.defineStore(l.DATA_DICTIONARY_ID,{state:()=>({someState:"你好 pinia",list:{}}),getters:{getDicByKey:e=>r=>e.list[r]||[],getDicTextByValue:e=>(r,i)=>(e.list[r]||[]).filter(t=>t.value===i).map(t=>t.label).join(""),getDicValueByText:e=>(r,i)=>(e.list[r]||[]).filter(t=>t.label===i).map(t=>t.label).join("")},actions:{save(e){this.list=e}},persist:!0});exports.useDataDicStore=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("pinia"),n=require("../types.cjs.js"),l=a.defineStore(n.DATA_DICTIONARY_ID,{state:()=>({someState:"你好 pinia",list:{}}),getters:{getDicByKey:e=>r=>e.list[r]||[],getDicTextByValue:e=>(r,i)=>(e.list[r]||[]).filter(t=>t.value===i).map(t=>t.label).join(""),getDicValueByText:e=>(r,i)=>(e.list[r]||[]).filter(t=>t.label===i).map(t=>t.value).join("")},actions:{save(e){this.list=e}},persist:!0});exports.useDataDicStore=l;
@@ -1,6 +1,6 @@
1
- import { defineStore as l } from "pinia";
2
- import { DATA_DICTIONARY_ID as a } from "../types.esm.js";
3
- const u = l(a, {
1
+ import { defineStore as a } from "pinia";
2
+ import { DATA_DICTIONARY_ID as l } from "../types.esm.js";
3
+ const u = a(l, {
4
4
  state: () => ({
5
5
  someState: "你好 pinia",
6
6
  list: {}
@@ -16,7 +16,7 @@ const u = l(a, {
16
16
  * @param state
17
17
  */
18
18
  getDicTextByValue: (t) => (r, i) => (t.list[r] || []).filter((e) => e.value === i).map((e) => e.label).join(""),
19
- getDicValueByText: (t) => (r, i) => (t.list[r] || []).filter((e) => e.label === i).map((e) => e.label).join("")
19
+ getDicValueByText: (t) => (r, i) => (t.list[r] || []).filter((e) => e.label === i).map((e) => e.value).join("")
20
20
  },
21
21
  actions: {
22
22
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "files": [
5
5
  "dist/**",
6
6
  "src"
@@ -34,11 +34,12 @@ const useDataDicStore = defineStore(DATA_DICTIONARY_ID, {
34
34
  };
35
35
  },
36
36
  getDicValueByText: (state) => {
37
+ // 根据文字匹配对应的value
37
38
  return (key: string, text: string) => {
38
39
  const rs = state.list[key] || [];
39
40
  return rs
40
41
  .filter((item: any) => item.label === text)
41
- .map((item: any) => item.label)
42
+ .map((item: any) => item.value)
42
43
  .join("");
43
44
  };
44
45
  }