@ethlete/query 5.4.1 → 5.6.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/CHANGELOG.md +988 -0
- package/esm2022/lib/devtools/components/query-devtools/query-devtools.component.mjs +3 -3
- package/esm2022/lib/devtools/pipes/query-short-name.pipe.mjs +3 -3
- package/esm2022/lib/directives/infinity-query-trigger.directive.mjs +3 -3
- package/esm2022/lib/directives/infinity-query.directive.mjs +3 -3
- package/esm2022/lib/directives/query.directive.mjs +3 -3
- package/esm2022/lib/query/query.types.mjs +1 -1
- package/esm2022/lib/query-creator/query-creator.types.mjs +1 -1
- package/esm2022/lib/query-form/query-form.mjs +23 -9
- package/esm2022/lib/query-form/query-form.types.mjs +1 -1
- package/fesm2022/ethlete-query.mjs +37 -23
- package/fesm2022/ethlete-query.mjs.map +1 -1
- package/lib/query-form/query-form.d.ts +11 -2
- package/lib/query-form/query-form.types.d.ts +10 -1
- package/package.json +5 -5
|
@@ -5,8 +5,15 @@ export declare class QueryField<T> {
|
|
|
5
5
|
get control(): import("@angular/forms").FormControl<T | null>;
|
|
6
6
|
constructor(data: QueryFieldOptions<T>);
|
|
7
7
|
}
|
|
8
|
+
export interface QueryFormOptions {
|
|
9
|
+
/**
|
|
10
|
+
* A prefix to use for the query parameters. This is useful when you have multiple query forms on the same page.
|
|
11
|
+
*/
|
|
12
|
+
queryParamPrefix?: string;
|
|
13
|
+
}
|
|
8
14
|
export declare class QueryForm<T extends Record<string, QueryField<any>>> {
|
|
9
15
|
private _fields;
|
|
16
|
+
private _options?;
|
|
10
17
|
private readonly _destroy$;
|
|
11
18
|
private readonly _unobserveTrigger$;
|
|
12
19
|
private readonly _router;
|
|
@@ -31,6 +38,7 @@ export declare class QueryForm<T extends Record<string, QueryField<any>>> {
|
|
|
31
38
|
private readonly _lastFormValue$;
|
|
32
39
|
private readonly _currentFormValue$;
|
|
33
40
|
private get _formValue();
|
|
41
|
+
private get _form();
|
|
34
42
|
private readonly _changes$;
|
|
35
43
|
readonly changes$: import("rxjs").Observable<QueryFormValueEvent<T>>;
|
|
36
44
|
readonly currentValue$: import("rxjs").Observable<QueryFormValue<T>>;
|
|
@@ -58,8 +66,8 @@ export declare class QueryForm<T extends Record<string, QueryField<any>>> {
|
|
|
58
66
|
} : QueryFormGroupControls<T>;
|
|
59
67
|
get value(): QueryFormValue<T>;
|
|
60
68
|
get defaultFormValue(): QueryFormValue<T>;
|
|
61
|
-
constructor(_fields: T);
|
|
62
|
-
observe(options?: QueryFormObserveOptions):
|
|
69
|
+
constructor(_fields: T, _options?: QueryFormOptions | undefined);
|
|
70
|
+
observe(options?: QueryFormObserveOptions): this;
|
|
63
71
|
private _handleQueryFormResets;
|
|
64
72
|
unobserve(): void;
|
|
65
73
|
setFormValueFromUrlQueryParams(options: {
|
|
@@ -68,6 +76,7 @@ export declare class QueryForm<T extends Record<string, QueryField<any>>> {
|
|
|
68
76
|
setValue(value: QueryFormValue<T>, options?: QueryFormWriteOptions): void;
|
|
69
77
|
patchValue(value: Partial<QueryFormValue<T>>, options?: QueryFormWriteOptions): void;
|
|
70
78
|
private _getDefaultValue;
|
|
79
|
+
private _transformKeyToQueryParam;
|
|
71
80
|
private _isDefaultValue;
|
|
72
81
|
private _setupFormGroup;
|
|
73
82
|
private _extractDefaultValues;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormControl } from '@angular/forms';
|
|
1
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
2
2
|
import { QueryField } from './query-form';
|
|
3
3
|
export interface QueryFieldOptions<T = unknown> {
|
|
4
4
|
/**
|
|
@@ -82,6 +82,15 @@ export type QueryFormGroupControls<T extends Record<string, QueryField<any>>> =
|
|
|
82
82
|
export type QueryFormValue<T extends Record<string, QueryField<any>>> = {
|
|
83
83
|
[Property in keyof T]: T[Property]['control']['value'];
|
|
84
84
|
};
|
|
85
|
+
export type QueryFormOf<T extends FormGroup> = {
|
|
86
|
+
[K in keyof T['controls']]: QueryField<T['controls'][K]['value']>;
|
|
87
|
+
};
|
|
88
|
+
export interface QueryFormGroup extends FormGroup {
|
|
89
|
+
_setValue: FormGroup['setValue'];
|
|
90
|
+
_patchValue: FormGroup['patchValue'];
|
|
91
|
+
setValue(value: unknown, options?: QueryFormWriteOptions): void;
|
|
92
|
+
patchValue(value: unknown, options?: QueryFormWriteOptions): void;
|
|
93
|
+
}
|
|
85
94
|
export interface QueryFormObserveOptions {
|
|
86
95
|
/**
|
|
87
96
|
* Whether the form value should be synced to the url query params.
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethlete/query",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "17.
|
|
6
|
-
"@angular/core": "17.
|
|
7
|
-
"@angular/forms": "17.
|
|
8
|
-
"@angular/router": "17.
|
|
5
|
+
"@angular/common": "17.2.1",
|
|
6
|
+
"@angular/core": "17.2.1",
|
|
7
|
+
"@angular/forms": "17.2.1",
|
|
8
|
+
"@angular/router": "17.2.1",
|
|
9
9
|
"@ethlete/core": "^4.0.3",
|
|
10
10
|
"@ethlete/types": "^1.6.2",
|
|
11
11
|
"rxjs": "^7.8.1"
|