@ngdux/list 3.0.1 → 5.0.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/ngdux-list.mjs +215 -20
- package/fesm2022/ngdux-list.mjs.map +1 -1
- package/package.json +9 -11
- package/types/ngdux-list.d.ts +429 -0
- package/esm2022/index.mjs +0 -12
- package/esm2022/lib/+state/effects.mjs +0 -23
- package/esm2022/lib/+state/state.service.mjs +0 -55
- package/esm2022/lib/models/list.model.mjs +0 -7
- package/esm2022/lib/ngdux-list-state.module.mjs +0 -53
- package/esm2022/lib/services/list-notification-service.mjs +0 -21
- package/esm2022/lib/state-generator/abstract-list-effects.mjs +0 -50
- package/esm2022/lib/state-generator/abstract-list-state.service.mjs +0 -44
- package/esm2022/lib/state-generator/abstract-list.facade.mjs +0 -85
- package/esm2022/lib/state-generator/list-actions.mjs +0 -58
- package/esm2022/lib/state-generator/list-reducer.mjs +0 -104
- package/esm2022/lib/state-generator/list-selectors.mjs +0 -80
- package/esm2022/lib/state-generator/list-state.mjs +0 -18
- package/esm2022/ngdux-list.mjs +0 -5
- package/index.d.ts +0 -11
- package/lib/+state/effects.d.ts +0 -14
- package/lib/+state/state.service.d.ts +0 -22
- package/lib/models/list.model.d.ts +0 -191
- package/lib/ngdux-list-state.module.d.ts +0 -23
- package/lib/services/list-notification-service.d.ts +0 -13
- package/lib/state-generator/abstract-list-effects.d.ts +0 -49
- package/lib/state-generator/abstract-list-state.service.d.ts +0 -21
- package/lib/state-generator/abstract-list.facade.d.ts +0 -45
- package/lib/state-generator/list-actions.d.ts +0 -2
- package/lib/state-generator/list-reducer.d.ts +0 -10
- package/lib/state-generator/list-selectors.d.ts +0 -4
- package/lib/state-generator/list-state.d.ts +0 -12
package/fesm2022/ngdux-list.mjs
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequestState, getDefaultRequestOptions, DEFAULT_PAGE } from '@ngdux/data-model-common';
|
|
2
2
|
export { RequestState } from '@ngdux/data-model-common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken,
|
|
4
|
+
import { InjectionToken, Inject, Injectable, Optional, NgModule, inject } from '@angular/core';
|
|
5
5
|
import * as i1 from '@ngrx/store';
|
|
6
|
-
import { createAction, props, createReducer, on, createSelector, createFeatureSelector, select, Store } from '@ngrx/store';
|
|
6
|
+
import { createAction, props, createReducer, on, createSelector, createFeatureSelector, select, Store, provideState } from '@ngrx/store';
|
|
7
7
|
import * as i1$1 from '@ngdux/store-common';
|
|
8
8
|
import { getLastPageNumber, createLoadingStateActionHandlers, createRequestStateActionHandlers } from '@ngdux/store-common';
|
|
9
9
|
import { createEntityAdapter } from '@ngrx/entity';
|
|
10
10
|
import * as i2 from '@ngrx/effects';
|
|
11
|
-
import { createEffect, ofType, Actions } from '@ngrx/effects';
|
|
11
|
+
import { createEffect, ofType, Actions, provideEffects } from '@ngrx/effects';
|
|
12
12
|
import { __decorate, __param, __metadata } from 'tslib';
|
|
13
|
-
import { of } from 'rxjs';
|
|
13
|
+
import { of, map as map$1, withLatestFrom as withLatestFrom$1, filter as filter$1, switchMap as switchMap$1, catchError as catchError$1, exhaustMap as exhaustMap$1, tap as tap$1 } from 'rxjs';
|
|
14
14
|
import { map, withLatestFrom, filter, switchMap, catchError, exhaustMap, tap } from 'rxjs/operators';
|
|
15
15
|
|
|
16
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
17
16
|
const LIST_FEATURE_KEY = new InjectionToken('LIST_FEATURE_KEY');
|
|
18
17
|
const LIST_FEATURE_KEYS = new InjectionToken('LIST_FEATURE_KEYS');
|
|
19
18
|
const LIST_SERVICES = new InjectionToken('LIST_SERVICES');
|
|
@@ -291,16 +290,19 @@ class ListStateService {
|
|
|
291
290
|
getFeatureSelectors(featureKey) {
|
|
292
291
|
return this.selectors[featureKey];
|
|
293
292
|
}
|
|
294
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
295
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
293
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ListStateService, deps: [{ token: i1.ReducerManager }, { token: LIST_FEATURE_KEYS }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
294
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ListStateService }); }
|
|
296
295
|
}
|
|
297
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
296
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ListStateService, decorators: [{
|
|
298
297
|
type: Injectable
|
|
299
298
|
}], ctorParameters: () => [{ type: i1.ReducerManager }, { type: undefined, decorators: [{
|
|
300
299
|
type: Inject,
|
|
301
300
|
args: [LIST_FEATURE_KEYS]
|
|
302
301
|
}] }] });
|
|
303
302
|
|
|
303
|
+
/**
|
|
304
|
+
* @deprecated This class is deprecated and will be removed in a future release. Please use `createListEffects` instead.
|
|
305
|
+
*/
|
|
304
306
|
class AbstractListEffects {
|
|
305
307
|
constructor(actions$, store, service, listActions, listSelectors, notificationService) {
|
|
306
308
|
this.actions$ = actions$;
|
|
@@ -374,13 +376,16 @@ class NotificationServicePlaceholder {
|
|
|
374
376
|
console.log(data.title, data.message);
|
|
375
377
|
return of(true);
|
|
376
378
|
}
|
|
377
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
378
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
379
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: NotificationServicePlaceholder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
380
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: NotificationServicePlaceholder }); }
|
|
379
381
|
}
|
|
380
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: NotificationServicePlaceholder, decorators: [{
|
|
381
383
|
type: Injectable
|
|
382
384
|
}] });
|
|
383
385
|
|
|
386
|
+
/**
|
|
387
|
+
* @deprecated This NgModule is deprecated and will be removed in a future release. Use `provideListState` and `createListState` instead to set up your list state in a more modular way.
|
|
388
|
+
*/
|
|
384
389
|
class NgduxListStateModule {
|
|
385
390
|
constructor(registerEffectsService, actions$, store, listStateService, featureKeys, services, notificationServices) {
|
|
386
391
|
featureKeys.forEach((featureKey, index) => {
|
|
@@ -401,11 +406,11 @@ class NgduxListStateModule {
|
|
|
401
406
|
]
|
|
402
407
|
};
|
|
403
408
|
}
|
|
404
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
405
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
406
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
409
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: NgduxListStateModule, deps: [{ token: i1$1.RegisterEffectsService }, { token: i2.Actions }, { token: i1.Store }, { token: ListStateService }, { token: LIST_FEATURE_KEYS }, { token: LIST_SERVICES }, { token: LIST_NOTIFICATION_SERVICES }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
410
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.4", ngImport: i0, type: NgduxListStateModule }); }
|
|
411
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: NgduxListStateModule, providers: [ListStateService] }); }
|
|
407
412
|
}
|
|
408
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
413
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: NgduxListStateModule, decorators: [{
|
|
409
414
|
type: NgModule,
|
|
410
415
|
args: [{
|
|
411
416
|
providers: [ListStateService]
|
|
@@ -421,6 +426,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
|
421
426
|
args: [LIST_NOTIFICATION_SERVICES]
|
|
422
427
|
}] }] });
|
|
423
428
|
|
|
429
|
+
/**
|
|
430
|
+
* @deprecated This class is deprecated and will be removed in a future release.
|
|
431
|
+
*/
|
|
424
432
|
class AbstractListReducerManager {
|
|
425
433
|
constructor(reducerManager, featureKey) {
|
|
426
434
|
this.reducerManager = reducerManager;
|
|
@@ -447,16 +455,19 @@ class AbstractListReducerManager {
|
|
|
447
455
|
const getState = createFeatureSelector(this.featureKey);
|
|
448
456
|
return createListSelectors(this.entityAdapter, getState);
|
|
449
457
|
}
|
|
450
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
451
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
458
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: AbstractListReducerManager, deps: [{ token: i1.ReducerManager }, { token: LIST_FEATURE_KEY }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
459
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: AbstractListReducerManager }); }
|
|
452
460
|
}
|
|
453
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: AbstractListReducerManager, decorators: [{
|
|
454
462
|
type: Injectable
|
|
455
463
|
}], ctorParameters: () => [{ type: i1.ReducerManager }, { type: undefined, decorators: [{
|
|
456
464
|
type: Inject,
|
|
457
465
|
args: [LIST_FEATURE_KEY]
|
|
458
466
|
}] }] });
|
|
459
467
|
|
|
468
|
+
/**
|
|
469
|
+
* @deprecated This class is deprecated and will be removed in a future release. Please use `provideListFacade` or `createListFacade` instead.
|
|
470
|
+
*/
|
|
460
471
|
class AbstractListFacade {
|
|
461
472
|
constructor(store, listActions, listSelectors) {
|
|
462
473
|
this.store = store;
|
|
@@ -541,6 +552,178 @@ class AbstractListFacade {
|
|
|
541
552
|
}
|
|
542
553
|
}
|
|
543
554
|
|
|
555
|
+
function createListEffects(listActions, listSelectors, listService, notificationService) {
|
|
556
|
+
return {
|
|
557
|
+
reload$: createEffect((actions$ = inject(Actions)) => reloadEffect(actions$, listActions), { functional: true }),
|
|
558
|
+
loadFirstPage$: createEffect((actions$ = inject(Actions)) => loadFirstPageEffect(actions$, listActions), {
|
|
559
|
+
functional: true
|
|
560
|
+
}),
|
|
561
|
+
loadPreviousPage$: createEffect((store = inject(Store), actions$ = inject(Actions)) => loadPreviousPageEffect(store, actions$, listActions, listSelectors), { functional: true }),
|
|
562
|
+
loadNextPage$: createEffect((store = inject(Store), actions$ = inject(Actions)) => loadNextPageEffect(store, actions$, listActions, listSelectors), { functional: true }),
|
|
563
|
+
loadPage$: createEffect((store = inject(Store), actions$ = inject(Actions), service = listService()) => loadPageEffect(store, actions$, listActions, listSelectors, service), { functional: true }),
|
|
564
|
+
patch$: createEffect((actions$ = inject(Actions), service = listService()) => patchEffect(actions$, listActions, service), { functional: true }),
|
|
565
|
+
delete$: createEffect((actions$ = inject(Actions), service = listService()) => deleteEffect(actions$, listActions, service), { functional: true }),
|
|
566
|
+
deleteSuccess$: createEffect((actions$ = inject(Actions), service = notificationService()) => deleteSuccessEffect(actions$, listActions, service), { functional: true, dispatch: false }),
|
|
567
|
+
errorsHandler$: createEffect((actions$ = inject(Actions), service = notificationService()) => errorsHandlerEffect(actions$, listActions, service), { functional: true, dispatch: false })
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
function reloadEffect(actions$, listActions) {
|
|
571
|
+
return actions$.pipe(ofType(listActions.changePageSize, listActions.changeSorting, listActions.changeFiltering, listActions.changePagingOptions, listActions.changeRequestParams, listActions.initialize, listActions.reset, listActions.changePageNumber, listActions.patchSuccess, listActions.deleteSuccess), map$1(() => listActions.loadPage()));
|
|
572
|
+
}
|
|
573
|
+
function loadFirstPageEffect(actions$, listActions) {
|
|
574
|
+
return actions$.pipe(ofType(listActions.loadFirstPage), map$1(() => listActions.changePageNumber({ pageNumber: 1 })));
|
|
575
|
+
}
|
|
576
|
+
function loadPreviousPageEffect(store, actions$, listActions, listSelectors) {
|
|
577
|
+
return actions$.pipe(ofType(listActions.loadPreviousPage), withLatestFrom$1(store.pipe(select(listSelectors.getCurrentPageNumber))), filter$1(([, currentPageNumber]) => currentPageNumber > 1), map$1(([, currentPageNumber]) => listActions.changePageNumber({ pageNumber: currentPageNumber - 1 })));
|
|
578
|
+
}
|
|
579
|
+
function loadNextPageEffect(store, actions$, listActions, listSelectors) {
|
|
580
|
+
return actions$.pipe(ofType(listActions.loadNextPage), withLatestFrom$1(store.pipe(select(listSelectors.isLastPage)), store.pipe(select(listSelectors.getCurrentPageNumber))), filter$1(([, isLastPage]) => !isLastPage), map$1(([, , currentPageNumber]) => listActions.changePageNumber({ pageNumber: currentPageNumber + 1 })));
|
|
581
|
+
}
|
|
582
|
+
function loadPageEffect(store, actions$, listActions, listSelectors, service) {
|
|
583
|
+
return actions$.pipe(ofType(listActions.loadPage), withLatestFrom$1(store.pipe(select(listSelectors.getPagingOptions)), store.pipe(select(listSelectors.getSortingOptions)), store.pipe(select(listSelectors.getFilteringOptions)), store.pipe(select(listSelectors.getRequestParameters))), switchMap$1(([, pagingOptions, sortingOptions, filteringOptions, requestParameters]) => {
|
|
584
|
+
return service
|
|
585
|
+
.loadResources({
|
|
586
|
+
pagingOptions,
|
|
587
|
+
sortingOptions,
|
|
588
|
+
filteringOptions,
|
|
589
|
+
requestParameters
|
|
590
|
+
})
|
|
591
|
+
.pipe(map$1(resources => listActions.loadPageSuccess({
|
|
592
|
+
resources,
|
|
593
|
+
pagingOptions
|
|
594
|
+
})), catchError$1((errors) => of(listActions.loadPageFailure({ errors }))));
|
|
595
|
+
}));
|
|
596
|
+
}
|
|
597
|
+
function patchEffect(actions$, listActions, service) {
|
|
598
|
+
return actions$.pipe(ofType(listActions.patch), exhaustMap$1(action => {
|
|
599
|
+
if (!service.patchResources) {
|
|
600
|
+
throw new Error('patchResources not implement in the ListService');
|
|
601
|
+
}
|
|
602
|
+
return service.patchResources(action.resourceIds, action.resource).pipe(map$1(resources => listActions.patchSuccess({ resources })), catchError$1((errors) => of(listActions.patchFailure({ errors }))));
|
|
603
|
+
}));
|
|
604
|
+
}
|
|
605
|
+
function deleteEffect(actions$, listActions, service) {
|
|
606
|
+
return actions$.pipe(ofType(listActions.delete), exhaustMap$1(({ resourceIds }) => {
|
|
607
|
+
if (!service.deleteResources) {
|
|
608
|
+
throw new Error('deleteResources not implement in the ListService');
|
|
609
|
+
}
|
|
610
|
+
return service.deleteResources(resourceIds).pipe(map$1(() => listActions.deleteSuccess({ resourceIds })), catchError$1((errors) => of(listActions.deleteFailure({ errors }))));
|
|
611
|
+
}));
|
|
612
|
+
}
|
|
613
|
+
function deleteSuccessEffect(actions$, listActions, notificationService) {
|
|
614
|
+
return actions$.pipe(ofType(listActions.deleteSuccess), tap$1(({ resourceIds }) => {
|
|
615
|
+
notificationService?.onListDelete(resourceIds);
|
|
616
|
+
}));
|
|
617
|
+
}
|
|
618
|
+
function errorsHandlerEffect(actions$, listActions, notificationService) {
|
|
619
|
+
return actions$.pipe(ofType(listActions.loadPageFailure, listActions.deleteFailure, listActions.patchFailure), tap$1(({ errors }) => {
|
|
620
|
+
notificationService?.onListErrors(errors);
|
|
621
|
+
}));
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
function provideListFacade(token, listActions, listSelectors) {
|
|
625
|
+
return {
|
|
626
|
+
provide: token,
|
|
627
|
+
useFactory: () => createListFacade(listActions, listSelectors, inject(Store))
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
function createListFacade(listActions, listSelectors, store) {
|
|
631
|
+
const resources$ = store.pipe(select(listSelectors.getAll));
|
|
632
|
+
const loadingState$ = store.pipe(select(listSelectors.getLoadingState));
|
|
633
|
+
const requestState$ = store.pipe(select(listSelectors.getRequestState));
|
|
634
|
+
const errors$ = store.pipe(select(listSelectors.getErrors));
|
|
635
|
+
const isReady$ = store.pipe(select(listSelectors.isReady));
|
|
636
|
+
const areSelectedReady$ = store.pipe(select(listSelectors.areSelectedReady));
|
|
637
|
+
const currentPageData$ = store.pipe(select(listSelectors.getCurrentPageData));
|
|
638
|
+
const currentPageNumber$ = store.pipe(select(listSelectors.getCurrentPageNumber));
|
|
639
|
+
const filteringOptions$ = store.pipe(select(listSelectors.getFilteringOptions));
|
|
640
|
+
const requestParameters$ = store.pipe(select(listSelectors.getRequestParameters));
|
|
641
|
+
const lastPageNumber$ = store.pipe(select(listSelectors.getLastPageNumber));
|
|
642
|
+
const pagingOptions$ = store.pipe(select(listSelectors.getPagingOptions));
|
|
643
|
+
const requestOptions$ = store.pipe(select(listSelectors.getRequestOptions));
|
|
644
|
+
const sortingOptions$ = store.pipe(select(listSelectors.getSortingOptions));
|
|
645
|
+
const selectedItems$ = store.pipe(select(listSelectors.getSelectedItems));
|
|
646
|
+
const totalCount$ = store.pipe(select(listSelectors.getTotalCount));
|
|
647
|
+
return {
|
|
648
|
+
resources$,
|
|
649
|
+
loadingState$,
|
|
650
|
+
requestState$,
|
|
651
|
+
errors$,
|
|
652
|
+
isReady$,
|
|
653
|
+
areSelectedReady$,
|
|
654
|
+
currentPageData$,
|
|
655
|
+
currentPageNumber$,
|
|
656
|
+
filteringOptions$,
|
|
657
|
+
requestParameters$,
|
|
658
|
+
lastPageNumber$,
|
|
659
|
+
pagingOptions$,
|
|
660
|
+
requestOptions$,
|
|
661
|
+
sortingOptions$,
|
|
662
|
+
selectedItems$,
|
|
663
|
+
totalCount$,
|
|
664
|
+
setPageSize(props) {
|
|
665
|
+
store.dispatch(listActions.setPageSize(props));
|
|
666
|
+
},
|
|
667
|
+
setFiltering(props) {
|
|
668
|
+
store.dispatch(listActions.setFiltering(props));
|
|
669
|
+
},
|
|
670
|
+
setSorting(props) {
|
|
671
|
+
store.dispatch(listActions.setSorting(props));
|
|
672
|
+
},
|
|
673
|
+
setRequestParameters(props) {
|
|
674
|
+
store.dispatch(listActions.setRequestParams(props));
|
|
675
|
+
},
|
|
676
|
+
changeFiltering(props) {
|
|
677
|
+
store.dispatch(listActions.changeFiltering(props));
|
|
678
|
+
},
|
|
679
|
+
changePagingOptions(props) {
|
|
680
|
+
store.dispatch(listActions.changePagingOptions(props));
|
|
681
|
+
},
|
|
682
|
+
changePageSize(props) {
|
|
683
|
+
store.dispatch(listActions.changePageSize(props));
|
|
684
|
+
},
|
|
685
|
+
changePageNumber(props) {
|
|
686
|
+
store.dispatch(listActions.changePageNumber(props));
|
|
687
|
+
},
|
|
688
|
+
changeSelectedResources(props) {
|
|
689
|
+
store.dispatch(listActions.changeSelectedResources(props));
|
|
690
|
+
},
|
|
691
|
+
changeSorting(props) {
|
|
692
|
+
store.dispatch(listActions.changeSorting(props));
|
|
693
|
+
},
|
|
694
|
+
changeRequestParams(props) {
|
|
695
|
+
store.dispatch(listActions.changeRequestParams(props));
|
|
696
|
+
},
|
|
697
|
+
loadPage() {
|
|
698
|
+
store.dispatch(listActions.loadPage());
|
|
699
|
+
},
|
|
700
|
+
loadFirstPage() {
|
|
701
|
+
store.dispatch(listActions.loadFirstPage());
|
|
702
|
+
},
|
|
703
|
+
loadNextPage() {
|
|
704
|
+
store.dispatch(listActions.loadNextPage());
|
|
705
|
+
},
|
|
706
|
+
loadPreviousPage() {
|
|
707
|
+
store.dispatch(listActions.loadPreviousPage());
|
|
708
|
+
},
|
|
709
|
+
patch(props) {
|
|
710
|
+
store.dispatch(listActions.patch(props));
|
|
711
|
+
},
|
|
712
|
+
delete(props) {
|
|
713
|
+
store.dispatch(listActions.delete(props));
|
|
714
|
+
},
|
|
715
|
+
initialize() {
|
|
716
|
+
store.dispatch(listActions.initialize());
|
|
717
|
+
},
|
|
718
|
+
reinitialize() {
|
|
719
|
+
store.dispatch(listActions.reset());
|
|
720
|
+
},
|
|
721
|
+
resetRequestState() {
|
|
722
|
+
store.dispatch(listActions.resetRequestState());
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
|
|
544
727
|
function createListState(featureName, idKey) {
|
|
545
728
|
const actions = createListActions(featureName);
|
|
546
729
|
const entityAdapter = createListEntityAdapter(idKey);
|
|
@@ -554,10 +737,22 @@ function createListState(featureName, idKey) {
|
|
|
554
737
|
entityAdapter
|
|
555
738
|
};
|
|
556
739
|
}
|
|
740
|
+
function provideListState(featureKey, facadeToken, service, notificationService = (NotificationServicePlaceholder)) {
|
|
741
|
+
const { actions, selectors, reducer } = createListState(featureKey);
|
|
742
|
+
return [
|
|
743
|
+
provideState(featureKey, reducer),
|
|
744
|
+
provideListFacade(facadeToken, actions, selectors),
|
|
745
|
+
provideEffects([
|
|
746
|
+
createListEffects(actions, selectors, () => inject(service), () => inject(notificationService))
|
|
747
|
+
]),
|
|
748
|
+
service,
|
|
749
|
+
notificationService
|
|
750
|
+
];
|
|
751
|
+
}
|
|
557
752
|
|
|
558
753
|
/**
|
|
559
754
|
* Generated bundle index. Do not edit.
|
|
560
755
|
*/
|
|
561
756
|
|
|
562
|
-
export { AbstractListEffects, AbstractListFacade, AbstractListReducerManager, LIST_FEATURE_KEY, LIST_FEATURE_KEYS, LIST_NOTIFICATION_SERVICES, LIST_SERVICES, ListStateService, NgduxListStateModule, createListActions, createListEntityAdapter, createListReducer, createListSelectors, createListState };
|
|
757
|
+
export { AbstractListEffects, AbstractListFacade, AbstractListReducerManager, LIST_FEATURE_KEY, LIST_FEATURE_KEYS, LIST_NOTIFICATION_SERVICES, LIST_SERVICES, ListStateService, NgduxListStateModule, createListActions, createListEntityAdapter, createListReducer, createListSelectors, createListState, provideListState };
|
|
563
758
|
//# sourceMappingURL=ngdux-list.mjs.map
|