@tectra-ng/utils 0.3.2 → 0.4.0
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/fesm2022/tectra-ng-utils-clipboard.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-clock.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-currency.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-date.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-drag-scroll.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-file.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-filter-state.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-filter.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-form-changes.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-form-validation.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-http.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-in-view.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-polling.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-selection.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-text.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-title.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils-validators.mjs.map +1 -1
- package/fesm2022/tectra-ng-utils.mjs +1 -1
- package/fesm2022/tectra-ng-utils.mjs.map +1 -1
- package/package.json +5 -5
- package/types/tectra-ng-utils-auto-focus.d.ts +7 -0
- package/types/tectra-ng-utils-auto-focus.d.ts.map +1 -1
- package/types/tectra-ng-utils-breakpoint.d.ts +15 -0
- package/types/tectra-ng-utils-breakpoint.d.ts.map +1 -1
- package/types/tectra-ng-utils-clipboard.d.ts +19 -0
- package/types/tectra-ng-utils-clipboard.d.ts.map +1 -1
- package/types/tectra-ng-utils-clock.d.ts +11 -0
- package/types/tectra-ng-utils-clock.d.ts.map +1 -1
- package/types/tectra-ng-utils-currency.d.ts +9 -0
- package/types/tectra-ng-utils-currency.d.ts.map +1 -1
- package/types/tectra-ng-utils-date.d.ts +96 -0
- package/types/tectra-ng-utils-date.d.ts.map +1 -1
- package/types/tectra-ng-utils-debounce-input.d.ts +11 -0
- package/types/tectra-ng-utils-debounce-input.d.ts.map +1 -1
- package/types/tectra-ng-utils-drag-scroll.d.ts +13 -0
- package/types/tectra-ng-utils-drag-scroll.d.ts.map +1 -1
- package/types/tectra-ng-utils-file.d.ts +21 -0
- package/types/tectra-ng-utils-file.d.ts.map +1 -1
- package/types/tectra-ng-utils-filter-state.d.ts +58 -0
- package/types/tectra-ng-utils-filter-state.d.ts.map +1 -1
- package/types/tectra-ng-utils-filter.d.ts +29 -0
- package/types/tectra-ng-utils-filter.d.ts.map +1 -1
- package/types/tectra-ng-utils-form-changes.d.ts +18 -0
- package/types/tectra-ng-utils-form-changes.d.ts.map +1 -1
- package/types/tectra-ng-utils-form-validation.d.ts +26 -0
- package/types/tectra-ng-utils-form-validation.d.ts.map +1 -1
- package/types/tectra-ng-utils-go-back.d.ts +8 -0
- package/types/tectra-ng-utils-go-back.d.ts.map +1 -1
- package/types/tectra-ng-utils-http.d.ts +72 -0
- package/types/tectra-ng-utils-http.d.ts.map +1 -1
- package/types/tectra-ng-utils-in-view.d.ts +19 -0
- package/types/tectra-ng-utils-in-view.d.ts.map +1 -1
- package/types/tectra-ng-utils-plural.d.ts +23 -0
- package/types/tectra-ng-utils-plural.d.ts.map +1 -1
- package/types/tectra-ng-utils-polling.d.ts +69 -0
- package/types/tectra-ng-utils-polling.d.ts.map +1 -1
- package/types/tectra-ng-utils-random.d.ts +12 -0
- package/types/tectra-ng-utils-random.d.ts.map +1 -1
- package/types/tectra-ng-utils-relative-time.d.ts +16 -0
- package/types/tectra-ng-utils-relative-time.d.ts.map +1 -1
- package/types/tectra-ng-utils-scroll-end.d.ts +10 -0
- package/types/tectra-ng-utils-scroll-end.d.ts.map +1 -1
- package/types/tectra-ng-utils-selection.d.ts +16 -0
- package/types/tectra-ng-utils-selection.d.ts.map +1 -1
- package/types/tectra-ng-utils-stop-propagation.d.ts +6 -0
- package/types/tectra-ng-utils-stop-propagation.d.ts.map +1 -1
- package/types/tectra-ng-utils-stream.d.ts +8 -0
- package/types/tectra-ng-utils-stream.d.ts.map +1 -1
- package/types/tectra-ng-utils-style-class.d.ts +17 -0
- package/types/tectra-ng-utils-style-class.d.ts.map +1 -1
- package/types/tectra-ng-utils-text.d.ts +41 -0
- package/types/tectra-ng-utils-text.d.ts.map +1 -1
- package/types/tectra-ng-utils-title.d.ts +14 -0
- package/types/tectra-ng-utils-title.d.ts.map +1 -1
- package/types/tectra-ng-utils-validators.d.ts +61 -0
- package/types/tectra-ng-utils-validators.d.ts.map +1 -1
- package/types/tectra-ng-utils.d.ts +2 -1
- package/types/tectra-ng-utils.d.ts.map +1 -1
|
@@ -1,22 +1,43 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Signal } from "@angular/core";
|
|
3
3
|
import { Params } from "@angular/router";
|
|
4
|
+
/** Where filters are kept: `local` or `session` browser storage, or `memory`. */
|
|
4
5
|
export type TxStorageKind = 'local' | 'session' | 'memory';
|
|
6
|
+
/** Options of `txFilterState`: the storage key, initial filters and where they are kept. */
|
|
5
7
|
export interface TxFilterStateOptions<T extends object> {
|
|
8
|
+
/** Storage key the filters are saved under. */
|
|
6
9
|
key: string;
|
|
10
|
+
/** Filters when nothing is saved; the values that differ from it are saved and put in the URL. */
|
|
7
11
|
initial: T;
|
|
12
|
+
/** Keeps the filters in the query string and follows back and forward in the history (default `false`). */
|
|
8
13
|
url?: boolean;
|
|
14
|
+
/** `local` (default), `session` or `memory`; `false` keeps nothing. */
|
|
9
15
|
storage?: TxStorageKind | false;
|
|
10
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Filters as signals, created by `txFilterState`: read, change, reset and see what differs from the
|
|
19
|
+
* initial values.
|
|
20
|
+
*/
|
|
11
21
|
export interface TxFilterState<T extends object> {
|
|
22
|
+
/** Signal of the current filters */
|
|
12
23
|
readonly value: Signal<T>;
|
|
24
|
+
/** Signal: nothing differs from `initial` */
|
|
13
25
|
readonly isInitial: Signal<boolean>;
|
|
26
|
+
/** Signal: keys that differ from `initial` — for a "3 filters" badge */
|
|
14
27
|
readonly changed: Signal<(keyof T)[]>;
|
|
28
|
+
/** Replaces the filters and saves them */
|
|
15
29
|
set(filters: T): void;
|
|
30
|
+
/** Changes some keys */
|
|
16
31
|
patch(filters: Partial<T>): void;
|
|
32
|
+
/** Back to `initial`; removes the stored copy and the query params */
|
|
17
33
|
reset(): void;
|
|
18
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates the state in an injection context; `url` (`false`) writes the query string, `storage` is `'local'` (default), `'session'`, `'memory'` or `false`. Start: URL → storage (merged over `initial`, so new keys get their defaults) → `initial`
|
|
37
|
+
* @see https://tectra-ng.com/components/filter-state
|
|
38
|
+
*/
|
|
19
39
|
export declare function txFilterState<T extends object>(options: TxFilterStateOptions<T>): TxFilterState<T>;
|
|
40
|
+
/** Base class for a filters service that keeps its filters in local storage; set `localStorageKey`. */
|
|
20
41
|
export declare abstract class TxSaveFilters<T> {
|
|
21
42
|
private readonly filterStorage;
|
|
22
43
|
protected abstract localStorageKey: string;
|
|
@@ -25,6 +46,10 @@ export declare abstract class TxSaveFilters<T> {
|
|
|
25
46
|
static ɵfac: i0.ɵɵFactoryDeclaration<TxSaveFilters<any>, never>;
|
|
26
47
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
27
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Base class for a filters service that keeps its filters in local storage and in the query string;
|
|
51
|
+
* set `localStorageKey` and `initialFilters()`.
|
|
52
|
+
*/
|
|
28
53
|
export declare abstract class TxUrlFilters<T extends object> extends TxSaveFilters<T> {
|
|
29
54
|
private readonly urlSync;
|
|
30
55
|
protected abstract initialFilters(): T;
|
|
@@ -34,22 +59,55 @@ export declare abstract class TxUrlFilters<T extends object> extends TxSaveFilte
|
|
|
34
59
|
static ɵfac: i0.ɵɵFactoryDeclaration<TxUrlFilters<any>, never>;
|
|
35
60
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
36
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* A `Storage` that lives in memory; used when the browser storage is missing or blocked, and on the
|
|
64
|
+
* server.
|
|
65
|
+
*/
|
|
37
66
|
export declare class TxMemoryStorage implements Storage {
|
|
38
67
|
private readonly items;
|
|
39
68
|
constructor(source?: Storage);
|
|
69
|
+
/** Number of stored items. */
|
|
40
70
|
get length(): number;
|
|
71
|
+
/** Removes all items. */
|
|
41
72
|
clear(): void;
|
|
73
|
+
/** Returns the value of a key, or `null`. */
|
|
42
74
|
getItem(key: string): string | null;
|
|
75
|
+
/** Returns the key at the given position, or `null`. */
|
|
43
76
|
key(index: number): string | null;
|
|
77
|
+
/** Removes a key. */
|
|
44
78
|
removeItem(key: string): void;
|
|
79
|
+
/** Stores a value under a key. */
|
|
45
80
|
setItem(key: string, value: string): void;
|
|
46
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* `localStorage` / `sessionStorage` when it works, a shared `TxMemoryStorage` on the server or when blocked
|
|
84
|
+
* @see https://tectra-ng.com/components/filter-state
|
|
85
|
+
*/
|
|
47
86
|
export declare function injectStorage(kind?: TxStorageKind): Storage;
|
|
87
|
+
/**
|
|
88
|
+
* JSON in a storage without throwing on broken data or a full quota
|
|
89
|
+
* @see https://tectra-ng.com/components/filter-state
|
|
90
|
+
*/
|
|
48
91
|
export declare function readJson<T>(storage: Storage, key: string): T | null;
|
|
92
|
+
/** Saves a value as JSON in the storage; ignores a full or blocked storage. */
|
|
49
93
|
export declare function writeJson(storage: Storage, key: string, value: unknown): void;
|
|
94
|
+
/** Compares two values by their JSON text. */
|
|
50
95
|
export declare function isSameValue(a: unknown, b: unknown): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Plain strings stay readable, everything else is JSON
|
|
98
|
+
* @see https://tectra-ng.com/components/filter-state
|
|
99
|
+
*/
|
|
51
100
|
export declare function encodeUrlFilterValue(value: unknown): string;
|
|
101
|
+
/** Turns a query parameter back into a filter value: parsed when it is JSON, otherwise the plain text. */
|
|
52
102
|
export declare function decodeUrlFilterValue(value: string): unknown;
|
|
103
|
+
/**
|
|
104
|
+
* Query params of the changed values, `null` for the rest (Angular removes them)
|
|
105
|
+
* @see https://tectra-ng.com/components/filter-state
|
|
106
|
+
*/
|
|
53
107
|
export declare function filtersToQueryParams<T extends object>(filters: T, initial: T): Params;
|
|
108
|
+
/**
|
|
109
|
+
* Filters from query params over `initial`, or `null` when the URL has none of their keys
|
|
110
|
+
* @see https://tectra-ng.com/components/filter-state
|
|
111
|
+
*/
|
|
54
112
|
export declare function queryParamsToFilters<T extends object>(params: Params, initial: T): T | null;
|
|
55
113
|
//# sourceMappingURL=tectra-ng-utils-filter-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tectra-ng-utils-filter-state.d.ts","names":[],"sources":["../../../../packages/utils/filter-state/src/filter-state.types.ts","../../../../packages/utils/filter-state/src/filter-state.ts","../../../../packages/utils/filter-state/src/filter-state.base.ts","../../../../packages/utils/filter-state/src/storage.ts","../../../../packages/utils/filter-state/src/url-filters.functions.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tectra-ng-utils-filter-state.d.ts","names":[],"sources":["../../../../packages/utils/filter-state/src/filter-state.types.ts","../../../../packages/utils/filter-state/src/filter-state.ts","../../../../packages/utils/filter-state/src/filter-state.base.ts","../../../../packages/utils/filter-state/src/storage.ts","../../../../packages/utils/filter-state/src/url-filters.functions.ts"],"mappings":";;;;YAGY;;iBAGK,qBAAqB;;EAEpC;;EAEA,SAAS;;EAET;;EAEA,UAAU;;;;;;iBAOK,cAAc;;WACpB,OAAO,OAAO;;WACd,WAAW;;WACX,SAAS,cAAc;;EAChC,IAAI,SAAS;;EACb,MAAM,SAAS,QAAQ;;EACvB;;;;;;wBCpBc,cAAc,kBAAkB,SAAS,qBAAqB,KAAK,cAAc;;8BCA3E,cAAc;mBACjB;qBAEE;YAET,aAAa,SAAS;YAItB,oBAAoB;SATV,MAAA,GAAA,qBAAA;;;;;;;8BAmBA,aAAa,0BAA0B,cAAc;mBACxD;qBAEE,kBAAkB;YAE3B,iBAAiB,SAAS;YAEjB,aAAa,SAAS;YAKtB,oBAAoB;SAZnB,MAAA,GAAA,qBAAA;;;;;;;qBClBT,2BAA2B;mBACrB;EAEL,YAAA,SAAS;;MAajB;;EAKJ;;EAKA,QAAQ;;EAKR,IAAI;;EAKJ,WAAW;;EAKX,QAAQ,aAAa;;;;;;wBAUP,cAAc,OAAM,gBAA0B;;;;;wBAiB9C,SAAS,GAAG,SAAS,SAAS,cAAc;;wBAa5C,UAAU,SAAS,SAAS,aAAa;;wBCtFzC,YAAY,YAAY;;;;;wBAgBxB,qBAAqB;;wBAQrB,qBAAqB;;;;;wBAIrB,qBAAqB,kBAAkB,SAAS,GAAG,SAAS,IAAI;;;;;wBAOhE,qBAAqB,kBAAkB,QAAQ,QAAQ,SAAS,IAAI"}
|
|
@@ -1,17 +1,46 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { PipeTransform } from "@angular/core";
|
|
3
3
|
import { TxFilterMatchMode, resolveField } from "@tectra-ng/ui/table";
|
|
4
|
+
/**
|
|
5
|
+
* Own match rule for a filter: gets the value, the filter and the locale, returns whether the item
|
|
6
|
+
* matches.
|
|
7
|
+
*/
|
|
4
8
|
export type TxMatchFunction = (value: unknown, filter: unknown, locale?: string) => boolean;
|
|
9
|
+
/** Where to look for a value in an item: a list of field paths or a function that returns the values. */
|
|
5
10
|
export type TxFilterFields<T> = readonly string[] | ((item: T) => readonly unknown[]);
|
|
11
|
+
/**
|
|
12
|
+
* Lower case without accents and outer spaces — compare your own strings the same way
|
|
13
|
+
* @see https://tectra-ng.com/components/filter
|
|
14
|
+
*/
|
|
6
15
|
export declare function normalizeSearch(value: unknown, locale?: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* The function behind `txSearch`
|
|
18
|
+
* @see https://tectra-ng.com/components/filter
|
|
19
|
+
*/
|
|
7
20
|
export declare function filterBySearch<T>(items: readonly T[], query: string | null | undefined, fields: TxFilterFields<T>, locale?: string): T[];
|
|
21
|
+
/**
|
|
22
|
+
* One value against one filter
|
|
23
|
+
* @see https://tectra-ng.com/components/filter
|
|
24
|
+
*/
|
|
8
25
|
export declare function matches(value: unknown, filter: unknown, matchMode?: TxFilterMatchMode | TxMatchFunction, locale?: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The function behind `txFilterBy`. Match modes: `startsWith`, `contains`, `notContains`, `endsWith`, `equals`, `notEquals`, `in`, `lt`, `lte`, `gt`, `gte`, `between`, `dateIs`, `dateIsNot`, `dateBefore`, `dateAfter`, or `(value, filter, locale) => boolean`
|
|
28
|
+
* @see https://tectra-ng.com/components/filter
|
|
29
|
+
*/
|
|
9
30
|
export declare function filterBy<T>(items: readonly T[], filter: unknown, fields: TxFilterFields<T>, matchMode?: TxFilterMatchMode | TxMatchFunction, locale?: string): T[];
|
|
31
|
+
/**
|
|
32
|
+
* Items where any of the fields contains the query; all items for an empty query. `fields` — paths or a function returning the values
|
|
33
|
+
* @see https://tectra-ng.com/components/filter
|
|
34
|
+
*/
|
|
10
35
|
export declare class TxSearchPipe implements PipeTransform {
|
|
11
36
|
transform<T>(items: readonly T[] | null | undefined, query: string | null | undefined, fields: TxFilterFields<T>): T[];
|
|
12
37
|
static ɵfac: i0.ɵɵFactoryDeclaration<TxSearchPipe, never>;
|
|
13
38
|
static ɵpipe: i0.ɵɵPipeDeclaration<TxSearchPipe, "txSearch", true>;
|
|
14
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Items where any field matches the value by a match mode (`contains` by default) or your own function
|
|
42
|
+
* @see https://tectra-ng.com/components/filter
|
|
43
|
+
*/
|
|
15
44
|
export declare class TxFilterByPipe implements PipeTransform {
|
|
16
45
|
transform<T>(items: readonly T[] | null | undefined, filter: unknown, fields: TxFilterFields<T>, matchMode?: TxFilterMatchMode | TxMatchFunction): T[];
|
|
17
46
|
static ɵfac: i0.ɵɵFactoryDeclaration<TxFilterByPipe, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tectra-ng-utils-filter.d.ts","names":[],"sources":["../../../../packages/utils/filter/src/filter.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tectra-ng-utils-filter.d.ts","names":[],"sources":["../../../../packages/utils/filter/src/filter.ts"],"mappings":";;;;;;;YAOY,mBAAmB,gBAAgB,iBAAiB;;YAEpD,eAAe,2BAA2B,MAAM;;;;;wBAI5C,gBAAgB,gBAAgB;;;;;wBAYhC,eAAe,GAAG,gBAAgB,KAAK,kCAAkC,QAAQ,eAAe,IAAI,kBAAkB;;;;;wBAYtH,QAAQ,gBAAgB,iBAAiB,YAAW,oBAAoB,iBAA8B;;;;;wBAItG,SAAS,GAAG,gBAAgB,KAAK,iBAAiB,QAAQ,eAAe,IAAI,YAAW,oBAAoB,iBAA8B,kBAAkB;;;;;qBAK/J,wBAAwB;EACnC,UAAU,GAAG,gBAAgB,wBAAwB,kCAAkC,QAAQ,eAAe,KAAK;SADxG,MAAA,GAAA,qBAAA;SAAA,OAAA,GAAA,kBAAA;;;;;;qBAOA,0BAA0B;EACrC,UAAU,GAAG,gBAAgB,wBAAwB,iBAAiB,QAAQ,eAAe,IAAI,YAAW,oBAAoB,kBAA+B;SADpJ,MAAA,GAAA,qBAAA;SAAA,OAAA,GAAA,kBAAA"}
|
|
@@ -1,22 +1,40 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Signal } from "@angular/core";
|
|
3
3
|
import { AbstractControl } from "@angular/forms";
|
|
4
|
+
/**
|
|
5
|
+
* The comparison it uses
|
|
6
|
+
* @see https://tectra-ng.com/components/form-changes
|
|
7
|
+
*/
|
|
4
8
|
export declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
9
|
+
/** Remembers the initial value of a form and tells whether it changed; provide it per component. */
|
|
5
10
|
export declare class TxFormChangeTracker {
|
|
6
11
|
private initial;
|
|
7
12
|
private tracking;
|
|
13
|
+
/** Remembers the current values (provide the service in the component) */
|
|
8
14
|
initFormTracking(form: AbstractControl): void;
|
|
15
|
+
/** `true` when the values differ from the remembered ones */
|
|
9
16
|
hasFormChanges(form: AbstractControl): boolean;
|
|
17
|
+
/** Remembers the values again — after a save */
|
|
10
18
|
updateInitialFormState(form: AbstractControl): void;
|
|
19
|
+
/** Puts the remembered values back */
|
|
11
20
|
resetFormToInitial(form: AbstractControl): void;
|
|
21
|
+
/** Forgets them */
|
|
12
22
|
resetFormTracking(): void;
|
|
13
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<TxFormChangeTracker, never>;
|
|
14
24
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
15
25
|
}
|
|
26
|
+
/** Change tracking of one form, created by `trackFormChanges`. */
|
|
16
27
|
export interface TxFormChanges {
|
|
28
|
+
/** `true` while the form value differs from the saved one. */
|
|
17
29
|
readonly changed: Signal<boolean>;
|
|
30
|
+
/** Takes the current value as the new initial one. */
|
|
18
31
|
commit(): void;
|
|
32
|
+
/** Resets the form to the initial value. */
|
|
19
33
|
revert(): void;
|
|
20
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* In an injection context: `{ changed, commit(), revert() }` — a signal, take the current values as the new start, put the start values back
|
|
37
|
+
* @see https://tectra-ng.com/components/form-changes
|
|
38
|
+
*/
|
|
21
39
|
export declare function trackFormChanges(form: AbstractControl): TxFormChanges;
|
|
22
40
|
//# sourceMappingURL=tectra-ng-utils-form-changes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tectra-ng-utils-form-changes.d.ts","names":[],"sources":["../../../../packages/utils/form-changes/src/form-changes.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tectra-ng-utils-form-changes.d.ts","names":[],"sources":["../../../../packages/utils/form-changes/src/form-changes.ts"],"mappings":";;;;;;;wBAKgB,UAAU,YAAY;;qBAwBzB;UACH;UACA;;EAER,iBAAiB,MAAM;;EAKvB,eAAe,MAAM;;EAIrB,uBAAuB,MAAM;;EAI7B,mBAAmB,MAAM;;EAMzB;SAvBW,MAAA,GAAA,qBAAA;;;;iBA8BI;;WAEN,SAAS;;EAElB;;EAEA;;;;;;wBAGc,iBAAiB,MAAM,kBAAkB"}
|
|
@@ -1,28 +1,54 @@
|
|
|
1
1
|
import { AbstractControl } from "@angular/forms";
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Touched and dirty for a control and every control inside groups and arrays
|
|
5
|
+
* @see https://tectra-ng.com/components/form-validation
|
|
6
|
+
*/
|
|
3
7
|
export declare function markAllTouched(control: AbstractControl): void;
|
|
8
|
+
/**
|
|
9
|
+
* The first element with `ng-invalid` that has no invalid element inside
|
|
10
|
+
* @see https://tectra-ng.com/components/form-validation
|
|
11
|
+
*/
|
|
4
12
|
export declare function firstInvalidElement(scope: ParentNode): HTMLElement | null;
|
|
13
|
+
/**
|
|
14
|
+
* The element itself when it takes focus, or the first focusable element inside
|
|
15
|
+
* @see https://tectra-ng.com/components/form-validation
|
|
16
|
+
*/
|
|
5
17
|
export declare function focusTarget(element: HTMLElement): HTMLElement;
|
|
18
|
+
/** Options of `TxFormValidation.scrollToFirstInvalid`. */
|
|
6
19
|
export interface TxScrollToInvalidOptions {
|
|
20
|
+
/** Element to search for the first invalid field in (default: the whole page). */
|
|
7
21
|
scope?: ParentNode;
|
|
22
|
+
/** Moves focus to the invalid field (default `true`). */
|
|
8
23
|
focus?: boolean;
|
|
24
|
+
/** Where the field lands in the viewport after scrolling (default `center`). */
|
|
9
25
|
block?: ScrollLogicalPosition;
|
|
10
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Shows the user what is wrong after a failed save: every control becomes touched and dirty (so the kit fields show their errors), the first invalid field scrolls into the middle of the screen and gets the focus — the inner input of a kit field (select, datepicker, multiselect …), not its wrapper. Smooth scrolling turns instant with reduced motion.
|
|
29
|
+
* @see https://tectra-ng.com/components/form-validation
|
|
30
|
+
*/
|
|
11
31
|
export declare class TxFormValidation {
|
|
12
32
|
private readonly document;
|
|
13
33
|
private readonly isBrowser;
|
|
14
34
|
private readonly host;
|
|
35
|
+
/** `TxFormValidation`: marks all touched, scrolls to and focuses the first invalid field; `{ scope, focus, block }`; returns `true` when a field was found. Provide it in a component to search only inside it */
|
|
15
36
|
scrollToFirstInvalid(form: AbstractControl, options?: TxScrollToInvalidOptions): boolean;
|
|
16
37
|
static ɵfac: i0.ɵɵFactoryDeclaration<TxFormValidation, never>;
|
|
17
38
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
18
39
|
}
|
|
40
|
+
/** On a form: on submit, scrolls to and focuses the first invalid field, or reports a valid submit. */
|
|
19
41
|
export declare class TxScrollToInvalid {
|
|
20
42
|
private readonly container;
|
|
21
43
|
private readonly validation;
|
|
22
44
|
private readonly host;
|
|
45
|
+
/** focus the field after scrolling */
|
|
23
46
|
readonly focus: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
47
|
+
/** where the field lands — `center`, `start`, `end`, `nearest` */
|
|
24
48
|
readonly block: import("@angular/core").InputSignal<ScrollLogicalPosition>;
|
|
49
|
+
/** the form was submitted invalid; the first error is in view */
|
|
25
50
|
readonly invalidSubmit: import("@angular/core").OutputEmitterRef<void>;
|
|
51
|
+
/** the form was submitted and is valid */
|
|
26
52
|
readonly validSubmit: import("@angular/core").OutputEmitterRef<void>;
|
|
27
53
|
check(): void;
|
|
28
54
|
static ɵfac: i0.ɵɵFactoryDeclaration<TxScrollToInvalid, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tectra-ng-utils-form-validation.d.ts","names":[],"sources":["../../../../packages/utils/form-validation/src/form-validation.functions.ts","../../../../packages/utils/form-validation/src/form-validation.service.ts","../../../../packages/utils/form-validation/src/scroll-to-invalid.directive.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tectra-ng-utils-form-validation.d.ts","names":[],"sources":["../../../../packages/utils/form-validation/src/form-validation.functions.ts","../../../../packages/utils/form-validation/src/form-validation.service.ts","../../../../packages/utils/form-validation/src/scroll-to-invalid.directive.ts"],"mappings":";;;;;;wBAIgB,eAAe,SAAS;;;;;wBAQxB,oBAAoB,OAAO,aAAa;;;;;wBAKxC,YAAY,SAAS,cAAc;;iBCXlC;;EAEf,QAAQ;;EAER;;EAEA,QAAQ;;;;;;qBAIG;mBACM;mBACA;mBACA;;EAEjB,qBAAqB,MAAM,iBAAiB,UAAS;SAL1C,MAAA,GAAA,qBAAA;;;;qBCPA;mBACM;mBACA;mBACA;;WAER,+BAAK;;WACL,+BAAK,YAAA;;WAEL,uCAAa;;WACb,qCAAW;EAEpB;SAXW,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAiB;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;IAAA;IAAA"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { UrlTree } from "@angular/router";
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* A back button that never leaves the app: it goes back in history when the user came from another page of the app, and opens a fallback route when the page was opened directly (a link from an email, a new tab, a reload after a deep link).
|
|
5
|
+
* @see https://tectra-ng.com/components/go-back
|
|
6
|
+
*/
|
|
3
7
|
export declare class TxGoBack {
|
|
4
8
|
private readonly location;
|
|
5
9
|
private readonly router;
|
|
6
10
|
private readonly element;
|
|
11
|
+
/** Fallback route — a URL, router commands or a `UrlTree`; `/` by default */
|
|
7
12
|
readonly fallback: import("@angular/core").InputSignal<string | UrlTree | readonly unknown[]>;
|
|
13
|
+
/** `back` or `fallback` — which way it went */
|
|
8
14
|
readonly navigated: import("@angular/core").OutputEmitterRef<"back" | "fallback">;
|
|
9
15
|
protected readonly needsRole: boolean;
|
|
16
|
+
/** `true` when an earlier page of the app is in the history */
|
|
10
17
|
canGoBack(): boolean;
|
|
18
|
+
/** Goes back now (`exportAs: 'txGoBack'`) */
|
|
11
19
|
back(): void;
|
|
12
20
|
protected onClick(event: Event): void;
|
|
13
21
|
protected onKey(event: Event): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tectra-ng-utils-go-back.d.ts","names":[],"sources":["../../../../packages/utils/go-back/src/go-back.directive.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tectra-ng-utils-go-back.d.ts","names":[],"sources":["../../../../packages/utils/go-back/src/go-back.directive.ts"],"mappings":";;;;;;qBAiBa;mBACM;mBACA;mBACA;;WAER,kCAAQ,qBAAA;;WAER,mCAAS;qBAEC;;EAEnB;;EAKA;YAWU,QAAQ,OAAO;YAKf,MAAM,OAAO;SAhCZ,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAQ;MAAA;MAAA;MAAA;;;IAAA"}
|
|
@@ -2,42 +2,114 @@ import { HttpErrorResponse, HttpParams } from "@angular/common/http";
|
|
|
2
2
|
import { MonoTypeOperatorFunction } from "rxjs";
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
import { PipeTransform } from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* `HttpParams` from an object: skips `null`, `undefined`, `''` and empty arrays, repeats a key for every array item, dates as ISO strings, objects as JSON; `0` and `false` stay
|
|
7
|
+
* @see https://tectra-ng.com/components/http
|
|
8
|
+
*/
|
|
5
9
|
export declare function buildHttpParams(query: object): HttpParams;
|
|
10
|
+
/** Options of `retryHttpReads`. */
|
|
6
11
|
export interface TxHttpRetryOptions {
|
|
12
|
+
/** How many times to retry (default 5). */
|
|
7
13
|
count?: number;
|
|
14
|
+
/** Delay before the first retry in ms, doubled each time (default 2000). */
|
|
8
15
|
baseDelayMs?: number;
|
|
16
|
+
/** Longest delay in ms; a `Retry-After` above it stops the retries (default 30000). */
|
|
9
17
|
maxDelayMs?: number;
|
|
18
|
+
/** Statuses that are retried (default: no response, 429, 502, 503 and 504). */
|
|
10
19
|
statuses?: readonly number[];
|
|
11
20
|
}
|
|
21
|
+
/** Input of the retry delay calculation for one failed attempt. */
|
|
12
22
|
export interface TxHttpRetryDelay {
|
|
23
|
+
/** The failed response; its `Retry-After` header wins over the back-off. */
|
|
13
24
|
error: HttpErrorResponse;
|
|
25
|
+
/** Number of the retry, starting at 1. */
|
|
14
26
|
attempt: number;
|
|
27
|
+
/** Delay before the first retry in ms. */
|
|
15
28
|
baseDelayMs: number;
|
|
29
|
+
/** Longest allowed delay in ms. */
|
|
16
30
|
maxDelayMs: number;
|
|
17
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Kind of an HTTP response: `ok`, `redirect`, `clientError`, `serverError`, `warning`, `noResponse` or
|
|
34
|
+
* `unknown`.
|
|
35
|
+
*/
|
|
18
36
|
export type TxHttpStatusGroup = 'ok' | 'redirect' | 'clientError' | 'serverError' | 'warning' | 'noResponse' | 'unknown';
|
|
37
|
+
/** Colour tone that fits an HTTP status: `success`, `info`, `warn`, `danger` or `secondary`. */
|
|
19
38
|
export type TxHttpStatusTone = 'success' | 'info' | 'warn' | 'danger' | 'secondary';
|
|
39
|
+
/**
|
|
40
|
+
* `5`, `2000`, `30000`, `2`
|
|
41
|
+
* @see https://tectra-ng.com/components/http
|
|
42
|
+
*/
|
|
20
43
|
export declare const TX_HTTP_RETRY_COUNT = 5;
|
|
44
|
+
/**
|
|
45
|
+
* `5`, `2000`, `30000`, `2`
|
|
46
|
+
* @see https://tectra-ng.com/components/http
|
|
47
|
+
*/
|
|
21
48
|
export declare const TX_HTTP_RETRY_BASE_DELAY_MS = 2000;
|
|
49
|
+
/**
|
|
50
|
+
* `5`, `2000`, `30000`, `2`
|
|
51
|
+
* @see https://tectra-ng.com/components/http
|
|
52
|
+
*/
|
|
22
53
|
export declare const TX_HTTP_RETRY_MAX_DELAY_MS = 30000;
|
|
54
|
+
/**
|
|
55
|
+
* `5`, `2000`, `30000`, `2`
|
|
56
|
+
* @see https://tectra-ng.com/components/http
|
|
57
|
+
*/
|
|
23
58
|
export declare const TX_HTTP_RETRY_FACTOR = 2;
|
|
59
|
+
/** Status `0` that the browser reports when a request got no response. */
|
|
24
60
|
export declare const TX_HTTP_NETWORK_ERROR_STATUS = 0;
|
|
61
|
+
/**
|
|
62
|
+
* `0`, `429`, `502`, `503`, `504`
|
|
63
|
+
* @see https://tectra-ng.com/components/http
|
|
64
|
+
*/
|
|
25
65
|
export declare const TX_HTTP_RETRYABLE_STATUSES: readonly number[];
|
|
66
|
+
/**
|
|
67
|
+
* Milliseconds from a `Retry-After` header — seconds or an HTTP date; `null` when missing or broken
|
|
68
|
+
* @see https://tectra-ng.com/components/http
|
|
69
|
+
*/
|
|
26
70
|
export declare function parseRetryAfter(value: string | null | undefined, now?: number): number | null;
|
|
71
|
+
/**
|
|
72
|
+
* The wait before an attempt, or `null` to stop
|
|
73
|
+
* @see https://tectra-ng.com/components/http
|
|
74
|
+
*/
|
|
27
75
|
export declare function httpRetryDelay(data: TxHttpRetryDelay): number | null;
|
|
76
|
+
/**
|
|
77
|
+
* RxJS operator for GET requests: retries a network error, 429, 502, 503 and 504 with exponential back-off (2 s, 4 s, 8 s … up to 30 s, 5 times); a `Retry-After` header wins, and when it asks for longer than `maxDelayMs` the error goes through. Options: `count`, `baseDelayMs`, `maxDelayMs`, `statuses`
|
|
78
|
+
* @see https://tectra-ng.com/components/http
|
|
79
|
+
*/
|
|
28
80
|
export declare function retryHttpReads<T>(options?: TxHttpRetryOptions): MonoTypeOperatorFunction<T>;
|
|
81
|
+
/**
|
|
82
|
+
* `ok`, `redirect`, `clientError`, `serverError`, `warning` (codes you list), `noResponse` (no status or 0), `unknown`
|
|
83
|
+
* @see https://tectra-ng.com/components/http
|
|
84
|
+
*/
|
|
29
85
|
export declare function httpStatusGroup(status: number | null | undefined, warnCodes?: readonly number[]): TxHttpStatusGroup;
|
|
86
|
+
/**
|
|
87
|
+
* Kit severity of a status: `success`, `info`, `warn`, `danger`, `secondary`
|
|
88
|
+
* @see https://tectra-ng.com/components/http
|
|
89
|
+
*/
|
|
30
90
|
export declare function httpStatusTone(status: number | null | undefined, warnCodes?: readonly number[]): TxHttpStatusTone;
|
|
91
|
+
/**
|
|
92
|
+
* Severity for `tx-tag`, `tx-status-icon`, `tx-badge`
|
|
93
|
+
* @see https://tectra-ng.com/components/http
|
|
94
|
+
*/
|
|
31
95
|
export declare class TxHttpStatusTonePipe implements PipeTransform {
|
|
32
96
|
transform(status: number | null | undefined, warnCodes?: readonly number[]): TxHttpStatusTone;
|
|
33
97
|
static ɵfac: i0.ɵɵFactoryDeclaration<TxHttpStatusTonePipe, never>;
|
|
34
98
|
static ɵpipe: i0.ɵɵPipeDeclaration<TxHttpStatusTonePipe, "txHttpStatusTone", true>;
|
|
35
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* The group as a key, for your own texts
|
|
102
|
+
* @see https://tectra-ng.com/components/http
|
|
103
|
+
*/
|
|
36
104
|
export declare class TxHttpStatusGroupPipe implements PipeTransform {
|
|
37
105
|
transform(status: number | null | undefined, warnCodes?: readonly number[]): TxHttpStatusGroup;
|
|
38
106
|
static ɵfac: i0.ɵɵFactoryDeclaration<TxHttpStatusGroupPipe, never>;
|
|
39
107
|
static ɵpipe: i0.ɵɵPipeDeclaration<TxHttpStatusGroupPipe, "txHttpStatusGroup", true>;
|
|
40
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Translated group name: OK, Redirect, Client error, Server error, Warning, No response, Unknown
|
|
111
|
+
* @see https://tectra-ng.com/components/http
|
|
112
|
+
*/
|
|
41
113
|
export declare class TxHttpStatusLabelPipe implements PipeTransform {
|
|
42
114
|
private readonly locale;
|
|
43
115
|
transform(status: number | null | undefined, warnCodes?: readonly number[]): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tectra-ng-utils-http.d.ts","names":[],"sources":["../../../../packages/utils/http/src/http-params.functions.ts","../../../../packages/utils/http/src/http.types.ts","../../../../packages/utils/http/src/http-retry.functions.ts","../../../../packages/utils/http/src/http-status.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tectra-ng-utils-http.d.ts","names":[],"sources":["../../../../packages/utils/http/src/http-params.functions.ts","../../../../packages/utils/http/src/http.types.ts","../../../../packages/utils/http/src/http-retry.functions.ts","../../../../packages/utils/http/src/http-status.ts"],"mappings":";;;;;;;;wBAWgB,gBAAgB,gBAAgB;;iBCR/B;;EAEf;;EAEA;;EAEA;;EAEA;;;iBAIe;;EAEf,OAAO;;EAEP;;EAEA;;EAEA;;;;;;YAOU;;YAGA;;;;;qBC7BC;;;;;qBACA;;;;;qBACA;;;;;qBACA;;qBAEA;;;;;qBACA;;;;;wBAQG,gBAAgB,kCAAkC;;;;;wBAalD,eAAe,MAAM;;;;;wBAQrB,eAAe,GAAG,UAAS,qBAA0B,yBAAyB;;;;;wBCd9E,gBAAgB,mCAAmC,gCAAoC;;;;;wBAmBvF,eAAe,mCAAmC,gCAAoC;;;;;qBAKzF,gCAAgC;EAC3C,UAAU,mCAAmC,gCAAoC;SADtE,MAAA,GAAA,qBAAA;SAAA,OAAA,GAAA,kBAAA;;;;;;qBAOA,iCAAiC;EAC5C,UAAU,mCAAmC,gCAAoC;SADtE,MAAA,GAAA,qBAAA;SAAA,OAAA,GAAA,kBAAA;;;;;;qBAOA,iCAAiC;mBAC3B;EAEjB,UAAU,mCAAmC;SAHlC,MAAA,GAAA,qBAAA;SAAA,OAAA,GAAA,kBAAA"}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* Knows when an element scrolls into view — to animate it in, count an impression, load a picture or a chart late. `txInView` adds the `tx-in-view` class and your enter / leave classes, and reports `entered` and `left`; `txVisibleOnScroll` watches a scrolling list and reports each fully visible item once (mark notifications read, track seen rows). Both use one `IntersectionObserver`, start in the browser only, and treat a browser without it as "in view". To render a heavy block only when it comes near, use Angular's `@defer (on viewport)`.
|
|
4
|
+
* @see https://tectra-ng.com/components/in-view
|
|
5
|
+
*/
|
|
2
6
|
export declare class TxInView {
|
|
3
7
|
private readonly element;
|
|
4
8
|
private readonly renderer;
|
|
5
9
|
private readonly view;
|
|
10
|
+
/** share of the element that must be visible, 0–1 */
|
|
6
11
|
readonly threshold: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
12
|
+
/** grows or shrinks the viewport, e.g. `0px 0px -20% 0px` */
|
|
7
13
|
readonly rootMargin: import("@angular/core").InputSignal<string>;
|
|
14
|
+
/** stop watching after the first entry */
|
|
8
15
|
readonly once: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
16
|
+
/** classes added when the element is in view */
|
|
9
17
|
readonly enterClass: import("@angular/core").InputSignal<string | undefined>;
|
|
18
|
+
/** classes added when it leaves (with `once` off) */
|
|
10
19
|
readonly leaveClass: import("@angular/core").InputSignal<string | undefined>;
|
|
20
|
+
/** the element came into view */
|
|
11
21
|
readonly entered: import("@angular/core").OutputEmitterRef<void>;
|
|
22
|
+
/** the element left the view */
|
|
12
23
|
readonly left: import("@angular/core").OutputEmitterRef<void>;
|
|
24
|
+
/** `txInView` (`exportAs: 'txInView'`): signal, `true` while in view (stays `true` with `once`) */
|
|
13
25
|
readonly isInView: import("@angular/core").WritableSignal<boolean>;
|
|
14
26
|
constructor();
|
|
15
27
|
private update;
|
|
@@ -45,18 +57,25 @@ export declare class TxInView {
|
|
|
45
57
|
"left": "left";
|
|
46
58
|
}, never, never, true, never>;
|
|
47
59
|
}
|
|
60
|
+
/** One item of a list watched by `txVisibleOnScroll`; its position in the list matches the child element. */
|
|
48
61
|
export interface TxVisibleOnScrollItem {
|
|
62
|
+
/** Value reported by `itemVisible` when the item is seen. */
|
|
49
63
|
id: string;
|
|
64
|
+
/** Skips the item, for example when it is already handled. */
|
|
50
65
|
ignore?: boolean;
|
|
51
66
|
}
|
|
67
|
+
/** Reports each child of a scrolling list once it has been seen, by the id of its item. */
|
|
52
68
|
export declare class TxVisibleOnScroll {
|
|
53
69
|
private readonly host;
|
|
54
70
|
private readonly view;
|
|
55
71
|
private readonly emitted;
|
|
56
72
|
private readonly ids;
|
|
57
73
|
private observer;
|
|
74
|
+
/** Items of the list in the order of the children: `{ id, ignore? }`; ids that leave the list are forgotten */
|
|
58
75
|
readonly items: import("@angular/core").InputSignal<readonly TxVisibleOnScrollItem[]>;
|
|
76
|
+
/** share of an item that counts as fully visible; items taller than the box never count */
|
|
59
77
|
readonly visibleRatio: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
78
|
+
/** id of an item seen for the first time */
|
|
60
79
|
readonly itemVisible: import("@angular/core").OutputEmitterRef<string>;
|
|
61
80
|
constructor();
|
|
62
81
|
private sync;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tectra-ng-utils-in-view.d.ts","names":[],"sources":["../../../../packages/utils/in-view/src/in-view.directive.ts","../../../../packages/utils/in-view/src/visible-on-scroll.directive.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tectra-ng-utils-in-view.d.ts","names":[],"sources":["../../../../packages/utils/in-view/src/in-view.directive.ts","../../../../packages/utils/in-view/src/visible-on-scroll.directive.ts"],"mappings":";;;;;qBAUa;mBACM;mBACA;mBACA;;WAER,mCAAS;;WACT,oCAAU;;WACV,8BAAI;;WACJ,oCAAU;;WACV,oCAAU;;WAEV,iCAAO;;WACP,8BAAI;;WAEJ,kCAAQ;;UA4BT;SA1CG,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAQ;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;IAAA;IAAA;;;;iBCNJ;;EAEf;;EAEA;;;qBAQW;mBACM;mBACA;mBACA;mBACA;UACT;;WAEC,+BAAK,qBAAA;;WACL,sCAAY;;WAEZ,qCAAW;;UAOZ;UAmBA;SApCG,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAiB;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;IAAA"}
|
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { PipeTransform } from "@angular/core";
|
|
3
|
+
/** Plural form of a translation key: `one`, `few` or `many`. */
|
|
3
4
|
export type TxPluralForm = 'one' | 'few' | 'many';
|
|
5
|
+
/** Plural category of the locale (`zero`, `one`, `two`, `few`, `many`, `other`). */
|
|
4
6
|
export type TxPluralCategory = Intl.LDMLPluralRule;
|
|
7
|
+
/** Texts by plural category, with `=0`, `=1` … for an exact number. */
|
|
5
8
|
export type TxPluralForms = Partial<Record<TxPluralCategory | `=${number}`, string>>;
|
|
9
|
+
/**
|
|
10
|
+
* The full category: `zero`, `one`, `two`, `few`, `many` or `other`
|
|
11
|
+
* @see https://tectra-ng.com/components/plural
|
|
12
|
+
*/
|
|
6
13
|
export declare function pluralCategory(count: number, locale?: string): TxPluralCategory;
|
|
14
|
+
/**
|
|
15
|
+
* The function behind `txPluralForm`; `en-US` by default
|
|
16
|
+
* @see https://tectra-ng.com/components/plural
|
|
17
|
+
*/
|
|
7
18
|
export declare function pluralForm(count: number, locale?: string): TxPluralForm;
|
|
19
|
+
/**
|
|
20
|
+
* The function behind `txPlural`
|
|
21
|
+
* @see https://tectra-ng.com/components/plural
|
|
22
|
+
*/
|
|
8
23
|
export declare function plural(count: number, forms: string | TxPluralForms, locale?: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* `one`, `few` or `many` for a count (`Intl.PluralRules`: `one` and `few` as they are, every other category is `many`); the tectra locale unless a locale is given
|
|
26
|
+
* @see https://tectra-ng.com/components/plural
|
|
27
|
+
*/
|
|
9
28
|
export declare class TxPluralFormPipe implements PipeTransform {
|
|
10
29
|
private readonly localeService;
|
|
11
30
|
transform(count: number | null | undefined, locale?: string): TxPluralForm;
|
|
12
31
|
static ɵfac: i0.ɵɵFactoryDeclaration<TxPluralFormPipe, never>;
|
|
13
32
|
static ɵpipe: i0.ɵɵPipeDeclaration<TxPluralFormPipe, "txPluralForm", true>;
|
|
14
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* The text for a count: an ICU message (`{count, plural, =0 {none} one {# file} other {# files}}`) or a map `{ '=0', one, few, many, other }`; `#` is the count
|
|
36
|
+
* @see https://tectra-ng.com/components/plural
|
|
37
|
+
*/
|
|
15
38
|
export declare class TxPluralPipe implements PipeTransform {
|
|
16
39
|
private readonly localeService;
|
|
17
40
|
transform(count: number | null | undefined, forms: string | TxPluralForms, locale?: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tectra-ng-utils-plural.d.ts","names":[],"sources":["../../../../packages/utils/plural/src/plural.types.ts","../../../../packages/utils/plural/src/plural.functions.ts","../../../../packages/utils/plural/src/plural.pipe.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"tectra-ng-utils-plural.d.ts","names":[],"sources":["../../../../packages/utils/plural/src/plural.types.ts","../../../../packages/utils/plural/src/plural.functions.ts","../../../../packages/utils/plural/src/plural.pipe.ts"],"mappings":";;;YACY;;YAGA,mBAAmB,KAAK;;YAGxB,gBAAgB,QAAQ,OAAO;;;;;wBCO3B,eAAe,eAAe,kBAAmB;;;;;wBAIjD,WAAW,eAAe,kBAAmB;;;;;wBAK7C,OAAO,eAAe,gBAAgB,eAAe;;;;;qBCjBxD,4BAA4B;mBACtB;EAEjB,UAAU,kCAAkC,kBAAkB;SAHnD,MAAA,GAAA,qBAAA;SAAA,OAAA,GAAA,kBAAA;;;;;;qBASA,wBAAwB;mBAClB;EAEjB,UAAU,kCAAkC,gBAAgB,eAAe;SAHhE,MAAA,GAAA,qBAAA;SAAA,OAAA,GAAA,kBAAA"}
|