@ditari/bsui 1.0.43 → 1.0.44

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 s=require("pinia"),a=require("../types.cjs.js"),n=s.defineStore(a.DATA_DICTIONARY_ID,{state:()=>({someState:"你好 pinia",list:{}}),getters:{getDicByKey:e=>t=>e.list[t]||[],getDicTextByValue:e=>(t,i)=>(e.list[t]||[]).filter(r=>r.value===i).map(r=>r.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"),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;
@@ -19,6 +19,10 @@ declare const useDataDicStore: import("pinia").StoreDefinition<string, State, {
19
19
  someState: string;
20
20
  list: any;
21
21
  } & import("pinia").PiniaCustomStateProperties<State>) => (key: string, value: string) => any;
22
+ getDicValueByText: (state: {
23
+ someState: string;
24
+ list: any;
25
+ } & import("pinia").PiniaCustomStateProperties<State>) => (key: string, text: string) => any;
22
26
  }, {
23
27
  /**
24
28
  * 保存字典数据
@@ -19,6 +19,10 @@ declare const useDataDicStore: import("pinia").StoreDefinition<string, State, {
19
19
  someState: string;
20
20
  list: any;
21
21
  } & import("pinia").PiniaCustomStateProperties<State>) => (key: string, value: string) => any;
22
+ getDicValueByText: (state: {
23
+ someState: string;
24
+ list: any;
25
+ } & import("pinia").PiniaCustomStateProperties<State>) => (key: string, text: string) => any;
22
26
  }, {
23
27
  /**
24
28
  * 保存字典数据
@@ -1,6 +1,6 @@
1
- import { defineStore as s } from "pinia";
2
- import { DATA_DICTIONARY_ID as o } from "../types.esm.js";
3
- const u = s(o, {
1
+ import { defineStore as l } from "pinia";
2
+ import { DATA_DICTIONARY_ID as a } from "../types.esm.js";
3
+ const u = l(a, {
4
4
  state: () => ({
5
5
  someState: "你好 pinia",
6
6
  list: {}
@@ -10,12 +10,13 @@ const u = s(o, {
10
10
  * 根据key获取字典列表
11
11
  * @param state
12
12
  */
13
- getDicByKey: (t) => (e) => t.list[e] || [],
13
+ getDicByKey: (t) => (r) => t.list[r] || [],
14
14
  /**
15
15
  * 根据字典名称和字典的value 获取对应的中文
16
16
  * @param state
17
17
  */
18
- getDicTextByValue: (t) => (e, i) => (t.list[e] || []).filter((r) => r.value === i).map((r) => r.label).join("")
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
20
  },
20
21
  actions: {
21
22
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "files": [
5
5
  "dist/**",
6
6
  "src"
@@ -32,6 +32,15 @@ const useDataDicStore = defineStore(DATA_DICTIONARY_ID, {
32
32
  .map((item: any) => item.label)
33
33
  .join("");
34
34
  };
35
+ },
36
+ getDicValueByText: (state) => {
37
+ return (key: string, text: string) => {
38
+ const rs = state.list[key] || [];
39
+ return rs
40
+ .filter((item: any) => item.label === text)
41
+ .map((item: any) => item.label)
42
+ .join("");
43
+ };
35
44
  }
36
45
  },
37
46
  actions: {