@recursyve/nice-data-filter-kit 14.4.1 → 14.5.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/esm2020/lib/components/nice-filter-view/nice-base-filter-view.component.mjs +2 -1
- package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.service.mjs +10 -1
- package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.store.mjs +95 -4
- package/esm2020/lib/models/filter.model.mjs +1 -1
- package/esm2020/lib/utils/filter.utils.mjs +3 -2
- package/fesm2015/recursyve-nice-data-filter-kit.mjs +96 -4
- package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/fesm2020/recursyve-nice-data-filter-kit.mjs +105 -4
- package/fesm2020/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/lib/components/nice-filter-view/nice-base-filter-view.component.d.ts +1 -0
- package/lib/components/nice-filter-view/store/nice-filter-view.service.d.ts +4 -1
- package/lib/components/nice-filter-view/store/nice-filter-view.store.d.ts +4 -0
- package/lib/models/filter.model.d.ts +2 -0
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import * as i5$1 from '@recursyve/nice-ui-kit.v2';
|
|
|
5
5
|
import { isNullOrUndefined, ObjectUtils, FileUtils, ArrayUtils, ExportBottomSheetComponent, NiceLoadingSpinnerModule, NiceTypeaheadModule, NiceExportBottomSheetModule, NiceAsyncTypeaheadProvider, NICE_ASYNC_TYPEAHEAD_PROVIDER, NiceAsyncTypeaheadModule } from '@recursyve/nice-ui-kit.v2';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
7
|
import { Directive, Input, NgModule, Injectable, Inject, InjectionToken, Optional, Pipe, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Output, HostListener, forwardRef, TemplateRef, ContentChild, ContentChildren, QueryList, ViewChild } from '@angular/core';
|
|
8
|
-
import { Store, StoreConfig, Query, arrayAdd, arrayUpsert, arrayRemove, EntityStore, QueryEntity, EntityActions } from '@datorama/akita';
|
|
8
|
+
import { Store, StoreConfig, Query, arrayAdd, arrayUpsert, arrayRemove, EntityStore, transaction, QueryEntity, EntityActions } from '@datorama/akita';
|
|
9
9
|
import { combineLatest, Subject, firstValueFrom, of, lastValueFrom, startWith, tap, distinct, take } from 'rxjs';
|
|
10
10
|
import { __decorate, __metadata, __awaiter, __rest } from 'tslib';
|
|
11
11
|
import * as i2 from '@angular/router';
|
|
@@ -566,7 +566,8 @@ class FilterUtils {
|
|
|
566
566
|
rules: (_e = filterParameters.rules) !== null && _e !== void 0 ? _e : []
|
|
567
567
|
},
|
|
568
568
|
order: OrderUtils.combineOrders(filterParameters.order, filterParameters.fallbackOrder),
|
|
569
|
-
data: filterParameters.data
|
|
569
|
+
data: filterParameters.data,
|
|
570
|
+
groupBy: filterParameters.groupBy
|
|
570
571
|
};
|
|
571
572
|
}
|
|
572
573
|
static filterChangeNeedsRefresh(currentFilters, newFilters) {
|
|
@@ -2825,6 +2826,7 @@ const initialValue = {
|
|
|
2825
2826
|
mode: "paginated",
|
|
2826
2827
|
autoLoad: true,
|
|
2827
2828
|
disabled: false,
|
|
2829
|
+
initialLoadCompleted: false,
|
|
2828
2830
|
filterConfigLoading: false,
|
|
2829
2831
|
filterConfig: [],
|
|
2830
2832
|
filterResult: null,
|
|
@@ -2852,7 +2854,7 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2852
2854
|
this.update({ filterParameters });
|
|
2853
2855
|
}
|
|
2854
2856
|
setResult(filterResult) {
|
|
2855
|
-
const { mode, resetResult } = this.getValue();
|
|
2857
|
+
const { mode, resetResult, initialLoadCompleted } = this.getValue();
|
|
2856
2858
|
if (mode === "accumulated") {
|
|
2857
2859
|
this.update((state) => {
|
|
2858
2860
|
var _a, _b;
|
|
@@ -2880,6 +2882,9 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2880
2882
|
else {
|
|
2881
2883
|
this.set([...filterResult.values]);
|
|
2882
2884
|
}
|
|
2885
|
+
if (!initialLoadCompleted) {
|
|
2886
|
+
this.update({ initialLoadCompleted: true });
|
|
2887
|
+
}
|
|
2883
2888
|
}
|
|
2884
2889
|
addValue(value, opts) {
|
|
2885
2890
|
const { filterResult } = this.getValue();
|
|
@@ -2891,6 +2896,16 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2891
2896
|
});
|
|
2892
2897
|
this.add(value, opts);
|
|
2893
2898
|
}
|
|
2899
|
+
addValues(values, opts) {
|
|
2900
|
+
const { filterResult } = this.getValue();
|
|
2901
|
+
if (!filterResult) {
|
|
2902
|
+
return;
|
|
2903
|
+
}
|
|
2904
|
+
this.update({
|
|
2905
|
+
filterResult: Object.assign(Object.assign({}, filterResult), { values: arrayAdd(filterResult.values, values, opts) })
|
|
2906
|
+
});
|
|
2907
|
+
this.add(values, opts);
|
|
2908
|
+
}
|
|
2894
2909
|
upsertValue(value, key) {
|
|
2895
2910
|
const { filterResult } = this.getValue();
|
|
2896
2911
|
if (!filterResult) {
|
|
@@ -2902,6 +2917,19 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2902
2917
|
});
|
|
2903
2918
|
this.upsert(value[idKey], value);
|
|
2904
2919
|
}
|
|
2920
|
+
upsertValues(values, key) {
|
|
2921
|
+
const { filterResult } = this.getValue();
|
|
2922
|
+
if (!filterResult) {
|
|
2923
|
+
return;
|
|
2924
|
+
}
|
|
2925
|
+
const idKey = key !== null && key !== void 0 ? key : this.idKey;
|
|
2926
|
+
for (const value of values) {
|
|
2927
|
+
this.update({
|
|
2928
|
+
filterResult: Object.assign(Object.assign({}, filterResult), { values: arrayUpsert(filterResult.values, value[idKey], value, key) })
|
|
2929
|
+
});
|
|
2930
|
+
this.upsert(value[idKey], value);
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2905
2933
|
removeValue(value, key) {
|
|
2906
2934
|
const { filterResult } = this.getValue();
|
|
2907
2935
|
if (!filterResult) {
|
|
@@ -2913,6 +2941,18 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2913
2941
|
});
|
|
2914
2942
|
this.remove(value[idKey]);
|
|
2915
2943
|
}
|
|
2944
|
+
removeValues(values, key) {
|
|
2945
|
+
const { filterResult } = this.getValue();
|
|
2946
|
+
if (!filterResult) {
|
|
2947
|
+
return;
|
|
2948
|
+
}
|
|
2949
|
+
const idKey = key !== null && key !== void 0 ? key : this.idKey;
|
|
2950
|
+
const ids = values.map(value => value[idKey]);
|
|
2951
|
+
this.update({
|
|
2952
|
+
filterResult: Object.assign(Object.assign({}, filterResult), { values: arrayRemove(filterResult.values, ids) })
|
|
2953
|
+
});
|
|
2954
|
+
this.remove(ids);
|
|
2955
|
+
}
|
|
2916
2956
|
getParameters(filterParameters) {
|
|
2917
2957
|
const { baseRules } = this.getValue();
|
|
2918
2958
|
const parameters = Object.assign(Object.assign({}, filterParameters), { rules: (filterParameters === null || filterParameters === void 0 ? void 0 : filterParameters.rules) ? [...filterParameters.rules] : [] });
|
|
@@ -2931,6 +2971,48 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2931
2971
|
}
|
|
2932
2972
|
NiceFilterViewStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewStore, deps: [{ token: FILTER_VIEW_STATE }, { token: FILTER_VIEW_STORE }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2933
2973
|
NiceFilterViewStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewStore });
|
|
2974
|
+
__decorate([
|
|
2975
|
+
transaction(),
|
|
2976
|
+
__metadata("design:type", Function),
|
|
2977
|
+
__metadata("design:paramtypes", [Object]),
|
|
2978
|
+
__metadata("design:returntype", void 0)
|
|
2979
|
+
], NiceFilterViewStore.prototype, "setResult", null);
|
|
2980
|
+
__decorate([
|
|
2981
|
+
transaction(),
|
|
2982
|
+
__metadata("design:type", Function),
|
|
2983
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
2984
|
+
__metadata("design:returntype", void 0)
|
|
2985
|
+
], NiceFilterViewStore.prototype, "addValue", null);
|
|
2986
|
+
__decorate([
|
|
2987
|
+
transaction(),
|
|
2988
|
+
__metadata("design:type", Function),
|
|
2989
|
+
__metadata("design:paramtypes", [Array, Object]),
|
|
2990
|
+
__metadata("design:returntype", void 0)
|
|
2991
|
+
], NiceFilterViewStore.prototype, "addValues", null);
|
|
2992
|
+
__decorate([
|
|
2993
|
+
transaction(),
|
|
2994
|
+
__metadata("design:type", Function),
|
|
2995
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
2996
|
+
__metadata("design:returntype", void 0)
|
|
2997
|
+
], NiceFilterViewStore.prototype, "upsertValue", null);
|
|
2998
|
+
__decorate([
|
|
2999
|
+
transaction(),
|
|
3000
|
+
__metadata("design:type", Function),
|
|
3001
|
+
__metadata("design:paramtypes", [Array, String]),
|
|
3002
|
+
__metadata("design:returntype", void 0)
|
|
3003
|
+
], NiceFilterViewStore.prototype, "upsertValues", null);
|
|
3004
|
+
__decorate([
|
|
3005
|
+
transaction(),
|
|
3006
|
+
__metadata("design:type", Function),
|
|
3007
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
3008
|
+
__metadata("design:returntype", void 0)
|
|
3009
|
+
], NiceFilterViewStore.prototype, "removeValue", null);
|
|
3010
|
+
__decorate([
|
|
3011
|
+
transaction(),
|
|
3012
|
+
__metadata("design:type", Function),
|
|
3013
|
+
__metadata("design:paramtypes", [Array, String]),
|
|
3014
|
+
__metadata("design:returntype", void 0)
|
|
3015
|
+
], NiceFilterViewStore.prototype, "removeValues", null);
|
|
2934
3016
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewStore, decorators: [{
|
|
2935
3017
|
type: Injectable
|
|
2936
3018
|
}], ctorParameters: function () {
|
|
@@ -2941,7 +3023,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
|
|
|
2941
3023
|
type: Inject,
|
|
2942
3024
|
args: [FILTER_VIEW_STORE]
|
|
2943
3025
|
}] }];
|
|
2944
|
-
} });
|
|
3026
|
+
}, propDecorators: { setResult: [], addValue: [], addValues: [], upsertValue: [], upsertValues: [], removeValue: [], removeValues: [] } });
|
|
2945
3027
|
|
|
2946
3028
|
class NiceFilterViewQuery extends QueryEntity {
|
|
2947
3029
|
constructor(store) {
|
|
@@ -3182,12 +3264,21 @@ class NiceFilterViewService {
|
|
|
3182
3264
|
addValue(value, opts) {
|
|
3183
3265
|
this.store.addValue(value, opts);
|
|
3184
3266
|
}
|
|
3267
|
+
addValues(value, opts) {
|
|
3268
|
+
this.store.addValues(value, opts);
|
|
3269
|
+
}
|
|
3185
3270
|
upsertValue(value, key) {
|
|
3186
3271
|
this.store.upsertValue(value, key);
|
|
3187
3272
|
}
|
|
3273
|
+
upsertValues(values, key) {
|
|
3274
|
+
this.store.upsertValues(values, key);
|
|
3275
|
+
}
|
|
3188
3276
|
removeValue(value, key) {
|
|
3189
3277
|
this.store.removeValue(value, key);
|
|
3190
3278
|
}
|
|
3279
|
+
removeValues(values, key) {
|
|
3280
|
+
this.store.removeValues(values, key);
|
|
3281
|
+
}
|
|
3191
3282
|
resetResult(waitForNextFilter) {
|
|
3192
3283
|
if (!waitForNextFilter) {
|
|
3193
3284
|
this.store.update({
|
|
@@ -4946,6 +5037,7 @@ class NiceBaseFilterViewComponent {
|
|
|
4946
5037
|
this.autoLoad(autoLoad);
|
|
4947
5038
|
this.loadConfig(loadConfig, configQueryParams);
|
|
4948
5039
|
this.filterViewLoading$ = this.filterViewQuery.selectLoading();
|
|
5040
|
+
this.filterViewCount$ = this.filterViewQuery.selectCount();
|
|
4949
5041
|
if (this.selectableListDirective) {
|
|
4950
5042
|
this.filterViewService.updateSubState("selectable", { stateName: this.selectableListDirective.state });
|
|
4951
5043
|
}
|