@recursyve/nice-data-filter-kit 14.4.2 → 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/fesm2015/recursyve-nice-data-filter-kit.mjs +94 -3
- package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/fesm2020/recursyve-nice-data-filter-kit.mjs +103 -3
- 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/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 } from 'tslib';
|
|
11
11
|
import * as i2 from '@angular/router';
|
|
@@ -2757,6 +2757,7 @@ const initialValue = {
|
|
|
2757
2757
|
mode: "paginated",
|
|
2758
2758
|
autoLoad: true,
|
|
2759
2759
|
disabled: false,
|
|
2760
|
+
initialLoadCompleted: false,
|
|
2760
2761
|
filterConfigLoading: false,
|
|
2761
2762
|
filterConfig: [],
|
|
2762
2763
|
filterResult: null,
|
|
@@ -2790,7 +2791,7 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2790
2791
|
this.update({ filterParameters });
|
|
2791
2792
|
}
|
|
2792
2793
|
setResult(filterResult) {
|
|
2793
|
-
const { mode, resetResult } = this.getValue();
|
|
2794
|
+
const { mode, resetResult, initialLoadCompleted } = this.getValue();
|
|
2794
2795
|
if (mode === "accumulated") {
|
|
2795
2796
|
this.update((state) => ({
|
|
2796
2797
|
filterResult: {
|
|
@@ -2815,6 +2816,9 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2815
2816
|
else {
|
|
2816
2817
|
this.set([...filterResult.values]);
|
|
2817
2818
|
}
|
|
2819
|
+
if (!initialLoadCompleted) {
|
|
2820
|
+
this.update({ initialLoadCompleted: true });
|
|
2821
|
+
}
|
|
2818
2822
|
}
|
|
2819
2823
|
addValue(value, opts) {
|
|
2820
2824
|
const { filterResult } = this.getValue();
|
|
@@ -2829,6 +2833,19 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2829
2833
|
});
|
|
2830
2834
|
this.add(value, opts);
|
|
2831
2835
|
}
|
|
2836
|
+
addValues(values, opts) {
|
|
2837
|
+
const { filterResult } = this.getValue();
|
|
2838
|
+
if (!filterResult) {
|
|
2839
|
+
return;
|
|
2840
|
+
}
|
|
2841
|
+
this.update({
|
|
2842
|
+
filterResult: {
|
|
2843
|
+
...filterResult,
|
|
2844
|
+
values: arrayAdd(filterResult.values, values, opts)
|
|
2845
|
+
}
|
|
2846
|
+
});
|
|
2847
|
+
this.add(values, opts);
|
|
2848
|
+
}
|
|
2832
2849
|
upsertValue(value, key) {
|
|
2833
2850
|
const { filterResult } = this.getValue();
|
|
2834
2851
|
if (!filterResult) {
|
|
@@ -2843,6 +2860,22 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2843
2860
|
});
|
|
2844
2861
|
this.upsert(value[idKey], value);
|
|
2845
2862
|
}
|
|
2863
|
+
upsertValues(values, key) {
|
|
2864
|
+
const { filterResult } = this.getValue();
|
|
2865
|
+
if (!filterResult) {
|
|
2866
|
+
return;
|
|
2867
|
+
}
|
|
2868
|
+
const idKey = key ?? this.idKey;
|
|
2869
|
+
for (const value of values) {
|
|
2870
|
+
this.update({
|
|
2871
|
+
filterResult: {
|
|
2872
|
+
...filterResult,
|
|
2873
|
+
values: arrayUpsert(filterResult.values, value[idKey], value, key)
|
|
2874
|
+
}
|
|
2875
|
+
});
|
|
2876
|
+
this.upsert(value[idKey], value);
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2846
2879
|
removeValue(value, key) {
|
|
2847
2880
|
const { filterResult } = this.getValue();
|
|
2848
2881
|
if (!filterResult) {
|
|
@@ -2857,6 +2890,21 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2857
2890
|
});
|
|
2858
2891
|
this.remove(value[idKey]);
|
|
2859
2892
|
}
|
|
2893
|
+
removeValues(values, key) {
|
|
2894
|
+
const { filterResult } = this.getValue();
|
|
2895
|
+
if (!filterResult) {
|
|
2896
|
+
return;
|
|
2897
|
+
}
|
|
2898
|
+
const idKey = key ?? this.idKey;
|
|
2899
|
+
const ids = values.map(value => value[idKey]);
|
|
2900
|
+
this.update({
|
|
2901
|
+
filterResult: {
|
|
2902
|
+
...filterResult,
|
|
2903
|
+
values: arrayRemove(filterResult.values, ids)
|
|
2904
|
+
}
|
|
2905
|
+
});
|
|
2906
|
+
this.remove(ids);
|
|
2907
|
+
}
|
|
2860
2908
|
getParameters(filterParameters) {
|
|
2861
2909
|
const { baseRules } = this.getValue();
|
|
2862
2910
|
const parameters = {
|
|
@@ -2878,6 +2926,48 @@ class NiceFilterViewStore extends EntityStore {
|
|
|
2878
2926
|
}
|
|
2879
2927
|
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 });
|
|
2880
2928
|
NiceFilterViewStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewStore });
|
|
2929
|
+
__decorate([
|
|
2930
|
+
transaction(),
|
|
2931
|
+
__metadata("design:type", Function),
|
|
2932
|
+
__metadata("design:paramtypes", [Object]),
|
|
2933
|
+
__metadata("design:returntype", void 0)
|
|
2934
|
+
], NiceFilterViewStore.prototype, "setResult", null);
|
|
2935
|
+
__decorate([
|
|
2936
|
+
transaction(),
|
|
2937
|
+
__metadata("design:type", Function),
|
|
2938
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
2939
|
+
__metadata("design:returntype", void 0)
|
|
2940
|
+
], NiceFilterViewStore.prototype, "addValue", null);
|
|
2941
|
+
__decorate([
|
|
2942
|
+
transaction(),
|
|
2943
|
+
__metadata("design:type", Function),
|
|
2944
|
+
__metadata("design:paramtypes", [Array, Object]),
|
|
2945
|
+
__metadata("design:returntype", void 0)
|
|
2946
|
+
], NiceFilterViewStore.prototype, "addValues", null);
|
|
2947
|
+
__decorate([
|
|
2948
|
+
transaction(),
|
|
2949
|
+
__metadata("design:type", Function),
|
|
2950
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
2951
|
+
__metadata("design:returntype", void 0)
|
|
2952
|
+
], NiceFilterViewStore.prototype, "upsertValue", null);
|
|
2953
|
+
__decorate([
|
|
2954
|
+
transaction(),
|
|
2955
|
+
__metadata("design:type", Function),
|
|
2956
|
+
__metadata("design:paramtypes", [Array, String]),
|
|
2957
|
+
__metadata("design:returntype", void 0)
|
|
2958
|
+
], NiceFilterViewStore.prototype, "upsertValues", null);
|
|
2959
|
+
__decorate([
|
|
2960
|
+
transaction(),
|
|
2961
|
+
__metadata("design:type", Function),
|
|
2962
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
2963
|
+
__metadata("design:returntype", void 0)
|
|
2964
|
+
], NiceFilterViewStore.prototype, "removeValue", null);
|
|
2965
|
+
__decorate([
|
|
2966
|
+
transaction(),
|
|
2967
|
+
__metadata("design:type", Function),
|
|
2968
|
+
__metadata("design:paramtypes", [Array, String]),
|
|
2969
|
+
__metadata("design:returntype", void 0)
|
|
2970
|
+
], NiceFilterViewStore.prototype, "removeValues", null);
|
|
2881
2971
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewStore, decorators: [{
|
|
2882
2972
|
type: Injectable
|
|
2883
2973
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
@@ -2886,7 +2976,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
|
|
|
2886
2976
|
}] }, { type: undefined, decorators: [{
|
|
2887
2977
|
type: Inject,
|
|
2888
2978
|
args: [FILTER_VIEW_STORE]
|
|
2889
|
-
}] }]; } });
|
|
2979
|
+
}] }]; }, propDecorators: { setResult: [], addValue: [], addValues: [], upsertValue: [], upsertValues: [], removeValue: [], removeValues: [] } });
|
|
2890
2980
|
|
|
2891
2981
|
class NiceFilterViewQuery extends QueryEntity {
|
|
2892
2982
|
constructor(store) {
|
|
@@ -3129,12 +3219,21 @@ class NiceFilterViewService {
|
|
|
3129
3219
|
addValue(value, opts) {
|
|
3130
3220
|
this.store.addValue(value, opts);
|
|
3131
3221
|
}
|
|
3222
|
+
addValues(value, opts) {
|
|
3223
|
+
this.store.addValues(value, opts);
|
|
3224
|
+
}
|
|
3132
3225
|
upsertValue(value, key) {
|
|
3133
3226
|
this.store.upsertValue(value, key);
|
|
3134
3227
|
}
|
|
3228
|
+
upsertValues(values, key) {
|
|
3229
|
+
this.store.upsertValues(values, key);
|
|
3230
|
+
}
|
|
3135
3231
|
removeValue(value, key) {
|
|
3136
3232
|
this.store.removeValue(value, key);
|
|
3137
3233
|
}
|
|
3234
|
+
removeValues(values, key) {
|
|
3235
|
+
this.store.removeValues(values, key);
|
|
3236
|
+
}
|
|
3138
3237
|
resetResult(waitForNextFilter) {
|
|
3139
3238
|
if (!waitForNextFilter) {
|
|
3140
3239
|
this.store.update({
|
|
@@ -4938,6 +5037,7 @@ class NiceBaseFilterViewComponent {
|
|
|
4938
5037
|
this.autoLoad(autoLoad);
|
|
4939
5038
|
this.loadConfig(loadConfig, configQueryParams);
|
|
4940
5039
|
this.filterViewLoading$ = this.filterViewQuery.selectLoading();
|
|
5040
|
+
this.filterViewCount$ = this.filterViewQuery.selectCount();
|
|
4941
5041
|
if (this.selectableListDirective) {
|
|
4942
5042
|
this.filterViewService.updateSubState("selectable", { stateName: this.selectableListDirective.state });
|
|
4943
5043
|
}
|