@ngutil/data 0.0.11 → 0.0.13
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/esm2022/provider/array.mjs +1 -1
- package/esm2022/provider/local.mjs +6 -3
- package/esm2022/provider/provider.mjs +8 -1
- package/esm2022/query/index.mjs +2 -2
- package/esm2022/query/sorter.mjs +8 -1
- package/esm2022/source/properties/sorter.mjs +29 -2
- package/esm2022/source/proxy.directive.mjs +24 -18
- package/esm2022/source/source.mjs +20 -19
- package/fesm2022/ngutil-data.mjs +86 -37
- package/fesm2022/ngutil-data.mjs.map +1 -1
- package/package.json +2 -2
- package/provider/local.d.ts +2 -1
- package/provider/provider.d.ts +5 -1
- package/query/index.d.ts +1 -1
- package/query/sorter.d.ts +5 -4
- package/source/properties/sorter.d.ts +10 -1
- package/source/proxy.directive.d.ts +5 -4
- package/source/source.d.ts +1 -0
package/query/sorter.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ export declare const enum SortDirection {
|
|
|
4
4
|
Asc = "asc",
|
|
5
5
|
Desc = "desc"
|
|
6
6
|
}
|
|
7
|
-
type
|
|
8
|
-
type
|
|
9
|
-
dir:
|
|
7
|
+
export type SortDir = SortDirection.Asc | SortDirection.Desc | "asc" | "desc";
|
|
8
|
+
export type SortDirExtra = {
|
|
9
|
+
dir: SortDir;
|
|
10
10
|
emptyFirst: boolean;
|
|
11
11
|
};
|
|
12
12
|
export type Sorter<T extends Model> = Array<{
|
|
13
|
-
[key: string]:
|
|
13
|
+
[key: string]: SortDir | SortDirExtra;
|
|
14
14
|
}>;
|
|
15
15
|
type NormalizedEntry = {
|
|
16
16
|
path: string;
|
|
@@ -37,4 +37,5 @@ export declare function sortBy<T extends Model>(sorters: Sorter<T>): SorterFn<T>
|
|
|
37
37
|
export declare function sorterNormalize<T extends Model>(sorters: Sorter<T>): SorterNormalized;
|
|
38
38
|
export declare function compare(a: any, b: any, emptyFirst: boolean): number;
|
|
39
39
|
export declare function sorterMerge<T extends Model>(...sorters: Array<Sorter<T> | undefined | null>): Sorter<T> | undefined;
|
|
40
|
+
export declare function sorterFind<T extends Model>(sorters: Sorter<T>, name: string): SortDir | SortDirExtra | undefined;
|
|
40
41
|
export {};
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { Observable } from "rxjs";
|
|
2
2
|
import { DeepReadonly } from "@ngutil/common";
|
|
3
|
+
import { sorterFind } from "../../query";
|
|
3
4
|
import { Property, PropertyCombined } from "./abstract";
|
|
5
|
+
import { Model } from "../../model";
|
|
4
6
|
export declare class SorterProperty<T> extends Property<T> {
|
|
5
7
|
update(other: T): void;
|
|
6
8
|
}
|
|
7
|
-
|
|
9
|
+
type OfTypes<T extends Model> = ReturnType<typeof sorterFind<T>>;
|
|
10
|
+
export declare class SorterCombined<T extends Model> extends PropertyCombined<T> {
|
|
8
11
|
normal: SorterProperty<T>;
|
|
9
12
|
forced: SorterProperty<T>;
|
|
10
13
|
merged$: Observable<DeepReadonly<T> | undefined>;
|
|
14
|
+
of(name: string): Observable<OfTypes<T>>;
|
|
15
|
+
directionOf(name: string): Observable<import("../../query").SortDir | undefined>;
|
|
16
|
+
isSet(name: string): Observable<boolean>;
|
|
17
|
+
isAsc(name: string): Observable<boolean>;
|
|
18
|
+
isDesc(name: string): Observable<boolean>;
|
|
11
19
|
}
|
|
20
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataSource as CdkDataSource, CollectionViewer } from "@angular/cdk/collections";
|
|
2
2
|
import { OnDestroy } from "@angular/core";
|
|
3
|
-
import { Observable
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
4
|
import { Busy, ConnectProtocol } from "@ngutil/common";
|
|
5
5
|
import { Model } from "../model";
|
|
6
6
|
import { Filter, Grouper, Slimer, Sorter } from "../query";
|
|
@@ -39,8 +39,9 @@ export type DataSourceInput<T extends Model> = any;
|
|
|
39
39
|
*/
|
|
40
40
|
export declare class DataSourceProxy<T extends Model = Model> extends CdkDataSource<T | undefined> implements OnDestroy, ConnectProtocol {
|
|
41
41
|
#private;
|
|
42
|
-
set
|
|
43
|
-
|
|
42
|
+
set value(value: DataSourceInput<T>);
|
|
43
|
+
get value(): DataSource<T>;
|
|
44
|
+
readonly value$: Observable<DataSource<T>>;
|
|
44
45
|
readonly items$: Observable<import("@ngutil/data").PartialCollection<T>>;
|
|
45
46
|
readonly busy$: Observable<boolean>;
|
|
46
47
|
readonly isBusy: import("@angular/core").Signal<boolean>;
|
|
@@ -53,5 +54,5 @@ export declare class DataSourceProxy<T extends Model = Model> extends CdkDataSou
|
|
|
53
54
|
disconnect(collectionViewer: CollectionViewer): void;
|
|
54
55
|
ngOnDestroy(): void;
|
|
55
56
|
static ɵfac: i0.ɵɵFactoryDeclaration<DataSourceProxy<any>, [{ optional: true; }]>;
|
|
56
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<DataSourceProxy<any>, "[nuDataSource]", ["nuDataSource"], { "
|
|
57
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DataSourceProxy<any>, "[nuDataSource]", ["nuDataSource"], { "value": { "alias": "nuDataSource"; "required": true; }; "filter": { "alias": "filter"; "required": false; }; "sorter": { "alias": "sorter"; "required": false; }; "grouper": { "alias": "grouper"; "required": false; }; "slimer": { "alias": "slimer"; "required": false; }; }, {}, never, never, true, never>;
|
|
57
58
|
}
|
package/source/source.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export declare class DataSource<T extends Model> extends CdkDataSource<T | undef
|
|
|
25
25
|
readonly store: CollectionStore<T>;
|
|
26
26
|
constructor(provider: DataProvider<T>, store?: CollectionStore<T>);
|
|
27
27
|
setSlice(slice: Slice): this;
|
|
28
|
+
all(): this;
|
|
28
29
|
realod(): void;
|
|
29
30
|
getItem(ref: ModelRef): Observable<T | undefined>;
|
|
30
31
|
getItemPosition(ref: ModelRef): Observable<number | undefined>;
|