@karta.io/utils 1.0.0-beta.49 → 1.0.0-beta.5
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.
- package/dist/index.cjs +179 -336
- package/dist/index.d.cts +32 -76
- package/dist/index.d.mts +32 -76
- package/dist/index.d.ts +32 -76
- package/dist/index.mjs +173 -324
- package/package.json +36 -35
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { MaybeRef,
|
|
2
|
+
import { MaybeRef, Component, EmitsOptions, VNode, Ref } from 'vue';
|
|
3
3
|
import { AxiosRequestConfig } from 'axios';
|
|
4
4
|
export { AxiosError as HttpError, AxiosPromise as HttpPromise, AxiosRequestConfig as HttpRequestConfig, AxiosResponse as HttpResponse } from 'axios';
|
|
5
5
|
import { MaybeRef as MaybeRef$1 } from '@vueuse/core';
|
|
@@ -23,7 +23,7 @@ interface ResponseError {
|
|
|
23
23
|
data: Record<string, string | string[]> | null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare function camelizeKeys
|
|
26
|
+
declare function camelizeKeys(object: Dictionary): Dictionary;
|
|
27
27
|
|
|
28
28
|
interface Options$3 {
|
|
29
29
|
labelType: 'key' | 'value';
|
|
@@ -33,21 +33,6 @@ declare function convertEnumToOptions(obj: any, options?: Options$3): {
|
|
|
33
33
|
label: unknown;
|
|
34
34
|
}[];
|
|
35
35
|
|
|
36
|
-
interface EnrichErrorParams {
|
|
37
|
-
message: string;
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
}
|
|
40
|
-
declare class EnrichError extends Error {
|
|
41
|
-
constructor(data: EnrichErrorParams);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declare function getStatusMessage(status: number): string;
|
|
45
|
-
declare function formatErrorDataMessage(data?: Record<string, string | string[]>): string;
|
|
46
|
-
declare function formatErrorForNotify(error: Error | ResponseError | any): {
|
|
47
|
-
title: string;
|
|
48
|
-
message: any;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
36
|
interface Options$2 extends Intl.NumberFormatOptions {
|
|
52
37
|
locale?: string;
|
|
53
38
|
defaultValue?: string | number;
|
|
@@ -76,8 +61,6 @@ declare function isElementIgnored({ ignoredClasses, event, }?: {
|
|
|
76
61
|
|
|
77
62
|
declare function isEmptyObject(object: object): boolean;
|
|
78
63
|
|
|
79
|
-
declare function isHtml(data: string): boolean;
|
|
80
|
-
|
|
81
64
|
interface MapOptions {
|
|
82
65
|
labelKey?: string;
|
|
83
66
|
valueKey?: string;
|
|
@@ -95,7 +78,7 @@ declare function getPaginationParams({ page, limit, }: {
|
|
|
95
78
|
limit: number;
|
|
96
79
|
offset: number;
|
|
97
80
|
};
|
|
98
|
-
declare function getPaginationLimit({ limit
|
|
81
|
+
declare function getPaginationLimit({ limit }: {
|
|
99
82
|
limit: string | number;
|
|
100
83
|
}): number;
|
|
101
84
|
declare function getPaginationOffset({ page, limit, }: {
|
|
@@ -110,7 +93,7 @@ declare function getPaginationPages({ count, limit, }: {
|
|
|
110
93
|
declare function parsePhone(phone: string | null | undefined): string;
|
|
111
94
|
|
|
112
95
|
type SnakelizeKeysProp = Record<string | number, any>;
|
|
113
|
-
declare function snakelizeKeys
|
|
96
|
+
declare function snakelizeKeys(prop: SnakelizeKeysProp): SnakelizeKeysProp;
|
|
114
97
|
|
|
115
98
|
/**
|
|
116
99
|
* Принимает на вход число в виде строки или числа,
|
|
@@ -151,13 +134,13 @@ declare function useAsyncItems<T extends (...args: any[]) => any>({ apiMethod, q
|
|
|
151
134
|
params: MaybeRef<Parameters<T>[0]>;
|
|
152
135
|
config?: AxiosRequestConfig;
|
|
153
136
|
}): {
|
|
154
|
-
isLoading: vue.Ref<false
|
|
155
|
-
isFetching: vue.Ref<boolean
|
|
156
|
-
isError: vue.Ref<false
|
|
157
|
-
data: vue.Ref<any
|
|
158
|
-
error: vue.Ref<
|
|
137
|
+
isLoading: vue.Ref<false> | vue.Ref<true>;
|
|
138
|
+
isFetching: vue.Ref<boolean>;
|
|
139
|
+
isError: vue.Ref<false> | vue.Ref<true>;
|
|
140
|
+
data: vue.Ref<any>;
|
|
141
|
+
error: vue.Ref<unknown>;
|
|
159
142
|
items: vue.ComputedRef<Awaited<ReturnType<T>>["results"]>;
|
|
160
|
-
count: vue.Ref<number
|
|
143
|
+
count: vue.Ref<number>;
|
|
161
144
|
refetch: () => void;
|
|
162
145
|
reload: () => void;
|
|
163
146
|
abort: () => void;
|
|
@@ -183,14 +166,12 @@ declare function useAsyncMultiselect<T extends (...args: any[]) => any, K extend
|
|
|
183
166
|
}): {
|
|
184
167
|
items: vue.ComputedRef<any[]>;
|
|
185
168
|
options: vue.ComputedRef<ReturnType<K>[]>;
|
|
186
|
-
search: vue.Ref<string
|
|
169
|
+
search: vue.Ref<string>;
|
|
187
170
|
hasNextPage: vue.ComputedRef<boolean>;
|
|
188
|
-
isFetching: vue.Ref<boolean
|
|
189
|
-
isLoading: vue.Ref<false
|
|
171
|
+
isFetching: vue.Ref<boolean>;
|
|
172
|
+
isLoading: vue.Ref<false> | vue.Ref<true>;
|
|
190
173
|
loadPage: (newPage?: number) => void;
|
|
191
174
|
updateSearch: (value: string) => void;
|
|
192
|
-
refetch: () => void;
|
|
193
|
-
reload: () => void;
|
|
194
175
|
};
|
|
195
176
|
|
|
196
177
|
interface ReactiveData {
|
|
@@ -212,25 +193,23 @@ declare function useAsyncSelect<T extends (...args: any[]) => any, K extends (pa
|
|
|
212
193
|
}): {
|
|
213
194
|
items: vue.ComputedRef<any[]>;
|
|
214
195
|
options: vue.ComputedRef<ReturnType<K>[]>;
|
|
215
|
-
search: vue.Ref<string
|
|
196
|
+
search: vue.Ref<string>;
|
|
216
197
|
hasNextPage: vue.ComputedRef<boolean>;
|
|
217
|
-
isFetching: vue.Ref<boolean
|
|
218
|
-
isLoading: vue.Ref<false
|
|
198
|
+
isFetching: vue.Ref<boolean>;
|
|
199
|
+
isLoading: vue.Ref<false> | vue.Ref<true>;
|
|
219
200
|
loadPage: (newPage?: number) => void;
|
|
220
201
|
updateSearch: (value: string) => void;
|
|
221
|
-
refetch: () => void;
|
|
222
|
-
reload: () => void;
|
|
223
202
|
};
|
|
224
203
|
|
|
225
204
|
declare function useBreakpoint(): {
|
|
226
|
-
isMobile: vue.
|
|
227
|
-
isDesktop: vue.
|
|
228
|
-
isGreaterXxs: vue.
|
|
229
|
-
isGreaterXs: vue.
|
|
230
|
-
isGreaterSm: vue.
|
|
231
|
-
isGreaterMd: vue.
|
|
232
|
-
isGreaterLg: vue.
|
|
233
|
-
isGreaterXl: vue.
|
|
205
|
+
isMobile: vue.Ref<boolean>;
|
|
206
|
+
isDesktop: vue.Ref<boolean>;
|
|
207
|
+
isGreaterXxs: vue.Ref<boolean>;
|
|
208
|
+
isGreaterXs: vue.Ref<boolean>;
|
|
209
|
+
isGreaterSm: vue.Ref<boolean>;
|
|
210
|
+
isGreaterMd: vue.Ref<boolean>;
|
|
211
|
+
isGreaterLg: vue.Ref<boolean>;
|
|
212
|
+
isGreaterXl: vue.Ref<boolean>;
|
|
234
213
|
};
|
|
235
214
|
|
|
236
215
|
declare function useClassName(block: string): {
|
|
@@ -267,41 +246,19 @@ type VersionsList = {
|
|
|
267
246
|
declare function useDetectBrowser(versions: VersionsList, userAgent?: any): BrowserInfo;
|
|
268
247
|
|
|
269
248
|
interface VNodeCustom$1 extends VNode {
|
|
270
|
-
close
|
|
271
|
-
}
|
|
272
|
-
interface Dialog {
|
|
273
|
-
uuid: string;
|
|
274
|
-
name?: string;
|
|
275
|
-
vnode: VNodeCustom$1;
|
|
276
|
-
layer: number;
|
|
277
|
-
}
|
|
278
|
-
interface DialogOptions {
|
|
279
|
-
hashPrefix?: string;
|
|
249
|
+
close(): void;
|
|
280
250
|
}
|
|
281
|
-
|
|
282
|
-
name: string;
|
|
283
|
-
layer: number;
|
|
284
|
-
[key: string]: any;
|
|
285
|
-
}
|
|
286
|
-
declare function useDialog(options?: DialogOptions): {
|
|
251
|
+
declare function useDialog(): {
|
|
287
252
|
open: ({ layer, component, props, }: {
|
|
288
253
|
component: Component;
|
|
289
254
|
props?: any;
|
|
290
255
|
layer?: number;
|
|
291
256
|
}) => string;
|
|
292
257
|
getInstance: (uuid: string) => VNodeCustom$1;
|
|
293
|
-
getLayer: (uuid: string) => number;
|
|
294
258
|
close: (uuid: string) => void;
|
|
295
259
|
closeAll: () => void;
|
|
296
260
|
showConfirm: (text?: string) => boolean;
|
|
297
261
|
isOnTop: (uuid: string) => boolean;
|
|
298
|
-
genHash: ({ layer, componentName, props, }: {
|
|
299
|
-
componentName: string;
|
|
300
|
-
props?: any;
|
|
301
|
-
layer?: number;
|
|
302
|
-
}) => string;
|
|
303
|
-
parseHash: (hash: string, componentName: string) => DialogParseHashResult | undefined;
|
|
304
|
-
clearHash: () => void;
|
|
305
262
|
openByHash: ({ layer, component, props, }: {
|
|
306
263
|
component: Component;
|
|
307
264
|
props?: any;
|
|
@@ -314,17 +271,17 @@ declare function useDialog(options?: DialogOptions): {
|
|
|
314
271
|
};
|
|
315
272
|
|
|
316
273
|
declare function useGlobalScroll(): {
|
|
317
|
-
isLocked: vue.Ref<boolean
|
|
274
|
+
isLocked: vue.Ref<boolean>;
|
|
318
275
|
lock: () => void;
|
|
319
276
|
unlock: () => void;
|
|
320
277
|
};
|
|
321
278
|
|
|
322
|
-
declare function useFilters<T extends Record<string, any>, K extends Record<string, any>>({ config, initialFilters }: {
|
|
279
|
+
declare function useFilters<T extends Record<string, any>, K extends Record<string, any>>({ config, initialFilters, }: {
|
|
323
280
|
config: T;
|
|
324
281
|
initialFilters: K;
|
|
325
282
|
}): {
|
|
326
|
-
isOpen: Ref<boolean
|
|
327
|
-
filtersModel: Ref<K
|
|
283
|
+
isOpen: Ref<boolean>;
|
|
284
|
+
filtersModel: Ref<K>;
|
|
328
285
|
filtersFromQuery: vue.ComputedRef<{}>;
|
|
329
286
|
filtersCount: vue.ComputedRef<number>;
|
|
330
287
|
updateOne: (key: keyof K, value: any) => void;
|
|
@@ -349,7 +306,7 @@ interface Options {
|
|
|
349
306
|
declare function useLogger(scope: string, options?: Options): logdown.Logger;
|
|
350
307
|
|
|
351
308
|
interface VNodeCustom extends VNode {
|
|
352
|
-
close
|
|
309
|
+
close(): void;
|
|
353
310
|
}
|
|
354
311
|
/**
|
|
355
312
|
* @deprecated use useDialog
|
|
@@ -390,5 +347,4 @@ declare function isTypeUrl(message?: string): RuleItem;
|
|
|
390
347
|
declare function isTypeNumber(value?: number, message?: string): RuleItem;
|
|
391
348
|
declare function isStrictLength(value?: number, message?: string): RuleItem;
|
|
392
349
|
|
|
393
|
-
export { AppComponentsResolver,
|
|
394
|
-
export type { BrowserInfo, Dialog, DialogOptions, DialogParseHashResult, Dictionary, ResponseError, VersionsList };
|
|
350
|
+
export { AppComponentsResolver, type BrowserInfo, type Dictionary, type ResponseError, UiComponentsResolver, type VersionsList, camelizeKeys, convertEnumToOptions, formatMoney, genHash, genRandomNumber, genUUID, getCardNumber, getCountryFromPhone, getPaginationLimit, getPaginationOffset, getPaginationPages, getPaginationParams, isElementIgnored, isEmptyObject, isMax, isMin, isRequired, isStrictLength, isTypeEmail, isTypeNumber, isTypeUrl, mapDataObjectForFilters, parsePhone, snakelizeKeys, unformatNumber, useAbortController, useAsyncItems, useAsyncMultiselect, useAsyncSelect, useBreakpoint, useClassName, useDayjs, useDetectBrowser, useDialog, useFilters, useGlobalScroll, useLogger, usePanel, validateNumber, validatePhone };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { MaybeRef,
|
|
2
|
+
import { MaybeRef, Component, EmitsOptions, VNode, Ref } from 'vue';
|
|
3
3
|
import { AxiosRequestConfig } from 'axios';
|
|
4
4
|
export { AxiosError as HttpError, AxiosPromise as HttpPromise, AxiosRequestConfig as HttpRequestConfig, AxiosResponse as HttpResponse } from 'axios';
|
|
5
5
|
import { MaybeRef as MaybeRef$1 } from '@vueuse/core';
|
|
@@ -23,7 +23,7 @@ interface ResponseError {
|
|
|
23
23
|
data: Record<string, string | string[]> | null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare function camelizeKeys
|
|
26
|
+
declare function camelizeKeys(object: Dictionary): Dictionary;
|
|
27
27
|
|
|
28
28
|
interface Options$3 {
|
|
29
29
|
labelType: 'key' | 'value';
|
|
@@ -33,21 +33,6 @@ declare function convertEnumToOptions(obj: any, options?: Options$3): {
|
|
|
33
33
|
label: unknown;
|
|
34
34
|
}[];
|
|
35
35
|
|
|
36
|
-
interface EnrichErrorParams {
|
|
37
|
-
message: string;
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
}
|
|
40
|
-
declare class EnrichError extends Error {
|
|
41
|
-
constructor(data: EnrichErrorParams);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declare function getStatusMessage(status: number): string;
|
|
45
|
-
declare function formatErrorDataMessage(data?: Record<string, string | string[]>): string;
|
|
46
|
-
declare function formatErrorForNotify(error: Error | ResponseError | any): {
|
|
47
|
-
title: string;
|
|
48
|
-
message: any;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
36
|
interface Options$2 extends Intl.NumberFormatOptions {
|
|
52
37
|
locale?: string;
|
|
53
38
|
defaultValue?: string | number;
|
|
@@ -76,8 +61,6 @@ declare function isElementIgnored({ ignoredClasses, event, }?: {
|
|
|
76
61
|
|
|
77
62
|
declare function isEmptyObject(object: object): boolean;
|
|
78
63
|
|
|
79
|
-
declare function isHtml(data: string): boolean;
|
|
80
|
-
|
|
81
64
|
interface MapOptions {
|
|
82
65
|
labelKey?: string;
|
|
83
66
|
valueKey?: string;
|
|
@@ -95,7 +78,7 @@ declare function getPaginationParams({ page, limit, }: {
|
|
|
95
78
|
limit: number;
|
|
96
79
|
offset: number;
|
|
97
80
|
};
|
|
98
|
-
declare function getPaginationLimit({ limit
|
|
81
|
+
declare function getPaginationLimit({ limit }: {
|
|
99
82
|
limit: string | number;
|
|
100
83
|
}): number;
|
|
101
84
|
declare function getPaginationOffset({ page, limit, }: {
|
|
@@ -110,7 +93,7 @@ declare function getPaginationPages({ count, limit, }: {
|
|
|
110
93
|
declare function parsePhone(phone: string | null | undefined): string;
|
|
111
94
|
|
|
112
95
|
type SnakelizeKeysProp = Record<string | number, any>;
|
|
113
|
-
declare function snakelizeKeys
|
|
96
|
+
declare function snakelizeKeys(prop: SnakelizeKeysProp): SnakelizeKeysProp;
|
|
114
97
|
|
|
115
98
|
/**
|
|
116
99
|
* Принимает на вход число в виде строки или числа,
|
|
@@ -151,13 +134,13 @@ declare function useAsyncItems<T extends (...args: any[]) => any>({ apiMethod, q
|
|
|
151
134
|
params: MaybeRef<Parameters<T>[0]>;
|
|
152
135
|
config?: AxiosRequestConfig;
|
|
153
136
|
}): {
|
|
154
|
-
isLoading: vue.Ref<false
|
|
155
|
-
isFetching: vue.Ref<boolean
|
|
156
|
-
isError: vue.Ref<false
|
|
157
|
-
data: vue.Ref<any
|
|
158
|
-
error: vue.Ref<
|
|
137
|
+
isLoading: vue.Ref<false> | vue.Ref<true>;
|
|
138
|
+
isFetching: vue.Ref<boolean>;
|
|
139
|
+
isError: vue.Ref<false> | vue.Ref<true>;
|
|
140
|
+
data: vue.Ref<any>;
|
|
141
|
+
error: vue.Ref<unknown>;
|
|
159
142
|
items: vue.ComputedRef<Awaited<ReturnType<T>>["results"]>;
|
|
160
|
-
count: vue.Ref<number
|
|
143
|
+
count: vue.Ref<number>;
|
|
161
144
|
refetch: () => void;
|
|
162
145
|
reload: () => void;
|
|
163
146
|
abort: () => void;
|
|
@@ -183,14 +166,12 @@ declare function useAsyncMultiselect<T extends (...args: any[]) => any, K extend
|
|
|
183
166
|
}): {
|
|
184
167
|
items: vue.ComputedRef<any[]>;
|
|
185
168
|
options: vue.ComputedRef<ReturnType<K>[]>;
|
|
186
|
-
search: vue.Ref<string
|
|
169
|
+
search: vue.Ref<string>;
|
|
187
170
|
hasNextPage: vue.ComputedRef<boolean>;
|
|
188
|
-
isFetching: vue.Ref<boolean
|
|
189
|
-
isLoading: vue.Ref<false
|
|
171
|
+
isFetching: vue.Ref<boolean>;
|
|
172
|
+
isLoading: vue.Ref<false> | vue.Ref<true>;
|
|
190
173
|
loadPage: (newPage?: number) => void;
|
|
191
174
|
updateSearch: (value: string) => void;
|
|
192
|
-
refetch: () => void;
|
|
193
|
-
reload: () => void;
|
|
194
175
|
};
|
|
195
176
|
|
|
196
177
|
interface ReactiveData {
|
|
@@ -212,25 +193,23 @@ declare function useAsyncSelect<T extends (...args: any[]) => any, K extends (pa
|
|
|
212
193
|
}): {
|
|
213
194
|
items: vue.ComputedRef<any[]>;
|
|
214
195
|
options: vue.ComputedRef<ReturnType<K>[]>;
|
|
215
|
-
search: vue.Ref<string
|
|
196
|
+
search: vue.Ref<string>;
|
|
216
197
|
hasNextPage: vue.ComputedRef<boolean>;
|
|
217
|
-
isFetching: vue.Ref<boolean
|
|
218
|
-
isLoading: vue.Ref<false
|
|
198
|
+
isFetching: vue.Ref<boolean>;
|
|
199
|
+
isLoading: vue.Ref<false> | vue.Ref<true>;
|
|
219
200
|
loadPage: (newPage?: number) => void;
|
|
220
201
|
updateSearch: (value: string) => void;
|
|
221
|
-
refetch: () => void;
|
|
222
|
-
reload: () => void;
|
|
223
202
|
};
|
|
224
203
|
|
|
225
204
|
declare function useBreakpoint(): {
|
|
226
|
-
isMobile: vue.
|
|
227
|
-
isDesktop: vue.
|
|
228
|
-
isGreaterXxs: vue.
|
|
229
|
-
isGreaterXs: vue.
|
|
230
|
-
isGreaterSm: vue.
|
|
231
|
-
isGreaterMd: vue.
|
|
232
|
-
isGreaterLg: vue.
|
|
233
|
-
isGreaterXl: vue.
|
|
205
|
+
isMobile: vue.Ref<boolean>;
|
|
206
|
+
isDesktop: vue.Ref<boolean>;
|
|
207
|
+
isGreaterXxs: vue.Ref<boolean>;
|
|
208
|
+
isGreaterXs: vue.Ref<boolean>;
|
|
209
|
+
isGreaterSm: vue.Ref<boolean>;
|
|
210
|
+
isGreaterMd: vue.Ref<boolean>;
|
|
211
|
+
isGreaterLg: vue.Ref<boolean>;
|
|
212
|
+
isGreaterXl: vue.Ref<boolean>;
|
|
234
213
|
};
|
|
235
214
|
|
|
236
215
|
declare function useClassName(block: string): {
|
|
@@ -267,41 +246,19 @@ type VersionsList = {
|
|
|
267
246
|
declare function useDetectBrowser(versions: VersionsList, userAgent?: any): BrowserInfo;
|
|
268
247
|
|
|
269
248
|
interface VNodeCustom$1 extends VNode {
|
|
270
|
-
close
|
|
271
|
-
}
|
|
272
|
-
interface Dialog {
|
|
273
|
-
uuid: string;
|
|
274
|
-
name?: string;
|
|
275
|
-
vnode: VNodeCustom$1;
|
|
276
|
-
layer: number;
|
|
277
|
-
}
|
|
278
|
-
interface DialogOptions {
|
|
279
|
-
hashPrefix?: string;
|
|
249
|
+
close(): void;
|
|
280
250
|
}
|
|
281
|
-
|
|
282
|
-
name: string;
|
|
283
|
-
layer: number;
|
|
284
|
-
[key: string]: any;
|
|
285
|
-
}
|
|
286
|
-
declare function useDialog(options?: DialogOptions): {
|
|
251
|
+
declare function useDialog(): {
|
|
287
252
|
open: ({ layer, component, props, }: {
|
|
288
253
|
component: Component;
|
|
289
254
|
props?: any;
|
|
290
255
|
layer?: number;
|
|
291
256
|
}) => string;
|
|
292
257
|
getInstance: (uuid: string) => VNodeCustom$1;
|
|
293
|
-
getLayer: (uuid: string) => number;
|
|
294
258
|
close: (uuid: string) => void;
|
|
295
259
|
closeAll: () => void;
|
|
296
260
|
showConfirm: (text?: string) => boolean;
|
|
297
261
|
isOnTop: (uuid: string) => boolean;
|
|
298
|
-
genHash: ({ layer, componentName, props, }: {
|
|
299
|
-
componentName: string;
|
|
300
|
-
props?: any;
|
|
301
|
-
layer?: number;
|
|
302
|
-
}) => string;
|
|
303
|
-
parseHash: (hash: string, componentName: string) => DialogParseHashResult | undefined;
|
|
304
|
-
clearHash: () => void;
|
|
305
262
|
openByHash: ({ layer, component, props, }: {
|
|
306
263
|
component: Component;
|
|
307
264
|
props?: any;
|
|
@@ -314,17 +271,17 @@ declare function useDialog(options?: DialogOptions): {
|
|
|
314
271
|
};
|
|
315
272
|
|
|
316
273
|
declare function useGlobalScroll(): {
|
|
317
|
-
isLocked: vue.Ref<boolean
|
|
274
|
+
isLocked: vue.Ref<boolean>;
|
|
318
275
|
lock: () => void;
|
|
319
276
|
unlock: () => void;
|
|
320
277
|
};
|
|
321
278
|
|
|
322
|
-
declare function useFilters<T extends Record<string, any>, K extends Record<string, any>>({ config, initialFilters }: {
|
|
279
|
+
declare function useFilters<T extends Record<string, any>, K extends Record<string, any>>({ config, initialFilters, }: {
|
|
323
280
|
config: T;
|
|
324
281
|
initialFilters: K;
|
|
325
282
|
}): {
|
|
326
|
-
isOpen: Ref<boolean
|
|
327
|
-
filtersModel: Ref<K
|
|
283
|
+
isOpen: Ref<boolean>;
|
|
284
|
+
filtersModel: Ref<K>;
|
|
328
285
|
filtersFromQuery: vue.ComputedRef<{}>;
|
|
329
286
|
filtersCount: vue.ComputedRef<number>;
|
|
330
287
|
updateOne: (key: keyof K, value: any) => void;
|
|
@@ -349,7 +306,7 @@ interface Options {
|
|
|
349
306
|
declare function useLogger(scope: string, options?: Options): logdown.Logger;
|
|
350
307
|
|
|
351
308
|
interface VNodeCustom extends VNode {
|
|
352
|
-
close
|
|
309
|
+
close(): void;
|
|
353
310
|
}
|
|
354
311
|
/**
|
|
355
312
|
* @deprecated use useDialog
|
|
@@ -390,5 +347,4 @@ declare function isTypeUrl(message?: string): RuleItem;
|
|
|
390
347
|
declare function isTypeNumber(value?: number, message?: string): RuleItem;
|
|
391
348
|
declare function isStrictLength(value?: number, message?: string): RuleItem;
|
|
392
349
|
|
|
393
|
-
export { AppComponentsResolver,
|
|
394
|
-
export type { BrowserInfo, Dialog, DialogOptions, DialogParseHashResult, Dictionary, ResponseError, VersionsList };
|
|
350
|
+
export { AppComponentsResolver, type BrowserInfo, type Dictionary, type ResponseError, UiComponentsResolver, type VersionsList, camelizeKeys, convertEnumToOptions, formatMoney, genHash, genRandomNumber, genUUID, getCardNumber, getCountryFromPhone, getPaginationLimit, getPaginationOffset, getPaginationPages, getPaginationParams, isElementIgnored, isEmptyObject, isMax, isMin, isRequired, isStrictLength, isTypeEmail, isTypeNumber, isTypeUrl, mapDataObjectForFilters, parsePhone, snakelizeKeys, unformatNumber, useAbortController, useAsyncItems, useAsyncMultiselect, useAsyncSelect, useBreakpoint, useClassName, useDayjs, useDetectBrowser, useDialog, useFilters, useGlobalScroll, useLogger, usePanel, validateNumber, validatePhone };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { MaybeRef,
|
|
2
|
+
import { MaybeRef, Component, EmitsOptions, VNode, Ref } from 'vue';
|
|
3
3
|
import { AxiosRequestConfig } from 'axios';
|
|
4
4
|
export { AxiosError as HttpError, AxiosPromise as HttpPromise, AxiosRequestConfig as HttpRequestConfig, AxiosResponse as HttpResponse } from 'axios';
|
|
5
5
|
import { MaybeRef as MaybeRef$1 } from '@vueuse/core';
|
|
@@ -23,7 +23,7 @@ interface ResponseError {
|
|
|
23
23
|
data: Record<string, string | string[]> | null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare function camelizeKeys
|
|
26
|
+
declare function camelizeKeys(object: Dictionary): Dictionary;
|
|
27
27
|
|
|
28
28
|
interface Options$3 {
|
|
29
29
|
labelType: 'key' | 'value';
|
|
@@ -33,21 +33,6 @@ declare function convertEnumToOptions(obj: any, options?: Options$3): {
|
|
|
33
33
|
label: unknown;
|
|
34
34
|
}[];
|
|
35
35
|
|
|
36
|
-
interface EnrichErrorParams {
|
|
37
|
-
message: string;
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
}
|
|
40
|
-
declare class EnrichError extends Error {
|
|
41
|
-
constructor(data: EnrichErrorParams);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declare function getStatusMessage(status: number): string;
|
|
45
|
-
declare function formatErrorDataMessage(data?: Record<string, string | string[]>): string;
|
|
46
|
-
declare function formatErrorForNotify(error: Error | ResponseError | any): {
|
|
47
|
-
title: string;
|
|
48
|
-
message: any;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
36
|
interface Options$2 extends Intl.NumberFormatOptions {
|
|
52
37
|
locale?: string;
|
|
53
38
|
defaultValue?: string | number;
|
|
@@ -76,8 +61,6 @@ declare function isElementIgnored({ ignoredClasses, event, }?: {
|
|
|
76
61
|
|
|
77
62
|
declare function isEmptyObject(object: object): boolean;
|
|
78
63
|
|
|
79
|
-
declare function isHtml(data: string): boolean;
|
|
80
|
-
|
|
81
64
|
interface MapOptions {
|
|
82
65
|
labelKey?: string;
|
|
83
66
|
valueKey?: string;
|
|
@@ -95,7 +78,7 @@ declare function getPaginationParams({ page, limit, }: {
|
|
|
95
78
|
limit: number;
|
|
96
79
|
offset: number;
|
|
97
80
|
};
|
|
98
|
-
declare function getPaginationLimit({ limit
|
|
81
|
+
declare function getPaginationLimit({ limit }: {
|
|
99
82
|
limit: string | number;
|
|
100
83
|
}): number;
|
|
101
84
|
declare function getPaginationOffset({ page, limit, }: {
|
|
@@ -110,7 +93,7 @@ declare function getPaginationPages({ count, limit, }: {
|
|
|
110
93
|
declare function parsePhone(phone: string | null | undefined): string;
|
|
111
94
|
|
|
112
95
|
type SnakelizeKeysProp = Record<string | number, any>;
|
|
113
|
-
declare function snakelizeKeys
|
|
96
|
+
declare function snakelizeKeys(prop: SnakelizeKeysProp): SnakelizeKeysProp;
|
|
114
97
|
|
|
115
98
|
/**
|
|
116
99
|
* Принимает на вход число в виде строки или числа,
|
|
@@ -151,13 +134,13 @@ declare function useAsyncItems<T extends (...args: any[]) => any>({ apiMethod, q
|
|
|
151
134
|
params: MaybeRef<Parameters<T>[0]>;
|
|
152
135
|
config?: AxiosRequestConfig;
|
|
153
136
|
}): {
|
|
154
|
-
isLoading: vue.Ref<false
|
|
155
|
-
isFetching: vue.Ref<boolean
|
|
156
|
-
isError: vue.Ref<false
|
|
157
|
-
data: vue.Ref<any
|
|
158
|
-
error: vue.Ref<
|
|
137
|
+
isLoading: vue.Ref<false> | vue.Ref<true>;
|
|
138
|
+
isFetching: vue.Ref<boolean>;
|
|
139
|
+
isError: vue.Ref<false> | vue.Ref<true>;
|
|
140
|
+
data: vue.Ref<any>;
|
|
141
|
+
error: vue.Ref<unknown>;
|
|
159
142
|
items: vue.ComputedRef<Awaited<ReturnType<T>>["results"]>;
|
|
160
|
-
count: vue.Ref<number
|
|
143
|
+
count: vue.Ref<number>;
|
|
161
144
|
refetch: () => void;
|
|
162
145
|
reload: () => void;
|
|
163
146
|
abort: () => void;
|
|
@@ -183,14 +166,12 @@ declare function useAsyncMultiselect<T extends (...args: any[]) => any, K extend
|
|
|
183
166
|
}): {
|
|
184
167
|
items: vue.ComputedRef<any[]>;
|
|
185
168
|
options: vue.ComputedRef<ReturnType<K>[]>;
|
|
186
|
-
search: vue.Ref<string
|
|
169
|
+
search: vue.Ref<string>;
|
|
187
170
|
hasNextPage: vue.ComputedRef<boolean>;
|
|
188
|
-
isFetching: vue.Ref<boolean
|
|
189
|
-
isLoading: vue.Ref<false
|
|
171
|
+
isFetching: vue.Ref<boolean>;
|
|
172
|
+
isLoading: vue.Ref<false> | vue.Ref<true>;
|
|
190
173
|
loadPage: (newPage?: number) => void;
|
|
191
174
|
updateSearch: (value: string) => void;
|
|
192
|
-
refetch: () => void;
|
|
193
|
-
reload: () => void;
|
|
194
175
|
};
|
|
195
176
|
|
|
196
177
|
interface ReactiveData {
|
|
@@ -212,25 +193,23 @@ declare function useAsyncSelect<T extends (...args: any[]) => any, K extends (pa
|
|
|
212
193
|
}): {
|
|
213
194
|
items: vue.ComputedRef<any[]>;
|
|
214
195
|
options: vue.ComputedRef<ReturnType<K>[]>;
|
|
215
|
-
search: vue.Ref<string
|
|
196
|
+
search: vue.Ref<string>;
|
|
216
197
|
hasNextPage: vue.ComputedRef<boolean>;
|
|
217
|
-
isFetching: vue.Ref<boolean
|
|
218
|
-
isLoading: vue.Ref<false
|
|
198
|
+
isFetching: vue.Ref<boolean>;
|
|
199
|
+
isLoading: vue.Ref<false> | vue.Ref<true>;
|
|
219
200
|
loadPage: (newPage?: number) => void;
|
|
220
201
|
updateSearch: (value: string) => void;
|
|
221
|
-
refetch: () => void;
|
|
222
|
-
reload: () => void;
|
|
223
202
|
};
|
|
224
203
|
|
|
225
204
|
declare function useBreakpoint(): {
|
|
226
|
-
isMobile: vue.
|
|
227
|
-
isDesktop: vue.
|
|
228
|
-
isGreaterXxs: vue.
|
|
229
|
-
isGreaterXs: vue.
|
|
230
|
-
isGreaterSm: vue.
|
|
231
|
-
isGreaterMd: vue.
|
|
232
|
-
isGreaterLg: vue.
|
|
233
|
-
isGreaterXl: vue.
|
|
205
|
+
isMobile: vue.Ref<boolean>;
|
|
206
|
+
isDesktop: vue.Ref<boolean>;
|
|
207
|
+
isGreaterXxs: vue.Ref<boolean>;
|
|
208
|
+
isGreaterXs: vue.Ref<boolean>;
|
|
209
|
+
isGreaterSm: vue.Ref<boolean>;
|
|
210
|
+
isGreaterMd: vue.Ref<boolean>;
|
|
211
|
+
isGreaterLg: vue.Ref<boolean>;
|
|
212
|
+
isGreaterXl: vue.Ref<boolean>;
|
|
234
213
|
};
|
|
235
214
|
|
|
236
215
|
declare function useClassName(block: string): {
|
|
@@ -267,41 +246,19 @@ type VersionsList = {
|
|
|
267
246
|
declare function useDetectBrowser(versions: VersionsList, userAgent?: any): BrowserInfo;
|
|
268
247
|
|
|
269
248
|
interface VNodeCustom$1 extends VNode {
|
|
270
|
-
close
|
|
271
|
-
}
|
|
272
|
-
interface Dialog {
|
|
273
|
-
uuid: string;
|
|
274
|
-
name?: string;
|
|
275
|
-
vnode: VNodeCustom$1;
|
|
276
|
-
layer: number;
|
|
277
|
-
}
|
|
278
|
-
interface DialogOptions {
|
|
279
|
-
hashPrefix?: string;
|
|
249
|
+
close(): void;
|
|
280
250
|
}
|
|
281
|
-
|
|
282
|
-
name: string;
|
|
283
|
-
layer: number;
|
|
284
|
-
[key: string]: any;
|
|
285
|
-
}
|
|
286
|
-
declare function useDialog(options?: DialogOptions): {
|
|
251
|
+
declare function useDialog(): {
|
|
287
252
|
open: ({ layer, component, props, }: {
|
|
288
253
|
component: Component;
|
|
289
254
|
props?: any;
|
|
290
255
|
layer?: number;
|
|
291
256
|
}) => string;
|
|
292
257
|
getInstance: (uuid: string) => VNodeCustom$1;
|
|
293
|
-
getLayer: (uuid: string) => number;
|
|
294
258
|
close: (uuid: string) => void;
|
|
295
259
|
closeAll: () => void;
|
|
296
260
|
showConfirm: (text?: string) => boolean;
|
|
297
261
|
isOnTop: (uuid: string) => boolean;
|
|
298
|
-
genHash: ({ layer, componentName, props, }: {
|
|
299
|
-
componentName: string;
|
|
300
|
-
props?: any;
|
|
301
|
-
layer?: number;
|
|
302
|
-
}) => string;
|
|
303
|
-
parseHash: (hash: string, componentName: string) => DialogParseHashResult | undefined;
|
|
304
|
-
clearHash: () => void;
|
|
305
262
|
openByHash: ({ layer, component, props, }: {
|
|
306
263
|
component: Component;
|
|
307
264
|
props?: any;
|
|
@@ -314,17 +271,17 @@ declare function useDialog(options?: DialogOptions): {
|
|
|
314
271
|
};
|
|
315
272
|
|
|
316
273
|
declare function useGlobalScroll(): {
|
|
317
|
-
isLocked: vue.Ref<boolean
|
|
274
|
+
isLocked: vue.Ref<boolean>;
|
|
318
275
|
lock: () => void;
|
|
319
276
|
unlock: () => void;
|
|
320
277
|
};
|
|
321
278
|
|
|
322
|
-
declare function useFilters<T extends Record<string, any>, K extends Record<string, any>>({ config, initialFilters }: {
|
|
279
|
+
declare function useFilters<T extends Record<string, any>, K extends Record<string, any>>({ config, initialFilters, }: {
|
|
323
280
|
config: T;
|
|
324
281
|
initialFilters: K;
|
|
325
282
|
}): {
|
|
326
|
-
isOpen: Ref<boolean
|
|
327
|
-
filtersModel: Ref<K
|
|
283
|
+
isOpen: Ref<boolean>;
|
|
284
|
+
filtersModel: Ref<K>;
|
|
328
285
|
filtersFromQuery: vue.ComputedRef<{}>;
|
|
329
286
|
filtersCount: vue.ComputedRef<number>;
|
|
330
287
|
updateOne: (key: keyof K, value: any) => void;
|
|
@@ -349,7 +306,7 @@ interface Options {
|
|
|
349
306
|
declare function useLogger(scope: string, options?: Options): logdown.Logger;
|
|
350
307
|
|
|
351
308
|
interface VNodeCustom extends VNode {
|
|
352
|
-
close
|
|
309
|
+
close(): void;
|
|
353
310
|
}
|
|
354
311
|
/**
|
|
355
312
|
* @deprecated use useDialog
|
|
@@ -390,5 +347,4 @@ declare function isTypeUrl(message?: string): RuleItem;
|
|
|
390
347
|
declare function isTypeNumber(value?: number, message?: string): RuleItem;
|
|
391
348
|
declare function isStrictLength(value?: number, message?: string): RuleItem;
|
|
392
349
|
|
|
393
|
-
export { AppComponentsResolver,
|
|
394
|
-
export type { BrowserInfo, Dialog, DialogOptions, DialogParseHashResult, Dictionary, ResponseError, VersionsList };
|
|
350
|
+
export { AppComponentsResolver, type BrowserInfo, type Dictionary, type ResponseError, UiComponentsResolver, type VersionsList, camelizeKeys, convertEnumToOptions, formatMoney, genHash, genRandomNumber, genUUID, getCardNumber, getCountryFromPhone, getPaginationLimit, getPaginationOffset, getPaginationPages, getPaginationParams, isElementIgnored, isEmptyObject, isMax, isMin, isRequired, isStrictLength, isTypeEmail, isTypeNumber, isTypeUrl, mapDataObjectForFilters, parsePhone, snakelizeKeys, unformatNumber, useAbortController, useAsyncItems, useAsyncMultiselect, useAsyncSelect, useBreakpoint, useClassName, useDayjs, useDetectBrowser, useDialog, useFilters, useGlobalScroll, useLogger, usePanel, validateNumber, validatePhone };
|