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

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,9 +1,13 @@
1
1
  import type { WFormCheckboxProps } from '../type';
2
- import type { OptionType } from '../../../../type';
3
2
  declare const _default: __VLS_WithSlots<import("vue").DefineComponent<WFormCheckboxProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<WFormCheckboxProps> & Readonly<{}>, {
4
3
  params: any;
5
4
  method: string;
6
- options: OptionType[];
5
+ options: {
6
+ key: import("../../../../type").KeyType;
7
+ value: import("../../../../type").KeyType;
8
+ label: string;
9
+ disabled?: boolean | undefined;
10
+ }[];
7
11
  allowClear: boolean;
8
12
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
9
13
  label?: ((props: any) => any) | undefined;
@@ -6,8 +6,8 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<WFormProps
6
6
  $data: {};
7
7
  $props: {
8
8
  size?: "small" | "middle" | "large" | undefined;
9
- disabled?: boolean | undefined;
10
9
  onSubmit?: ((e: Event) => void) | undefined;
10
+ disabled?: boolean | undefined;
11
11
  colon?: boolean | undefined;
12
12
  labelCol?: (Partial<import("vue").ExtractPropTypes<{
13
13
  span: (NumberConstructor | StringConstructor)[];
@@ -134,8 +134,8 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<WFormProps
134
134
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R, args_2: import("@vue/reactivity").OnCleanup) => any : (args_0: any, args_1: any, args_2: import("@vue/reactivity").OnCleanup) => any, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
135
135
  name?: string | undefined;
136
136
  size?: "small" | "middle" | "large" | undefined;
137
- disabled?: boolean | undefined;
138
137
  onSubmit?: ((e: Event) => void) | undefined;
138
+ disabled?: boolean | undefined;
139
139
  prefixCls?: string | undefined;
140
140
  layout?: string | undefined;
141
141
  colon?: boolean | undefined;
@@ -11,7 +11,12 @@ declare const _default: import("vue").DefineComponent<WInputMatchProps, {}, {},
11
11
  labelModel: string;
12
12
  labelOptions: WDropdownListItem[];
13
13
  afterModel: string;
14
- afterOptions: import("../../../../type.ts").OptionType[];
14
+ afterOptions: {
15
+ key: import("../../../../type.ts").KeyType;
16
+ value: import("../../../../type.ts").KeyType;
17
+ label: string;
18
+ disabled?: boolean | undefined;
19
+ }[];
15
20
  numberfs: string[];
16
21
  inputfs: string[];
17
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,9 +1,13 @@
1
1
  import type { WFormRadioProps } from '../type';
2
- import type { OptionType } from '../../../../type';
3
2
  declare const _default: __VLS_WithSlots<import("vue").DefineComponent<WFormRadioProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<WFormRadioProps> & Readonly<{}>, {
4
3
  params: any;
5
4
  method: string;
6
- options: OptionType[];
5
+ options: {
6
+ key: import("../../../../type").KeyType;
7
+ value: import("../../../../type").KeyType;
8
+ label: string;
9
+ disabled?: boolean | undefined;
10
+ }[];
7
11
  allowClear: boolean;
8
12
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
9
13
  label?: ((props: any) => any) | undefined;
@@ -1,5 +1,4 @@
1
1
  import type { WFormSelectProps } from '../type';
2
- import type { OptionType } from '../../../../type';
3
2
  declare var __VLS_11: number, __VLS_12: any, __VLS_15: "label" | "extra" | "help", __VLS_16: any;
4
3
  type __VLS_Slots = {} & {
5
4
  [K in NonNullable<typeof __VLS_11>]?: (props: typeof __VLS_12) => any;
@@ -9,7 +8,12 @@ type __VLS_Slots = {} & {
9
8
  declare const _default: __VLS_WithSlots<import("vue").DefineComponent<WFormSelectProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<WFormSelectProps> & Readonly<{}>, {
10
9
  params: any;
11
10
  method: string;
12
- options: OptionType[];
11
+ options: {
12
+ key: import("../../../../type").KeyType;
13
+ value: import("../../../../type").KeyType;
14
+ label: string;
15
+ disabled?: boolean | undefined;
16
+ }[];
13
17
  allowClear: boolean;
14
18
  autoClearSearchValue: boolean;
15
19
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, __VLS_Slots>;
@@ -6,16 +6,19 @@ type IdType = ExtendedSuffix<'country'>;
6
6
  */
7
7
  export default function useCountryDict(id?: IdType): {
8
8
  dict: {
9
- [x: string]: any;
10
9
  key: import("../../../type").KeyType;
11
10
  value: import("../../../type").KeyType;
12
11
  label: string;
13
12
  disabled?: boolean | undefined;
14
13
  }[];
15
- getDict: (reload?: boolean) => Promise<import("../../../type").OptionType[]>;
14
+ getDict: (reload?: boolean) => Promise<{
15
+ key: import("../../../type").KeyType;
16
+ value: import("../../../type").KeyType;
17
+ label: string;
18
+ disabled?: boolean | undefined;
19
+ }[]>;
16
20
  getLabelByCode: (code: string) => string;
17
21
  getItemByCode: (code: string) => {
18
- [x: string]: any;
19
22
  key: import("../../../type").KeyType;
20
23
  value: import("../../../type").KeyType;
21
24
  label: string;
@@ -6,16 +6,19 @@ type IdType = ExtendedSuffix<'currency'>;
6
6
  */
7
7
  export default function useCurrencyDict(id?: IdType): {
8
8
  dict: {
9
- [x: string]: any;
10
9
  key: import("../../../type").KeyType;
11
10
  value: import("../../../type").KeyType;
12
11
  label: string;
13
12
  disabled?: boolean | undefined;
14
13
  }[];
15
- getDict: (reload?: boolean) => Promise<import("../../../type").OptionType[]>;
14
+ getDict: (reload?: boolean) => Promise<{
15
+ key: import("../../../type").KeyType;
16
+ value: import("../../../type").KeyType;
17
+ label: string;
18
+ disabled?: boolean | undefined;
19
+ }[]>;
16
20
  getLabelByCode: (code: string) => string;
17
21
  getItemByCode: (code: string) => {
18
- [x: string]: any;
19
22
  key: import("../../../type").KeyType;
20
23
  value: import("../../../type").KeyType;
21
24
  label: string;
@@ -6,16 +6,19 @@ type IdType = ExtendedSuffix<'customer'>;
6
6
  */
7
7
  export default function useCustomerDict(id?: IdType): {
8
8
  dict: {
9
- [x: string]: any;
10
9
  key: import("../../../type").KeyType;
11
10
  value: import("../../../type").KeyType;
12
11
  label: string;
13
12
  disabled?: boolean | undefined;
14
13
  }[];
15
- getDict: (reload?: boolean) => Promise<import("../../../type").OptionType[]>;
14
+ getDict: (reload?: boolean) => Promise<{
15
+ key: import("../../../type").KeyType;
16
+ value: import("../../../type").KeyType;
17
+ label: string;
18
+ disabled?: boolean | undefined;
19
+ }[]>;
16
20
  getLabelByCode: (code: string) => string;
17
21
  getItemByCode: (code: string) => {
18
- [x: string]: any;
19
22
  key: import("../../../type").KeyType;
20
23
  value: import("../../../type").KeyType;
21
24
  label: string;
@@ -6,16 +6,19 @@ type IdType = ExtendedSuffix<'warehouseZone'>;
6
6
  */
7
7
  export default function useWarehouseZoneDict(id?: IdType): {
8
8
  dict: {
9
- [x: string]: any;
10
9
  key: import("../../../type").KeyType;
11
10
  value: import("../../../type").KeyType;
12
11
  label: string;
13
12
  disabled?: boolean | undefined;
14
13
  }[];
15
- getDict: (reload?: boolean) => Promise<import("../../../type").OptionType[]>;
14
+ getDict: (reload?: boolean) => Promise<{
15
+ key: import("../../../type").KeyType;
16
+ value: import("../../../type").KeyType;
17
+ label: string;
18
+ disabled?: boolean | undefined;
19
+ }[]>;
16
20
  getLabelByCode: (code: string) => string;
17
21
  getItemByCode: (code: string) => {
18
- [x: string]: any;
19
22
  key: import("../../../type").KeyType;
20
23
  value: import("../../../type").KeyType;
21
24
  label: string;
@@ -8,9 +8,9 @@ export type DictBasicNameType = 'warehouseZone' | 'country' | 'customer' | 'curr
8
8
  */
9
9
  export type DictNameType = DictBasicNameType | (string & {});
10
10
  /** 字典拉取配置 */
11
- export type DictOptionType = {
11
+ export type DictOptionType<T = unknown> = {
12
12
  /** 远程请求,返回 `{ key, value, label, ... }` 选项列表 */
13
- request: () => Promise<OptionType[]>;
13
+ request: () => Promise<OptionType<T>[]>;
14
14
  };
15
15
  /**
16
16
  * 通用字典 Hook,供**业务项目自定义字典**使用:按名称读写缓存、按 code 查 label/item、清除缓存。
@@ -21,22 +21,10 @@ export type DictOptionType = {
21
21
  * @param option 拉取配置,需提供 `request`
22
22
  * @returns `{ dict, getDict, getLabelByCode, getItemByCode, clearDict }`
23
23
  */
24
- export default function useDict(name: DictNameType, option: DictOptionType): {
25
- dict: {
26
- [x: string]: any;
27
- key: import("../../type").KeyType;
28
- value: import("../../type").KeyType;
29
- label: string;
30
- disabled?: boolean | undefined;
31
- }[];
32
- getDict: (reload?: boolean) => Promise<OptionType[]>;
24
+ export default function useDict<T = unknown>(name: DictNameType, option: DictOptionType<T>): {
25
+ dict: OptionType<T>[];
26
+ getDict: (reload?: boolean) => Promise<OptionType<T>[]>;
33
27
  getLabelByCode: (code: string) => string;
34
- getItemByCode: (code: string) => {
35
- [x: string]: any;
36
- key: import("../../type").KeyType;
37
- value: import("../../type").KeyType;
38
- label: string;
39
- disabled?: boolean | undefined;
40
- } | undefined;
28
+ getItemByCode: (code: string) => OptionType<T> | undefined;
41
29
  clearDict: (option?: ClearDictOption | boolean) => void;
42
30
  };
@@ -1,6 +1,6 @@
1
1
  export { default as useCatchPreloadError } from './src/useCatchPreloadError';
2
2
  export { default as useCookie } from './src/useCookie';
3
- export { default as useDate, type DateInput, type DateRange, type UseDateOptions, type RecentRangeOptions } from './src/useDate';
3
+ export { default as useDate, type DateInput, type DateRange, type UseDateOptions, type RecentRangeOptions, type RangeOffsets, type RecentRangeN, } from './src/useDate';
4
4
  export { default as useEnum } from './src/useEnum';
5
5
  export { default as useExport } from './src/useExport';
6
6
  export * from './src/useI18n';
@@ -12,7 +12,12 @@ export type RecentRangeOptions = {
12
12
  includeCurrent?: boolean;
13
13
  /** 基准日,默认今天 */
14
14
  base?: DateInput;
15
+ /** 方向:forward=正向(往未来)、backward=反向(往过去),默认 backward */
16
+ direction?: 'forward' | 'backward';
15
17
  };
18
+ /** 相对 base 的偏移元组 [起点偏移, 终点偏移];配合 direction:backward 时正=往过去,forward 时正=往未来 */
19
+ export type RangeOffsets = readonly [start: number, end: number];
20
+ export type RecentRangeN = number | RangeOffsets;
16
21
  export declare const DEFAULT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
17
22
  export declare const DEFAULT_DATE_FORMAT = "YYYY-MM-DD";
18
23
  /**
@@ -31,10 +36,10 @@ export default function useDate(options?: UseDateOptions): {
31
36
  endOf: (value?: DateInput, unit?: OpUnitType) => Dayjs;
32
37
  toTimestamp: (value?: DateInput) => number;
33
38
  fromTimestamp: (ms: number) => Dayjs;
34
- recentRange: (n: number, unit?: ManipulateType, opts?: RecentRangeOptions) => DateRange;
35
- recentDays: (n: number, opts?: RecentRangeOptions) => DateRange;
36
- recentMonths: (n: number, opts?: RecentRangeOptions) => DateRange;
37
- recentYears: (n: number, opts?: RecentRangeOptions) => DateRange;
39
+ recentRange: (n: RecentRangeN, unit?: ManipulateType, opts?: RecentRangeOptions) => DateRange;
40
+ recentDays: (n: RecentRangeN, opts?: RecentRangeOptions) => DateRange;
41
+ recentMonths: (n: RecentRangeN, opts?: RecentRangeOptions) => DateRange;
42
+ recentYears: (n: RecentRangeN, opts?: RecentRangeOptions) => DateRange;
38
43
  presets: {
39
44
  last3Days: () => DateRange;
40
45
  last7Days: () => DateRange;
@@ -1,4 +1,3 @@
1
- import type { OptionType } from '../../../type';
2
1
  type CommonType = {
3
2
  [key: string]: {
4
3
  [key: string]: string;
@@ -12,7 +11,12 @@ export declare const COMMON: {};
12
11
  export declare const OPTION: {};
13
12
  export default function useEnum<T extends CommonType, K>(options: EnumType<T, K>): {
14
13
  enums: T;
15
- enumMap: Map<keyof T, OptionType[]>;
14
+ enumMap: Map<keyof T, {
15
+ key: import("../../../type").KeyType;
16
+ value: import("../../../type").KeyType;
17
+ label: string;
18
+ disabled?: boolean | undefined;
19
+ }[]>;
16
20
  getEnum: <T_1 extends keyof T, K_1 extends keyof T[T_1]>(name: T_1, keyTypeTransform?: "number" | "boolean" | "boolean2number" | "original") => {
17
21
  key: keyof T[T_1];
18
22
  value: keyof T[T_1];
@@ -3,35 +3,30 @@ import type { DictNameType } from '../../hooks';
3
3
  export declare const useDictStore: import("pinia").StoreDefinition<"dict", Pick<{
4
4
  dicts: {
5
5
  [x: string & {}]: {
6
- [x: string]: any;
7
6
  key: import("../../type").KeyType;
8
7
  value: import("../../type").KeyType;
9
8
  label: string;
10
9
  disabled?: boolean | undefined;
11
10
  }[];
12
11
  warehouseZone: {
13
- [x: string]: any;
14
12
  key: import("../../type").KeyType;
15
13
  value: import("../../type").KeyType;
16
14
  label: string;
17
15
  disabled?: boolean | undefined;
18
16
  }[];
19
17
  country: {
20
- [x: string]: any;
21
18
  key: import("../../type").KeyType;
22
19
  value: import("../../type").KeyType;
23
20
  label: string;
24
21
  disabled?: boolean | undefined;
25
22
  }[];
26
23
  customer: {
27
- [x: string]: any;
28
24
  key: import("../../type").KeyType;
29
25
  value: import("../../type").KeyType;
30
26
  label: string;
31
27
  disabled?: boolean | undefined;
32
28
  }[];
33
29
  currency: {
34
- [x: string]: any;
35
30
  key: import("../../type").KeyType;
36
31
  value: import("../../type").KeyType;
37
32
  label: string;
@@ -47,35 +42,30 @@ export declare const useDictStore: import("pinia").StoreDefinition<"dict", Pick<
47
42
  }, "dicts">, Pick<{
48
43
  dicts: {
49
44
  [x: string & {}]: {
50
- [x: string]: any;
51
45
  key: import("../../type").KeyType;
52
46
  value: import("../../type").KeyType;
53
47
  label: string;
54
48
  disabled?: boolean | undefined;
55
49
  }[];
56
50
  warehouseZone: {
57
- [x: string]: any;
58
51
  key: import("../../type").KeyType;
59
52
  value: import("../../type").KeyType;
60
53
  label: string;
61
54
  disabled?: boolean | undefined;
62
55
  }[];
63
56
  country: {
64
- [x: string]: any;
65
57
  key: import("../../type").KeyType;
66
58
  value: import("../../type").KeyType;
67
59
  label: string;
68
60
  disabled?: boolean | undefined;
69
61
  }[];
70
62
  customer: {
71
- [x: string]: any;
72
63
  key: import("../../type").KeyType;
73
64
  value: import("../../type").KeyType;
74
65
  label: string;
75
66
  disabled?: boolean | undefined;
76
67
  }[];
77
68
  currency: {
78
- [x: string]: any;
79
69
  key: import("../../type").KeyType;
80
70
  value: import("../../type").KeyType;
81
71
  label: string;
@@ -91,35 +81,30 @@ export declare const useDictStore: import("pinia").StoreDefinition<"dict", Pick<
91
81
  }, never>, Pick<{
92
82
  dicts: {
93
83
  [x: string & {}]: {
94
- [x: string]: any;
95
84
  key: import("../../type").KeyType;
96
85
  value: import("../../type").KeyType;
97
86
  label: string;
98
87
  disabled?: boolean | undefined;
99
88
  }[];
100
89
  warehouseZone: {
101
- [x: string]: any;
102
90
  key: import("../../type").KeyType;
103
91
  value: import("../../type").KeyType;
104
92
  label: string;
105
93
  disabled?: boolean | undefined;
106
94
  }[];
107
95
  country: {
108
- [x: string]: any;
109
96
  key: import("../../type").KeyType;
110
97
  value: import("../../type").KeyType;
111
98
  label: string;
112
99
  disabled?: boolean | undefined;
113
100
  }[];
114
101
  customer: {
115
- [x: string]: any;
116
102
  key: import("../../type").KeyType;
117
103
  value: import("../../type").KeyType;
118
104
  label: string;
119
105
  disabled?: boolean | undefined;
120
106
  }[];
121
107
  currency: {
122
- [x: string]: any;
123
108
  key: import("../../type").KeyType;
124
109
  value: import("../../type").KeyType;
125
110
  label: string;
@@ -136,35 +121,30 @@ export declare const useDictStore: import("pinia").StoreDefinition<"dict", Pick<
136
121
  export declare const useDictStoreWithOut: () => import("pinia").Store<"dict", Pick<{
137
122
  dicts: {
138
123
  [x: string & {}]: {
139
- [x: string]: any;
140
124
  key: import("../../type").KeyType;
141
125
  value: import("../../type").KeyType;
142
126
  label: string;
143
127
  disabled?: boolean | undefined;
144
128
  }[];
145
129
  warehouseZone: {
146
- [x: string]: any;
147
130
  key: import("../../type").KeyType;
148
131
  value: import("../../type").KeyType;
149
132
  label: string;
150
133
  disabled?: boolean | undefined;
151
134
  }[];
152
135
  country: {
153
- [x: string]: any;
154
136
  key: import("../../type").KeyType;
155
137
  value: import("../../type").KeyType;
156
138
  label: string;
157
139
  disabled?: boolean | undefined;
158
140
  }[];
159
141
  customer: {
160
- [x: string]: any;
161
142
  key: import("../../type").KeyType;
162
143
  value: import("../../type").KeyType;
163
144
  label: string;
164
145
  disabled?: boolean | undefined;
165
146
  }[];
166
147
  currency: {
167
- [x: string]: any;
168
148
  key: import("../../type").KeyType;
169
149
  value: import("../../type").KeyType;
170
150
  label: string;
@@ -180,35 +160,30 @@ export declare const useDictStoreWithOut: () => import("pinia").Store<"dict", Pi
180
160
  }, "dicts">, Pick<{
181
161
  dicts: {
182
162
  [x: string & {}]: {
183
- [x: string]: any;
184
163
  key: import("../../type").KeyType;
185
164
  value: import("../../type").KeyType;
186
165
  label: string;
187
166
  disabled?: boolean | undefined;
188
167
  }[];
189
168
  warehouseZone: {
190
- [x: string]: any;
191
169
  key: import("../../type").KeyType;
192
170
  value: import("../../type").KeyType;
193
171
  label: string;
194
172
  disabled?: boolean | undefined;
195
173
  }[];
196
174
  country: {
197
- [x: string]: any;
198
175
  key: import("../../type").KeyType;
199
176
  value: import("../../type").KeyType;
200
177
  label: string;
201
178
  disabled?: boolean | undefined;
202
179
  }[];
203
180
  customer: {
204
- [x: string]: any;
205
181
  key: import("../../type").KeyType;
206
182
  value: import("../../type").KeyType;
207
183
  label: string;
208
184
  disabled?: boolean | undefined;
209
185
  }[];
210
186
  currency: {
211
- [x: string]: any;
212
187
  key: import("../../type").KeyType;
213
188
  value: import("../../type").KeyType;
214
189
  label: string;
@@ -224,35 +199,30 @@ export declare const useDictStoreWithOut: () => import("pinia").Store<"dict", Pi
224
199
  }, never>, Pick<{
225
200
  dicts: {
226
201
  [x: string & {}]: {
227
- [x: string]: any;
228
202
  key: import("../../type").KeyType;
229
203
  value: import("../../type").KeyType;
230
204
  label: string;
231
205
  disabled?: boolean | undefined;
232
206
  }[];
233
207
  warehouseZone: {
234
- [x: string]: any;
235
208
  key: import("../../type").KeyType;
236
209
  value: import("../../type").KeyType;
237
210
  label: string;
238
211
  disabled?: boolean | undefined;
239
212
  }[];
240
213
  country: {
241
- [x: string]: any;
242
214
  key: import("../../type").KeyType;
243
215
  value: import("../../type").KeyType;
244
216
  label: string;
245
217
  disabled?: boolean | undefined;
246
218
  }[];
247
219
  customer: {
248
- [x: string]: any;
249
220
  key: import("../../type").KeyType;
250
221
  value: import("../../type").KeyType;
251
222
  label: string;
252
223
  disabled?: boolean | undefined;
253
224
  }[];
254
225
  currency: {
255
- [x: string]: any;
256
226
  key: import("../../type").KeyType;
257
227
  value: import("../../type").KeyType;
258
228
  label: string;
@@ -9,13 +9,12 @@ export type KeyType = string | number;
9
9
  /**
10
10
  * 下拉框数据类型
11
11
  */
12
- export type OptionType = {
12
+ export type OptionType<T = unknown> = {
13
13
  key: KeyType;
14
14
  value: KeyType;
15
15
  label: string;
16
16
  disabled?: boolean;
17
- [key: string]: any;
18
- };
17
+ } & T;
19
18
  /**
20
19
  * 比较类型
21
20
  */