@karta.io/utils 1.0.0-beta.1 → 1.0.0-beta.11
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 +6 -4
- package/dist/index.d.cts +350 -0
- package/dist/index.d.mts +350 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.mjs +6 -4
- package/package.json +21 -20
package/dist/index.cjs
CHANGED
|
@@ -48,8 +48,9 @@ function AppComponentsResolver(options = {}) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function camelizeKeys(object) {
|
|
51
|
-
if (Array.isArray(object))
|
|
51
|
+
if (Array.isArray(object)) {
|
|
52
52
|
return object.map((v) => camelizeKeys(v));
|
|
53
|
+
}
|
|
53
54
|
if (object !== null && object.constructor === Object) {
|
|
54
55
|
return Object.keys(object).reduce(
|
|
55
56
|
(result, key) => ({
|
|
@@ -232,8 +233,9 @@ function parsePhone(phone) {
|
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
function snakelizeKeys(prop) {
|
|
235
|
-
if (Array.isArray(prop))
|
|
236
|
+
if (Array.isArray(prop)) {
|
|
236
237
|
return prop.map((item) => snakelizeKeys(item));
|
|
238
|
+
}
|
|
237
239
|
if (prop !== null && prop !== void 0 && prop.constructor === Object) {
|
|
238
240
|
return Object.keys(prop).reduce(
|
|
239
241
|
(accum, current) => ({
|
|
@@ -506,7 +508,7 @@ function useAsyncMultiselect({
|
|
|
506
508
|
if (!items.value.length)
|
|
507
509
|
return [];
|
|
508
510
|
if (!mapOptionCallback)
|
|
509
|
-
return
|
|
511
|
+
return items.value;
|
|
510
512
|
return items.value.map(mapOptionCallback);
|
|
511
513
|
});
|
|
512
514
|
const hasNextPage = vue.computed(() => count.value > items.value.length);
|
|
@@ -656,7 +658,7 @@ function useAsyncSelect({
|
|
|
656
658
|
if (!items.value.length)
|
|
657
659
|
return [];
|
|
658
660
|
if (!mapOptionCallback)
|
|
659
|
-
return
|
|
661
|
+
return items.value;
|
|
660
662
|
return items.value.map(mapOptionCallback);
|
|
661
663
|
});
|
|
662
664
|
const hasNextPage = vue.computed(() => count.value > items.value.length);
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { MaybeRef, Component, EmitsOptions, VNode, Ref } from 'vue';
|
|
3
|
+
import { AxiosRequestConfig } from 'axios';
|
|
4
|
+
export { AxiosError as HttpError, AxiosPromise as HttpPromise, AxiosRequestConfig as HttpRequestConfig, AxiosResponse as HttpResponse } from 'axios';
|
|
5
|
+
import { MaybeRef as MaybeRef$1 } from '@vueuse/core';
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import { Browser } from 'detect-browser';
|
|
8
|
+
import logdown from 'logdown';
|
|
9
|
+
import { RuleItem } from 'async-validator';
|
|
10
|
+
|
|
11
|
+
interface AppComponentsResolverOptions {
|
|
12
|
+
prefix?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function AppComponentsResolver(options?: AppComponentsResolverOptions): any;
|
|
15
|
+
|
|
16
|
+
interface Dictionary {
|
|
17
|
+
[keys: string | number]: any;
|
|
18
|
+
}
|
|
19
|
+
interface ResponseError {
|
|
20
|
+
status: number;
|
|
21
|
+
statusMessage: string;
|
|
22
|
+
message: string;
|
|
23
|
+
data: Record<string, string | string[]> | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare function camelizeKeys<T extends Record<string, any> = Dictionary>(object: Dictionary): T;
|
|
27
|
+
|
|
28
|
+
interface Options$3 {
|
|
29
|
+
labelType: 'key' | 'value';
|
|
30
|
+
}
|
|
31
|
+
declare function convertEnumToOptions(obj: any, options?: Options$3): {
|
|
32
|
+
value: unknown;
|
|
33
|
+
label: unknown;
|
|
34
|
+
}[];
|
|
35
|
+
|
|
36
|
+
interface Options$2 extends Intl.NumberFormatOptions {
|
|
37
|
+
locale?: string;
|
|
38
|
+
defaultValue?: string | number;
|
|
39
|
+
}
|
|
40
|
+
declare function formatMoney(value: string | number | null | undefined, currency?: string, options?: Options$2): string | number;
|
|
41
|
+
|
|
42
|
+
declare function genHash(hashLength: number): string;
|
|
43
|
+
|
|
44
|
+
declare function genRandomNumber(min: number, max: number): number;
|
|
45
|
+
|
|
46
|
+
declare function genUUID(): string;
|
|
47
|
+
|
|
48
|
+
interface Options$1 {
|
|
49
|
+
hasOnlyLast4: boolean;
|
|
50
|
+
isHidden: boolean;
|
|
51
|
+
dot: string;
|
|
52
|
+
}
|
|
53
|
+
declare function getCardNumber(number: string, options?: Partial<Options$1>): string;
|
|
54
|
+
|
|
55
|
+
declare function getCountryFromPhone(phone: string): string;
|
|
56
|
+
|
|
57
|
+
declare function isElementIgnored({ ignoredClasses, event, }?: {
|
|
58
|
+
ignoredClasses?: string[];
|
|
59
|
+
event?: Event;
|
|
60
|
+
}): boolean;
|
|
61
|
+
|
|
62
|
+
declare function isEmptyObject(object: object): boolean;
|
|
63
|
+
|
|
64
|
+
interface MapOptions {
|
|
65
|
+
labelKey?: string;
|
|
66
|
+
valueKey?: string;
|
|
67
|
+
excludedItems?: any[];
|
|
68
|
+
}
|
|
69
|
+
declare function mapDataObjectForFilters<T extends Record<string, any>>(data: T, options?: MapOptions): {
|
|
70
|
+
label: string;
|
|
71
|
+
value: any;
|
|
72
|
+
}[];
|
|
73
|
+
|
|
74
|
+
declare function getPaginationParams({ page, limit, }: {
|
|
75
|
+
page: string | number;
|
|
76
|
+
limit: string | number;
|
|
77
|
+
}): {
|
|
78
|
+
limit: number;
|
|
79
|
+
offset: number;
|
|
80
|
+
};
|
|
81
|
+
declare function getPaginationLimit({ limit }: {
|
|
82
|
+
limit: string | number;
|
|
83
|
+
}): number;
|
|
84
|
+
declare function getPaginationOffset({ page, limit, }: {
|
|
85
|
+
page: string | number;
|
|
86
|
+
limit: string | number;
|
|
87
|
+
}): number;
|
|
88
|
+
declare function getPaginationPages({ count, limit, }: {
|
|
89
|
+
count: number;
|
|
90
|
+
limit: string | number;
|
|
91
|
+
}): number;
|
|
92
|
+
|
|
93
|
+
declare function parsePhone(phone: string | null | undefined): string;
|
|
94
|
+
|
|
95
|
+
type SnakelizeKeysProp = Record<string | number, any>;
|
|
96
|
+
declare function snakelizeKeys<T extends Record<string, any> = SnakelizeKeysProp>(prop: SnakelizeKeysProp): T;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Принимает на вход число в виде строки или числа,
|
|
100
|
+
* возвращает корректное значение типа Number (убирает лишние пробелы и запятые)
|
|
101
|
+
* @example
|
|
102
|
+
* // returns 1000
|
|
103
|
+
* unformatNumber('1 000');
|
|
104
|
+
* @example
|
|
105
|
+
* // returns 1000
|
|
106
|
+
* unformatNumber('1,000')
|
|
107
|
+
* @example
|
|
108
|
+
* // returns 1000.123
|
|
109
|
+
* unformatNummber('1 000,123')
|
|
110
|
+
* @example
|
|
111
|
+
* // returns 1000.123
|
|
112
|
+
* unformatNummber('1,000.123')
|
|
113
|
+
* @param value
|
|
114
|
+
* @return number
|
|
115
|
+
*/
|
|
116
|
+
declare function unformatNumber(value: string | number): string | number;
|
|
117
|
+
|
|
118
|
+
declare function validateNumber(value: string | number, defaultValue: number): number;
|
|
119
|
+
|
|
120
|
+
interface UiComponentsResolverOptions {
|
|
121
|
+
prefix?: string;
|
|
122
|
+
}
|
|
123
|
+
declare function UiComponentsResolver(options?: UiComponentsResolverOptions): any;
|
|
124
|
+
|
|
125
|
+
declare function useAbortController<T extends (...args: any[]) => any>(callback: T): {
|
|
126
|
+
call(...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;
|
|
127
|
+
abort(): void;
|
|
128
|
+
isAborted(error: ResponseError): boolean;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
declare function useAsyncItems<T extends (...args: any[]) => any>({ apiMethod, queryKey, params, config, }: {
|
|
132
|
+
apiMethod: T;
|
|
133
|
+
queryKey: string;
|
|
134
|
+
params: MaybeRef<Parameters<T>[0]>;
|
|
135
|
+
config?: AxiosRequestConfig;
|
|
136
|
+
}): {
|
|
137
|
+
isLoading: vue.Ref<boolean> | vue.Ref<true> | vue.Ref<false>;
|
|
138
|
+
isFetching: vue.Ref<boolean>;
|
|
139
|
+
isError: vue.Ref<true> | vue.Ref<false>;
|
|
140
|
+
data: vue.Ref<any>;
|
|
141
|
+
error: vue.Ref<Error>;
|
|
142
|
+
items: vue.ComputedRef<Awaited<ReturnType<T>>["results"]>;
|
|
143
|
+
count: vue.Ref<number>;
|
|
144
|
+
refetch: () => void;
|
|
145
|
+
reload: () => void;
|
|
146
|
+
abort: () => void;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
interface ReactiveData$1 {
|
|
150
|
+
search: string;
|
|
151
|
+
page: number;
|
|
152
|
+
selectedValues?: any[];
|
|
153
|
+
params?: any;
|
|
154
|
+
}
|
|
155
|
+
declare function useAsyncMultiselect<T extends (...args: any[]) => any, K extends (params: any) => any>({ apiMethod, mapOptionCallback, selectedValues, params, queryKey, dataItemsKey, dataItemIdKey, dataCountKey, delay, onUpdated, }: {
|
|
156
|
+
apiMethod: T;
|
|
157
|
+
mapOptionCallback?: K;
|
|
158
|
+
selectedValues?: MaybeRef$1<Parameters<T>[0]['includedIds']>;
|
|
159
|
+
params?: MaybeRef$1<Partial<Parameters<T>[0]>>;
|
|
160
|
+
queryKey: string;
|
|
161
|
+
dataItemsKey?: string;
|
|
162
|
+
dataItemIdKey?: string;
|
|
163
|
+
dataCountKey?: string;
|
|
164
|
+
delay?: number;
|
|
165
|
+
onUpdated?: (data: ReactiveData$1) => void;
|
|
166
|
+
}): {
|
|
167
|
+
items: vue.ComputedRef<any[]>;
|
|
168
|
+
options: vue.ComputedRef<ReturnType<K>[]>;
|
|
169
|
+
search: vue.Ref<string>;
|
|
170
|
+
hasNextPage: vue.ComputedRef<boolean>;
|
|
171
|
+
isFetching: vue.Ref<boolean>;
|
|
172
|
+
isLoading: vue.Ref<boolean> | vue.Ref<true> | vue.Ref<false>;
|
|
173
|
+
loadPage: (newPage?: number) => void;
|
|
174
|
+
updateSearch: (value: string) => void;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
interface ReactiveData {
|
|
178
|
+
search: string;
|
|
179
|
+
page: number;
|
|
180
|
+
selectedValue?: any[];
|
|
181
|
+
params?: any;
|
|
182
|
+
}
|
|
183
|
+
declare function useAsyncSelect<T extends (...args: any[]) => any, K extends (params: any) => any>({ apiMethod, mapOptionCallback, selectedValue, params, queryKey, dataItemsKey, dataCountKey, delay, onUpdated, }: {
|
|
184
|
+
apiMethod: T;
|
|
185
|
+
mapOptionCallback?: K;
|
|
186
|
+
selectedValue?: MaybeRef$1<Parameters<T>[0]['includedIds']>;
|
|
187
|
+
params?: MaybeRef$1<Partial<Parameters<T>[0]>>;
|
|
188
|
+
queryKey: string;
|
|
189
|
+
dataItemsKey?: string;
|
|
190
|
+
dataCountKey?: string;
|
|
191
|
+
delay?: number;
|
|
192
|
+
onUpdated?: (data: ReactiveData) => void;
|
|
193
|
+
}): {
|
|
194
|
+
items: vue.ComputedRef<any[]>;
|
|
195
|
+
options: vue.ComputedRef<ReturnType<K>[]>;
|
|
196
|
+
search: vue.Ref<string>;
|
|
197
|
+
hasNextPage: vue.ComputedRef<boolean>;
|
|
198
|
+
isFetching: vue.Ref<boolean>;
|
|
199
|
+
isLoading: vue.Ref<boolean> | vue.Ref<true> | vue.Ref<false>;
|
|
200
|
+
loadPage: (newPage?: number) => void;
|
|
201
|
+
updateSearch: (value: string) => void;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
declare function useBreakpoint(): {
|
|
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>;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
declare function useClassName(block: string): {
|
|
216
|
+
b: (blockSuffix?: string) => string;
|
|
217
|
+
e: (element?: string) => string;
|
|
218
|
+
m: (modifier?: string, condition?: boolean) => string;
|
|
219
|
+
em: (element?: string, modifier?: string, condition?: boolean) => string;
|
|
220
|
+
mv: (modifier: string, modifierValue: string, condition?: boolean) => string;
|
|
221
|
+
cssVar: (object: Record<string, string | number>) => Record<string, string | number>;
|
|
222
|
+
cssVarName: (name: string) => string;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Обертка над dayjs, позволяющая задавать timezone
|
|
227
|
+
* @see https://day.js.org/en/
|
|
228
|
+
*
|
|
229
|
+
* Использовать параметр timezone нужно крайне аккуратно,
|
|
230
|
+
* может привести к утечкам памяти
|
|
231
|
+
* @todo Подумать как сделать оптимальнее
|
|
232
|
+
*/
|
|
233
|
+
declare function useDayjs(timezone?: string): (date?: dayjs.ConfigType, format?: dayjs.OptionType, locale?: string, strict?: boolean) => dayjs.Dayjs;
|
|
234
|
+
|
|
235
|
+
interface BrowserInfo {
|
|
236
|
+
isDeprecated?: boolean;
|
|
237
|
+
name?: string;
|
|
238
|
+
version?: string;
|
|
239
|
+
os?: string;
|
|
240
|
+
type?: string;
|
|
241
|
+
options?: any;
|
|
242
|
+
}
|
|
243
|
+
type VersionsList = {
|
|
244
|
+
[key in Browser]?: string | boolean;
|
|
245
|
+
};
|
|
246
|
+
declare function useDetectBrowser(versions: VersionsList, userAgent?: any): BrowserInfo;
|
|
247
|
+
|
|
248
|
+
interface VNodeCustom$1 extends VNode {
|
|
249
|
+
close(): void;
|
|
250
|
+
}
|
|
251
|
+
declare function useDialog(): {
|
|
252
|
+
open: ({ layer, component, props, }: {
|
|
253
|
+
component: Component;
|
|
254
|
+
props?: any;
|
|
255
|
+
layer?: number;
|
|
256
|
+
}) => string;
|
|
257
|
+
getInstance: (uuid: string) => VNodeCustom$1;
|
|
258
|
+
close: (uuid: string) => void;
|
|
259
|
+
closeAll: () => void;
|
|
260
|
+
showConfirm: (text?: string) => boolean;
|
|
261
|
+
isOnTop: (uuid: string) => boolean;
|
|
262
|
+
openByHash: ({ layer, component, props, }: {
|
|
263
|
+
component: Component;
|
|
264
|
+
props?: any;
|
|
265
|
+
layer?: number;
|
|
266
|
+
}) => void;
|
|
267
|
+
watchHash: ({ component, events, }: {
|
|
268
|
+
component: Component;
|
|
269
|
+
events?: EmitsOptions;
|
|
270
|
+
}) => any;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
declare function useGlobalScroll(): {
|
|
274
|
+
isLocked: vue.Ref<boolean>;
|
|
275
|
+
lock: () => void;
|
|
276
|
+
unlock: () => void;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
declare function useFilters<T extends Record<string, any>, K extends Record<string, any>>({ config, initialFilters, }: {
|
|
280
|
+
config: T;
|
|
281
|
+
initialFilters: K;
|
|
282
|
+
}): {
|
|
283
|
+
isOpen: Ref<boolean>;
|
|
284
|
+
filtersModel: Ref<K>;
|
|
285
|
+
filtersFromQuery: vue.ComputedRef<{}>;
|
|
286
|
+
filtersCount: vue.ComputedRef<number>;
|
|
287
|
+
updateOne: (key: keyof K, value: any) => void;
|
|
288
|
+
updateMany: (filters: Record<string, any>) => void;
|
|
289
|
+
open: () => void;
|
|
290
|
+
clear: () => void;
|
|
291
|
+
setQueryFromFilters: (filters: Record<string, any>) => void;
|
|
292
|
+
getValidatedParams: (query: Record<string, any>) => {
|
|
293
|
+
filters: any;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @see https://github.com/caiogondim/logdown.js#readme
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
interface Options {
|
|
302
|
+
tag?: string;
|
|
303
|
+
color?: string;
|
|
304
|
+
debug?: boolean;
|
|
305
|
+
}
|
|
306
|
+
declare function useLogger(scope: string, options?: Options): logdown.Logger;
|
|
307
|
+
|
|
308
|
+
interface VNodeCustom extends VNode {
|
|
309
|
+
close(): void;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* @deprecated use useDialog
|
|
313
|
+
*/
|
|
314
|
+
declare function usePanel(): {
|
|
315
|
+
open: ({ layer, component, props, }: {
|
|
316
|
+
component: Component;
|
|
317
|
+
props?: any;
|
|
318
|
+
layer?: number;
|
|
319
|
+
}) => string;
|
|
320
|
+
getInstance: (uuid: string) => VNodeCustom;
|
|
321
|
+
close: (uuid: string) => void;
|
|
322
|
+
closeAll: () => void;
|
|
323
|
+
openByHash: ({ layer, component, props, }: {
|
|
324
|
+
component: Component;
|
|
325
|
+
props?: any;
|
|
326
|
+
layer?: number;
|
|
327
|
+
}) => void;
|
|
328
|
+
watchHash: ({ component, events, }: {
|
|
329
|
+
component: Component;
|
|
330
|
+
events?: EmitsOptions;
|
|
331
|
+
}) => any;
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
declare function validatePhone(rule: string, value: string): boolean;
|
|
335
|
+
|
|
336
|
+
declare function isRequired(value?: boolean, message?: string): RuleItem;
|
|
337
|
+
declare function isMax(value?: number, message?: string): {
|
|
338
|
+
max: number;
|
|
339
|
+
message: string;
|
|
340
|
+
};
|
|
341
|
+
declare function isMin(value?: number, message?: string): {
|
|
342
|
+
min: number;
|
|
343
|
+
message: string;
|
|
344
|
+
};
|
|
345
|
+
declare function isTypeEmail(message?: string): RuleItem;
|
|
346
|
+
declare function isTypeUrl(message?: string): RuleItem;
|
|
347
|
+
declare function isTypeNumber(value?: number, message?: string): RuleItem;
|
|
348
|
+
declare function isStrictLength(value?: number, message?: string): RuleItem;
|
|
349
|
+
|
|
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
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { MaybeRef, Component, EmitsOptions, VNode, Ref } from 'vue';
|
|
3
|
+
import { AxiosRequestConfig } from 'axios';
|
|
4
|
+
export { AxiosError as HttpError, AxiosPromise as HttpPromise, AxiosRequestConfig as HttpRequestConfig, AxiosResponse as HttpResponse } from 'axios';
|
|
5
|
+
import { MaybeRef as MaybeRef$1 } from '@vueuse/core';
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import { Browser } from 'detect-browser';
|
|
8
|
+
import logdown from 'logdown';
|
|
9
|
+
import { RuleItem } from 'async-validator';
|
|
10
|
+
|
|
11
|
+
interface AppComponentsResolverOptions {
|
|
12
|
+
prefix?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function AppComponentsResolver(options?: AppComponentsResolverOptions): any;
|
|
15
|
+
|
|
16
|
+
interface Dictionary {
|
|
17
|
+
[keys: string | number]: any;
|
|
18
|
+
}
|
|
19
|
+
interface ResponseError {
|
|
20
|
+
status: number;
|
|
21
|
+
statusMessage: string;
|
|
22
|
+
message: string;
|
|
23
|
+
data: Record<string, string | string[]> | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare function camelizeKeys<T extends Record<string, any> = Dictionary>(object: Dictionary): T;
|
|
27
|
+
|
|
28
|
+
interface Options$3 {
|
|
29
|
+
labelType: 'key' | 'value';
|
|
30
|
+
}
|
|
31
|
+
declare function convertEnumToOptions(obj: any, options?: Options$3): {
|
|
32
|
+
value: unknown;
|
|
33
|
+
label: unknown;
|
|
34
|
+
}[];
|
|
35
|
+
|
|
36
|
+
interface Options$2 extends Intl.NumberFormatOptions {
|
|
37
|
+
locale?: string;
|
|
38
|
+
defaultValue?: string | number;
|
|
39
|
+
}
|
|
40
|
+
declare function formatMoney(value: string | number | null | undefined, currency?: string, options?: Options$2): string | number;
|
|
41
|
+
|
|
42
|
+
declare function genHash(hashLength: number): string;
|
|
43
|
+
|
|
44
|
+
declare function genRandomNumber(min: number, max: number): number;
|
|
45
|
+
|
|
46
|
+
declare function genUUID(): string;
|
|
47
|
+
|
|
48
|
+
interface Options$1 {
|
|
49
|
+
hasOnlyLast4: boolean;
|
|
50
|
+
isHidden: boolean;
|
|
51
|
+
dot: string;
|
|
52
|
+
}
|
|
53
|
+
declare function getCardNumber(number: string, options?: Partial<Options$1>): string;
|
|
54
|
+
|
|
55
|
+
declare function getCountryFromPhone(phone: string): string;
|
|
56
|
+
|
|
57
|
+
declare function isElementIgnored({ ignoredClasses, event, }?: {
|
|
58
|
+
ignoredClasses?: string[];
|
|
59
|
+
event?: Event;
|
|
60
|
+
}): boolean;
|
|
61
|
+
|
|
62
|
+
declare function isEmptyObject(object: object): boolean;
|
|
63
|
+
|
|
64
|
+
interface MapOptions {
|
|
65
|
+
labelKey?: string;
|
|
66
|
+
valueKey?: string;
|
|
67
|
+
excludedItems?: any[];
|
|
68
|
+
}
|
|
69
|
+
declare function mapDataObjectForFilters<T extends Record<string, any>>(data: T, options?: MapOptions): {
|
|
70
|
+
label: string;
|
|
71
|
+
value: any;
|
|
72
|
+
}[];
|
|
73
|
+
|
|
74
|
+
declare function getPaginationParams({ page, limit, }: {
|
|
75
|
+
page: string | number;
|
|
76
|
+
limit: string | number;
|
|
77
|
+
}): {
|
|
78
|
+
limit: number;
|
|
79
|
+
offset: number;
|
|
80
|
+
};
|
|
81
|
+
declare function getPaginationLimit({ limit }: {
|
|
82
|
+
limit: string | number;
|
|
83
|
+
}): number;
|
|
84
|
+
declare function getPaginationOffset({ page, limit, }: {
|
|
85
|
+
page: string | number;
|
|
86
|
+
limit: string | number;
|
|
87
|
+
}): number;
|
|
88
|
+
declare function getPaginationPages({ count, limit, }: {
|
|
89
|
+
count: number;
|
|
90
|
+
limit: string | number;
|
|
91
|
+
}): number;
|
|
92
|
+
|
|
93
|
+
declare function parsePhone(phone: string | null | undefined): string;
|
|
94
|
+
|
|
95
|
+
type SnakelizeKeysProp = Record<string | number, any>;
|
|
96
|
+
declare function snakelizeKeys<T extends Record<string, any> = SnakelizeKeysProp>(prop: SnakelizeKeysProp): T;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Принимает на вход число в виде строки или числа,
|
|
100
|
+
* возвращает корректное значение типа Number (убирает лишние пробелы и запятые)
|
|
101
|
+
* @example
|
|
102
|
+
* // returns 1000
|
|
103
|
+
* unformatNumber('1 000');
|
|
104
|
+
* @example
|
|
105
|
+
* // returns 1000
|
|
106
|
+
* unformatNumber('1,000')
|
|
107
|
+
* @example
|
|
108
|
+
* // returns 1000.123
|
|
109
|
+
* unformatNummber('1 000,123')
|
|
110
|
+
* @example
|
|
111
|
+
* // returns 1000.123
|
|
112
|
+
* unformatNummber('1,000.123')
|
|
113
|
+
* @param value
|
|
114
|
+
* @return number
|
|
115
|
+
*/
|
|
116
|
+
declare function unformatNumber(value: string | number): string | number;
|
|
117
|
+
|
|
118
|
+
declare function validateNumber(value: string | number, defaultValue: number): number;
|
|
119
|
+
|
|
120
|
+
interface UiComponentsResolverOptions {
|
|
121
|
+
prefix?: string;
|
|
122
|
+
}
|
|
123
|
+
declare function UiComponentsResolver(options?: UiComponentsResolverOptions): any;
|
|
124
|
+
|
|
125
|
+
declare function useAbortController<T extends (...args: any[]) => any>(callback: T): {
|
|
126
|
+
call(...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;
|
|
127
|
+
abort(): void;
|
|
128
|
+
isAborted(error: ResponseError): boolean;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
declare function useAsyncItems<T extends (...args: any[]) => any>({ apiMethod, queryKey, params, config, }: {
|
|
132
|
+
apiMethod: T;
|
|
133
|
+
queryKey: string;
|
|
134
|
+
params: MaybeRef<Parameters<T>[0]>;
|
|
135
|
+
config?: AxiosRequestConfig;
|
|
136
|
+
}): {
|
|
137
|
+
isLoading: vue.Ref<boolean> | vue.Ref<true> | vue.Ref<false>;
|
|
138
|
+
isFetching: vue.Ref<boolean>;
|
|
139
|
+
isError: vue.Ref<true> | vue.Ref<false>;
|
|
140
|
+
data: vue.Ref<any>;
|
|
141
|
+
error: vue.Ref<Error>;
|
|
142
|
+
items: vue.ComputedRef<Awaited<ReturnType<T>>["results"]>;
|
|
143
|
+
count: vue.Ref<number>;
|
|
144
|
+
refetch: () => void;
|
|
145
|
+
reload: () => void;
|
|
146
|
+
abort: () => void;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
interface ReactiveData$1 {
|
|
150
|
+
search: string;
|
|
151
|
+
page: number;
|
|
152
|
+
selectedValues?: any[];
|
|
153
|
+
params?: any;
|
|
154
|
+
}
|
|
155
|
+
declare function useAsyncMultiselect<T extends (...args: any[]) => any, K extends (params: any) => any>({ apiMethod, mapOptionCallback, selectedValues, params, queryKey, dataItemsKey, dataItemIdKey, dataCountKey, delay, onUpdated, }: {
|
|
156
|
+
apiMethod: T;
|
|
157
|
+
mapOptionCallback?: K;
|
|
158
|
+
selectedValues?: MaybeRef$1<Parameters<T>[0]['includedIds']>;
|
|
159
|
+
params?: MaybeRef$1<Partial<Parameters<T>[0]>>;
|
|
160
|
+
queryKey: string;
|
|
161
|
+
dataItemsKey?: string;
|
|
162
|
+
dataItemIdKey?: string;
|
|
163
|
+
dataCountKey?: string;
|
|
164
|
+
delay?: number;
|
|
165
|
+
onUpdated?: (data: ReactiveData$1) => void;
|
|
166
|
+
}): {
|
|
167
|
+
items: vue.ComputedRef<any[]>;
|
|
168
|
+
options: vue.ComputedRef<ReturnType<K>[]>;
|
|
169
|
+
search: vue.Ref<string>;
|
|
170
|
+
hasNextPage: vue.ComputedRef<boolean>;
|
|
171
|
+
isFetching: vue.Ref<boolean>;
|
|
172
|
+
isLoading: vue.Ref<boolean> | vue.Ref<true> | vue.Ref<false>;
|
|
173
|
+
loadPage: (newPage?: number) => void;
|
|
174
|
+
updateSearch: (value: string) => void;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
interface ReactiveData {
|
|
178
|
+
search: string;
|
|
179
|
+
page: number;
|
|
180
|
+
selectedValue?: any[];
|
|
181
|
+
params?: any;
|
|
182
|
+
}
|
|
183
|
+
declare function useAsyncSelect<T extends (...args: any[]) => any, K extends (params: any) => any>({ apiMethod, mapOptionCallback, selectedValue, params, queryKey, dataItemsKey, dataCountKey, delay, onUpdated, }: {
|
|
184
|
+
apiMethod: T;
|
|
185
|
+
mapOptionCallback?: K;
|
|
186
|
+
selectedValue?: MaybeRef$1<Parameters<T>[0]['includedIds']>;
|
|
187
|
+
params?: MaybeRef$1<Partial<Parameters<T>[0]>>;
|
|
188
|
+
queryKey: string;
|
|
189
|
+
dataItemsKey?: string;
|
|
190
|
+
dataCountKey?: string;
|
|
191
|
+
delay?: number;
|
|
192
|
+
onUpdated?: (data: ReactiveData) => void;
|
|
193
|
+
}): {
|
|
194
|
+
items: vue.ComputedRef<any[]>;
|
|
195
|
+
options: vue.ComputedRef<ReturnType<K>[]>;
|
|
196
|
+
search: vue.Ref<string>;
|
|
197
|
+
hasNextPage: vue.ComputedRef<boolean>;
|
|
198
|
+
isFetching: vue.Ref<boolean>;
|
|
199
|
+
isLoading: vue.Ref<boolean> | vue.Ref<true> | vue.Ref<false>;
|
|
200
|
+
loadPage: (newPage?: number) => void;
|
|
201
|
+
updateSearch: (value: string) => void;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
declare function useBreakpoint(): {
|
|
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>;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
declare function useClassName(block: string): {
|
|
216
|
+
b: (blockSuffix?: string) => string;
|
|
217
|
+
e: (element?: string) => string;
|
|
218
|
+
m: (modifier?: string, condition?: boolean) => string;
|
|
219
|
+
em: (element?: string, modifier?: string, condition?: boolean) => string;
|
|
220
|
+
mv: (modifier: string, modifierValue: string, condition?: boolean) => string;
|
|
221
|
+
cssVar: (object: Record<string, string | number>) => Record<string, string | number>;
|
|
222
|
+
cssVarName: (name: string) => string;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Обертка над dayjs, позволяющая задавать timezone
|
|
227
|
+
* @see https://day.js.org/en/
|
|
228
|
+
*
|
|
229
|
+
* Использовать параметр timezone нужно крайне аккуратно,
|
|
230
|
+
* может привести к утечкам памяти
|
|
231
|
+
* @todo Подумать как сделать оптимальнее
|
|
232
|
+
*/
|
|
233
|
+
declare function useDayjs(timezone?: string): (date?: dayjs.ConfigType, format?: dayjs.OptionType, locale?: string, strict?: boolean) => dayjs.Dayjs;
|
|
234
|
+
|
|
235
|
+
interface BrowserInfo {
|
|
236
|
+
isDeprecated?: boolean;
|
|
237
|
+
name?: string;
|
|
238
|
+
version?: string;
|
|
239
|
+
os?: string;
|
|
240
|
+
type?: string;
|
|
241
|
+
options?: any;
|
|
242
|
+
}
|
|
243
|
+
type VersionsList = {
|
|
244
|
+
[key in Browser]?: string | boolean;
|
|
245
|
+
};
|
|
246
|
+
declare function useDetectBrowser(versions: VersionsList, userAgent?: any): BrowserInfo;
|
|
247
|
+
|
|
248
|
+
interface VNodeCustom$1 extends VNode {
|
|
249
|
+
close(): void;
|
|
250
|
+
}
|
|
251
|
+
declare function useDialog(): {
|
|
252
|
+
open: ({ layer, component, props, }: {
|
|
253
|
+
component: Component;
|
|
254
|
+
props?: any;
|
|
255
|
+
layer?: number;
|
|
256
|
+
}) => string;
|
|
257
|
+
getInstance: (uuid: string) => VNodeCustom$1;
|
|
258
|
+
close: (uuid: string) => void;
|
|
259
|
+
closeAll: () => void;
|
|
260
|
+
showConfirm: (text?: string) => boolean;
|
|
261
|
+
isOnTop: (uuid: string) => boolean;
|
|
262
|
+
openByHash: ({ layer, component, props, }: {
|
|
263
|
+
component: Component;
|
|
264
|
+
props?: any;
|
|
265
|
+
layer?: number;
|
|
266
|
+
}) => void;
|
|
267
|
+
watchHash: ({ component, events, }: {
|
|
268
|
+
component: Component;
|
|
269
|
+
events?: EmitsOptions;
|
|
270
|
+
}) => any;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
declare function useGlobalScroll(): {
|
|
274
|
+
isLocked: vue.Ref<boolean>;
|
|
275
|
+
lock: () => void;
|
|
276
|
+
unlock: () => void;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
declare function useFilters<T extends Record<string, any>, K extends Record<string, any>>({ config, initialFilters, }: {
|
|
280
|
+
config: T;
|
|
281
|
+
initialFilters: K;
|
|
282
|
+
}): {
|
|
283
|
+
isOpen: Ref<boolean>;
|
|
284
|
+
filtersModel: Ref<K>;
|
|
285
|
+
filtersFromQuery: vue.ComputedRef<{}>;
|
|
286
|
+
filtersCount: vue.ComputedRef<number>;
|
|
287
|
+
updateOne: (key: keyof K, value: any) => void;
|
|
288
|
+
updateMany: (filters: Record<string, any>) => void;
|
|
289
|
+
open: () => void;
|
|
290
|
+
clear: () => void;
|
|
291
|
+
setQueryFromFilters: (filters: Record<string, any>) => void;
|
|
292
|
+
getValidatedParams: (query: Record<string, any>) => {
|
|
293
|
+
filters: any;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @see https://github.com/caiogondim/logdown.js#readme
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
interface Options {
|
|
302
|
+
tag?: string;
|
|
303
|
+
color?: string;
|
|
304
|
+
debug?: boolean;
|
|
305
|
+
}
|
|
306
|
+
declare function useLogger(scope: string, options?: Options): logdown.Logger;
|
|
307
|
+
|
|
308
|
+
interface VNodeCustom extends VNode {
|
|
309
|
+
close(): void;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* @deprecated use useDialog
|
|
313
|
+
*/
|
|
314
|
+
declare function usePanel(): {
|
|
315
|
+
open: ({ layer, component, props, }: {
|
|
316
|
+
component: Component;
|
|
317
|
+
props?: any;
|
|
318
|
+
layer?: number;
|
|
319
|
+
}) => string;
|
|
320
|
+
getInstance: (uuid: string) => VNodeCustom;
|
|
321
|
+
close: (uuid: string) => void;
|
|
322
|
+
closeAll: () => void;
|
|
323
|
+
openByHash: ({ layer, component, props, }: {
|
|
324
|
+
component: Component;
|
|
325
|
+
props?: any;
|
|
326
|
+
layer?: number;
|
|
327
|
+
}) => void;
|
|
328
|
+
watchHash: ({ component, events, }: {
|
|
329
|
+
component: Component;
|
|
330
|
+
events?: EmitsOptions;
|
|
331
|
+
}) => any;
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
declare function validatePhone(rule: string, value: string): boolean;
|
|
335
|
+
|
|
336
|
+
declare function isRequired(value?: boolean, message?: string): RuleItem;
|
|
337
|
+
declare function isMax(value?: number, message?: string): {
|
|
338
|
+
max: number;
|
|
339
|
+
message: string;
|
|
340
|
+
};
|
|
341
|
+
declare function isMin(value?: number, message?: string): {
|
|
342
|
+
min: number;
|
|
343
|
+
message: string;
|
|
344
|
+
};
|
|
345
|
+
declare function isTypeEmail(message?: string): RuleItem;
|
|
346
|
+
declare function isTypeUrl(message?: string): RuleItem;
|
|
347
|
+
declare function isTypeNumber(value?: number, message?: string): RuleItem;
|
|
348
|
+
declare function isStrictLength(value?: number, message?: string): RuleItem;
|
|
349
|
+
|
|
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
|
@@ -23,7 +23,7 @@ interface ResponseError {
|
|
|
23
23
|
data: Record<string, string | string[]> | null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare function camelizeKeys(object: Dictionary):
|
|
26
|
+
declare function camelizeKeys<T extends Record<string, any> = Dictionary>(object: Dictionary): T;
|
|
27
27
|
|
|
28
28
|
interface Options$3 {
|
|
29
29
|
labelType: 'key' | 'value';
|
|
@@ -93,7 +93,7 @@ declare function getPaginationPages({ count, limit, }: {
|
|
|
93
93
|
declare function parsePhone(phone: string | null | undefined): string;
|
|
94
94
|
|
|
95
95
|
type SnakelizeKeysProp = Record<string | number, any>;
|
|
96
|
-
declare function snakelizeKeys(prop: SnakelizeKeysProp):
|
|
96
|
+
declare function snakelizeKeys<T extends Record<string, any> = SnakelizeKeysProp>(prop: SnakelizeKeysProp): T;
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* Принимает на вход число в виде строки или числа,
|
|
@@ -134,11 +134,11 @@ declare function useAsyncItems<T extends (...args: any[]) => any>({ apiMethod, q
|
|
|
134
134
|
params: MaybeRef<Parameters<T>[0]>;
|
|
135
135
|
config?: AxiosRequestConfig;
|
|
136
136
|
}): {
|
|
137
|
-
isLoading: vue.Ref<
|
|
137
|
+
isLoading: vue.Ref<boolean> | vue.Ref<true> | vue.Ref<false>;
|
|
138
138
|
isFetching: vue.Ref<boolean>;
|
|
139
|
-
isError: vue.Ref<
|
|
139
|
+
isError: vue.Ref<true> | vue.Ref<false>;
|
|
140
140
|
data: vue.Ref<any>;
|
|
141
|
-
error: vue.Ref<
|
|
141
|
+
error: vue.Ref<Error>;
|
|
142
142
|
items: vue.ComputedRef<Awaited<ReturnType<T>>["results"]>;
|
|
143
143
|
count: vue.Ref<number>;
|
|
144
144
|
refetch: () => void;
|
|
@@ -169,7 +169,7 @@ declare function useAsyncMultiselect<T extends (...args: any[]) => any, K extend
|
|
|
169
169
|
search: vue.Ref<string>;
|
|
170
170
|
hasNextPage: vue.ComputedRef<boolean>;
|
|
171
171
|
isFetching: vue.Ref<boolean>;
|
|
172
|
-
isLoading: vue.Ref<
|
|
172
|
+
isLoading: vue.Ref<boolean> | vue.Ref<true> | vue.Ref<false>;
|
|
173
173
|
loadPage: (newPage?: number) => void;
|
|
174
174
|
updateSearch: (value: string) => void;
|
|
175
175
|
};
|
|
@@ -196,7 +196,7 @@ declare function useAsyncSelect<T extends (...args: any[]) => any, K extends (pa
|
|
|
196
196
|
search: vue.Ref<string>;
|
|
197
197
|
hasNextPage: vue.ComputedRef<boolean>;
|
|
198
198
|
isFetching: vue.Ref<boolean>;
|
|
199
|
-
isLoading: vue.Ref<
|
|
199
|
+
isLoading: vue.Ref<boolean> | vue.Ref<true> | vue.Ref<false>;
|
|
200
200
|
loadPage: (newPage?: number) => void;
|
|
201
201
|
updateSearch: (value: string) => void;
|
|
202
202
|
};
|
|
@@ -347,4 +347,4 @@ declare function isTypeUrl(message?: string): RuleItem;
|
|
|
347
347
|
declare function isTypeNumber(value?: number, message?: string): RuleItem;
|
|
348
348
|
declare function isStrictLength(value?: number, message?: string): RuleItem;
|
|
349
349
|
|
|
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 };
|
|
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.mjs
CHANGED
|
@@ -30,8 +30,9 @@ function AppComponentsResolver(options = {}) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function camelizeKeys(object) {
|
|
33
|
-
if (Array.isArray(object))
|
|
33
|
+
if (Array.isArray(object)) {
|
|
34
34
|
return object.map((v) => camelizeKeys(v));
|
|
35
|
+
}
|
|
35
36
|
if (object !== null && object.constructor === Object) {
|
|
36
37
|
return Object.keys(object).reduce(
|
|
37
38
|
(result, key) => ({
|
|
@@ -214,8 +215,9 @@ function parsePhone(phone) {
|
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
function snakelizeKeys(prop) {
|
|
217
|
-
if (Array.isArray(prop))
|
|
218
|
+
if (Array.isArray(prop)) {
|
|
218
219
|
return prop.map((item) => snakelizeKeys(item));
|
|
220
|
+
}
|
|
219
221
|
if (prop !== null && prop !== void 0 && prop.constructor === Object) {
|
|
220
222
|
return Object.keys(prop).reduce(
|
|
221
223
|
(accum, current) => ({
|
|
@@ -488,7 +490,7 @@ function useAsyncMultiselect({
|
|
|
488
490
|
if (!items.value.length)
|
|
489
491
|
return [];
|
|
490
492
|
if (!mapOptionCallback)
|
|
491
|
-
return
|
|
493
|
+
return items.value;
|
|
492
494
|
return items.value.map(mapOptionCallback);
|
|
493
495
|
});
|
|
494
496
|
const hasNextPage = computed(() => count.value > items.value.length);
|
|
@@ -638,7 +640,7 @@ function useAsyncSelect({
|
|
|
638
640
|
if (!items.value.length)
|
|
639
641
|
return [];
|
|
640
642
|
if (!mapOptionCallback)
|
|
641
|
-
return
|
|
643
|
+
return items.value;
|
|
642
644
|
return items.value.map(mapOptionCallback);
|
|
643
645
|
});
|
|
644
646
|
const hasNextPage = computed(() => count.value > items.value.length);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karta.io/utils",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.11",
|
|
4
4
|
"description": "karta.io utils for admin and application",
|
|
5
5
|
"author": "Vitaly Blokhin <karambafe@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"require": "./dist/index.cjs",
|
|
13
|
-
"import": "./dist/index.mjs"
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
14
15
|
},
|
|
15
16
|
"./*": "./*"
|
|
16
17
|
},
|
|
@@ -21,35 +22,35 @@
|
|
|
21
22
|
"dist"
|
|
22
23
|
],
|
|
23
24
|
"peerDependencies": {
|
|
24
|
-
"vue": "3.
|
|
25
|
+
"vue": "3.x"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@karta.io/common-data": "^1.0.0-beta.
|
|
28
|
-
"@tanstack/vue-query": "
|
|
29
|
-
"@vueuse/core": "10.7.
|
|
28
|
+
"@karta.io/common-data": "^1.0.0-beta.11",
|
|
29
|
+
"@tanstack/vue-query": "5.x",
|
|
30
|
+
"@vueuse/core": "10.7.2",
|
|
30
31
|
"async-validator": "4.2.5",
|
|
31
|
-
"axios": "1.
|
|
32
|
-
"dayjs": "1.11.
|
|
32
|
+
"axios": "1.6.7",
|
|
33
|
+
"dayjs": "1.11.10",
|
|
33
34
|
"detect-browser": "5.3.0",
|
|
34
|
-
"libphonenumber-js": "1.10.
|
|
35
|
+
"libphonenumber-js": "1.10.55",
|
|
35
36
|
"lodash": "4.17.21",
|
|
36
37
|
"logdown": "3.3.1",
|
|
37
38
|
"qs": "6.11.2",
|
|
38
|
-
"vue-router": "4.x
|
|
39
|
+
"vue-router": "4.x"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@qvant/prettier-config": "0.1.0",
|
|
42
|
-
"@types/lodash": "4.14.
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "
|
|
44
|
-
"@typescript-eslint/parser": "
|
|
45
|
-
"eslint": "8.
|
|
43
|
+
"@types/lodash": "4.14.202",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "6.20.0",
|
|
45
|
+
"@typescript-eslint/parser": "6.20.0",
|
|
46
|
+
"eslint": "8.56.0",
|
|
46
47
|
"eslint-config-airbnb-base": "15.0.0",
|
|
47
|
-
"eslint-plugin-import": "2.
|
|
48
|
-
"prettier": "3.
|
|
49
|
-
"typescript": "5.
|
|
50
|
-
"unbuild": "
|
|
51
|
-
"vitest": "
|
|
52
|
-
"vue": "3.
|
|
48
|
+
"eslint-plugin-import": "2.29.1",
|
|
49
|
+
"prettier": "3.2.5",
|
|
50
|
+
"typescript": "5.3.3",
|
|
51
|
+
"unbuild": "2.0.0",
|
|
52
|
+
"vitest": "1.2.2",
|
|
53
|
+
"vue": "3.4.15"
|
|
53
54
|
},
|
|
54
55
|
"scripts": {
|
|
55
56
|
"dev": "vitest",
|