@ngutil/data 0.0.102 → 0.0.105
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/ngutil-data.mjs +36 -34
- package/fesm2022/ngutil-data.mjs.map +1 -1
- package/index.d.ts +586 -9
- package/package.json +5 -5
- package/model/index.d.ts +0 -1
- package/model/meta.d.ts +0 -51
- package/provider/array.d.ts +0 -7
- package/provider/index.d.ts +0 -4
- package/provider/local.d.ts +0 -16
- package/provider/observable.d.ts +0 -7
- package/provider/provider.d.ts +0 -50
- package/query/common.d.ts +0 -2
- package/query/executor.d.ts +0 -30
- package/query/filter.d.ts +0 -118
- package/query/grouper.d.ts +0 -17
- package/query/index.d.ts +0 -8
- package/query/path.d.ts +0 -2
- package/query/query-property.d.ts +0 -25
- package/query/query.d.ts +0 -31
- package/query/slice.d.ts +0 -32
- package/query/slimer.d.ts +0 -28
- package/query/sorter.d.ts +0 -55
- package/source/index.d.ts +0 -2
- package/source/proxy.directive.d.ts +0 -92
- package/source/source.d.ts +0 -32
- package/store/collection-store.d.ts +0 -49
- package/store/index.d.ts +0 -2
- package/store/memory-store.d.ts +0 -16
package/fesm2022/ngutil-data.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Input, Directive, inject, input, NgModule } from '@angular/core';
|
|
3
3
|
import { DataSource as DataSource$1 } from '@angular/cdk/collections';
|
|
4
4
|
import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
|
|
5
|
-
import { BehaviorSubject, Observable, combineLatest, map, shareReplay, take, of, ReplaySubject, switchMap, distinctUntilChanged, merge, Subject, timer, catchError, tap,
|
|
5
|
+
import { BehaviorSubject, Observable, combineLatest, map, shareReplay, take, of, ReplaySubject, switchMap, distinctUntilChanged, merge, Subject, timer, catchError, tap, filter, takeUntil, NEVER, finalize, throwError } from 'rxjs';
|
|
6
6
|
import { BusyDirective } from '@ngutil/aria';
|
|
7
7
|
import { flatten, isEqual, intersection, flattenDeep } from 'es-toolkit';
|
|
8
8
|
import { deepFreeze, isPlainObject, isTruthy, isFalsy, deepClone, toSorted } from '@ngutil/common';
|
|
@@ -101,7 +101,7 @@ class QueryPropertySet extends Observable {
|
|
|
101
101
|
observables.push(o);
|
|
102
102
|
props[name] = o;
|
|
103
103
|
}
|
|
104
|
-
this.#combined = combineLatest(observables).pipe(map(values => deepFreeze(this.merge(...values))), shareReplay(1));
|
|
104
|
+
this.#combined = combineLatest(observables).pipe(map(values => deepFreeze(this.merge(...values.filter(v => v != null)))), shareReplay(1));
|
|
105
105
|
for (const [k, v] of Object.entries(props)) {
|
|
106
106
|
readonlyProp(this, k, v);
|
|
107
107
|
}
|
|
@@ -1066,6 +1066,7 @@ class MemoryStore extends CollectionStore {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
1068
1068
|
const DEBOUNCE_TIME = 50;
|
|
1069
|
+
const EMPTY_RESULT = { items: [], total: undefined };
|
|
1069
1070
|
class DataSource extends DataSource$1 {
|
|
1070
1071
|
#slice;
|
|
1071
1072
|
#reload;
|
|
@@ -1101,7 +1102,7 @@ class DataSource extends DataSource$1 {
|
|
|
1101
1102
|
this.#setBusy(true);
|
|
1102
1103
|
return this.provider.queryList(query).pipe(take(1), catchError(() => {
|
|
1103
1104
|
this.#setBusy(false);
|
|
1104
|
-
return of(
|
|
1105
|
+
return of(EMPTY_RESULT);
|
|
1105
1106
|
}), tap(() => this.#setBusy(false)), switchMap(result => {
|
|
1106
1107
|
if (result.total != null) {
|
|
1107
1108
|
this.total$.next(result.total);
|
|
@@ -1113,7 +1114,8 @@ class DataSource extends DataSource$1 {
|
|
|
1113
1114
|
}));
|
|
1114
1115
|
}
|
|
1115
1116
|
else {
|
|
1116
|
-
return
|
|
1117
|
+
// XXX: the return value is irrelevant
|
|
1118
|
+
return of(EMPTY_RESULT);
|
|
1117
1119
|
}
|
|
1118
1120
|
}), switchMap(() => this.store.getSlice(query.slice).pipe(take(1))))), shareReplay({ bufferSize: 1, refCount: true }));
|
|
1119
1121
|
this.isEmpty$ = combineLatest({ busy: this.isBusy$, items: this.items$ }).pipe(filter(({ busy }) => !busy), map(({ items }) => items.every(isFalsy)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
@@ -1310,10 +1312,10 @@ class DataSourceProxy extends DataSource$1 {
|
|
|
1310
1312
|
this.#valueSub?.unsubscribe();
|
|
1311
1313
|
this.#valueSub = undefined;
|
|
1312
1314
|
}
|
|
1313
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1314
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
1315
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxy, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1316
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.13", type: DataSourceProxy, isStandalone: true, selector: "[nuDataSource]", inputs: { value: ["nuDataSource", "value"] }, exportAs: ["nuDataSource"], usesInheritance: true, ngImport: i0 }); }
|
|
1315
1317
|
}
|
|
1316
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1318
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxy, decorators: [{
|
|
1317
1319
|
type: Directive,
|
|
1318
1320
|
args: [{
|
|
1319
1321
|
selector: "[nuDataSource]",
|
|
@@ -1327,78 +1329,78 @@ class DataSourceProxyFilter {
|
|
|
1327
1329
|
#proxy;
|
|
1328
1330
|
constructor() {
|
|
1329
1331
|
this.#proxy = inject(DataSourceProxy);
|
|
1330
|
-
this.filter = input.required();
|
|
1332
|
+
this.filter = input.required(...(ngDevMode ? [{ debugName: "filter" }] : []));
|
|
1331
1333
|
this.filter$ = toObservable(this.filter);
|
|
1332
1334
|
combineLatest({ query: this.#proxy.query$, filter: this.filter$ })
|
|
1333
1335
|
.pipe(takeUntilDestroyed())
|
|
1334
1336
|
.subscribe(({ query, filter }) => query.filter.forced.set(filter));
|
|
1335
1337
|
}
|
|
1336
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1337
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
1338
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxyFilter, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1339
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.13", type: DataSourceProxyFilter, isStandalone: true, selector: "[nuDataSource][filter]", inputs: { filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
1338
1340
|
}
|
|
1339
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1341
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxyFilter, decorators: [{
|
|
1340
1342
|
type: Directive,
|
|
1341
1343
|
args: [{
|
|
1342
1344
|
selector: "[nuDataSource][filter]"
|
|
1343
1345
|
}]
|
|
1344
|
-
}], ctorParameters: () => [] });
|
|
1346
|
+
}], ctorParameters: () => [], propDecorators: { filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: true }] }] } });
|
|
1345
1347
|
class DataSourceProxySorter {
|
|
1346
1348
|
#proxy;
|
|
1347
1349
|
constructor() {
|
|
1348
1350
|
this.#proxy = inject(DataSourceProxy);
|
|
1349
|
-
this.sorter = input.required();
|
|
1351
|
+
this.sorter = input.required(...(ngDevMode ? [{ debugName: "sorter" }] : []));
|
|
1350
1352
|
this.sorter$ = toObservable(this.sorter);
|
|
1351
1353
|
combineLatest({ query: this.#proxy.query$, sorter: this.sorter$ })
|
|
1352
1354
|
.pipe(takeUntilDestroyed())
|
|
1353
1355
|
.subscribe(({ query, sorter }) => query.sorter.forced.set(sorter));
|
|
1354
1356
|
}
|
|
1355
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1356
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
1357
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxySorter, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1358
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.13", type: DataSourceProxySorter, isStandalone: true, selector: "[nuDataSource][sorter]", inputs: { sorter: { classPropertyName: "sorter", publicName: "sorter", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
1357
1359
|
}
|
|
1358
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1360
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxySorter, decorators: [{
|
|
1359
1361
|
type: Directive,
|
|
1360
1362
|
args: [{
|
|
1361
1363
|
selector: "[nuDataSource][sorter]"
|
|
1362
1364
|
}]
|
|
1363
|
-
}], ctorParameters: () => [] });
|
|
1365
|
+
}], ctorParameters: () => [], propDecorators: { sorter: [{ type: i0.Input, args: [{ isSignal: true, alias: "sorter", required: true }] }] } });
|
|
1364
1366
|
class DataSourceProxySlimer {
|
|
1365
1367
|
#proxy;
|
|
1366
1368
|
constructor() {
|
|
1367
1369
|
this.#proxy = inject(DataSourceProxy);
|
|
1368
|
-
this.slimer = input.required();
|
|
1370
|
+
this.slimer = input.required(...(ngDevMode ? [{ debugName: "slimer" }] : []));
|
|
1369
1371
|
this.slimer$ = toObservable(this.slimer);
|
|
1370
1372
|
combineLatest({ query: this.#proxy.query$, slimer: this.slimer$ })
|
|
1371
1373
|
.pipe(takeUntilDestroyed())
|
|
1372
1374
|
.subscribe(({ query, slimer }) => query.slimer.forced.set(slimer));
|
|
1373
1375
|
}
|
|
1374
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1375
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
1376
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxySlimer, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1377
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.13", type: DataSourceProxySlimer, isStandalone: true, selector: "[nuDataSource][slimer]", inputs: { slimer: { classPropertyName: "slimer", publicName: "slimer", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
1376
1378
|
}
|
|
1377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxySlimer, decorators: [{
|
|
1378
1380
|
type: Directive,
|
|
1379
1381
|
args: [{
|
|
1380
1382
|
selector: "[nuDataSource][slimer]"
|
|
1381
1383
|
}]
|
|
1382
|
-
}], ctorParameters: () => [] });
|
|
1384
|
+
}], ctorParameters: () => [], propDecorators: { slimer: [{ type: i0.Input, args: [{ isSignal: true, alias: "slimer", required: true }] }] } });
|
|
1383
1385
|
class DataSourceProxyGrouper {
|
|
1384
1386
|
#proxy;
|
|
1385
1387
|
constructor() {
|
|
1386
1388
|
this.#proxy = inject(DataSourceProxy);
|
|
1387
|
-
this.grouper = input.required();
|
|
1389
|
+
this.grouper = input.required(...(ngDevMode ? [{ debugName: "grouper" }] : []));
|
|
1388
1390
|
this.grouper$ = toObservable(this.grouper);
|
|
1389
1391
|
combineLatest({ query: this.#proxy.query$, grouper: this.grouper$ })
|
|
1390
1392
|
.pipe(takeUntilDestroyed())
|
|
1391
1393
|
.subscribe(({ query, grouper }) => query.grouper.forced.set(grouper));
|
|
1392
1394
|
}
|
|
1393
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1394
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
1395
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxyGrouper, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1396
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.13", type: DataSourceProxyGrouper, isStandalone: true, selector: "[nuDataSource][grouper]", inputs: { grouper: { classPropertyName: "grouper", publicName: "grouper", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
1395
1397
|
}
|
|
1396
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxyGrouper, decorators: [{
|
|
1397
1399
|
type: Directive,
|
|
1398
1400
|
args: [{
|
|
1399
1401
|
selector: "[nuDataSource][grouper]"
|
|
1400
1402
|
}]
|
|
1401
|
-
}], ctorParameters: () => [] });
|
|
1403
|
+
}], ctorParameters: () => [], propDecorators: { grouper: [{ type: i0.Input, args: [{ isSignal: true, alias: "grouper", required: true }] }] } });
|
|
1402
1404
|
class DataSourceProxyBusy {
|
|
1403
1405
|
#proxy = inject(DataSourceProxy);
|
|
1404
1406
|
#busy = inject(BusyDirective);
|
|
@@ -1407,10 +1409,10 @@ class DataSourceProxyBusy {
|
|
|
1407
1409
|
.pipe(takeUntilDestroyed(), switchMap(value => value.isBusy$))
|
|
1408
1410
|
.subscribe(isBusy => this.#busy.set(isBusy, "data-source"));
|
|
1409
1411
|
}
|
|
1410
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1411
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
1412
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxyBusy, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1413
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.13", type: DataSourceProxyBusy, isStandalone: true, selector: "[nuDataSource][nuBusy]", ngImport: i0 }); }
|
|
1412
1414
|
}
|
|
1413
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1415
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceProxyBusy, decorators: [{
|
|
1414
1416
|
type: Directive,
|
|
1415
1417
|
args: [{
|
|
1416
1418
|
selector: "[nuDataSource][nuBusy]"
|
|
@@ -1597,8 +1599,8 @@ class ObservableProvider extends LocalProvider {
|
|
|
1597
1599
|
}
|
|
1598
1600
|
|
|
1599
1601
|
class DataSourceModule {
|
|
1600
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1601
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1602
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1603
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.13", ngImport: i0, type: DataSourceModule, imports: [DataSourceProxy,
|
|
1602
1604
|
DataSourceProxyBusy,
|
|
1603
1605
|
DataSourceProxyFilter,
|
|
1604
1606
|
DataSourceProxyGrouper,
|
|
@@ -1609,9 +1611,9 @@ class DataSourceModule {
|
|
|
1609
1611
|
DataSourceProxyGrouper,
|
|
1610
1612
|
DataSourceProxySlimer,
|
|
1611
1613
|
DataSourceProxySorter] }); }
|
|
1612
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
1614
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceModule }); }
|
|
1613
1615
|
}
|
|
1614
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1616
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DataSourceModule, decorators: [{
|
|
1615
1617
|
type: NgModule,
|
|
1616
1618
|
args: [{
|
|
1617
1619
|
imports: [
|