@smartsoft001/crud-shell-angular 2.92.0 → 2.93.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.
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, inject, ElementRef, Component, input, Directive, computed, signal, InjectionToken, Pipe, NgModule, viewChild, viewChildren, output, ChangeDetectorRef, effect, Injector } from '@angular/core';
3
- import { NgrxStoreService, BaseComponent as BaseComponent$1, PopoverService, StyleService, ButtonComponent, MenuService, FormComponent, AccordionComponent, AccordionHeaderComponent, AccordionBodyComponent, ListComponent as ListComponent$1, SharedModule, DetailsComponent, AuthService, CreateDynamicComponent, DynamicComponentLoader, ToastService, DetailsService, DynamicContentDirective, PageComponent, HardwareService, ListMode, FILE_SERVICE_CONFIG, PaginationMode } from '@smartsoft001/angular';
3
+ import { NgrxStoreService, BaseComponent as BaseComponent$1, PopoverService, StyleService, ButtonComponent, MenuService, FormComponent, AccordionComponent, AccordionHeaderComponent, AccordionBodyComponent, ListComponent as ListComponent$1, SharedModule, PaginationMode, DetailsComponent, AuthService, CreateDynamicComponent, DynamicComponentLoader, ToastService, DetailsService, DynamicContentDirective, PageComponent, HardwareService, ListMode, FILE_SERVICE_CONFIG } from '@smartsoft001/angular';
4
4
  import { toSignal } from '@angular/core/rxjs-interop';
5
5
  import * as i1 from '@ngrx/store';
6
6
  import { createFeatureSelector, createSelector, select as select$1 } from '@ngrx/store';
7
- import { map } from 'rxjs/operators';
7
+ import { map, first } from 'rxjs/operators';
8
8
  import { FieldType, getModelOptions, getModelFieldsWithOptions } from '@smartsoft001/models';
9
9
  import { TranslateService, TranslatePipe } from '@ngx-translate/core';
10
10
  import { __decorate, __metadata } from 'tslib';
@@ -17,7 +17,8 @@ import { NgComponentOutlet, NgClass, CommonModule, NgTemplateOutlet, Location }
17
17
  import * as _ from 'lodash';
18
18
  import { DynamicIoDirective, DynamicIoModule } from 'ng-dynamic-component';
19
19
  import { HttpClient } from '@angular/common/http';
20
- import * as i1$1 from '@angular/router';
20
+ import 'reflect-metadata';
21
+ import * as i3 from '@angular/router';
21
22
  import { Router, ActivatedRoute, RouterModule } from '@angular/router';
22
23
 
23
24
  class CrudConfig {
@@ -1784,6 +1785,388 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
1784
1785
  }]
1785
1786
  }] });
1786
1787
 
1788
+ const initialState = {
1789
+ loaded: false,
1790
+ };
1791
+ const crudReducer = (state, action, entity) => {
1792
+ if (!state) {
1793
+ state = { ...initialState };
1794
+ }
1795
+ switch (action.type) {
1796
+ case `[${entity}] Create`:
1797
+ return {
1798
+ ...state,
1799
+ loaded: false,
1800
+ error: null,
1801
+ };
1802
+ case `[${entity}] Create Success`:
1803
+ return {
1804
+ ...state,
1805
+ loaded: true,
1806
+ error: null,
1807
+ };
1808
+ case `[${entity}] Create Failure`:
1809
+ return {
1810
+ ...state,
1811
+ loaded: true,
1812
+ error: action.error,
1813
+ };
1814
+ case `[${entity}] Create Many`:
1815
+ return {
1816
+ ...state,
1817
+ loaded: false,
1818
+ error: null,
1819
+ };
1820
+ case `[${entity}] Create Many Success`:
1821
+ return {
1822
+ ...state,
1823
+ loaded: true,
1824
+ error: null,
1825
+ };
1826
+ case `[${entity}] Create Many Failure`:
1827
+ return {
1828
+ ...state,
1829
+ loaded: true,
1830
+ error: action.error,
1831
+ };
1832
+ case `[${entity}] Export`:
1833
+ return {
1834
+ ...state,
1835
+ loaded: false,
1836
+ };
1837
+ case `[${entity}] Export Success`:
1838
+ return {
1839
+ ...state,
1840
+ loaded: true,
1841
+ };
1842
+ case `[${entity}] Export Failure`:
1843
+ return {
1844
+ ...state,
1845
+ loaded: true,
1846
+ };
1847
+ case `[${entity}] Read`:
1848
+ return {
1849
+ ...state,
1850
+ loaded: false,
1851
+ filter: action.filter,
1852
+ error: null,
1853
+ totalCount: null,
1854
+ links: null,
1855
+ };
1856
+ case `[${entity}] Read Success`: {
1857
+ let list = [];
1858
+ if (action.filter &&
1859
+ action.filter.offset &&
1860
+ state.list &&
1861
+ action.filter.paginationMode !== PaginationMode.singlePage) {
1862
+ state.list.forEach((i) => {
1863
+ list.push(i);
1864
+ });
1865
+ list = [...list, ...action.result.data];
1866
+ }
1867
+ else {
1868
+ list = action.result.data;
1869
+ }
1870
+ return {
1871
+ ...state,
1872
+ loaded: true,
1873
+ list,
1874
+ totalCount: action.result.totalCount,
1875
+ links: action.result.links,
1876
+ error: null,
1877
+ };
1878
+ }
1879
+ case `[${entity}] Clear`:
1880
+ return { ...initialState };
1881
+ case `[${entity}] Read Failure`:
1882
+ return {
1883
+ ...state,
1884
+ loaded: true,
1885
+ error: action.error,
1886
+ };
1887
+ case `[${entity}] Select`:
1888
+ return {
1889
+ ...state,
1890
+ loaded: false,
1891
+ selected: null,
1892
+ error: null,
1893
+ };
1894
+ case `[${entity}] Select Success`:
1895
+ return {
1896
+ ...state,
1897
+ loaded: true,
1898
+ selected: action.item,
1899
+ error: null,
1900
+ };
1901
+ case `[${entity}] Select Failure`:
1902
+ return {
1903
+ ...state,
1904
+ loaded: true,
1905
+ error: action.error,
1906
+ };
1907
+ case `[${entity}] MultiSelect`:
1908
+ return {
1909
+ ...state,
1910
+ multiSelected: [...action.items],
1911
+ };
1912
+ case `[${entity}] Unselect`:
1913
+ return {
1914
+ ...state,
1915
+ loaded: true,
1916
+ selected: null,
1917
+ error: null,
1918
+ };
1919
+ case `[${entity}] Update`:
1920
+ return {
1921
+ ...state,
1922
+ loaded: false,
1923
+ error: null,
1924
+ };
1925
+ case `[${entity}] Update Success`:
1926
+ return {
1927
+ ...state,
1928
+ loaded: true,
1929
+ error: null,
1930
+ };
1931
+ case `[${entity}] Update Failure`:
1932
+ return {
1933
+ ...state,
1934
+ loaded: true,
1935
+ error: action.error,
1936
+ };
1937
+ case `[${entity}] Update partial`:
1938
+ return {
1939
+ ...state,
1940
+ loaded: false,
1941
+ error: null,
1942
+ };
1943
+ case `[${entity}] Update partial Success`:
1944
+ return {
1945
+ ...state,
1946
+ loaded: true,
1947
+ error: null,
1948
+ };
1949
+ case `[${entity}] Update partial Failure`:
1950
+ return {
1951
+ ...state,
1952
+ loaded: true,
1953
+ error: action.error,
1954
+ };
1955
+ case `[${entity}] Update partial many`:
1956
+ return {
1957
+ ...state,
1958
+ loaded: false,
1959
+ error: null,
1960
+ };
1961
+ case `[${entity}] Update partial many Success`:
1962
+ return {
1963
+ ...state,
1964
+ multiSelected: [],
1965
+ loaded: true,
1966
+ error: null,
1967
+ };
1968
+ case `[${entity}] Update partial many Failure`:
1969
+ return {
1970
+ ...state,
1971
+ loaded: true,
1972
+ error: action.error,
1973
+ };
1974
+ case `[${entity}] Delete`:
1975
+ return {
1976
+ ...state,
1977
+ loaded: false,
1978
+ error: null,
1979
+ };
1980
+ case `[${entity}] Delete Success`:
1981
+ return {
1982
+ ...state,
1983
+ loaded: true,
1984
+ error: null,
1985
+ };
1986
+ case `[${entity}] Delete Failure`:
1987
+ return {
1988
+ ...state,
1989
+ loaded: true,
1990
+ error: action.error,
1991
+ };
1992
+ default:
1993
+ return state;
1994
+ }
1995
+ };
1996
+ function getReducer(entity) {
1997
+ return (state, action) => {
1998
+ return crudReducer(state, action, entity);
1999
+ };
2000
+ }
2001
+
2002
+ class CrudEffects {
2003
+ actions$;
2004
+ service;
2005
+ config;
2006
+ store;
2007
+ state;
2008
+ constructor(actions$, service, config, store, state) {
2009
+ this.actions$ = actions$;
2010
+ this.service = service;
2011
+ this.config = config;
2012
+ this.store = store;
2013
+ this.state = state;
2014
+ }
2015
+ init() {
2016
+ const metadata = Reflect.getMetadata(this.config.entity, CrudEffects);
2017
+ if (metadata)
2018
+ return;
2019
+ Reflect.defineMetadata(this.config.entity, true, CrudEffects);
2020
+ this.actions$.subscribe((action) => {
2021
+ switch (action.type) {
2022
+ case `[${this.config.entity}] Create`:
2023
+ this.service
2024
+ .create(action.item)
2025
+ .then(() => this.store.dispatch(createSuccess(this.config.entity, action.item)))
2026
+ .catch((error) => {
2027
+ this.store.dispatch(createFailure(this.config.entity, action.item, error));
2028
+ });
2029
+ break;
2030
+ case `[${this.config.entity}] Create Success`: {
2031
+ const createState = this.state.getValue()[this.config.entity];
2032
+ this.store.dispatch(read(this.config.entity, createState.filter ? { ...createState.filter, offset: 0 } : null));
2033
+ break;
2034
+ }
2035
+ case `[${this.config.entity}] Create Many`:
2036
+ this.service
2037
+ .createMany(action.data.items, action.data.options)
2038
+ .then(() => this.store.dispatch(createManySuccess(this.config.entity, {
2039
+ items: action.data.items,
2040
+ options: action.data.options,
2041
+ })))
2042
+ .catch((error) => {
2043
+ this.store.dispatch(createManyFailure(this.config.entity, {
2044
+ items: action.data.items,
2045
+ options: action.data.options,
2046
+ }, error));
2047
+ });
2048
+ break;
2049
+ case `[${this.config.entity}] Create Many Success`: {
2050
+ const createManyState = this.state.getValue()[this.config.entity];
2051
+ this.store.dispatch(read(this.config.entity, createManyState.filter
2052
+ ? { ...createManyState.filter, offset: 0 }
2053
+ : null));
2054
+ break;
2055
+ }
2056
+ case `[${this.config.entity}] Read`:
2057
+ this.service
2058
+ .getList(action.filter)
2059
+ .then((result) => this.store.dispatch(readSuccess(this.config.entity, action.filter, result)))
2060
+ .catch((error) => {
2061
+ this.store.dispatch(readFailure(this.config.entity, action.filter, error));
2062
+ });
2063
+ break;
2064
+ case `[${this.config.entity}] Export`:
2065
+ this.service
2066
+ .exportList(action.filter, action.format)
2067
+ .then(() => this.store.dispatch(exportListSuccess(this.config.entity, action.filter)))
2068
+ .catch((error) => {
2069
+ this.store.dispatch(exportListFailure(this.config.entity, action.filter, error));
2070
+ });
2071
+ break;
2072
+ case `[${this.config.entity}] Select`:
2073
+ this.service
2074
+ .getById(action.id)
2075
+ .then((result) => this.store.dispatch(selectSuccess(this.config.entity, action.id, result)))
2076
+ .catch((error) => {
2077
+ this.store.dispatch(selectFailure(this.config.entity, action.id, error));
2078
+ });
2079
+ break;
2080
+ case `[${this.config.entity}] Update`:
2081
+ this.service
2082
+ .updatePartial(action.item)
2083
+ .then(() => this.store.dispatch(updateSuccess(this.config.entity, action.item)))
2084
+ .catch((error) => {
2085
+ this.store.dispatch(updateFailure(this.config.entity, action.item, error));
2086
+ this.store.dispatch(read(this.config.entity));
2087
+ });
2088
+ break;
2089
+ case `[${this.config.entity}] Update Success`:
2090
+ this.store
2091
+ .pipe(select$1(getCrudFilter(this.config.entity)), first())
2092
+ .subscribe((filter) => {
2093
+ this.store.dispatch(read(this.config.entity, {
2094
+ ...filter,
2095
+ offset: 0,
2096
+ }));
2097
+ this.store.dispatch(select(this.config.entity, action.item.id));
2098
+ });
2099
+ break;
2100
+ case `[${this.config.entity}] Update partial`:
2101
+ this.service
2102
+ .updatePartial(action.item)
2103
+ .then(() => this.store.dispatch(updatePartialSuccess(this.config.entity, action.item)))
2104
+ .catch((error) => {
2105
+ this.store.dispatch(updatePartialFailure(this.config.entity, action.item, error));
2106
+ this.store.dispatch(read(this.config.entity));
2107
+ });
2108
+ break;
2109
+ case `[${this.config.entity}] Update partial Success`:
2110
+ this.store
2111
+ .pipe(select$1(getCrudFilter(this.config.entity)), first())
2112
+ .subscribe((filter) => {
2113
+ this.store.dispatch(read(this.config.entity, {
2114
+ ...filter,
2115
+ offset: 0,
2116
+ }));
2117
+ this.store.dispatch(select(this.config.entity, action.item.id));
2118
+ });
2119
+ break;
2120
+ case `[${this.config.entity}] Update partial many`:
2121
+ this.service
2122
+ .updatePartialMany(action.items)
2123
+ .then(() => this.store.dispatch(updatePartialManySuccess(this.config.entity, action.items)))
2124
+ .catch((error) => {
2125
+ this.store.dispatch(updatePartialManyFailure(this.config.entity, action.items, error));
2126
+ this.store.dispatch(read(this.config.entity));
2127
+ });
2128
+ break;
2129
+ case `[${this.config.entity}] Update partial many Success`:
2130
+ this.store
2131
+ .pipe(select$1(getCrudFilter(this.config.entity)), first())
2132
+ .subscribe((filter) => {
2133
+ this.store.dispatch(read(this.config.entity, {
2134
+ ...filter,
2135
+ offset: 0,
2136
+ }));
2137
+ });
2138
+ break;
2139
+ case `[${this.config.entity}] Delete`:
2140
+ this.service
2141
+ .delete(action.id)
2142
+ .then(() => this.store.dispatch(deleteSuccess(this.config.entity, action.id)))
2143
+ .catch((error) => {
2144
+ this.store.dispatch(deleteFailure(this.config.entity, action.id, error));
2145
+ });
2146
+ break;
2147
+ case `[${this.config.entity}] Delete Success`:
2148
+ this.store
2149
+ .pipe(select$1(getCrudFilter(this.config.entity)), first())
2150
+ .subscribe((filter) => {
2151
+ this.store.dispatch(read(this.config.entity, {
2152
+ ...filter,
2153
+ offset: 0,
2154
+ }));
2155
+ });
2156
+ break;
2157
+ default:
2158
+ console.warn(`No effect for action type ${action.type} in entity ${this.config.entity}`);
2159
+ break;
2160
+ }
2161
+ });
2162
+ }
2163
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: CrudEffects, deps: [{ token: i1.ActionsSubject }, { token: CrudService }, { token: CrudConfig }, { token: i1.Store }, { token: i1.State }], target: i0.ɵɵFactoryTarget.Injectable });
2164
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: CrudEffects });
2165
+ }
2166
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: CrudEffects, decorators: [{
2167
+ type: Injectable
2168
+ }], ctorParameters: () => [{ type: i1.ActionsSubject }, { type: CrudService }, { type: CrudConfig }, { type: i1.Store }, { type: i1.State }] });
2169
+
1787
2170
  class CrudItemPageBaseComponent extends BaseComponent$1 {
1788
2171
  config = inject((CrudFullConfig));
1789
2172
  facade = inject((CrudFacade));
@@ -2751,12 +3134,18 @@ const PAGES = [
2751
3134
  ItemStandardComponent,
2752
3135
  ];
2753
3136
  class CrudFullModule {
2754
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: CrudFullModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3137
+ constructor(config, effects) {
3138
+ NgrxStoreService.addReducer(config.entity, config.reducerFactory
3139
+ ? config.reducerFactory()
3140
+ : getReducer(config.entity));
3141
+ effects.init();
3142
+ }
3143
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: CrudFullModule, deps: [{ token: CrudConfig }, { token: CrudEffects }], target: i0.ɵɵFactoryTarget.NgModule });
2755
3144
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: CrudFullModule, imports: [ItemComponent,
2756
3145
  ListComponent,
2757
3146
  ListStandardComponent,
2758
3147
  ItemStandardComponent, SharedModule,
2759
- CrudPipesModule, i1$1.RouterModule, FormsModule,
3148
+ CrudPipesModule, i3.RouterModule, FormsModule,
2760
3149
  CommonModule,
2761
3150
  CrudComponentsModule], exports: [ItemComponent,
2762
3151
  ListComponent,
@@ -2767,6 +3156,7 @@ class CrudFullModule {
2767
3156
  CrudListGroupService,
2768
3157
  PageService,
2769
3158
  CrudFacade,
3159
+ CrudEffects,
2770
3160
  CrudListPaginationFactory,
2771
3161
  ], imports: [PAGES, SharedModule,
2772
3162
  CrudPipesModule,
@@ -2801,13 +3191,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
2801
3191
  CrudListGroupService,
2802
3192
  PageService,
2803
3193
  CrudFacade,
3194
+ CrudEffects,
2804
3195
  CrudListPaginationFactory,
2805
3196
  ],
2806
3197
  }]
2807
- }] });
3198
+ }], ctorParameters: () => [{ type: CrudConfig }, { type: CrudEffects }] });
2808
3199
 
2809
3200
  class CrudCoreModule {
2810
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: CrudCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3201
+ constructor(config, effects) {
3202
+ NgrxStoreService.addReducer(config.entity, config.reducerFactory
3203
+ ? config.reducerFactory()
3204
+ : getReducer(config.entity));
3205
+ effects.init();
3206
+ }
3207
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: CrudCoreModule, deps: [{ token: CrudConfig }, { token: CrudEffects }], target: i0.ɵɵFactoryTarget.NgModule });
2811
3208
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: CrudCoreModule, imports: [SharedModule,
2812
3209
  CrudPipesModule,
2813
3210
  FormsModule,
@@ -2816,6 +3213,7 @@ class CrudCoreModule {
2816
3213
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: CrudCoreModule, providers: [
2817
3214
  CrudService,
2818
3215
  CrudListGroupService,
3216
+ CrudEffects,
2819
3217
  PageService,
2820
3218
  CrudFacade,
2821
3219
  CrudListPaginationFactory,
@@ -2839,12 +3237,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
2839
3237
  providers: [
2840
3238
  CrudService,
2841
3239
  CrudListGroupService,
3240
+ CrudEffects,
2842
3241
  PageService,
2843
3242
  CrudFacade,
2844
3243
  CrudListPaginationFactory,
2845
3244
  ],
2846
3245
  }]
2847
- }] });
3246
+ }], ctorParameters: () => [{ type: CrudConfig }, { type: CrudEffects }] });
2848
3247
  class CrudModule {
2849
3248
  static forFeature(options) {
2850
3249
  return {
@@ -2868,220 +3267,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
2868
3267
  args: [{}]
2869
3268
  }] });
2870
3269
 
2871
- const initialState = {
2872
- loaded: false,
2873
- };
2874
- const crudReducer = (state, action, entity) => {
2875
- if (!state) {
2876
- state = { ...initialState };
2877
- }
2878
- switch (action.type) {
2879
- case `[${entity}] Create`:
2880
- return {
2881
- ...state,
2882
- loaded: false,
2883
- error: null,
2884
- };
2885
- case `[${entity}] Create Success`:
2886
- return {
2887
- ...state,
2888
- loaded: true,
2889
- error: null,
2890
- };
2891
- case `[${entity}] Create Failure`:
2892
- return {
2893
- ...state,
2894
- loaded: true,
2895
- error: action.error,
2896
- };
2897
- case `[${entity}] Create Many`:
2898
- return {
2899
- ...state,
2900
- loaded: false,
2901
- error: null,
2902
- };
2903
- case `[${entity}] Create Many Success`:
2904
- return {
2905
- ...state,
2906
- loaded: true,
2907
- error: null,
2908
- };
2909
- case `[${entity}] Create Many Failure`:
2910
- return {
2911
- ...state,
2912
- loaded: true,
2913
- error: action.error,
2914
- };
2915
- case `[${entity}] Export`:
2916
- return {
2917
- ...state,
2918
- loaded: false,
2919
- };
2920
- case `[${entity}] Export Success`:
2921
- return {
2922
- ...state,
2923
- loaded: true,
2924
- };
2925
- case `[${entity}] Export Failure`:
2926
- return {
2927
- ...state,
2928
- loaded: true,
2929
- };
2930
- case `[${entity}] Read`:
2931
- return {
2932
- ...state,
2933
- loaded: false,
2934
- filter: action.filter,
2935
- error: null,
2936
- totalCount: null,
2937
- links: null,
2938
- };
2939
- case `[${entity}] Read Success`: {
2940
- let list = [];
2941
- if (action.filter &&
2942
- action.filter.offset &&
2943
- state.list &&
2944
- action.filter.paginationMode !== PaginationMode.singlePage) {
2945
- state.list.forEach((i) => {
2946
- list.push(i);
2947
- });
2948
- list = [...list, ...action.result.data];
2949
- }
2950
- else {
2951
- list = action.result.data;
2952
- }
2953
- return {
2954
- ...state,
2955
- loaded: true,
2956
- list,
2957
- totalCount: action.result.totalCount,
2958
- links: action.result.links,
2959
- error: null,
2960
- };
2961
- }
2962
- case `[${entity}] Clear`:
2963
- return { ...initialState };
2964
- case `[${entity}] Read Failure`:
2965
- return {
2966
- ...state,
2967
- loaded: true,
2968
- error: action.error,
2969
- };
2970
- case `[${entity}] Select`:
2971
- return {
2972
- ...state,
2973
- loaded: false,
2974
- selected: null,
2975
- error: null,
2976
- };
2977
- case `[${entity}] Select Success`:
2978
- return {
2979
- ...state,
2980
- loaded: true,
2981
- selected: action.item,
2982
- error: null,
2983
- };
2984
- case `[${entity}] Select Failure`:
2985
- return {
2986
- ...state,
2987
- loaded: true,
2988
- error: action.error,
2989
- };
2990
- case `[${entity}] MultiSelect`:
2991
- return {
2992
- ...state,
2993
- multiSelected: [...action.items],
2994
- };
2995
- case `[${entity}] Unselect`:
2996
- return {
2997
- ...state,
2998
- loaded: true,
2999
- selected: null,
3000
- error: null,
3001
- };
3002
- case `[${entity}] Update`:
3003
- return {
3004
- ...state,
3005
- loaded: false,
3006
- error: null,
3007
- };
3008
- case `[${entity}] Update Success`:
3009
- return {
3010
- ...state,
3011
- loaded: true,
3012
- error: null,
3013
- };
3014
- case `[${entity}] Update Failure`:
3015
- return {
3016
- ...state,
3017
- loaded: true,
3018
- error: action.error,
3019
- };
3020
- case `[${entity}] Update partial`:
3021
- return {
3022
- ...state,
3023
- loaded: false,
3024
- error: null,
3025
- };
3026
- case `[${entity}] Update partial Success`:
3027
- return {
3028
- ...state,
3029
- loaded: true,
3030
- error: null,
3031
- };
3032
- case `[${entity}] Update partial Failure`:
3033
- return {
3034
- ...state,
3035
- loaded: true,
3036
- error: action.error,
3037
- };
3038
- case `[${entity}] Update partial many`:
3039
- return {
3040
- ...state,
3041
- loaded: false,
3042
- error: null,
3043
- };
3044
- case `[${entity}] Update partial many Success`:
3045
- return {
3046
- ...state,
3047
- multiSelected: [],
3048
- loaded: true,
3049
- error: null,
3050
- };
3051
- case `[${entity}] Update partial many Failure`:
3052
- return {
3053
- ...state,
3054
- loaded: true,
3055
- error: action.error,
3056
- };
3057
- case `[${entity}] Delete`:
3058
- return {
3059
- ...state,
3060
- loaded: false,
3061
- error: null,
3062
- };
3063
- case `[${entity}] Delete Success`:
3064
- return {
3065
- ...state,
3066
- loaded: true,
3067
- error: null,
3068
- };
3069
- case `[${entity}] Delete Failure`:
3070
- return {
3071
- ...state,
3072
- loaded: true,
3073
- error: action.error,
3074
- };
3075
- default:
3076
- return state;
3077
- }
3078
- };
3079
- function getReducer(entity) {
3080
- return (state, action) => {
3081
- return crudReducer(state, action, entity);
3082
- };
3083
- }
3084
-
3085
3270
  /**
3086
3271
  * Generated bundle index. Do not edit.
3087
3272
  */