@recursyve/nice-data-filter-kit 15.3.1 → 15.3.3
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/api/filter.api.mjs +24 -10
- package/esm2020/lib/components/base-list/providers/base-filter.service.mjs +5 -5
- package/esm2020/lib/components/nice-filter-view/components/advanced-filters/providers/async-typeahead.provider.mjs +3 -3
- package/esm2020/lib/components/nice-filter-view/components/advanced-filters/rule/components/select/select-filter.component.mjs +15 -11
- package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.query.mjs +4 -1
- package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.service.mjs +3 -3
- package/fesm2015/recursyve-nice-data-filter-kit.mjs +38 -31
- package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/fesm2020/recursyve-nice-data-filter-kit.mjs +42 -23
- package/fesm2020/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/lib/api/filter.api.d.ts +4 -4
- package/lib/components/base-list/providers/base-filter.service.d.ts +3 -2
- package/lib/components/nice-filter-view/components/advanced-filters/providers/async-typeahead.provider.d.ts +1 -0
- package/lib/components/nice-filter-view/components/advanced-filters/rule/components/select/select-filter.component.d.ts +4 -0
- package/lib/components/nice-filter-view/store/nice-filter-view.query.d.ts +2 -0
- package/package.json +1 -1
|
@@ -149,14 +149,26 @@ class NiceFilterApi {
|
|
|
149
149
|
getFilterConfig(option = {}) {
|
|
150
150
|
return this.http.get(this.url("filter/config"), option);
|
|
151
151
|
}
|
|
152
|
-
searchFilterValue(id, value) {
|
|
152
|
+
searchFilterValue(id, value, options) {
|
|
153
153
|
if (value === undefined) {
|
|
154
154
|
value = "";
|
|
155
155
|
}
|
|
156
|
-
return this.http.get(this.url(`filter/config/value
|
|
156
|
+
return this.http.get(this.url(`filter/config/value`), {
|
|
157
|
+
params: {
|
|
158
|
+
...options?.params,
|
|
159
|
+
id,
|
|
160
|
+
value
|
|
161
|
+
}
|
|
162
|
+
});
|
|
157
163
|
}
|
|
158
|
-
searchFilterResourceValue(id, resourceId) {
|
|
159
|
-
return this.http.get(this.url(`filter/config/id
|
|
164
|
+
searchFilterResourceValue(id, resourceId, options) {
|
|
165
|
+
return this.http.get(this.url(`filter/config/id`), {
|
|
166
|
+
params: {
|
|
167
|
+
...options?.params,
|
|
168
|
+
id,
|
|
169
|
+
resourceId
|
|
170
|
+
}
|
|
171
|
+
});
|
|
160
172
|
}
|
|
161
173
|
url(...args) {
|
|
162
174
|
const [route, queryParams] = this.transformUrlArgs(args);
|
|
@@ -180,6 +192,9 @@ class NiceFilterApi {
|
|
|
180
192
|
const mixinNiceFilterApi = (model) => {
|
|
181
193
|
return (base) => {
|
|
182
194
|
return class extends base {
|
|
195
|
+
constructor(...args) {
|
|
196
|
+
super(...args);
|
|
197
|
+
}
|
|
183
198
|
filter(queryModel, option = {}) {
|
|
184
199
|
return this.post("filter", queryModel, option).pipe(map(x => model ? ({
|
|
185
200
|
...x,
|
|
@@ -198,28 +213,27 @@ const mixinNiceFilterApi = (model) => {
|
|
|
198
213
|
getFilterConfig(option = {}) {
|
|
199
214
|
return this.get("filter/config", option);
|
|
200
215
|
}
|
|
201
|
-
searchFilterValue(id, value) {
|
|
216
|
+
searchFilterValue(id, value, options) {
|
|
202
217
|
if (value === undefined) {
|
|
203
218
|
value = "";
|
|
204
219
|
}
|
|
205
220
|
return this.get("filter/config/value", {
|
|
206
221
|
params: {
|
|
222
|
+
...options?.params,
|
|
207
223
|
id,
|
|
208
224
|
value
|
|
209
225
|
}
|
|
210
226
|
});
|
|
211
227
|
}
|
|
212
|
-
searchFilterResourceValue(id, resourceId) {
|
|
228
|
+
searchFilterResourceValue(id, resourceId, options) {
|
|
213
229
|
return this.get("filter/config/id", {
|
|
214
230
|
params: {
|
|
231
|
+
...options?.params,
|
|
215
232
|
id,
|
|
216
233
|
resourceId
|
|
217
234
|
}
|
|
218
235
|
});
|
|
219
236
|
}
|
|
220
|
-
constructor(...args) {
|
|
221
|
-
super(...args);
|
|
222
|
-
}
|
|
223
237
|
};
|
|
224
238
|
};
|
|
225
239
|
};
|
|
@@ -612,11 +626,11 @@ class NiceFilterService {
|
|
|
612
626
|
getFilterConfig(option = {}) {
|
|
613
627
|
return this.api?.getFilterConfig(option);
|
|
614
628
|
}
|
|
615
|
-
searchFilterValue(filterConfig, value) {
|
|
616
|
-
return this.api?.searchFilterValue(filterConfig.id, value);
|
|
629
|
+
searchFilterValue(filterConfig, value, options) {
|
|
630
|
+
return this.api?.searchFilterValue(filterConfig.id, value, options);
|
|
617
631
|
}
|
|
618
|
-
searchFilterResourceValue(filterConfig, resourceId) {
|
|
619
|
-
return this.api?.searchFilterResourceValue(filterConfig.id, resourceId);
|
|
632
|
+
searchFilterResourceValue(filterConfig, resourceId, options) {
|
|
633
|
+
return this.api?.searchFilterResourceValue(filterConfig.id, resourceId, options);
|
|
620
634
|
}
|
|
621
635
|
}
|
|
622
636
|
NiceFilterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterService, deps: [{ token: NiceFilterApi }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -3002,6 +3016,9 @@ class NiceFilterViewQuery extends QueryEntity {
|
|
|
3002
3016
|
selectFilterResult() {
|
|
3003
3017
|
return this.select("filterResult");
|
|
3004
3018
|
}
|
|
3019
|
+
selectQueryParams() {
|
|
3020
|
+
return this.select("queryParams");
|
|
3021
|
+
}
|
|
3005
3022
|
getParameters() {
|
|
3006
3023
|
return this.store.getParameters(this.store.getValue().filterParameters);
|
|
3007
3024
|
}
|
|
@@ -3066,13 +3083,13 @@ class NiceFilterViewService {
|
|
|
3066
3083
|
}
|
|
3067
3084
|
}
|
|
3068
3085
|
async filter() {
|
|
3069
|
-
const { filterParameters, disabled } = this.store.getValue();
|
|
3086
|
+
const { filterParameters, disabled, queryParams } = this.store.getValue();
|
|
3070
3087
|
if (disabled) {
|
|
3071
3088
|
return;
|
|
3072
3089
|
}
|
|
3073
3090
|
try {
|
|
3074
3091
|
this.store.setLoading(true);
|
|
3075
|
-
const result = await firstValueFrom(this.filterService.filter(this.store.getParameters(filterParameters)));
|
|
3092
|
+
const result = await firstValueFrom(this.filterService.filter(this.store.getParameters(filterParameters), { params: queryParams }));
|
|
3076
3093
|
this.store.setResult(result);
|
|
3077
3094
|
}
|
|
3078
3095
|
catch (e) {
|
|
@@ -3586,10 +3603,10 @@ class AdvancedFiltersAsyncTypeaheadProvider extends NiceAsyncTypeaheadProvider {
|
|
|
3586
3603
|
this.resource = "advancedFilter";
|
|
3587
3604
|
}
|
|
3588
3605
|
getById(id, options) {
|
|
3589
|
-
return lastValueFrom(this.filterService.searchFilterResourceValue(options.filterConfig, id));
|
|
3606
|
+
return lastValueFrom(this.filterService.searchFilterResourceValue(options.filterConfig, id, { params: options?.queryParams }));
|
|
3590
3607
|
}
|
|
3591
3608
|
async search(searchQuery, page, options) {
|
|
3592
|
-
const res = await lastValueFrom(this.filterService.searchFilterValue(options.filterConfig, searchQuery));
|
|
3609
|
+
const res = await lastValueFrom(this.filterService.searchFilterValue(options.filterConfig, searchQuery, { params: options?.queryParams }));
|
|
3593
3610
|
return {
|
|
3594
3611
|
items: res,
|
|
3595
3612
|
nextPage: null
|
|
@@ -3784,9 +3801,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
3784
3801
|
}] } });
|
|
3785
3802
|
|
|
3786
3803
|
class NiceAdvancedSelectFilterComponent extends FilterComponent {
|
|
3787
|
-
constructor() {
|
|
3788
|
-
super(
|
|
3804
|
+
constructor(filterViewQuery) {
|
|
3805
|
+
super();
|
|
3806
|
+
this.filterViewQuery = filterViewQuery;
|
|
3789
3807
|
this.values = [];
|
|
3808
|
+
this.queryParams$ = this.filterViewQuery.selectQueryParams();
|
|
3790
3809
|
}
|
|
3791
3810
|
async ngOnInit() {
|
|
3792
3811
|
if (!this.filterConfig.lazyLoading) {
|
|
@@ -3810,14 +3829,14 @@ class NiceAdvancedSelectFilterComponent extends FilterComponent {
|
|
|
3810
3829
|
super.writeValue(value);
|
|
3811
3830
|
}
|
|
3812
3831
|
}
|
|
3813
|
-
NiceAdvancedSelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceAdvancedSelectFilterComponent, deps:
|
|
3832
|
+
NiceAdvancedSelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceAdvancedSelectFilterComponent, deps: [{ token: NiceFilterViewQuery }], target: i0.ɵɵFactoryTarget.Component });
|
|
3814
3833
|
NiceAdvancedSelectFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NiceAdvancedSelectFilterComponent, selector: "nice-advanced-select-filter", inputs: { filterConfig: "filterConfig" }, providers: [
|
|
3815
3834
|
{
|
|
3816
3835
|
provide: NG_VALUE_ACCESSOR,
|
|
3817
3836
|
useExisting: forwardRef(() => NiceAdvancedSelectFilterComponent),
|
|
3818
3837
|
multi: true
|
|
3819
3838
|
}
|
|
3820
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"flex-auto\">\n <nice-typeahead\n *ngIf=\"!filterConfig.lazyLoading\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n\n <nice-async-typeahead\n *ngIf=\"filterConfig.lazyLoading\"\n resource=\"advancedFilter\"\n [searchOptions]=\"{ filterConfig }\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n ></nice-async-typeahead>\n</mat-form-field>\n", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5$1.NiceTypeaheadComponent, selector: "nice-typeahead", inputs: ["items", "labelFormatFn", "required", "disabled", "placeholder", "emptyPlaceholder", "allowNotFoundItems", "panelClass", "bindValue", "bindLabel", "typeahead", "page$", "loading", "loadingPage", "searchFn", "optionTemplate"], outputs: ["change"] }, { kind: "component", type: i5$1.NiceAsyncTypeaheadComponent, selector: "nice-async-typeahead", inputs: ["resource", "searchOptions", "autoReload", "preloadResource", "allowNotFoundItems", "panelClass", "bindValue", "bindLabel", "placeholder", "emptyPlaceholder", "optionTemplate", "filterFn", "labelFormatFn", "disabled", "value", "required"], outputs: ["entityRemoved", "selected"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
3839
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\" class=\"flex-auto\">\n <nice-typeahead\n *ngIf=\"!filterConfig.lazyLoading\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n\n <nice-async-typeahead\n *ngIf=\"filterConfig.lazyLoading\"\n resource=\"advancedFilter\"\n [searchOptions]=\"{ filterConfig, queryParams: queryParams$ | async }\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n ></nice-async-typeahead>\n</mat-form-field>\n", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5$1.NiceTypeaheadComponent, selector: "nice-typeahead", inputs: ["items", "labelFormatFn", "required", "disabled", "placeholder", "emptyPlaceholder", "allowNotFoundItems", "panelClass", "bindValue", "bindLabel", "typeahead", "page$", "loading", "loadingPage", "searchFn", "optionTemplate"], outputs: ["change"] }, { kind: "component", type: i5$1.NiceAsyncTypeaheadComponent, selector: "nice-async-typeahead", inputs: ["resource", "searchOptions", "autoReload", "preloadResource", "allowNotFoundItems", "panelClass", "bindValue", "bindLabel", "placeholder", "emptyPlaceholder", "optionTemplate", "filterFn", "labelFormatFn", "disabled", "value", "required"], outputs: ["entityRemoved", "selected"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
|
|
3821
3840
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceAdvancedSelectFilterComponent, decorators: [{
|
|
3822
3841
|
type: Component,
|
|
3823
3842
|
args: [{ selector: "nice-advanced-select-filter", encapsulation: ViewEncapsulation.None, providers: [
|
|
@@ -3826,8 +3845,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
3826
3845
|
useExisting: forwardRef(() => NiceAdvancedSelectFilterComponent),
|
|
3827
3846
|
multi: true
|
|
3828
3847
|
}
|
|
3829
|
-
], template: "<mat-form-field appearance=\"outline\" class=\"flex-auto\">\n <nice-typeahead\n *ngIf=\"!filterConfig.lazyLoading\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n\n <nice-async-typeahead\n *ngIf=\"filterConfig.lazyLoading\"\n resource=\"advancedFilter\"\n [searchOptions]=\"{ filterConfig }\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n ></nice-async-typeahead>\n</mat-form-field>\n" }]
|
|
3830
|
-
}], propDecorators: { filterConfig: [{
|
|
3848
|
+
], template: "<mat-form-field appearance=\"outline\" class=\"flex-auto\">\n <nice-typeahead\n *ngIf=\"!filterConfig.lazyLoading\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n\n <nice-async-typeahead\n *ngIf=\"filterConfig.lazyLoading\"\n resource=\"advancedFilter\"\n [searchOptions]=\"{ filterConfig, queryParams: queryParams$ | async }\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n ></nice-async-typeahead>\n</mat-form-field>\n" }]
|
|
3849
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewQuery }]; }, propDecorators: { filterConfig: [{
|
|
3831
3850
|
type: Input
|
|
3832
3851
|
}] } });
|
|
3833
3852
|
|