@dxtmisha/functional-basic 0.12.2 → 0.12.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/library.d.ts +715 -113
- package/dist/library.js +913 -546
- package/package.json +1 -1
package/dist/library.d.ts
CHANGED
|
@@ -100,6 +100,13 @@ export declare class Api {
|
|
|
100
100
|
* @param callback function for call/ функция для вызова
|
|
101
101
|
*/
|
|
102
102
|
static setPreparation(callback: (apiFetch: ApiFetch) => Promise<void>): Api;
|
|
103
|
+
/**
|
|
104
|
+
* Set config for API.
|
|
105
|
+
*
|
|
106
|
+
* Установить конфигурацию для API.
|
|
107
|
+
* @param config config for API/ конфигурация для API
|
|
108
|
+
*/
|
|
109
|
+
static setConfig(config?: ApiConfig): Api;
|
|
103
110
|
/**
|
|
104
111
|
* Modify the function after the request.
|
|
105
112
|
*
|
|
@@ -144,6 +151,22 @@ export declare class Api {
|
|
|
144
151
|
static delete<T>(request: ApiFetch): Promise<T>;
|
|
145
152
|
}
|
|
146
153
|
|
|
154
|
+
/**
|
|
155
|
+
* API configuration/ Конфигурация API
|
|
156
|
+
*/
|
|
157
|
+
export declare type ApiConfig = {
|
|
158
|
+
/** Base URL for API requests/ Базовый URL для API-запросов */
|
|
159
|
+
urlRoot?: string;
|
|
160
|
+
/** Default headers for API requests/ Заголовки по умолчанию для API-запросов */
|
|
161
|
+
headers?: Record<string, string>;
|
|
162
|
+
/** Default request data for API requests/ Данные запроса по умолчанию для API-запросов */
|
|
163
|
+
requestDefault?: Record<string, any>;
|
|
164
|
+
/** Function to call before request/ Функция для вызова перед запросом */
|
|
165
|
+
preparation?: (apiFetch: ApiFetch) => Promise<void>;
|
|
166
|
+
/** Function to call after request/ Функция для вызова после запроса */
|
|
167
|
+
end: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>;
|
|
168
|
+
};
|
|
169
|
+
|
|
147
170
|
/**
|
|
148
171
|
* Shape of API response data wrapper/ Структура обёртки данных ответа API
|
|
149
172
|
*/
|
|
@@ -241,6 +264,8 @@ export declare type ApiFetch = {
|
|
|
241
264
|
devMode?: boolean;
|
|
242
265
|
/** Suppress error logging/ Подавить логирование ошибок */
|
|
243
266
|
hideError?: boolean;
|
|
267
|
+
/** Suppress loading/ Подавить загрузку */
|
|
268
|
+
hideLoading?: boolean;
|
|
244
269
|
/** Custom response processor/ Пользовательский процессор ответа */
|
|
245
270
|
queryReturn?: (query: Response) => Promise<any>;
|
|
246
271
|
/** Run global preparation hooks/ Запускать глобальные хуки подготовки */
|
|
@@ -249,6 +274,8 @@ export declare type ApiFetch = {
|
|
|
249
274
|
globalEnd?: boolean;
|
|
250
275
|
/** Additional fetch() options/ Дополнительные опции fetch() */
|
|
251
276
|
init?: RequestInit;
|
|
277
|
+
/** Timeout for the request in milliseconds/ Таймаут запроса в миллисекундах */
|
|
278
|
+
timeout?: number;
|
|
252
279
|
/** AbortController for canceling the request/ AbortController для отмены запроса */
|
|
253
280
|
controller?: AbortController;
|
|
254
281
|
};
|
|
@@ -294,11 +321,16 @@ export declare class ApiInstance {
|
|
|
294
321
|
protected response: ApiResponse;
|
|
295
322
|
/** Request modification handler / Обработчик модификации запроса */
|
|
296
323
|
protected preparation: ApiPreparation;
|
|
324
|
+
/** Loading handler / Обработчик загрузки */
|
|
325
|
+
protected loading: LoadingInstance;
|
|
326
|
+
/** Error handler / Обработчик ошибок */
|
|
327
|
+
protected errorCenter: ErrorCenterInstance;
|
|
297
328
|
/**
|
|
298
329
|
* Constructor
|
|
299
330
|
* @param url base path to the script/ базовый путь к скрипту
|
|
331
|
+
* @param options options for the API instance/ опции для экземпляра API
|
|
300
332
|
*/
|
|
301
|
-
constructor(url?: string);
|
|
333
|
+
constructor(url?: string, options?: ApiInstanceOptions);
|
|
302
334
|
/**
|
|
303
335
|
* Is the server local.
|
|
304
336
|
*
|
|
@@ -432,7 +464,10 @@ export declare class ApiInstance {
|
|
|
432
464
|
* Выполнение запроса.
|
|
433
465
|
* @param apiFetch property of the request/ свойство запроса
|
|
434
466
|
*/
|
|
435
|
-
protected makeQuery(apiFetch: ApiFetch): Promise<
|
|
467
|
+
protected makeQuery(apiFetch: ApiFetch): Promise<{
|
|
468
|
+
query: Response;
|
|
469
|
+
timeoutId: any;
|
|
470
|
+
}>;
|
|
436
471
|
/**
|
|
437
472
|
* Transforms data if needed.
|
|
438
473
|
*
|
|
@@ -449,8 +484,51 @@ export declare class ApiInstance {
|
|
|
449
484
|
* @param status status object/ объект статуса
|
|
450
485
|
*/
|
|
451
486
|
protected makeStatus<T>(data: ApiData<T>, status: ApiStatus): ApiData<T>;
|
|
487
|
+
/**
|
|
488
|
+
* Processing an error.
|
|
489
|
+
*
|
|
490
|
+
* Обработка ошибки.
|
|
491
|
+
* @param error error object/ объект ошибки
|
|
492
|
+
* @param group error group/ группа ошибки
|
|
493
|
+
*/
|
|
494
|
+
protected makeError(error: Record<string, any> & {
|
|
495
|
+
name: string;
|
|
496
|
+
}, group?: string): void;
|
|
497
|
+
/**
|
|
498
|
+
* Processing an error query.
|
|
499
|
+
*
|
|
500
|
+
* Обработка ошибки запроса.
|
|
501
|
+
* @param query error query/ ошибка запроса
|
|
502
|
+
*/
|
|
503
|
+
protected makeErrorQuery(query: Response): void;
|
|
504
|
+
/**
|
|
505
|
+
* Initialize controller for request.
|
|
506
|
+
*
|
|
507
|
+
* Инициализация контроллера для запроса.
|
|
508
|
+
* @param apiFetch request options/ опции запроса
|
|
509
|
+
* @param fetchInit request initialization/ инициализация запроса
|
|
510
|
+
*/
|
|
511
|
+
protected initController(apiFetch: ApiFetch, fetchInit: RequestInit): any;
|
|
452
512
|
}
|
|
453
513
|
|
|
514
|
+
/** Options for the API instance/ Опции для экземпляра API */
|
|
515
|
+
export declare type ApiInstanceOptions = {
|
|
516
|
+
/** Class for working with headers/ Класс для работы с заголовками */
|
|
517
|
+
headersClass?: typeof ApiHeaders;
|
|
518
|
+
/** Class for working with default request parameters/ Класс для работы с параметрами запроса по умолчанию */
|
|
519
|
+
requestDefaultClass?: typeof ApiDefault;
|
|
520
|
+
/** Class for working with status/ Класс для работы со статусом */
|
|
521
|
+
statusClass?: typeof ApiStatus;
|
|
522
|
+
/** Class for working with response/ Класс для работы с ответом */
|
|
523
|
+
responseClass?: typeof ApiResponse;
|
|
524
|
+
/** Class for working with preparation/ Класс для работы с модификацией запроса */
|
|
525
|
+
preparationClass?: typeof ApiPreparation;
|
|
526
|
+
/** Instance of loading handler/ Экземпляр обработчика загрузки */
|
|
527
|
+
loadingClass?: LoadingInstance;
|
|
528
|
+
/** Instance of error handler/ Экземпляр обработчика ошибок */
|
|
529
|
+
errorCenterClass?: ErrorCenterInstance;
|
|
530
|
+
};
|
|
531
|
+
|
|
454
532
|
/**
|
|
455
533
|
* Supported HTTP methods type/ Тип HTTP-методов
|
|
456
534
|
* (derived from ApiMethodItem enum)/ (получен из перечисления ApiMethodItem)
|
|
@@ -857,8 +935,9 @@ export declare class BroadcastMessage<Message = any> {
|
|
|
857
935
|
* @param name channel name/ название канала
|
|
858
936
|
* @param callback callback on message received/ колбэк на получение сообщения
|
|
859
937
|
* @param callbackError callback on message error/ колбэк на ошибку сообщения
|
|
938
|
+
* @param errorCenter error center instance/ экземпляр центра ошибок
|
|
860
939
|
*/
|
|
861
|
-
constructor(name: string, callback?: ((event: MessageEvent<Message>) => void) | undefined, callbackError?: ((event: MessageEvent<Message>) => void) | undefined);
|
|
940
|
+
constructor(name: string, callback?: ((event: MessageEvent<Message>) => void) | undefined, callbackError?: ((event: MessageEvent<Message>) => void) | undefined, errorCenter?: ErrorCenterInstance);
|
|
862
941
|
/**
|
|
863
942
|
* Get the channel.
|
|
864
943
|
*
|
|
@@ -1136,6 +1215,7 @@ export declare function createElement<T extends HTMLElement>(parentElement?: HTM
|
|
|
1136
1215
|
export declare class DataStorage<T> {
|
|
1137
1216
|
private name;
|
|
1138
1217
|
private isSession;
|
|
1218
|
+
private errorCenter;
|
|
1139
1219
|
/**
|
|
1140
1220
|
* Changing the prefix in key names. Should be called at the beginning of the code.
|
|
1141
1221
|
*
|
|
@@ -1149,8 +1229,9 @@ export declare class DataStorage<T> {
|
|
|
1149
1229
|
* Constructor
|
|
1150
1230
|
* @param name value name/ название значения
|
|
1151
1231
|
* @param isSession should we use a session/ использовать ли сессию
|
|
1232
|
+
* @param errorCenter error center instance/ экземпляр центра ошибок
|
|
1152
1233
|
*/
|
|
1153
|
-
constructor(name: string, isSession?: boolean);
|
|
1234
|
+
constructor(name: string, isSession?: boolean, errorCenter?: ErrorCenterInstance);
|
|
1154
1235
|
/**
|
|
1155
1236
|
* Getting data from local storage.
|
|
1156
1237
|
*
|
|
@@ -1751,6 +1832,254 @@ export declare function encodeAttribute(text: string): string;
|
|
|
1751
1832
|
*/
|
|
1752
1833
|
export declare function ensureMaxSize(file: Uint8Array, compress?: number, type?: string): Promise<string>;
|
|
1753
1834
|
|
|
1835
|
+
/**
|
|
1836
|
+
* Class for managing error storage and handling.
|
|
1837
|
+
*
|
|
1838
|
+
* Класс для управления хранилищем ошибок и их обработкой.
|
|
1839
|
+
*/
|
|
1840
|
+
export declare class ErrorCenter {
|
|
1841
|
+
/** Instance of the error center / Экземпляр центра ошибок */
|
|
1842
|
+
protected static item: ErrorCenterInstance;
|
|
1843
|
+
/**
|
|
1844
|
+
* Checks if a cause with specific code exists.
|
|
1845
|
+
*
|
|
1846
|
+
* Проверяет наличие причины с конкретным кодом.
|
|
1847
|
+
* @param code error code / код ошибки
|
|
1848
|
+
* @param group error group / группа ошибки
|
|
1849
|
+
*/
|
|
1850
|
+
static has(code: string, group?: string): boolean;
|
|
1851
|
+
/**
|
|
1852
|
+
* Gets a specific error cause by code and group.
|
|
1853
|
+
*
|
|
1854
|
+
* Получает конкретную причину ошибки по коду и группе.
|
|
1855
|
+
* @param code error code / код ошибки
|
|
1856
|
+
* @param group error group / группа ошибки
|
|
1857
|
+
*/
|
|
1858
|
+
static get(code: string, group?: string): ErrorCenterCauseItem | undefined;
|
|
1859
|
+
/**
|
|
1860
|
+
* Returns the instance of the class.
|
|
1861
|
+
*
|
|
1862
|
+
* Возвращает инстанс класса.
|
|
1863
|
+
*/
|
|
1864
|
+
static getItem(): ErrorCenterInstance;
|
|
1865
|
+
/**
|
|
1866
|
+
* Adds an error cause to the storage.
|
|
1867
|
+
*
|
|
1868
|
+
* Добавляет причину ошибки в хранилище.
|
|
1869
|
+
* @param cause error cause item / элемент причины ошибки
|
|
1870
|
+
*/
|
|
1871
|
+
static add(cause: ErrorCenterCauseItem): ErrorCenter;
|
|
1872
|
+
/**
|
|
1873
|
+
* Adds a list of error causes to the storage.
|
|
1874
|
+
*
|
|
1875
|
+
* Добавляет список причин ошибок в хранилище.
|
|
1876
|
+
* @param causes error causes list / список причин ошибок
|
|
1877
|
+
*/
|
|
1878
|
+
static addList(causes: ErrorCenterCauseList): ErrorCenter;
|
|
1879
|
+
/**
|
|
1880
|
+
* Registers a new handler.
|
|
1881
|
+
*
|
|
1882
|
+
* Регистрирует новый обработчик.
|
|
1883
|
+
* @param group target group / целевая группа
|
|
1884
|
+
* @param handler handler callback / обратный вызов обработчика
|
|
1885
|
+
*/
|
|
1886
|
+
static addHandler(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): ErrorCenter;
|
|
1887
|
+
/**
|
|
1888
|
+
* Registers a list of handlers.
|
|
1889
|
+
*
|
|
1890
|
+
* Регистрирует список обработчиков.
|
|
1891
|
+
* @param handlers handlers list / список обработчиков
|
|
1892
|
+
*/
|
|
1893
|
+
static addHandlerList(handlers: ErrorCenterHandlerList): ErrorCenter;
|
|
1894
|
+
/**
|
|
1895
|
+
* Triggers error handling for a group.
|
|
1896
|
+
*
|
|
1897
|
+
* Вызывает обработку ошибки для группы.
|
|
1898
|
+
* @param cause error cause details / детали причины ошибки
|
|
1899
|
+
*/
|
|
1900
|
+
static on(cause: ErrorCenterCauseItem): ErrorCenter;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* Interface for an error item / Интерфейс для элемента ошибки
|
|
1905
|
+
*/
|
|
1906
|
+
export declare type ErrorCenterCauseItem = {
|
|
1907
|
+
/** Error group / Группа ошибки */
|
|
1908
|
+
group?: ErrorCenterGroup;
|
|
1909
|
+
/** Error code / Код ошибки */
|
|
1910
|
+
code: string;
|
|
1911
|
+
/** Error label / Название ошибки */
|
|
1912
|
+
label?: string;
|
|
1913
|
+
/** Error message / Сообщение ошибки */
|
|
1914
|
+
message?: string;
|
|
1915
|
+
/** Additional details / Дополнительные детали */
|
|
1916
|
+
details?: any;
|
|
1917
|
+
};
|
|
1918
|
+
|
|
1919
|
+
/**
|
|
1920
|
+
* List of error items / Список элементов ошибок
|
|
1921
|
+
*/
|
|
1922
|
+
export declare type ErrorCenterCauseList = ErrorCenterCauseItem[];
|
|
1923
|
+
|
|
1924
|
+
/**
|
|
1925
|
+
* Error group identifier / Идентификатор группы ошибок
|
|
1926
|
+
*/
|
|
1927
|
+
export declare type ErrorCenterGroup = string | undefined;
|
|
1928
|
+
|
|
1929
|
+
/**
|
|
1930
|
+
* Class for managing and triggering error handlers.
|
|
1931
|
+
*
|
|
1932
|
+
* Класс для управления и вызова обработчиков ошибок.
|
|
1933
|
+
*/
|
|
1934
|
+
export declare class ErrorCenterHandler {
|
|
1935
|
+
/** Registered handlers list / Список зарегистрированных обработчиков */
|
|
1936
|
+
protected handlers: ErrorCenterHandlerList;
|
|
1937
|
+
/**
|
|
1938
|
+
* Constructor
|
|
1939
|
+
* @param handlers initial handlers list / начальный список обработчиков
|
|
1940
|
+
*/
|
|
1941
|
+
constructor(handlers?: ErrorCenterHandlerList);
|
|
1942
|
+
/**
|
|
1943
|
+
* Checks if handlers exist for a group.
|
|
1944
|
+
*
|
|
1945
|
+
* Проверяет наличие обработчиков для группы.
|
|
1946
|
+
* @param group error group / группа ошибки
|
|
1947
|
+
*/
|
|
1948
|
+
has(group: ErrorCenterGroup): boolean;
|
|
1949
|
+
/**
|
|
1950
|
+
* Gets handlers for a group.
|
|
1951
|
+
*
|
|
1952
|
+
* Получает обработчики для группы.
|
|
1953
|
+
* @param group error group / группа ошибки
|
|
1954
|
+
*/
|
|
1955
|
+
get(group: ErrorCenterGroup): ErrorCenterHandlerItem | undefined;
|
|
1956
|
+
/**
|
|
1957
|
+
* Adds a handler for a specific group.
|
|
1958
|
+
*
|
|
1959
|
+
* Добавляет обработчик для определенной группы.
|
|
1960
|
+
* @param group error group / группа ошибки
|
|
1961
|
+
* @param handler callback function / функция обратного вызова
|
|
1962
|
+
*/
|
|
1963
|
+
add(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): this;
|
|
1964
|
+
/**
|
|
1965
|
+
* Adds a list of group-based handlers.
|
|
1966
|
+
*
|
|
1967
|
+
* Добавляет список обработчиков по группам.
|
|
1968
|
+
* @param handlers handlers list / список обработчиков
|
|
1969
|
+
*/
|
|
1970
|
+
addList(handlers: ErrorCenterHandlerList): this;
|
|
1971
|
+
/**
|
|
1972
|
+
* Triggers handlers for a group and logs to console.
|
|
1973
|
+
*
|
|
1974
|
+
* Вызывает обработчики для группы и выводит ошибку в консоль.
|
|
1975
|
+
* @param cause error cause details / детали причины ошибки
|
|
1976
|
+
*/
|
|
1977
|
+
on(cause: ErrorCenterCauseItem): this;
|
|
1978
|
+
/**
|
|
1979
|
+
* Logs error cause to the console.
|
|
1980
|
+
*
|
|
1981
|
+
* Выводит причину ошибки в консоль.
|
|
1982
|
+
* @param cause error details / детали ошибки
|
|
1983
|
+
*/
|
|
1984
|
+
protected toConsole(cause: ErrorCenterCauseItem): this;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* Callback function for error handling / Функция обратного вызова для обработки ошибок
|
|
1989
|
+
*/
|
|
1990
|
+
export declare type ErrorCenterHandlerCallback = (cause: ErrorCenterCauseItem) => void;
|
|
1991
|
+
|
|
1992
|
+
/**
|
|
1993
|
+
* Interface for error handler storage / Интерфейс для хранения обработчика ошибок
|
|
1994
|
+
*/
|
|
1995
|
+
export declare type ErrorCenterHandlerItem = {
|
|
1996
|
+
/** Targeted error group / Целевая группа ошибок */
|
|
1997
|
+
group?: ErrorCenterGroup;
|
|
1998
|
+
/** List of handlers / Список обработчиков */
|
|
1999
|
+
handlers: ErrorCenterHandlerCallback[];
|
|
2000
|
+
};
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* List of error handlers / Список обработчиков ошибок
|
|
2004
|
+
*/
|
|
2005
|
+
export declare type ErrorCenterHandlerList = ErrorCenterHandlerItem[];
|
|
2006
|
+
|
|
2007
|
+
/**
|
|
2008
|
+
* Class for managing error storage and handling within an instance.
|
|
2009
|
+
*
|
|
2010
|
+
* Класс для управления хранилищем ошибок и их обработкой внутри экземпляра.
|
|
2011
|
+
*/
|
|
2012
|
+
export declare class ErrorCenterInstance {
|
|
2013
|
+
protected handler: ErrorCenterHandler;
|
|
2014
|
+
/** List of stored error causes / Список сохраненных причин ошибок */
|
|
2015
|
+
protected causes: ErrorCenterCauseList;
|
|
2016
|
+
/**
|
|
2017
|
+
* Constructor
|
|
2018
|
+
* @param causes initial list of error causes / начальный список причин ошибок
|
|
2019
|
+
* @param handler handler instance / экземпляр обработчика
|
|
2020
|
+
*/
|
|
2021
|
+
constructor(causes?: ErrorCenterCauseList, handler?: ErrorCenterHandler);
|
|
2022
|
+
/**
|
|
2023
|
+
* Checks if a cause with specific code exists.
|
|
2024
|
+
*
|
|
2025
|
+
* Проверяет наличие причины с конкретным кодом.
|
|
2026
|
+
* @param code error code / код ошибки
|
|
2027
|
+
* @param group error group / группа ошибки
|
|
2028
|
+
*/
|
|
2029
|
+
has(code: string, group?: string): boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* Gets a specific error cause by code and group.
|
|
2032
|
+
*
|
|
2033
|
+
* Получает конкретную причину ошибки по коду и группе.
|
|
2034
|
+
* @param code error code / код ошибки
|
|
2035
|
+
* @param group error group / группа ошибки
|
|
2036
|
+
*/
|
|
2037
|
+
get(code: string, group?: string): ErrorCenterCauseItem | undefined;
|
|
2038
|
+
/**
|
|
2039
|
+
* Adds an error cause to the storage.
|
|
2040
|
+
*
|
|
2041
|
+
* Добавляет причину ошибки в хранилище.
|
|
2042
|
+
* @param cause error cause item / элемент причины ошибки
|
|
2043
|
+
*/
|
|
2044
|
+
add(cause: ErrorCenterCauseItem): this;
|
|
2045
|
+
/**
|
|
2046
|
+
* Adds a list of error causes to the storage.
|
|
2047
|
+
*
|
|
2048
|
+
* Добавляет список причин ошибок в хранилище.
|
|
2049
|
+
* @param causes error causes list / список причин ошибок
|
|
2050
|
+
*/
|
|
2051
|
+
addList(causes: ErrorCenterCauseList): this;
|
|
2052
|
+
/**
|
|
2053
|
+
* Registers a new handler.
|
|
2054
|
+
*
|
|
2055
|
+
* Регистрирует новый обработчик.
|
|
2056
|
+
* @param group target group / целевая группа
|
|
2057
|
+
* @param handler handler callback / обратный вызов обработчика
|
|
2058
|
+
*/
|
|
2059
|
+
addHandler(group: ErrorCenterGroup, handler: ErrorCenterHandlerCallback): this;
|
|
2060
|
+
/**
|
|
2061
|
+
* Registers a list of handlers.
|
|
2062
|
+
*
|
|
2063
|
+
* Регистрирует список обработчиков.
|
|
2064
|
+
* @param handlers handlers list / список обработчиков
|
|
2065
|
+
*/
|
|
2066
|
+
addHandlerList(handlers: ErrorCenterHandlerList): this;
|
|
2067
|
+
/**
|
|
2068
|
+
* Triggers error handling for a group.
|
|
2069
|
+
*
|
|
2070
|
+
* Вызывает обработку ошибки для группы.
|
|
2071
|
+
* @param cause error cause details / детали причины ошибки
|
|
2072
|
+
*/
|
|
2073
|
+
on(cause: ErrorCenterCauseItem): this;
|
|
2074
|
+
/**
|
|
2075
|
+
* Merges provided cause with stored cause data.
|
|
2076
|
+
*
|
|
2077
|
+
* Объединяет предоставленную причину с сохраненными данными причины.
|
|
2078
|
+
* @param cause input cause / входная причина
|
|
2079
|
+
*/
|
|
2080
|
+
protected assign(cause: ErrorCenterCauseItem): ErrorCenterCauseItem;
|
|
2081
|
+
}
|
|
2082
|
+
|
|
1754
2083
|
/**
|
|
1755
2084
|
* Escapes special regex characters in a string so it can be used safely in a RegExp.
|
|
1756
2085
|
*
|
|
@@ -2726,6 +3055,7 @@ export declare type GeoHours = '12' | '24';
|
|
|
2726
3055
|
* языка-зависимых функций
|
|
2727
3056
|
*/
|
|
2728
3057
|
export declare class GeoIntl {
|
|
3058
|
+
private errorCenter;
|
|
2729
3059
|
/**
|
|
2730
3060
|
* Returns an instance of the class according to the specified country code.
|
|
2731
3061
|
*
|
|
@@ -2739,8 +3069,9 @@ export declare class GeoIntl {
|
|
|
2739
3069
|
* Constructor
|
|
2740
3070
|
* @param code country code, full form language-country or one of them/
|
|
2741
3071
|
* код страны, полный вид язык-страна или один из них
|
|
3072
|
+
* @param errorCenter error center instance/ экземпляр центра ошибок
|
|
2742
3073
|
*/
|
|
2743
|
-
constructor(code?: string);
|
|
3074
|
+
constructor(code?: string, errorCenter?: ErrorCenterInstance);
|
|
2744
3075
|
/**
|
|
2745
3076
|
* Returns country code and language.
|
|
2746
3077
|
*
|
|
@@ -3024,8 +3355,8 @@ export declare interface GeoItemFull extends Omit<GeoItem, 'firstDay'> {
|
|
|
3024
3355
|
* Класс для хранения и обработка маски телефона.
|
|
3025
3356
|
*/
|
|
3026
3357
|
export declare class GeoPhone {
|
|
3027
|
-
protected static list
|
|
3028
|
-
protected static map
|
|
3358
|
+
protected static list?: GeoPhoneValue[];
|
|
3359
|
+
protected static map?: Record<string, GeoPhoneMap>;
|
|
3029
3360
|
/**
|
|
3030
3361
|
* Getting an object with information about the phone code and country.
|
|
3031
3362
|
*
|
|
@@ -3611,6 +3942,13 @@ export declare class Icons {
|
|
|
3611
3942
|
* @param url new file path/ новый путь к файлу
|
|
3612
3943
|
*/
|
|
3613
3944
|
static setUrl(url: string): void;
|
|
3945
|
+
/**
|
|
3946
|
+
* Changes the configuration.
|
|
3947
|
+
*
|
|
3948
|
+
* Изменяет конфигурацию.
|
|
3949
|
+
* @param config new configuration/ новая конфигурация
|
|
3950
|
+
*/
|
|
3951
|
+
static setConfig(config: IconsConfig): void;
|
|
3614
3952
|
/**
|
|
3615
3953
|
* Returns the icon name.
|
|
3616
3954
|
*
|
|
@@ -3626,6 +3964,13 @@ export declare class Icons {
|
|
|
3626
3964
|
protected static wait(): Promise<void>;
|
|
3627
3965
|
}
|
|
3628
3966
|
|
|
3967
|
+
export declare type IconsConfig = {
|
|
3968
|
+
/** URL to the icons storage / URL к хранилищу иконок */
|
|
3969
|
+
url?: string;
|
|
3970
|
+
/** List of custom icons / Список пользовательских иконок */
|
|
3971
|
+
list?: Record<string, IconsItem>;
|
|
3972
|
+
};
|
|
3973
|
+
|
|
3629
3974
|
export declare type IconsItem = string | Promise<string | any> | (() => Promise<string | any>);
|
|
3630
3975
|
|
|
3631
3976
|
/** Type for 2D coordinates/ Тип для 2D координат */
|
|
@@ -3806,6 +4151,14 @@ export declare function isObject<T>(value: T): value is Extract<T, Record<any, a
|
|
|
3806
4151
|
*/
|
|
3807
4152
|
export declare function isObjectNotArray<T>(value: T): value is Exclude<Extract<T, Record<any, any>>, any[] | undefined | null>;
|
|
3808
4153
|
|
|
4154
|
+
/**
|
|
4155
|
+
* Check if the device is online.
|
|
4156
|
+
*
|
|
4157
|
+
* Проверка, находится ли устройство в сети.
|
|
4158
|
+
* @returns true if the device is online, false otherwise/true, если устройство в сети, иначе false
|
|
4159
|
+
*/
|
|
4160
|
+
export declare function isOnLine(): boolean;
|
|
4161
|
+
|
|
3809
4162
|
/**
|
|
3810
4163
|
* Checks if value is in the array selected or if value equals selected, if selected is a string.
|
|
3811
4164
|
*
|
|
@@ -3893,9 +4246,8 @@ export declare type ItemValue<V> = {
|
|
|
3893
4246
|
* Класс для работы с глобальной загрузкой.
|
|
3894
4247
|
*/
|
|
3895
4248
|
export declare class Loading {
|
|
3896
|
-
|
|
3897
|
-
protected static
|
|
3898
|
-
protected static registrationList: LoadingRegistrationItem[];
|
|
4249
|
+
/** Instance of the loading class / Экземпляр класса загрузки */
|
|
4250
|
+
protected static item: LoadingInstance;
|
|
3899
4251
|
/**
|
|
3900
4252
|
* Check if the loader is active now.
|
|
3901
4253
|
*
|
|
@@ -3908,6 +4260,12 @@ export declare class Loading {
|
|
|
3908
4260
|
* Получить текущее значение загрузки.
|
|
3909
4261
|
*/
|
|
3910
4262
|
static get(): number;
|
|
4263
|
+
/**
|
|
4264
|
+
* Get instance of the loading class.
|
|
4265
|
+
*
|
|
4266
|
+
* Получить экземпляр класса загрузки.
|
|
4267
|
+
*/
|
|
4268
|
+
static getItem(): LoadingInstance;
|
|
3911
4269
|
/**
|
|
3912
4270
|
* Shows the loader.
|
|
3913
4271
|
*
|
|
@@ -3940,21 +4298,101 @@ export declare class Loading {
|
|
|
3940
4298
|
* @param element element/ элемент
|
|
3941
4299
|
*/
|
|
3942
4300
|
static unregistrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
|
|
4301
|
+
}
|
|
4302
|
+
|
|
4303
|
+
/**
|
|
4304
|
+
* Data for the loading event.
|
|
4305
|
+
*
|
|
4306
|
+
* Данные для события загрузки.
|
|
4307
|
+
*/
|
|
4308
|
+
export declare type LoadingDetail = {
|
|
4309
|
+
/** Loading status / Статус загрузки */
|
|
4310
|
+
loading: boolean;
|
|
4311
|
+
};
|
|
4312
|
+
|
|
4313
|
+
/**
|
|
4314
|
+
* Class for working with global loading.
|
|
4315
|
+
*
|
|
4316
|
+
* Класс для работы с глобальной загрузкой.
|
|
4317
|
+
*/
|
|
4318
|
+
export declare class LoadingInstance {
|
|
4319
|
+
protected eventName: string;
|
|
4320
|
+
/** Current loading value / Текущее значение загрузки */
|
|
4321
|
+
protected value: number;
|
|
4322
|
+
/** Event item / Элемент события */
|
|
4323
|
+
protected event?: EventItem<Window, CustomEvent>;
|
|
4324
|
+
/** Registration list / Список регистрации */
|
|
4325
|
+
protected registrationList: LoadingRegistrationItem[];
|
|
4326
|
+
/**
|
|
4327
|
+
* Constructor
|
|
4328
|
+
* @param eventName name of the event for tracking loading/ название события для отслеживания загрузки
|
|
4329
|
+
*/
|
|
4330
|
+
constructor(eventName?: string);
|
|
4331
|
+
/**
|
|
4332
|
+
* Check if the loader is active now.
|
|
4333
|
+
*
|
|
4334
|
+
* Проверить, активен ли сейчас загрузчик.
|
|
4335
|
+
* @returns returns true if the loader is active/ возвращает true, если загрузчик активен
|
|
4336
|
+
*/
|
|
4337
|
+
is(): boolean;
|
|
4338
|
+
/**
|
|
4339
|
+
* Get current loading value.
|
|
4340
|
+
*
|
|
4341
|
+
* Получить текущее значение загрузки.
|
|
4342
|
+
* @returns returns the current loading value/ возвращает текущее значение загрузки
|
|
4343
|
+
*/
|
|
4344
|
+
get(): number;
|
|
4345
|
+
/**
|
|
4346
|
+
* Shows the loader.
|
|
4347
|
+
*
|
|
4348
|
+
* Показывает загрузчик.
|
|
4349
|
+
*/
|
|
4350
|
+
show(): void;
|
|
4351
|
+
/**
|
|
4352
|
+
* Hides the loader.
|
|
4353
|
+
*
|
|
4354
|
+
* Скрывает загрузчик.
|
|
4355
|
+
*/
|
|
4356
|
+
hide(): void;
|
|
4357
|
+
/**
|
|
4358
|
+
* Event registration to listen for data changes.
|
|
4359
|
+
*
|
|
4360
|
+
* Регистрация события для прослушивания изменений данных.
|
|
4361
|
+
* @param listener the object that receives a notification (an object that implements the
|
|
4362
|
+
* Event interface) when an event of the specified type occurs/ объект, который принимает
|
|
4363
|
+
* уведомление, когда событие указанного типа произошло
|
|
4364
|
+
* @param element element/ элемент
|
|
4365
|
+
*/
|
|
4366
|
+
registrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
|
|
4367
|
+
/**
|
|
4368
|
+
* Unregistration of an event.
|
|
4369
|
+
*
|
|
4370
|
+
* Отмена регистрации события.
|
|
4371
|
+
* @param listener the object that receives a notification (an object that implements the
|
|
4372
|
+
* Event interface) when an event of the specified type occurs/ объект, который принимает
|
|
4373
|
+
* уведомление, когда событие указанного типа произошло
|
|
4374
|
+
* @param element element/ элемент
|
|
4375
|
+
*/
|
|
4376
|
+
unregistrationEvent(listener: EventListenerDetail<CustomEvent, LoadingDetail>, element?: ElementOrString<HTMLElement>): void;
|
|
3943
4377
|
/**
|
|
3944
4378
|
* Calls the event listener.
|
|
3945
4379
|
*
|
|
3946
4380
|
* Вызывает слушателя событий.
|
|
3947
4381
|
*/
|
|
3948
|
-
protected
|
|
4382
|
+
protected dispatch(): void;
|
|
3949
4383
|
}
|
|
3950
4384
|
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
4385
|
+
/**
|
|
4386
|
+
* Registration item for the loading event.
|
|
4387
|
+
*
|
|
4388
|
+
* Элемент регистрации для события загрузки.
|
|
4389
|
+
*/
|
|
4390
|
+
export declare type LoadingRegistrationItem = {
|
|
4391
|
+
/** Event item / Элемент события */
|
|
3956
4392
|
item: EventItem<Window, CustomEvent, LoadingDetail>;
|
|
4393
|
+
/** Event listener / Слушатель события */
|
|
3957
4394
|
listener: EventListenerDetail<CustomEvent, LoadingDetail>;
|
|
4395
|
+
/** Element / Элемент */
|
|
3958
4396
|
element?: ElementOrString<HTMLElement>;
|
|
3959
4397
|
};
|
|
3960
4398
|
|
|
@@ -5844,13 +6282,7 @@ export declare function transformation(value: any, isFunction?: boolean): any;
|
|
|
5844
6282
|
* Класс для получения переведенного текста.
|
|
5845
6283
|
*/
|
|
5846
6284
|
export declare class Translate {
|
|
5847
|
-
protected static
|
|
5848
|
-
protected static propsName: string;
|
|
5849
|
-
protected static readonly data: Record<string, string>;
|
|
5850
|
-
protected static cache: string[];
|
|
5851
|
-
protected static resolveList: (() => void)[];
|
|
5852
|
-
protected static timeout?: any;
|
|
5853
|
-
protected static isReadApi: boolean;
|
|
6285
|
+
protected static item: TranslateInstance;
|
|
5854
6286
|
/**
|
|
5855
6287
|
* Getting the translation text by its code.
|
|
5856
6288
|
*
|
|
@@ -5859,6 +6291,12 @@ export declare class Translate {
|
|
|
5859
6291
|
* @param replacement If set, replaces the text with the specified values/ если установлено, заменяет текст на указанные значения
|
|
5860
6292
|
*/
|
|
5861
6293
|
static get(name: string, replacement?: string[] | Record<string, string | number>): Promise<string>;
|
|
6294
|
+
/**
|
|
6295
|
+
* Returns an instance of the class.
|
|
6296
|
+
*
|
|
6297
|
+
* Возвращает экземпляр класса.
|
|
6298
|
+
*/
|
|
6299
|
+
static getItem(): TranslateInstance;
|
|
5862
6300
|
/**
|
|
5863
6301
|
* Getting the translation text by its code (Sync).
|
|
5864
6302
|
*
|
|
@@ -5943,109 +6381,60 @@ export declare class Translate {
|
|
|
5943
6381
|
*/
|
|
5944
6382
|
static setReadApi(value: boolean): Translate;
|
|
5945
6383
|
/**
|
|
5946
|
-
*
|
|
5947
|
-
*
|
|
5948
|
-
* Проверяет наличие перевода по коду с учетом запасных вариантов.
|
|
5949
|
-
* @param name code name/ название кода
|
|
5950
|
-
*/
|
|
5951
|
-
protected static hasName(name: string): boolean;
|
|
5952
|
-
/**
|
|
5953
|
-
* Retrieves translation text by code, returning the first matching fallback.
|
|
5954
|
-
*
|
|
5955
|
-
* Получает текст перевода по коду, возвращая первое совпадение из запасных вариантов.
|
|
5956
|
-
* @param name code name/ название кода
|
|
5957
|
-
*/
|
|
5958
|
-
protected static getText(name: string): string | undefined;
|
|
5959
|
-
/**
|
|
5960
|
-
* Getting the full title for translation.
|
|
5961
|
-
*
|
|
5962
|
-
* Получение полного названия для перевода.
|
|
5963
|
-
* @param name code name/ название кода
|
|
5964
|
-
*/
|
|
5965
|
-
protected static getName(name: string): string;
|
|
5966
|
-
/**
|
|
5967
|
-
* Getting the title for translation by language.
|
|
5968
|
-
*
|
|
5969
|
-
* Получение названия для перевода по языку.
|
|
5970
|
-
* @param name code name/ название кода
|
|
5971
|
-
*/
|
|
5972
|
-
protected static getNameByLanguage(name: string): string;
|
|
5973
|
-
/**
|
|
5974
|
-
* Getting the title for translation globally.
|
|
5975
|
-
*
|
|
5976
|
-
* Получение названия для перевода глобально.
|
|
5977
|
-
* @param name code name/ название кода
|
|
5978
|
-
*/
|
|
5979
|
-
protected static getNameByGlobal(name: string): string;
|
|
5980
|
-
/**
|
|
5981
|
-
* Returns a list of names that are not yet in the list.
|
|
5982
|
-
*
|
|
5983
|
-
* Возвращает список имен, которых еще нет в списке.
|
|
5984
|
-
* @param names list of codes to get translations/ список кодов для получения переводов
|
|
5985
|
-
*/
|
|
5986
|
-
protected static getNamesNone(names: string | string[]): string[];
|
|
5987
|
-
/**
|
|
5988
|
-
* Getting the list of translations from the server.
|
|
5989
|
-
*
|
|
5990
|
-
* Получение списка переводов с сервера.
|
|
5991
|
-
*/
|
|
5992
|
-
protected static getResponse(): Promise<Record<string, string>>;
|
|
5993
|
-
/**
|
|
5994
|
-
* Replaces the text with the specified values.
|
|
6384
|
+
* Set the configuration for the translation.
|
|
5995
6385
|
*
|
|
5996
|
-
*
|
|
5997
|
-
* @param
|
|
5998
|
-
* @param replacement values for replacement/ значения для замены
|
|
6386
|
+
* Установить конфигурацию для перевода.
|
|
6387
|
+
* @param config configuration/ конфигурация
|
|
5999
6388
|
*/
|
|
6000
|
-
|
|
6001
|
-
/**
|
|
6002
|
-
* Adding translation data from the server.
|
|
6003
|
-
*
|
|
6004
|
-
* Добавление данных по переводу с сервера.
|
|
6005
|
-
*/
|
|
6006
|
-
protected static make(): Promise<void>;
|
|
6007
|
-
/**
|
|
6008
|
-
* Adding translation data from the list.
|
|
6009
|
-
*
|
|
6010
|
-
* Добавление данных по переводу из списка.
|
|
6011
|
-
* @param list list of translations/ список переводов
|
|
6012
|
-
*/
|
|
6013
|
-
protected static makeList(list: Record<string, string>): void;
|
|
6389
|
+
static setConfig(config: TranslateConfig): Translate;
|
|
6014
6390
|
}
|
|
6015
6391
|
|
|
6016
6392
|
/**
|
|
6017
|
-
* Prefix for global translations
|
|
6018
|
-
* Префикс для глобальных
|
|
6393
|
+
* Prefix for global translations/
|
|
6394
|
+
* Префикс для глобальных переводов
|
|
6019
6395
|
*/
|
|
6020
6396
|
export declare const TRANSLATE_GLOBAL_PREFIX = "global";
|
|
6021
6397
|
|
|
6022
6398
|
/**
|
|
6023
|
-
* Request timeout for batch loading (ms)
|
|
6024
|
-
* Таймаут запроса для пакетной загрузки (мс)
|
|
6399
|
+
* Request timeout for batch loading (ms)/
|
|
6400
|
+
* Таймаут запроса для пакетной загрузки (мс)
|
|
6025
6401
|
*/
|
|
6026
6402
|
export declare const TRANSLATE_TIME_OUT = 160;
|
|
6027
6403
|
|
|
6028
6404
|
/**
|
|
6029
|
-
* Translation code or a list of translation codes for template replacement
|
|
6030
|
-
* Код перевода или список кодов для замены
|
|
6405
|
+
* Translation code or a list of translation codes for template replacement/
|
|
6406
|
+
* Код перевода или список кодов для замены шаблона
|
|
6031
6407
|
*/
|
|
6032
6408
|
export declare type TranslateCode = string | string[];
|
|
6033
6409
|
|
|
6034
6410
|
/**
|
|
6035
|
-
*
|
|
6036
|
-
*
|
|
6411
|
+
* Interface for the functional plugin options /
|
|
6412
|
+
* Интерфейс для опций функционального плагина
|
|
6413
|
+
*/
|
|
6414
|
+
export declare type TranslateConfig = {
|
|
6415
|
+
/** URL to the translations script / URL к скрипту переводов */
|
|
6416
|
+
url?: string;
|
|
6417
|
+
/** Property name for translations / Имя свойства для переводов */
|
|
6418
|
+
propsName?: string;
|
|
6419
|
+
/** Read translations from API / Читать переводы из API */
|
|
6420
|
+
readApi?: boolean;
|
|
6421
|
+
};
|
|
6422
|
+
|
|
6423
|
+
/**
|
|
6424
|
+
* A mapping of locale strings to their respective translation file loaders/
|
|
6425
|
+
* Сопоставление строк локалей и соответствующих им загрузчиков файлов перевода
|
|
6037
6426
|
*/
|
|
6038
6427
|
export declare type TranslateDataFile = Record<string, TranslateDataFileItem>;
|
|
6039
6428
|
|
|
6040
6429
|
/**
|
|
6041
|
-
* Asynchronous loader function for a translation file
|
|
6042
|
-
* Асинхронная функция-загрузчик для файла
|
|
6430
|
+
* Asynchronous loader function for a translation file/
|
|
6431
|
+
* Асинхронная функция-загрузчик для файла перевода
|
|
6043
6432
|
*/
|
|
6044
6433
|
export declare type TranslateDataFileItem = () => Promise<TranslateDataFileList>;
|
|
6045
6434
|
|
|
6046
6435
|
/**
|
|
6047
|
-
* A simple key-value record of translations from a file
|
|
6048
|
-
* Простой рекорд «ключ-значение» с переводами из
|
|
6436
|
+
* A simple key-value record of translations from a file/
|
|
6437
|
+
* Простой рекорд «ключ-значение» с переводами из файла
|
|
6049
6438
|
*/
|
|
6050
6439
|
export declare type TranslateDataFileList = Record<string, string>;
|
|
6051
6440
|
|
|
@@ -6055,60 +6444,273 @@ export declare type TranslateDataFileList = Record<string, string>;
|
|
|
6055
6444
|
* Класс для работы с файлами перевода.
|
|
6056
6445
|
*/
|
|
6057
6446
|
export declare class TranslateFile {
|
|
6447
|
+
protected language: string | (() => string);
|
|
6448
|
+
protected location: string | (() => string);
|
|
6058
6449
|
/** List of files with translations/ Список файлов с переводами */
|
|
6059
|
-
protected
|
|
6450
|
+
protected files: TranslateDataFile;
|
|
6060
6451
|
/** Data from files/ Данные из файлов */
|
|
6061
|
-
protected
|
|
6452
|
+
protected data: Record<string, TranslateDataFileList>;
|
|
6453
|
+
/**
|
|
6454
|
+
* Creates an instance of the class.
|
|
6455
|
+
*
|
|
6456
|
+
* Создает экземпляр класса.
|
|
6457
|
+
* @param data list of files/ список файлов
|
|
6458
|
+
* @param language language/ язык
|
|
6459
|
+
* @param location location/ местоположение
|
|
6460
|
+
*/
|
|
6461
|
+
constructor(data?: TranslateDataFile, language?: string | (() => string), location?: string | (() => string));
|
|
6062
6462
|
/**
|
|
6063
6463
|
* Checks if there are files for the current location.
|
|
6064
6464
|
*
|
|
6065
6465
|
* Проверяет, есть ли файлы для текущего местоположения.
|
|
6066
6466
|
*/
|
|
6067
|
-
|
|
6467
|
+
isFile(): boolean;
|
|
6468
|
+
/**
|
|
6469
|
+
* Returns the location.
|
|
6470
|
+
*
|
|
6471
|
+
* Возвращает местоположение.
|
|
6472
|
+
*/
|
|
6473
|
+
getLocation(): string;
|
|
6474
|
+
/**
|
|
6475
|
+
* Returns the language.
|
|
6476
|
+
*
|
|
6477
|
+
* Возвращает язык.
|
|
6478
|
+
*/
|
|
6479
|
+
getLanguage(): string;
|
|
6068
6480
|
/**
|
|
6069
6481
|
* Returns a list of translations from the file for the current location.
|
|
6070
6482
|
*
|
|
6071
6483
|
* Возвращает список переводов из файла для текущего местоположения.
|
|
6072
6484
|
*/
|
|
6073
|
-
|
|
6485
|
+
getList(): Promise<TranslateDataFileList | undefined>;
|
|
6074
6486
|
/**
|
|
6075
6487
|
* Adds a list of files with translations.
|
|
6076
6488
|
*
|
|
6077
6489
|
* Добавляет список файлов с переводами.
|
|
6078
6490
|
* @param data list of files/ список файлов
|
|
6079
6491
|
*/
|
|
6080
|
-
|
|
6492
|
+
add(data: TranslateDataFile): void;
|
|
6081
6493
|
/**
|
|
6082
6494
|
* Returns the key for the current location from the list of files.
|
|
6083
6495
|
*
|
|
6084
6496
|
* Возвращает ключ для текущего местоположения из списка файлов.
|
|
6085
6497
|
*/
|
|
6086
|
-
protected
|
|
6498
|
+
protected getIndex(): string | undefined;
|
|
6087
6499
|
/**
|
|
6088
6500
|
* Returns a list of translations from the cache.
|
|
6089
6501
|
*
|
|
6090
6502
|
* Возвращает список переводов из кэша.
|
|
6091
6503
|
* @param index file key/ ключ файла
|
|
6092
6504
|
*/
|
|
6093
|
-
protected
|
|
6505
|
+
protected getByData(index: string): TranslateDataFileList | undefined;
|
|
6094
6506
|
/**
|
|
6095
6507
|
* Returns a list of translations from the file and caches the result.
|
|
6096
6508
|
*
|
|
6097
6509
|
* Возвращает список переводов из файла и кэширует результат.
|
|
6098
6510
|
* @param index file key/ ключ файла
|
|
6099
6511
|
*/
|
|
6100
|
-
protected
|
|
6512
|
+
protected getByFile(index: string): Promise<TranslateDataFileList | undefined>;
|
|
6513
|
+
}
|
|
6514
|
+
|
|
6515
|
+
/**
|
|
6516
|
+
* Class for getting the translated text.
|
|
6517
|
+
*
|
|
6518
|
+
* Класс для получения переведенного текста.
|
|
6519
|
+
*/
|
|
6520
|
+
export declare class TranslateInstance {
|
|
6521
|
+
protected url: string;
|
|
6522
|
+
protected propsName: string;
|
|
6523
|
+
protected readonly files: TranslateFile;
|
|
6524
|
+
/** List of translations/ Список переводов */
|
|
6525
|
+
protected readonly data: Record<string, string>;
|
|
6526
|
+
/** Cache of codes to get/ Кэш кодов для получения */
|
|
6527
|
+
protected cache: string[];
|
|
6528
|
+
/** List of resolves for promises/ Список разрешений для промисов */
|
|
6529
|
+
protected resolveList: (() => void)[];
|
|
6530
|
+
/** Timeout for getting translations/ Таймаут для получения переводов */
|
|
6531
|
+
protected timeout?: any;
|
|
6532
|
+
/** Flag indicating whether to read from the API/ Флаг, указывающий, нужно ли читать из API */
|
|
6533
|
+
protected isReadApi: boolean;
|
|
6534
|
+
/**
|
|
6535
|
+
* Creates an instance of the class.
|
|
6536
|
+
*
|
|
6537
|
+
* Создает экземпляр класса.
|
|
6538
|
+
* @param url URL for getting translations/ URL для получения переводов
|
|
6539
|
+
* @param propsName Property name for getting translations/ Имя свойства для получения переводов
|
|
6540
|
+
* @param files List of files with translations/ Список файлов с переводами
|
|
6541
|
+
*/
|
|
6542
|
+
constructor(url?: string, propsName?: string, files?: TranslateFile);
|
|
6543
|
+
/**
|
|
6544
|
+
* Getting the translation text by its code.
|
|
6545
|
+
*
|
|
6546
|
+
* Получение текста перевода по его коду.
|
|
6547
|
+
* @param name code name/ название кода
|
|
6548
|
+
* @param replacement If set, replaces the text with the specified values/ если установлено, заменяет текст на указанные значения
|
|
6549
|
+
*/
|
|
6550
|
+
get(name: string, replacement?: string[] | Record<string, string | number>): Promise<string>;
|
|
6551
|
+
/**
|
|
6552
|
+
* Getting the translation text by its code (Sync).
|
|
6553
|
+
*
|
|
6554
|
+
* Получение текста перевода по его коду (Sync).
|
|
6555
|
+
* @param name code name/ название кода
|
|
6556
|
+
* @param first If set to false, returns an empty string if there is no text/
|
|
6557
|
+
* если установлено false, возвращает пустую строку, если нет текста
|
|
6558
|
+
* @param replacement If set, replaces the text with the specified values/
|
|
6559
|
+
* если установлено, заменяет текст на указанные значения
|
|
6560
|
+
*/
|
|
6561
|
+
getSync(name: string, first?: boolean, replacement?: string[] | Record<string, string | number>): string;
|
|
6562
|
+
/**
|
|
6563
|
+
* Getting a list of translations by an array of text codes.
|
|
6564
|
+
*
|
|
6565
|
+
* Получение списка переводов по массиву кодов текста.
|
|
6566
|
+
* @param names list of codes to get translations/ список кодов для получения переводов
|
|
6567
|
+
*/
|
|
6568
|
+
getList<T extends TranslateCode[]>(names: T): Promise<TranslateList<T>>;
|
|
6569
|
+
/**
|
|
6570
|
+
* Getting a list of translations by an array of text codes.
|
|
6571
|
+
*
|
|
6572
|
+
* Получение списка переводов по массиву кодов текста.
|
|
6573
|
+
* @param names list of codes to get translations/ список кодов для получения переводов
|
|
6574
|
+
* @param first If set to false, returns an empty string if there is no text/
|
|
6575
|
+
* если установлено false, возвращает пустую строку, если нет текста
|
|
6576
|
+
*/
|
|
6577
|
+
getListSync<T extends TranslateCode[]>(names: T, first?: boolean): TranslateList<T>;
|
|
6578
|
+
/**
|
|
6579
|
+
* Added a list of translated texts.
|
|
6580
|
+
*
|
|
6581
|
+
* Добавлен список переведенных текстов.
|
|
6582
|
+
* @param names list of codes to get translations/ список кодов для получения переводов
|
|
6583
|
+
*/
|
|
6584
|
+
add(names: string | string[]): Promise<void>;
|
|
6585
|
+
/**
|
|
6586
|
+
* Adds texts in sync mode.
|
|
6587
|
+
*
|
|
6588
|
+
* Добавляет тексты в режиме синхронизации.
|
|
6589
|
+
* @param data list of texts in the form of key-value/ список текстов в виде ключ-значение
|
|
6590
|
+
*/
|
|
6591
|
+
addSync(data: Record<string, string>): void;
|
|
6592
|
+
/**
|
|
6593
|
+
* Adding data in the form of a query or directly, depending on the execution environment.
|
|
6594
|
+
*
|
|
6595
|
+
* Добавление данных в виде запроса или напрямую, в зависимости от среды выполнения.
|
|
6596
|
+
* @param data list of texts in the form of key-value/ список текстов в виде ключ-значение
|
|
6597
|
+
*/
|
|
6598
|
+
addNormalOrSync(data: Record<string, string>): Promise<void>;
|
|
6599
|
+
/**
|
|
6600
|
+
* Adds texts synchronously by location.
|
|
6601
|
+
*
|
|
6602
|
+
* Добавляет тексты синхронно по местоположению.
|
|
6603
|
+
* @param data list of texts by location/ список текстов по местоположению
|
|
6604
|
+
*/
|
|
6605
|
+
addSyncByLocation(data: Record<string, Record<string, string>>): void;
|
|
6606
|
+
/**
|
|
6607
|
+
* Adds texts synchronously from the file.
|
|
6608
|
+
*
|
|
6609
|
+
* Добавляет тексты синхронно из файла.
|
|
6610
|
+
* @param data file with translations/ файл с переводами
|
|
6611
|
+
*/
|
|
6612
|
+
addSyncByFile(data: TranslateDataFile): void;
|
|
6613
|
+
/**
|
|
6614
|
+
* Change the path to the script for obtaining the translation.
|
|
6615
|
+
*
|
|
6616
|
+
* Изменить путь к скрипту для получения перевода.
|
|
6617
|
+
* @param url path to the script/ путь к скрипту
|
|
6618
|
+
*/
|
|
6619
|
+
setUrl(url: string): this;
|
|
6620
|
+
/**
|
|
6621
|
+
* Change the name of the property to get the translation.
|
|
6622
|
+
*
|
|
6623
|
+
* Изменить имя свойства для получения перевода.
|
|
6624
|
+
* @param name property name/ имя свойства
|
|
6625
|
+
*/
|
|
6626
|
+
setPropsName(name: string): this;
|
|
6627
|
+
/**
|
|
6628
|
+
* Change the read mode from the API.
|
|
6629
|
+
*
|
|
6630
|
+
* Изменить режим чтения из API.
|
|
6631
|
+
* @param value read mode/ режим чтения
|
|
6632
|
+
*/
|
|
6633
|
+
setReadApi(value: boolean): this;
|
|
6634
|
+
/**
|
|
6635
|
+
* Checks for translation by code, taking into account fallback options.
|
|
6636
|
+
*
|
|
6637
|
+
* Проверяет наличие перевода по коду с учетом запасных вариантов.
|
|
6638
|
+
* @param name code name/ название кода
|
|
6639
|
+
*/
|
|
6640
|
+
protected hasName(name: string): boolean;
|
|
6641
|
+
/**
|
|
6642
|
+
* Retrieves translation text by code, returning the first matching fallback.
|
|
6643
|
+
*
|
|
6644
|
+
* Получает текст перевода по коду, возвращая первое совпадение из запасных вариантов.
|
|
6645
|
+
* @param name code name/ название кода
|
|
6646
|
+
*/
|
|
6647
|
+
protected getText(name: string): string | undefined;
|
|
6648
|
+
/**
|
|
6649
|
+
* Getting the full title for translation.
|
|
6650
|
+
*
|
|
6651
|
+
* Получение полного названия для перевода.
|
|
6652
|
+
* @param name code name/ название кода
|
|
6653
|
+
*/
|
|
6654
|
+
protected getName(name: string): string;
|
|
6655
|
+
/**
|
|
6656
|
+
* Getting the title for translation by language.
|
|
6657
|
+
*
|
|
6658
|
+
* Получение названия для перевода по языку.
|
|
6659
|
+
* @param name code name/ название кода
|
|
6660
|
+
*/
|
|
6661
|
+
protected getNameByLanguage(name: string): string;
|
|
6662
|
+
/**
|
|
6663
|
+
* Getting the title for translation globally.
|
|
6664
|
+
*
|
|
6665
|
+
* Получение названия для перевода глобально.
|
|
6666
|
+
* @param name code name/ название кода
|
|
6667
|
+
*/
|
|
6668
|
+
protected getNameByGlobal(name: string): string;
|
|
6669
|
+
/**
|
|
6670
|
+
* Returns a list of names that are not yet in the list.
|
|
6671
|
+
*
|
|
6672
|
+
* Возвращает список имен, которых еще нет в списке.
|
|
6673
|
+
* @param names list of codes to get translations/ список кодов для получения переводов
|
|
6674
|
+
*/
|
|
6675
|
+
protected getNamesNone(names: string | string[]): string[];
|
|
6676
|
+
/**
|
|
6677
|
+
* Getting the list of translations from the server.
|
|
6678
|
+
*
|
|
6679
|
+
* Получение списка переводов с сервера.
|
|
6680
|
+
*/
|
|
6681
|
+
protected getResponse(): Promise<Record<string, string>>;
|
|
6682
|
+
/**
|
|
6683
|
+
* Replaces the text with the specified values.
|
|
6684
|
+
*
|
|
6685
|
+
* Заменяет текст на указанные значения.
|
|
6686
|
+
* @param text text to replace/ текст для замены
|
|
6687
|
+
* @param replacement values for replacement/ значения для замены
|
|
6688
|
+
*/
|
|
6689
|
+
protected replacement(text: string, replacement?: string[] | Record<string, string | number>): any;
|
|
6690
|
+
/**
|
|
6691
|
+
* Adding translation data from the server.
|
|
6692
|
+
*
|
|
6693
|
+
* Добавление данных по переводу с сервера.
|
|
6694
|
+
*/
|
|
6695
|
+
protected make(): Promise<void>;
|
|
6696
|
+
/**
|
|
6697
|
+
* Adding translation data from the list.
|
|
6698
|
+
*
|
|
6699
|
+
* Добавление данных по переводу из списка.
|
|
6700
|
+
* @param list list of translations/ список переводов
|
|
6701
|
+
*/
|
|
6702
|
+
protected makeList(list: Record<string, string>): void;
|
|
6101
6703
|
}
|
|
6102
6704
|
|
|
6103
6705
|
/**
|
|
6104
|
-
* Return type for translation retrieval: an object if a list was requested, or a string for a single key
|
|
6105
|
-
* Тип возвращаемого значения для получения перевода: объект, если был запрошен список, или строка для одного
|
|
6706
|
+
* Return type for translation retrieval: an object if a list was requested, or a string for a single key/
|
|
6707
|
+
* Тип возвращаемого значения для получения перевода: объект, если был запрошен список, или строка для одного ключа
|
|
6106
6708
|
*/
|
|
6107
6709
|
export declare type TranslateItemOrList<T extends TranslateCode> = T extends string[] ? TranslateList<T> : string;
|
|
6108
6710
|
|
|
6109
6711
|
/**
|
|
6110
|
-
* Object with translated strings, where the keys are the names of the translation codes
|
|
6111
|
-
* Объект с переведенными строками, где ключи — имена кодов
|
|
6712
|
+
* Object with translated strings, where the keys are the names of the translation codes/
|
|
6713
|
+
* Объект с переведенными строками, где ключи — имена кодов переводов
|
|
6112
6714
|
*/
|
|
6113
6715
|
export declare type TranslateList<T extends TranslateCode[]> = {
|
|
6114
6716
|
[K in T[number] as K extends readonly string[] ? K[0] : K]: string;
|