@karta.io/utils 1.0.0-beta.39 → 1.0.0-beta.4
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 +72 -286
- package/dist/index.d.ts +13 -56
- package/dist/index.mjs +73 -281
- package/package.json +34 -33
- package/dist/index.d.cts +0 -393
- package/dist/index.d.mts +0 -393
package/dist/index.d.ts
CHANGED
|
@@ -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,11 +134,11 @@ 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<
|
|
137
|
+
isLoading: vue.Ref<false> | vue.Ref<true>;
|
|
155
138
|
isFetching: vue.Ref<boolean>;
|
|
156
139
|
isError: vue.Ref<false> | vue.Ref<true>;
|
|
157
|
-
data: vue.Ref<any
|
|
158
|
-
error: vue.Ref<
|
|
140
|
+
data: vue.Ref<any>;
|
|
141
|
+
error: vue.Ref<unknown>;
|
|
159
142
|
items: vue.ComputedRef<Awaited<ReturnType<T>>["results"]>;
|
|
160
143
|
count: vue.Ref<number>;
|
|
161
144
|
refetch: () => void;
|
|
@@ -186,11 +169,9 @@ declare function useAsyncMultiselect<T extends (...args: any[]) => any, K extend
|
|
|
186
169
|
search: vue.Ref<string>;
|
|
187
170
|
hasNextPage: vue.ComputedRef<boolean>;
|
|
188
171
|
isFetching: vue.Ref<boolean>;
|
|
189
|
-
isLoading: vue.Ref<
|
|
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 {
|
|
@@ -215,11 +196,9 @@ declare function useAsyncSelect<T extends (...args: any[]) => any, K extends (pa
|
|
|
215
196
|
search: vue.Ref<string>;
|
|
216
197
|
hasNextPage: vue.ComputedRef<boolean>;
|
|
217
198
|
isFetching: vue.Ref<boolean>;
|
|
218
|
-
isLoading: vue.Ref<
|
|
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(): {
|
|
@@ -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;
|
|
@@ -319,7 +276,7 @@ declare function useGlobalScroll(): {
|
|
|
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
|
}): {
|
|
@@ -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,4 +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,
|
|
350
|
+
export { AppComponentsResolver, BrowserInfo, Dictionary, ResponseError, UiComponentsResolver, 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 };
|