@smartsoft001/crud-shell-angular 2.86.0 → 2.88.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,6 +1,6 @@
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 } from '@smartsoft001/angular';
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';
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';
@@ -2868,9 +2868,223 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
2868
2868
  args: [{}]
2869
2869
  }] });
2870
2870
 
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
+
2871
3085
  /**
2872
3086
  * Generated bundle index. Do not edit.
2873
3087
  */
2874
3088
 
2875
- export { CRUD_MODEL_POSSIBILITIES_PROVIDER, CrudComponentsModule, CrudConfig, CrudCoreModule, CrudFacade, CrudFullConfig, CrudFullModule, CrudItemPageBaseComponent, CrudListPageBaseComponent, CrudListPaginationFactory, CrudModule, CrudPipesModule, CrudSearchService, CrudService, ExportComponent, FilterCheckComponent, FilterComponent, FilterDateComponent, FilterDateTimeComponent, FilterDateWithEditComponent, FilterFlagComponent, FilterIntComponent, FilterRadioComponent, FilterTextComponent, FiltersComponent, FiltersConfigComponent, FormOptionsPipe, GroupComponent, ICrudModelPossibilitiesProvider, ItemComponent, ItemStandardComponent, ListComponent, ListStandardComponent, MultiselectComponent, PAGES, PageService };
3089
+ export { CRUD_MODEL_POSSIBILITIES_PROVIDER, CrudComponentsModule, CrudConfig, CrudCoreModule, CrudFacade, CrudFullConfig, CrudFullModule, CrudItemPageBaseComponent, CrudListPageBaseComponent, CrudListPaginationFactory, CrudModule, CrudPipesModule, CrudSearchService, CrudService, ExportComponent, FilterCheckComponent, FilterComponent, FilterDateComponent, FilterDateTimeComponent, FilterDateWithEditComponent, FilterFlagComponent, FilterIntComponent, FilterRadioComponent, FilterTextComponent, FiltersComponent, FiltersConfigComponent, FormOptionsPipe, GroupComponent, ICrudModelPossibilitiesProvider, ItemComponent, ItemStandardComponent, ListComponent, ListStandardComponent, MultiselectComponent, PAGES, PageService, getCrudError, getCrudFilter, getCrudLinks, getCrudList, getCrudLoaded, getCrudMultiSelected, getCrudSelected, getCrudState, getCrudTotalCount, getReducer, initialState };
2876
3090
  //# sourceMappingURL=smartsoft001-crud-shell-angular.mjs.map