@rt-tools/utils 0.0.1
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/README.md +99 -0
- package/fesm2022/rt-tools-utils.mjs +1567 -0
- package/fesm2022/rt-tools-utils.mjs.map +1 -0
- package/package.json +51 -0
- package/types/rt-tools-utils.d.ts +625 -0
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
import { ConnectedPosition, OverlayRef, ComponentType } from '@angular/cdk/overlay';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { InputSignalWithTransform, InputSignal, AfterViewInit, OnInit, Signal, OnDestroy, OutputEmitterRef, PipeTransform, InjectionToken, Provider } from '@angular/core';
|
|
4
|
+
import { BooleanInput } from '@angular/cdk/coercion';
|
|
5
|
+
import { Nullable } from '@rt-tools/core';
|
|
6
|
+
export { IDictionary, MessageBus, MessageBusEvent, Nullable, PlatformService, Primitive, WINDOW, isNil } from '@rt-tools/core';
|
|
7
|
+
import { SafeHtml } from '@angular/platform-browser';
|
|
8
|
+
import { Subject } from 'rxjs';
|
|
9
|
+
import { ValidatorFn, AbstractControl, ValidationErrors } from '@angular/forms';
|
|
10
|
+
|
|
11
|
+
declare const OVERLAY_POSITIONS: Readonly<ConnectedPosition[]>;
|
|
12
|
+
|
|
13
|
+
declare const DASH: string;
|
|
14
|
+
|
|
15
|
+
declare class RtIconOutlinedDirective {
|
|
16
|
+
isOutlined: InputSignalWithTransform<boolean, BooleanInput>;
|
|
17
|
+
get fontVariationSettings(): string;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RtIconOutlinedDirective, never>;
|
|
19
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RtIconOutlinedDirective, "mat-icon[rtIconOutlined]", never, { "isOutlined": { "alias": "rtIconOutlined"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare class RtScrollToElementDirective {
|
|
23
|
+
#private;
|
|
24
|
+
rtScrollToElement: InputSignal<string | number>;
|
|
25
|
+
elements: InputSignalWithTransform<unknown[], unknown[]>;
|
|
26
|
+
constructor();
|
|
27
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RtScrollToElementDirective, never>;
|
|
28
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RtScrollToElementDirective, "[rtScrollToElement]", never, { "rtScrollToElement": { "alias": "rtScrollToElement"; "required": true; "isSignal": true; }; "elements": { "alias": "elements"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare class RtHideTooltipDirective implements AfterViewInit {
|
|
32
|
+
#private;
|
|
33
|
+
/** Current HTMLElement */
|
|
34
|
+
element: InputSignal<HTMLElement>;
|
|
35
|
+
/** Indicates is tooltip shown */
|
|
36
|
+
isTooltipShown: InputSignalWithTransform<boolean, boolean>;
|
|
37
|
+
/** Set tooltip state by 'isTooltipShown' */
|
|
38
|
+
constructor();
|
|
39
|
+
ngAfterViewInit(): void;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RtHideTooltipDirective, never>;
|
|
41
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RtHideTooltipDirective, "[rtHideTooltipDirective]", never, { "element": { "alias": "rtHideTooltipDirective"; "required": true; "isSignal": true; }; "isTooltipShown": { "alias": "isTooltipShown"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type AnyObject = Record<string, any>;
|
|
45
|
+
type EmptyObject = Record<string, never>;
|
|
46
|
+
|
|
47
|
+
type IntersectionType<T extends object, M extends object> = keyof T & keyof M;
|
|
48
|
+
|
|
49
|
+
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
50
|
+
|
|
51
|
+
type PartialOmit<T, K extends keyof T> = Omit<T, K> & Partial<T>;
|
|
52
|
+
|
|
53
|
+
interface IMapper<I, M> {
|
|
54
|
+
mapFrom(raw: I): M;
|
|
55
|
+
mapTo?(model: M): I;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Makes selected props from a record optional */
|
|
59
|
+
type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
60
|
+
|
|
61
|
+
/** Get the union type of all the values in an object, array or array-like type */
|
|
62
|
+
type ValuesType<T extends ReadonlyArray<unknown> | ArrayLike<unknown> | Record<string | number | symbol, unknown>> = T extends ReadonlyArray<unknown> ? T[number] : T extends ArrayLike<unknown> ? T[number] : T extends object ? T[keyof T] : never;
|
|
63
|
+
|
|
64
|
+
declare class TypeCastHelper {
|
|
65
|
+
getAsString(data: unknown, defaultValue?: string): string;
|
|
66
|
+
getAsNumber(data: unknown, defaultValue?: number): number;
|
|
67
|
+
getAsBoolean(data: unknown): boolean;
|
|
68
|
+
getAsNull<T = unknown, R = T>(data: T, handler?: (data: T) => R): T | R | null;
|
|
69
|
+
getAsType(value: unknown, type: NonNullable<unknown>): any;
|
|
70
|
+
getAsTypedArray<T>(data: unknown[], cb: (item: unknown) => T, showError?: boolean): T[];
|
|
71
|
+
getAsDate(date: string | number | Date, asString?: boolean, parseFormatOptions?: string, formatOptions?: string): Date | string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface IBaseMapper<M> {
|
|
75
|
+
typeCast: TypeCastHelper;
|
|
76
|
+
mapTo?: (model: M, ...args: any[]) => any;
|
|
77
|
+
mapFrom?: (data: any, ...args: any[]) => M;
|
|
78
|
+
mapToArray?: (models: M[], ...args: any[]) => any;
|
|
79
|
+
mapFromArray?: (data: any[], ...args: any[]) => M[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
type Scriptable<T, TContext> = T | ((ctx: TContext, options: AnyObject) => T | undefined);
|
|
83
|
+
type ScriptableOptions<T, TContext> = {
|
|
84
|
+
[P in keyof T]: Scriptable<T[P], TContext>;
|
|
85
|
+
};
|
|
86
|
+
type ScriptableAndScriptableOptions<T, TContext> = Scriptable<T, TContext> | ScriptableOptions<T, TContext>;
|
|
87
|
+
type ScriptableAndArray<T, TContext> = readonly T[] | Scriptable<T, TContext>;
|
|
88
|
+
type ScriptableAndArrayOptions<T, TContext> = {
|
|
89
|
+
[P in keyof T]: ScriptableAndArray<T[P], TContext>;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
interface Icon {
|
|
93
|
+
value: string;
|
|
94
|
+
style?: {
|
|
95
|
+
[className: string]: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
interface Select<T> {
|
|
99
|
+
value: Array<NameValueType<string, T>>;
|
|
100
|
+
label?: string;
|
|
101
|
+
hint?: string;
|
|
102
|
+
}
|
|
103
|
+
interface NameValueType<N = string, V = string> {
|
|
104
|
+
name: N;
|
|
105
|
+
value: V;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare namespace ISideMenu {
|
|
109
|
+
type ItemData = string | number | object;
|
|
110
|
+
interface Item {
|
|
111
|
+
id: string | number;
|
|
112
|
+
icon?: string;
|
|
113
|
+
name?: string;
|
|
114
|
+
link?: string;
|
|
115
|
+
submenu?: Item[];
|
|
116
|
+
iconButton?: {
|
|
117
|
+
icon: string;
|
|
118
|
+
data?: ItemData;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
declare enum ASIDE_BUTTONS_ENUM {
|
|
124
|
+
USER_ACTIVE = "User active",
|
|
125
|
+
USER_INACTIVE = "User inactive",
|
|
126
|
+
DELETE = "Delete",
|
|
127
|
+
RESET = "Reset"
|
|
128
|
+
}
|
|
129
|
+
type AsideButtonsType = ASIDE_BUTTONS_ENUM.USER_ACTIVE | ASIDE_BUTTONS_ENUM.USER_INACTIVE | ASIDE_BUTTONS_ENUM.DELETE | ASIDE_BUTTONS_ENUM.RESET;
|
|
130
|
+
|
|
131
|
+
declare namespace IAside {
|
|
132
|
+
interface HeaderActionButton {
|
|
133
|
+
name: AsideButtonsType;
|
|
134
|
+
icon: string;
|
|
135
|
+
color: string;
|
|
136
|
+
tooltip: string;
|
|
137
|
+
disabled?: boolean;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
declare class RtNavigationDirective {
|
|
142
|
+
#private;
|
|
143
|
+
link: InputSignal<Nullable<string>>;
|
|
144
|
+
onClick(event: MouseEvent): void;
|
|
145
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RtNavigationDirective, never>;
|
|
146
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RtNavigationDirective, "[rtNavigationDirective]", never, { "link": { "alias": "rtNavigationDirective"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
declare abstract class RtTabQueryParamDirective implements OnInit {
|
|
150
|
+
#private;
|
|
151
|
+
readonly currentTabIndex: Signal<number>;
|
|
152
|
+
ngOnInit(): void;
|
|
153
|
+
setQueryTab(index: number): void;
|
|
154
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RtTabQueryParamDirective, never>;
|
|
155
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RtTabQueryParamDirective, never, never, {}, {}, never, never, true, never>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
declare class RtScrollDirective implements OnInit, OnDestroy {
|
|
159
|
+
#private;
|
|
160
|
+
active: InputSignal<boolean>;
|
|
161
|
+
multiplier: InputSignal<number>;
|
|
162
|
+
readonly scrollAction: OutputEmitterRef<void>;
|
|
163
|
+
ngOnInit(): void;
|
|
164
|
+
ngOnDestroy(): void;
|
|
165
|
+
scroll: EventListener;
|
|
166
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RtScrollDirective, never>;
|
|
167
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RtScrollDirective, "[rtScrollDirective]", never, { "active": { "alias": "active"; "required": false; "isSignal": true; }; "multiplier": { "alias": "multiplier"; "required": false; "isSignal": true; }; }, { "scrollAction": "scrollAction"; }, never, never, true, never>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
declare class RtEscapeKeyDirective {
|
|
171
|
+
readonly escapeKeyAction: OutputEmitterRef<void>;
|
|
172
|
+
handleKeyboardEvent(event: KeyboardEvent): void;
|
|
173
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RtEscapeKeyDirective, never>;
|
|
174
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RtEscapeKeyDirective, "[rtEscapeKey]", never, {}, { "escapeKeyAction": "escapeKeyAction"; }, never, never, true, never>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
declare enum MODAL_WINDOW_SIZE_ENUM {
|
|
178
|
+
SM = "25rem",
|
|
179
|
+
MD = "45rem",
|
|
180
|
+
LG = "65rem",
|
|
181
|
+
FULL = "100%"
|
|
182
|
+
}
|
|
183
|
+
type ModalWindowSizeType = MODAL_WINDOW_SIZE_ENUM.SM | MODAL_WINDOW_SIZE_ENUM.MD | MODAL_WINDOW_SIZE_ENUM.LG | MODAL_WINDOW_SIZE_ENUM.FULL;
|
|
184
|
+
|
|
185
|
+
declare enum POSITION_ENUM {
|
|
186
|
+
LEFT = "left",
|
|
187
|
+
RIGHT = "right",
|
|
188
|
+
TOP = "top",
|
|
189
|
+
BOTTOM = "bottom",
|
|
190
|
+
START = "start",
|
|
191
|
+
END = "end",
|
|
192
|
+
CENTER = "center"
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Date formatting and parsing utilities (replacement for date-fns)
|
|
197
|
+
*
|
|
198
|
+
* Supported format tokens:
|
|
199
|
+
* - yyyy: 4-digit year (2024)
|
|
200
|
+
* - yy: 2-digit year (24)
|
|
201
|
+
* - MM: 2-digit month (01-12)
|
|
202
|
+
* - M: month (1-12)
|
|
203
|
+
* - dd: 2-digit day (01-31)
|
|
204
|
+
* - d: day (1-31)
|
|
205
|
+
* - HH: 2-digit hour 24h (00-23)
|
|
206
|
+
* - H: hour 24h (0-23)
|
|
207
|
+
* - hh: 2-digit hour 12h (01-12)
|
|
208
|
+
* - h: hour 12h (1-12)
|
|
209
|
+
* - mm: 2-digit minutes (00-59)
|
|
210
|
+
* - m: minutes (0-59)
|
|
211
|
+
* - ss: 2-digit seconds (00-59)
|
|
212
|
+
* - s: seconds (0-59)
|
|
213
|
+
* - SSS: milliseconds (000-999)
|
|
214
|
+
* - a: AM/PM
|
|
215
|
+
* - EEEE: full weekday name (Monday)
|
|
216
|
+
* - EEE: short weekday name (Mon)
|
|
217
|
+
* - MMMM: full month name (January)
|
|
218
|
+
* - MMM: short month name (Jan)
|
|
219
|
+
*/
|
|
220
|
+
/**
|
|
221
|
+
* Checks if a value is a valid Date object
|
|
222
|
+
*/
|
|
223
|
+
declare function isDate(value: unknown): value is Date;
|
|
224
|
+
/**
|
|
225
|
+
* Formats a Date object according to the specified format string
|
|
226
|
+
*
|
|
227
|
+
* @param date - The date to format
|
|
228
|
+
* @param formatStr - The format string (e.g., 'dd.MM.yyyy', 'yyyy-MM-dd HH:mm:ss')
|
|
229
|
+
* @returns Formatted date string
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* formatDate(new Date(2024, 0, 15), 'dd.MM.yyyy') // '15.01.2024'
|
|
233
|
+
* formatDate(new Date(2024, 0, 15, 14, 30), 'yyyy-MM-dd HH:mm') // '2024-01-15 14:30'
|
|
234
|
+
*/
|
|
235
|
+
declare function formatDate(date: Date, formatStr: string): string;
|
|
236
|
+
/**
|
|
237
|
+
* Parses an ISO 8601 date string into a Date object
|
|
238
|
+
*
|
|
239
|
+
* @param dateString - ISO date string (e.g., '2024-01-15', '2024-01-15T14:30:00.000Z')
|
|
240
|
+
* @returns Date object or Invalid Date if parsing fails
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* parseISO('2024-01-15') // Date object for Jan 15, 2024
|
|
244
|
+
* parseISO('2024-01-15T14:30:00.000Z') // Date object with time
|
|
245
|
+
*/
|
|
246
|
+
declare function parseISO(dateString: string): Date;
|
|
247
|
+
/**
|
|
248
|
+
* Parses a date string according to the specified format
|
|
249
|
+
*
|
|
250
|
+
* @param dateString - The date string to parse
|
|
251
|
+
* @param formatStr - The format string describing the input
|
|
252
|
+
* @param referenceDate - Reference date for missing parts (defaults to current date)
|
|
253
|
+
* @returns Date object or Invalid Date if parsing fails
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* parseDate('15.01.2024', 'dd.MM.yyyy') // Date object for Jan 15, 2024
|
|
257
|
+
* parseDate('2024/01/15 14:30', 'yyyy/MM/dd HH:mm') // Date with time
|
|
258
|
+
*/
|
|
259
|
+
declare function parseDate(dateString: string, formatStr: string, referenceDate?: Date): Date;
|
|
260
|
+
|
|
261
|
+
declare function dateStringToDate(date: string | Date): Date;
|
|
262
|
+
|
|
263
|
+
declare function isDateValid(date?: Date): boolean;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Indicates if the arguments are equal
|
|
267
|
+
*
|
|
268
|
+
* @param f first parameter to compare
|
|
269
|
+
* @param s second parameter to compare
|
|
270
|
+
*/
|
|
271
|
+
declare function isEqual<T>(f: T, s: T): boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Indicates if the content of two arrays is identical
|
|
274
|
+
*
|
|
275
|
+
* @param f first array
|
|
276
|
+
* @param s second array
|
|
277
|
+
*/
|
|
278
|
+
declare function areArraysEqual<T>(f: T[], s: T[]): boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Indicates if the content of two objects is identical
|
|
281
|
+
*
|
|
282
|
+
* @param f first object
|
|
283
|
+
* @param s second object
|
|
284
|
+
*/
|
|
285
|
+
declare function areObjectsEqual<T>(f: T, s: T): boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Checks whether two arrays are equal regardless of the order of their elements.
|
|
288
|
+
* Supports deep comparison of nested arrays and objects.
|
|
289
|
+
*
|
|
290
|
+
* @template T The type of elements in the arrays
|
|
291
|
+
* @param f first array
|
|
292
|
+
* @param s second array
|
|
293
|
+
* @returns True if the arrays contain the same elements in any order, false otherwise
|
|
294
|
+
*/
|
|
295
|
+
declare function areArraysEqualUnordered<T>(f: T[], s: T[]): boolean;
|
|
296
|
+
|
|
297
|
+
declare function isNumber<T>(value: T | number | unknown | undefined): value is number;
|
|
298
|
+
|
|
299
|
+
declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
300
|
+
|
|
301
|
+
declare function isString<T>(value: T | null | undefined | unknown): value is string;
|
|
302
|
+
|
|
303
|
+
declare function initToday(): Date;
|
|
304
|
+
declare function isToday(date: Date): boolean;
|
|
305
|
+
|
|
306
|
+
/** Makes shallow copy of passed object */
|
|
307
|
+
declare function removeFieldFromObject<T extends object, K extends string>(obj: T, key: K): Omit<T, K>;
|
|
308
|
+
|
|
309
|
+
type ComparatorType<T> = (aa: T, bb: T) => number;
|
|
310
|
+
/**
|
|
311
|
+
* Allow to compare two values by provided comparator
|
|
312
|
+
*
|
|
313
|
+
* @param a - T
|
|
314
|
+
* @param b - T
|
|
315
|
+
* @param comparator - ComparatorType<T>
|
|
316
|
+
*/
|
|
317
|
+
declare function safeCompare<T>(a: T, b: T, comparator: ComparatorType<T>): number;
|
|
318
|
+
/**
|
|
319
|
+
* Allow to safely compare two string values
|
|
320
|
+
*
|
|
321
|
+
* @param a string
|
|
322
|
+
* @param b string
|
|
323
|
+
*/
|
|
324
|
+
declare function safeStrCompare(a: string, b: string): number;
|
|
325
|
+
/**
|
|
326
|
+
* Allow to safely compare two number values
|
|
327
|
+
*
|
|
328
|
+
* @param a number
|
|
329
|
+
* @param b number
|
|
330
|
+
*/
|
|
331
|
+
declare function safeNumCompare(a: number, b: number): number;
|
|
332
|
+
/**
|
|
333
|
+
* Allow composing comparison chain of several comparators
|
|
334
|
+
* that delegate comparison by the chain to the next comparators if current comparator returns 0
|
|
335
|
+
*
|
|
336
|
+
* @param comparators - Array<() => number>
|
|
337
|
+
*/
|
|
338
|
+
declare function safeComparatorPipe(...comparators: Array<() => number>): number;
|
|
339
|
+
|
|
340
|
+
declare const sortByAlphabet: <T extends object>(a: T, b: T, field: keyof T) => number;
|
|
341
|
+
declare const sortByDate: (a: {
|
|
342
|
+
[field: string]: any;
|
|
343
|
+
}, b: {
|
|
344
|
+
[field: string]: any;
|
|
345
|
+
}, field: string) => number;
|
|
346
|
+
|
|
347
|
+
declare function stringifyHttpLikeParams<T extends object>(params: T): {
|
|
348
|
+
[param: string]: string | string[];
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
declare function transformArrayInput<T>(array: unknown): T[];
|
|
352
|
+
|
|
353
|
+
declare function transformStringInput(value: unknown): string;
|
|
354
|
+
|
|
355
|
+
declare function checkIsEntityInArrayByKey<ENTITY extends Record<string, unknown>, KEY extends Extract<keyof ENTITY, string>>(selectedEntities: ENTITY[], entity: ENTITY, keyExp: KEY): boolean;
|
|
356
|
+
|
|
357
|
+
declare function emptyToDash<T>(value: T | null | undefined): T | string;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Check if the email is valid
|
|
361
|
+
* @param email
|
|
362
|
+
*/
|
|
363
|
+
declare function isEmail(email: any): boolean;
|
|
364
|
+
|
|
365
|
+
declare function isEmpty(value: unknown): boolean;
|
|
366
|
+
|
|
367
|
+
declare function isEmptyString(value: string): boolean;
|
|
368
|
+
|
|
369
|
+
declare function isEmptyArray<T>(value: T[]): boolean;
|
|
370
|
+
|
|
371
|
+
declare function isEmptyObject(value: Record<string, unknown>): boolean;
|
|
372
|
+
|
|
373
|
+
declare function debounce(timeout?: number): MethodDecorator;
|
|
374
|
+
|
|
375
|
+
declare enum HAS_OWN_SCOPE_ENUM {
|
|
376
|
+
ANY = "any",
|
|
377
|
+
OWN = "own",
|
|
378
|
+
INHERITED = "inherited"
|
|
379
|
+
}
|
|
380
|
+
type IHasScopeType = HAS_OWN_SCOPE_ENUM.ANY | HAS_OWN_SCOPE_ENUM.OWN | HAS_OWN_SCOPE_ENUM.INHERITED;
|
|
381
|
+
/**
|
|
382
|
+
* Safe property existence check with configurable scope.
|
|
383
|
+
*
|
|
384
|
+
* - Returns `false` for `null`/`undefined`.
|
|
385
|
+
* - Boxes primitives (e.g., strings, numbers) so prototype checks work.
|
|
386
|
+
* - Does **not** invoke getters; relies on `in` and an own-check helper.
|
|
387
|
+
* - Uses `Object.hasOwn` when available; **falls back** to
|
|
388
|
+
* `Object.prototype.hasOwnProperty.call` on older runtimes.
|
|
389
|
+
*
|
|
390
|
+
* @param obj {unknown} - Value to check. `null`/`undefined` short-circuit to `false`.
|
|
391
|
+
* @param key {PropertyKey} - Property key (string | number | symbol).
|
|
392
|
+
* @param scope {IHasScopeType} - Check mode: `'any'` (default), `'own'`, or `'inherited'`.
|
|
393
|
+
*
|
|
394
|
+
* @returns `true` if the property exists under the selected scope.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* hasPropertyInChain({ a: 1 }, 'a'); // true (ANY)
|
|
398
|
+
* hasPropertyInChain(Object.create({ a: 1 }), 'a', HAS_OWN_SCOPE_ENUM.INHERITED); // true
|
|
399
|
+
* hasPropertyInChain({ a: 1 }, 'b', HAS_OWN_SCOPE_ENUM.OWN); // false
|
|
400
|
+
*/
|
|
401
|
+
declare function hasPropertyInChain(obj: unknown, key: PropertyKey, scope?: IHasScopeType): boolean;
|
|
402
|
+
|
|
403
|
+
declare abstract class BaseMapper<M> implements IBaseMapper<M> {
|
|
404
|
+
readonly typeCast: TypeCastHelper;
|
|
405
|
+
mapFrom(data: NonNullable<unknown>, ...args: unknown[]): M;
|
|
406
|
+
mapFromArray(data: NonNullable<unknown>[], ...args: unknown[]): M[];
|
|
407
|
+
mapTo(model: M, ...args: unknown[]): unknown;
|
|
408
|
+
mapToArray(models: M[], ...args: unknown[]): unknown[];
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
declare class BreakStringPipe implements PipeTransform {
|
|
412
|
+
transform(value: Nullable<string>): string;
|
|
413
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BreakStringPipe, never>;
|
|
414
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<BreakStringPipe, "breakString", true>;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
declare class SanitizePipe implements PipeTransform {
|
|
418
|
+
#private;
|
|
419
|
+
transform(value: string): SafeHtml;
|
|
420
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SanitizePipe, never>;
|
|
421
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<SanitizePipe, "sanitize", true>;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
declare class EntityToStringPipe implements PipeTransform {
|
|
425
|
+
transform<T>(value: T): string;
|
|
426
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityToStringPipe, never>;
|
|
427
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<EntityToStringPipe, "entityToString", true>;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
declare class EmptyToDashPipe implements PipeTransform {
|
|
431
|
+
transform<T>(value: T | null | undefined): T | string;
|
|
432
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmptyToDashPipe, never>;
|
|
433
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<EmptyToDashPipe, "emptyToDash", true>;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* @description Use to compare equality to any of items with provided value
|
|
438
|
+
* @example
|
|
439
|
+
*
|
|
440
|
+
* Direct usage
|
|
441
|
+
* ```ts
|
|
442
|
+
* equalPipe.transform(100, 1, 10, 100) // => true
|
|
443
|
+
* ```
|
|
444
|
+
*
|
|
445
|
+
* Template usage
|
|
446
|
+
*
|
|
447
|
+
* ```html
|
|
448
|
+
* <div *ngIf="100 | equal:1:10:100">Visible</div>
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
declare class EqualPipe implements PipeTransform {
|
|
452
|
+
transform(value: any, ...compares: any[]): boolean;
|
|
453
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EqualPipe, never>;
|
|
454
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<EqualPipe, "equal", true>;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* @description Use to access to the deep object state for comparison
|
|
459
|
+
* @example
|
|
460
|
+
* {a: {b: true}} | equalChain:'a':'b':true => true
|
|
461
|
+
*/
|
|
462
|
+
declare class EqualChainPipe implements PipeTransform {
|
|
463
|
+
transform(obj: object, ...args: any[]): boolean;
|
|
464
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EqualChainPipe, never>;
|
|
465
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<EqualChainPipe, "equalChain", true>;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* @description Use to compare not equality to all items with provided value
|
|
470
|
+
* @example
|
|
471
|
+
*
|
|
472
|
+
* Direct usage
|
|
473
|
+
* ```ts
|
|
474
|
+
* notEqualPipe.transform(100, 1, 10, 100) // => false
|
|
475
|
+
* ```
|
|
476
|
+
*
|
|
477
|
+
* Template usage
|
|
478
|
+
*
|
|
479
|
+
* ```html
|
|
480
|
+
* <div *ngIf="100 | notEqual:1:10:100">Invisible</div>
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
declare class NotEqualPipe implements PipeTransform {
|
|
484
|
+
transform(value: any, ...compares: any[]): boolean;
|
|
485
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotEqualPipe, never>;
|
|
486
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<NotEqualPipe, "notEqual", true>;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* @description Use to access to the deep object state for comparison
|
|
491
|
+
* @example
|
|
492
|
+
* {a: {b: true}} | equalChain:'a':'b':false => true
|
|
493
|
+
*/
|
|
494
|
+
declare class NotEqualChainPipe implements PipeTransform {
|
|
495
|
+
transform(obj: object, ...args: any[]): boolean;
|
|
496
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotEqualChainPipe, never>;
|
|
497
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<NotEqualChainPipe, "notEqualChain", true>;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
declare class TernaryPipe implements PipeTransform {
|
|
501
|
+
transform(value: any, option1: any, option2: any): any;
|
|
502
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TernaryPipe, never>;
|
|
503
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<TernaryPipe, "ternary", true>;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
declare namespace OSTypes {
|
|
507
|
+
const WINDOWS: string;
|
|
508
|
+
const MAC_OS: string;
|
|
509
|
+
const LINUX: string;
|
|
510
|
+
const ANDROID: string;
|
|
511
|
+
const IOS: string;
|
|
512
|
+
const UNKNOWN: string;
|
|
513
|
+
}
|
|
514
|
+
declare class DeviceDetectorService {
|
|
515
|
+
#private;
|
|
516
|
+
userAgent: Nullable<string>;
|
|
517
|
+
constructor();
|
|
518
|
+
isMobile(): boolean;
|
|
519
|
+
isTablet(): boolean;
|
|
520
|
+
isDesktop(): boolean;
|
|
521
|
+
getOS(): string;
|
|
522
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceDetectorService, never>;
|
|
523
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DeviceDetectorService>;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
interface IBreakpoints {
|
|
527
|
+
xl: string;
|
|
528
|
+
lg: string;
|
|
529
|
+
md: string;
|
|
530
|
+
sm: string;
|
|
531
|
+
xs: string;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* A service that manages responsive design breakpoints using Angular's `BreakpointObserver`.
|
|
536
|
+
* This service provides signals for different screen sizes and allows dynamic
|
|
537
|
+
* breakpoint management.
|
|
538
|
+
*
|
|
539
|
+
* @Injectable
|
|
540
|
+
*/
|
|
541
|
+
declare class BreakpointService {
|
|
542
|
+
#private;
|
|
543
|
+
readonly isDesktop: Signal<Nullable<boolean>>;
|
|
544
|
+
readonly isSmallDesktop: Signal<Nullable<boolean>>;
|
|
545
|
+
readonly isMobile: Signal<Nullable<boolean>>;
|
|
546
|
+
readonly isTablet: Signal<Nullable<boolean>>;
|
|
547
|
+
readonly isSmallTablet: Signal<Nullable<boolean>>;
|
|
548
|
+
/**
|
|
549
|
+
* Allows setting custom breakpoints for different screen sizes.
|
|
550
|
+
*
|
|
551
|
+
* @param breakpoints - The custom breakpoints to apply.
|
|
552
|
+
*/
|
|
553
|
+
setBreakpoints(breakpoints: IBreakpoints): void;
|
|
554
|
+
/**
|
|
555
|
+
* Helper function to decrement the pixel value by 1.
|
|
556
|
+
* Used to exclude the exact pixel value in media queries.
|
|
557
|
+
*
|
|
558
|
+
* @usageNotes
|
|
559
|
+
*
|
|
560
|
+
* This function is useful for setting correct media queries.
|
|
561
|
+
* E.g. for mobile devices: media query should be `(max-width: 599px)`,
|
|
562
|
+
* and from `(min-width: 600px)` it should be considered as a tablet.
|
|
563
|
+
*
|
|
564
|
+
* @param value - The pixel value to decrement.
|
|
565
|
+
* @returns The adjusted pixel value as a string.
|
|
566
|
+
*/
|
|
567
|
+
decrementOnePixel(value: string): string;
|
|
568
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BreakpointService, never>;
|
|
569
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BreakpointService>;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
declare class Breakpoints implements IBreakpoints {
|
|
573
|
+
readonly xl: string;
|
|
574
|
+
readonly lg: string;
|
|
575
|
+
readonly md: string;
|
|
576
|
+
readonly sm: string;
|
|
577
|
+
readonly xs: string;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
type AsidePositions = 'left' | 'right';
|
|
581
|
+
declare class AsideRef<DATA, ANSWER> {
|
|
582
|
+
private answer;
|
|
583
|
+
overlayRef: OverlayRef;
|
|
584
|
+
component: ComponentType<unknown>;
|
|
585
|
+
position: AsidePositions;
|
|
586
|
+
data: DATA;
|
|
587
|
+
constructor(answer: Subject<ANSWER | null>, overlayRef: OverlayRef, component: ComponentType<unknown>, position: AsidePositions, data: DATA);
|
|
588
|
+
close(answer?: ANSWER): void;
|
|
589
|
+
}
|
|
590
|
+
declare const ASIDE_REF: InjectionToken<AsideRef<object, object>>;
|
|
591
|
+
declare const ddServices: Array<{
|
|
592
|
+
provide: string;
|
|
593
|
+
useValue: unknown;
|
|
594
|
+
}>;
|
|
595
|
+
|
|
596
|
+
declare const NAVIGATOR: InjectionToken<Navigator>;
|
|
597
|
+
|
|
598
|
+
declare function checkIsMatchingValues(sample: string): ValidatorFn;
|
|
599
|
+
|
|
600
|
+
declare function arraysNotEmptyValidator(control: AbstractControl): ValidationErrors | null;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Returns a set of dependency injection providers for utility services.
|
|
604
|
+
*
|
|
605
|
+
* @usageNotes
|
|
606
|
+
*
|
|
607
|
+
* This function provides utility services that are commonly used across
|
|
608
|
+
* an Angular application. Specifically, it provides the `BreakpointService`
|
|
609
|
+
* for managing responsive design breakpoints and the `PlatformService` for
|
|
610
|
+
* detecting the platform on which the application is running (e.g., browser or server).
|
|
611
|
+
*
|
|
612
|
+
* ```typescript
|
|
613
|
+
* bootstrapApplication(RootComponent, {
|
|
614
|
+
* providers: [
|
|
615
|
+
* provideRtUtils()
|
|
616
|
+
* ]
|
|
617
|
+
* });
|
|
618
|
+
* ```
|
|
619
|
+
*
|
|
620
|
+
* @publicApi
|
|
621
|
+
*/
|
|
622
|
+
declare function provideRtUtils(): Provider[];
|
|
623
|
+
|
|
624
|
+
export { ASIDE_BUTTONS_ENUM, ASIDE_REF, AsideRef, BaseMapper, BreakStringPipe, BreakpointService, Breakpoints, DASH, DeviceDetectorService, EmptyToDashPipe, EntityToStringPipe, EqualChainPipe, EqualPipe, HAS_OWN_SCOPE_ENUM, IAside, ISideMenu, MODAL_WINDOW_SIZE_ENUM, NAVIGATOR, NotEqualChainPipe, NotEqualPipe, OSTypes, OVERLAY_POSITIONS, POSITION_ENUM, RtEscapeKeyDirective, RtHideTooltipDirective, RtIconOutlinedDirective, RtNavigationDirective, RtScrollDirective, RtScrollToElementDirective, RtTabQueryParamDirective, SanitizePipe, TernaryPipe, TypeCastHelper, areArraysEqual, areArraysEqualUnordered, areObjectsEqual, arraysNotEmptyValidator, checkIsEntityInArrayByKey, checkIsMatchingValues, dateStringToDate, ddServices, debounce, emptyToDash, formatDate, hasPropertyInChain, initToday, isDate, isDateValid, isEmail, isEmpty, isEmptyArray, isEmptyObject, isEmptyString, isEqual, isNumber, isRecord, isString, isToday, parseDate, parseISO, provideRtUtils, removeFieldFromObject, safeComparatorPipe, safeCompare, safeNumCompare, safeStrCompare, sortByAlphabet, sortByDate, stringifyHttpLikeParams, transformArrayInput, transformStringInput };
|
|
625
|
+
export type { AnyObject, AsideButtonsType, AsidePositions, ComparatorType, EmptyObject, IBaseMapper, IBreakpoints, IHasScopeType, IMapper, Icon, IntersectionType, ModalWindowSizeType, Modify, NameValueType, Optional, PartialOmit, Scriptable, ScriptableAndArray, ScriptableAndArrayOptions, ScriptableAndScriptableOptions, ScriptableOptions, Select, ValuesType };
|