@ngrx-traits/common 12.0.0-beta.3 → 12.1.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/README.md +6 -4
- package/bundles/ngrx-traits-common.umd.js +3 -3
- package/bundles/ngrx-traits-common.umd.js.map +1 -1
- package/entities-pagination/entities-pagination.trait.d.ts +1 -1
- package/esm2015/entities-pagination/entities-pagination.trait.js +2 -2
- package/esm2015/entities-pagination/entities-pagination.trait.js.map +1 -1
- package/esm2015/filter-entities/filter-entities.trait.js +1 -1
- package/esm2015/filter-entities/filter-entities.trait.js.map +1 -1
- package/fesm2015/ngrx-traits-common.js +3 -3
- package/fesm2015/ngrx-traits-common.js.map +1 -1
- package/filter-entities/filter-entities.trait.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# NGRX-Traits
|
|
2
2
|
|
|
3
|
-
NGRX Traits is a
|
|
3
|
+
NGRX Traits is a library to help you compose and reuse a set ngrx actions, selectors, effects and reducers across your app.
|
|
4
4
|
|
|
5
5
|
# Features
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ NGRX Traits is a set of factory functions that dynamically generate actions, eff
|
|
|
8
8
|
- ✅ Easily mix with your own actions, selectors, reducers, and effects
|
|
9
9
|
- ✅ Create your own traits, to easily reuse business logic
|
|
10
10
|
- ✅ Transform any trait config from a global store to a local store bound to a components lifecycle
|
|
11
|
-
- ✅ Trait to load
|
|
11
|
+
- ✅ Trait to load entities list
|
|
12
12
|
- ✅ Trait to filter remote and locally entities list
|
|
13
13
|
- ✅ Trait to sort remote and locally entities list
|
|
14
14
|
- ✅ Trait to paginate entities list
|
|
@@ -16,9 +16,11 @@ NGRX Traits is a set of factory functions that dynamically generate actions, eff
|
|
|
16
16
|
- ✅ Trait to add crud operations to an entities list
|
|
17
17
|
- ✅ Trait to load single entities
|
|
18
18
|
- ✅ Trait to reduce boilerplate needed when calling backend apis
|
|
19
|
+
- ✅ Trait to set a value in the store
|
|
20
|
+
- ✅ Caching
|
|
19
21
|
|
|
20
22
|
# Installation and Usage
|
|
21
23
|
|
|
22
|
-
`npm
|
|
24
|
+
`npm i @ngrx-traits/{core,common} --save`
|
|
23
25
|
|
|
24
|
-
For more documentation go to our [github page](https://github.com/gabrielguerrero/ngrx-traits
|
|
26
|
+
For more documentation go to our [github page](https://github.com/gabrielguerrero/ngrx-traits)
|
|
@@ -615,7 +615,7 @@
|
|
|
615
615
|
* addLoadEntitiesTrait<Todo>(),
|
|
616
616
|
* //addFilterEntitiesTrait<Todo,TodoFilter>() // no params uses remote filtering
|
|
617
617
|
* addFilterEntitiesTrait<Todo,TodoFilter>({filterFn: (filter, entity) => // local filtering
|
|
618
|
-
* filter
|
|
618
|
+
* !filter.content || !!entity.content?.includes(filter.content.toLowerCase())
|
|
619
619
|
* // or use the following function to switch between remote search and local
|
|
620
620
|
* // depending on which properties have changed in the filter
|
|
621
621
|
* // isRemoteFilter: (previous, current) => previous?.someRemoteParam !== current?.someRemoteParam,
|
|
@@ -887,7 +887,7 @@
|
|
|
887
887
|
* To make the pagination experience smoother the loadEntities to get new pages is done when the current page is change to
|
|
888
888
|
* the last cached page.
|
|
889
889
|
* @param config
|
|
890
|
-
* @param config.cacheType - Default to '
|
|
890
|
+
* @param config.cacheType - Default to 'partial', change the cache mode
|
|
891
891
|
* @param config.pageSize - Default to 20, number of entities on each page
|
|
892
892
|
* @param config.currentPage - Default to 0, starting page
|
|
893
893
|
* @param config.pagesToCache - Default to 3, used in partial and grow cache mode, is the number of
|
|
@@ -929,7 +929,7 @@
|
|
|
929
929
|
* traits.selectors.selectTodosPageInfo()
|
|
930
930
|
*/
|
|
931
931
|
function addEntitiesPaginationTrait(_a) {
|
|
932
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.cacheType, cacheType = _c === void 0 ? '
|
|
932
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.cacheType, cacheType = _c === void 0 ? 'partial' : _c, _d = _b.pageSize, pageSize = _d === void 0 ? 20 : _d, _e = _b.currentPage, currentPage = _e === void 0 ? 0 : _e, _f = _b.pagesToCache, pagesToCache = _f === void 0 ? 3 : _f;
|
|
933
933
|
return core.createTraitFactory({
|
|
934
934
|
key: entitiesPaginationTraitKey,
|
|
935
935
|
depends: [loadEntitiesTraitKey],
|