wlwy-package 4.0.0-beta.11 → 4.0.0-beta.12

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,5 +1,9 @@
1
1
  import type { ExtendedSuffix } from '../../../type';
2
2
  type IdType = ExtendedSuffix<'country'>;
3
+ /**
4
+ * 内置国家字典。也可通过 {@link useBusinessDict}('country') 使用。
5
+ * @param id 缓存 key,默认 `'country'`;同名字典多份缓存时传 `'country_xxx'`
6
+ */
3
7
  export default function useCountryDict(id?: IdType): {
4
8
  dict: {
5
9
  [x: string]: any;
@@ -8,7 +12,7 @@ export default function useCountryDict(id?: IdType): {
8
12
  label: string;
9
13
  disabled?: boolean | undefined;
10
14
  }[];
11
- getDict: () => Promise<import("../../../type").OptionType[]>;
15
+ getDict: (reload?: boolean) => Promise<import("../../../type").OptionType[]>;
12
16
  getLabelByCode: (code: string) => string;
13
17
  getItemByCode: (code: string) => {
14
18
  [x: string]: any;
@@ -1,5 +1,9 @@
1
1
  import type { ExtendedSuffix } from '../../../type';
2
2
  type IdType = ExtendedSuffix<'currency'>;
3
+ /**
4
+ * 内置币种字典。也可通过 {@link useBusinessDict}('currency') 使用。
5
+ * @param id 缓存 key,默认 `'currency'`;同名字典多份缓存时传 `'currency_xxx'`
6
+ */
3
7
  export default function useCurrencyDict(id?: IdType): {
4
8
  dict: {
5
9
  [x: string]: any;
@@ -8,7 +12,7 @@ export default function useCurrencyDict(id?: IdType): {
8
12
  label: string;
9
13
  disabled?: boolean | undefined;
10
14
  }[];
11
- getDict: () => Promise<import("../../../type").OptionType[]>;
15
+ getDict: (reload?: boolean) => Promise<import("../../../type").OptionType[]>;
12
16
  getLabelByCode: (code: string) => string;
13
17
  getItemByCode: (code: string) => {
14
18
  [x: string]: any;
@@ -1,5 +1,9 @@
1
1
  import type { ExtendedSuffix } from '../../../type';
2
2
  type IdType = ExtendedSuffix<'customer'>;
3
+ /**
4
+ * 内置客户字典。也可通过 {@link useBusinessDict}('customer') 使用。
5
+ * @param id 缓存 key,默认 `'customer'`;同名字典多份缓存时传 `'customer_xxx'`
6
+ */
3
7
  export default function useCustomerDict(id?: IdType): {
4
8
  dict: {
5
9
  [x: string]: any;
@@ -8,7 +12,7 @@ export default function useCustomerDict(id?: IdType): {
8
12
  label: string;
9
13
  disabled?: boolean | undefined;
10
14
  }[];
11
- getDict: () => Promise<import("../../../type").OptionType[]>;
15
+ getDict: (reload?: boolean) => Promise<import("../../../type").OptionType[]>;
12
16
  getLabelByCode: (code: string) => string;
13
17
  getItemByCode: (code: string) => {
14
18
  [x: string]: any;
@@ -1,5 +1,9 @@
1
1
  import type { ExtendedSuffix } from '../../../type';
2
2
  type IdType = ExtendedSuffix<'warehouseZone'>;
3
+ /**
4
+ * 内置库区字典。也可通过 {@link useBusinessDict}('warehouseZone') 使用。
5
+ * @param id 缓存 key,默认 `'warehouseZone'`;同名字典多份缓存时传 `'warehouseZone_xxx'`
6
+ */
3
7
  export default function useWarehouseZoneDict(id?: IdType): {
4
8
  dict: {
5
9
  [x: string]: any;
@@ -8,7 +12,7 @@ export default function useWarehouseZoneDict(id?: IdType): {
8
12
  label: string;
9
13
  disabled?: boolean | undefined;
10
14
  }[];
11
- getDict: () => Promise<import("../../../type").OptionType[]>;
15
+ getDict: (reload?: boolean) => Promise<import("../../../type").OptionType[]>;
12
16
  getLabelByCode: (code: string) => string;
13
17
  getItemByCode: (code: string) => {
14
18
  [x: string]: any;
@@ -1,2 +1,13 @@
1
1
  import type { DictBasicNameType } from '.';
2
+ /**
3
+ * 公共组件**内置业务字典**入口。
4
+ *
5
+ * 仅支持 {@link DictBasicNameType}(`warehouseZone` / `country` / `customer` / `currency`),
6
+ * 内部转发至对应的 `useXxxDict`。
7
+ *
8
+ * 业务项目自定义字典请使用 {@link useDict}。
9
+ *
10
+ * @param name 内置字典基础名称
11
+ * @returns 对应内置字典 Hook 的返回值;未找到时返回 `{}`
12
+ */
2
13
  export default function useBusinessDict(name: DictBasicNameType): any;
@@ -1,9 +1,26 @@
1
- import type { ClearDictOption, ExtendedSuffix, OptionType } from '../../type';
1
+ import type { ClearDictOption, OptionType } from '../../type';
2
+ /** 公共组件内置业务字典基础名称(请通过 {@link useBusinessDict} / useXxxDict 使用) */
2
3
  export type DictBasicNameType = 'warehouseZone' | 'country' | 'customer' | 'currency';
3
- export type DictNameType = `private_${string}` | ExtendedSuffix<DictBasicNameType>;
4
+ /**
5
+ * 字典缓存 key。
6
+ * - 业务自定义字典:可传任意 `string`(建议避免与内置名冲突,或使用 `private_` 前缀)
7
+ * - 内置名及其后缀:会与公共内置字典共用同一缓存
8
+ */
9
+ export type DictNameType = DictBasicNameType | (string & {});
10
+ /** 字典拉取配置 */
4
11
  export type DictOptionType = {
12
+ /** 远程请求,返回 `{ key, value, label, ... }` 选项列表 */
5
13
  request: () => Promise<OptionType[]>;
6
14
  };
15
+ /**
16
+ * 通用字典 Hook,供**业务项目自定义字典**使用:按名称读写缓存、按 code 查 label/item、清除缓存。
17
+ *
18
+ * 公共组件内置字典请使用 {@link useBusinessDict}(或 `useCountryDict` 等具体 Hook)。
19
+ *
20
+ * @param name 字典名称(缓存 key),可传任意 string
21
+ * @param option 拉取配置,需提供 `request`
22
+ * @returns `{ dict, getDict, getLabelByCode, getItemByCode, clearDict }`
23
+ */
7
24
  export default function useDict(name: DictNameType, option: DictOptionType): {
8
25
  dict: {
9
26
  [x: string]: any;
@@ -12,7 +29,7 @@ export default function useDict(name: DictNameType, option: DictOptionType): {
12
29
  label: string;
13
30
  disabled?: boolean | undefined;
14
31
  }[];
15
- getDict: () => Promise<OptionType[]>;
32
+ getDict: (reload?: boolean) => Promise<OptionType[]>;
16
33
  getLabelByCode: (code: string) => string;
17
34
  getItemByCode: (code: string) => {
18
35
  [x: string]: any;
@@ -2,35 +2,7 @@ import type { ClearDictOption, OptionType } from '../../type';
2
2
  import type { DictNameType } from '../../hooks';
3
3
  export declare const useDictStore: import("pinia").StoreDefinition<"dict", Pick<{
4
4
  dicts: {
5
- [x: `private_${string}`]: {
6
- [x: string]: any;
7
- key: import("../../type").KeyType;
8
- value: import("../../type").KeyType;
9
- label: string;
10
- disabled?: boolean | undefined;
11
- }[];
12
- [x: `warehouseZone_${string}`]: {
13
- [x: string]: any;
14
- key: import("../../type").KeyType;
15
- value: import("../../type").KeyType;
16
- label: string;
17
- disabled?: boolean | undefined;
18
- }[];
19
- [x: `country_${string}`]: {
20
- [x: string]: any;
21
- key: import("../../type").KeyType;
22
- value: import("../../type").KeyType;
23
- label: string;
24
- disabled?: boolean | undefined;
25
- }[];
26
- [x: `customer_${string}`]: {
27
- [x: string]: any;
28
- key: import("../../type").KeyType;
29
- value: import("../../type").KeyType;
30
- label: string;
31
- disabled?: boolean | undefined;
32
- }[];
33
- [x: `currency_${string}`]: {
5
+ [x: string & {}]: {
34
6
  [x: string]: any;
35
7
  key: import("../../type").KeyType;
36
8
  value: import("../../type").KeyType;
@@ -74,35 +46,7 @@ export declare const useDictStore: import("pinia").StoreDefinition<"dict", Pick<
74
46
  removeFetchIns: (name: DictNameType) => void;
75
47
  }, "dicts">, Pick<{
76
48
  dicts: {
77
- [x: `private_${string}`]: {
78
- [x: string]: any;
79
- key: import("../../type").KeyType;
80
- value: import("../../type").KeyType;
81
- label: string;
82
- disabled?: boolean | undefined;
83
- }[];
84
- [x: `warehouseZone_${string}`]: {
85
- [x: string]: any;
86
- key: import("../../type").KeyType;
87
- value: import("../../type").KeyType;
88
- label: string;
89
- disabled?: boolean | undefined;
90
- }[];
91
- [x: `country_${string}`]: {
92
- [x: string]: any;
93
- key: import("../../type").KeyType;
94
- value: import("../../type").KeyType;
95
- label: string;
96
- disabled?: boolean | undefined;
97
- }[];
98
- [x: `customer_${string}`]: {
99
- [x: string]: any;
100
- key: import("../../type").KeyType;
101
- value: import("../../type").KeyType;
102
- label: string;
103
- disabled?: boolean | undefined;
104
- }[];
105
- [x: `currency_${string}`]: {
49
+ [x: string & {}]: {
106
50
  [x: string]: any;
107
51
  key: import("../../type").KeyType;
108
52
  value: import("../../type").KeyType;
@@ -146,35 +90,7 @@ export declare const useDictStore: import("pinia").StoreDefinition<"dict", Pick<
146
90
  removeFetchIns: (name: DictNameType) => void;
147
91
  }, never>, Pick<{
148
92
  dicts: {
149
- [x: `private_${string}`]: {
150
- [x: string]: any;
151
- key: import("../../type").KeyType;
152
- value: import("../../type").KeyType;
153
- label: string;
154
- disabled?: boolean | undefined;
155
- }[];
156
- [x: `warehouseZone_${string}`]: {
157
- [x: string]: any;
158
- key: import("../../type").KeyType;
159
- value: import("../../type").KeyType;
160
- label: string;
161
- disabled?: boolean | undefined;
162
- }[];
163
- [x: `country_${string}`]: {
164
- [x: string]: any;
165
- key: import("../../type").KeyType;
166
- value: import("../../type").KeyType;
167
- label: string;
168
- disabled?: boolean | undefined;
169
- }[];
170
- [x: `customer_${string}`]: {
171
- [x: string]: any;
172
- key: import("../../type").KeyType;
173
- value: import("../../type").KeyType;
174
- label: string;
175
- disabled?: boolean | undefined;
176
- }[];
177
- [x: `currency_${string}`]: {
93
+ [x: string & {}]: {
178
94
  [x: string]: any;
179
95
  key: import("../../type").KeyType;
180
96
  value: import("../../type").KeyType;
@@ -219,35 +135,7 @@ export declare const useDictStore: import("pinia").StoreDefinition<"dict", Pick<
219
135
  }, "getDict" | "setDict" | "clearDict" | "clearAllDict" | "setFetchIns" | "removeFetchIns">>;
220
136
  export declare const useDictStoreWithOut: () => import("pinia").Store<"dict", Pick<{
221
137
  dicts: {
222
- [x: `private_${string}`]: {
223
- [x: string]: any;
224
- key: import("../../type").KeyType;
225
- value: import("../../type").KeyType;
226
- label: string;
227
- disabled?: boolean | undefined;
228
- }[];
229
- [x: `warehouseZone_${string}`]: {
230
- [x: string]: any;
231
- key: import("../../type").KeyType;
232
- value: import("../../type").KeyType;
233
- label: string;
234
- disabled?: boolean | undefined;
235
- }[];
236
- [x: `country_${string}`]: {
237
- [x: string]: any;
238
- key: import("../../type").KeyType;
239
- value: import("../../type").KeyType;
240
- label: string;
241
- disabled?: boolean | undefined;
242
- }[];
243
- [x: `customer_${string}`]: {
244
- [x: string]: any;
245
- key: import("../../type").KeyType;
246
- value: import("../../type").KeyType;
247
- label: string;
248
- disabled?: boolean | undefined;
249
- }[];
250
- [x: `currency_${string}`]: {
138
+ [x: string & {}]: {
251
139
  [x: string]: any;
252
140
  key: import("../../type").KeyType;
253
141
  value: import("../../type").KeyType;
@@ -291,35 +179,7 @@ export declare const useDictStoreWithOut: () => import("pinia").Store<"dict", Pi
291
179
  removeFetchIns: (name: DictNameType) => void;
292
180
  }, "dicts">, Pick<{
293
181
  dicts: {
294
- [x: `private_${string}`]: {
295
- [x: string]: any;
296
- key: import("../../type").KeyType;
297
- value: import("../../type").KeyType;
298
- label: string;
299
- disabled?: boolean | undefined;
300
- }[];
301
- [x: `warehouseZone_${string}`]: {
302
- [x: string]: any;
303
- key: import("../../type").KeyType;
304
- value: import("../../type").KeyType;
305
- label: string;
306
- disabled?: boolean | undefined;
307
- }[];
308
- [x: `country_${string}`]: {
309
- [x: string]: any;
310
- key: import("../../type").KeyType;
311
- value: import("../../type").KeyType;
312
- label: string;
313
- disabled?: boolean | undefined;
314
- }[];
315
- [x: `customer_${string}`]: {
316
- [x: string]: any;
317
- key: import("../../type").KeyType;
318
- value: import("../../type").KeyType;
319
- label: string;
320
- disabled?: boolean | undefined;
321
- }[];
322
- [x: `currency_${string}`]: {
182
+ [x: string & {}]: {
323
183
  [x: string]: any;
324
184
  key: import("../../type").KeyType;
325
185
  value: import("../../type").KeyType;
@@ -363,35 +223,7 @@ export declare const useDictStoreWithOut: () => import("pinia").Store<"dict", Pi
363
223
  removeFetchIns: (name: DictNameType) => void;
364
224
  }, never>, Pick<{
365
225
  dicts: {
366
- [x: `private_${string}`]: {
367
- [x: string]: any;
368
- key: import("../../type").KeyType;
369
- value: import("../../type").KeyType;
370
- label: string;
371
- disabled?: boolean | undefined;
372
- }[];
373
- [x: `warehouseZone_${string}`]: {
374
- [x: string]: any;
375
- key: import("../../type").KeyType;
376
- value: import("../../type").KeyType;
377
- label: string;
378
- disabled?: boolean | undefined;
379
- }[];
380
- [x: `country_${string}`]: {
381
- [x: string]: any;
382
- key: import("../../type").KeyType;
383
- value: import("../../type").KeyType;
384
- label: string;
385
- disabled?: boolean | undefined;
386
- }[];
387
- [x: `customer_${string}`]: {
388
- [x: string]: any;
389
- key: import("../../type").KeyType;
390
- value: import("../../type").KeyType;
391
- label: string;
392
- disabled?: boolean | undefined;
393
- }[];
394
- [x: `currency_${string}`]: {
226
+ [x: string & {}]: {
395
227
  [x: string]: any;
396
228
  key: import("../../type").KeyType;
397
229
  value: import("../../type").KeyType;