@recursyve/nice-data-filter-kit 14.5.4 → 14.5.6
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 +2 -2
- 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 +41 -22
- 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: "14.2.3", ngImport: i0, type: NiceFilterService, deps: [{ token: NiceFilterApi }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -2998,6 +3012,9 @@ class NiceFilterViewQuery extends QueryEntity {
|
|
|
2998
3012
|
selectFilterResult() {
|
|
2999
3013
|
return this.select("filterResult");
|
|
3000
3014
|
}
|
|
3015
|
+
selectQueryParams() {
|
|
3016
|
+
return this.select("queryParams");
|
|
3017
|
+
}
|
|
3001
3018
|
getParameters() {
|
|
3002
3019
|
return this.store.getParameters(this.store.getValue().filterParameters);
|
|
3003
3020
|
}
|
|
@@ -3206,7 +3223,7 @@ class NiceFilterViewService {
|
|
|
3206
3223
|
removeRule(id) {
|
|
3207
3224
|
const { filterParameters } = this.store.getValue();
|
|
3208
3225
|
const currentQuery = filterParameters.rules?.[0];
|
|
3209
|
-
const oldRule = currentQuery
|
|
3226
|
+
const oldRule = currentQuery?.rules?.find((r) => r.id === id);
|
|
3210
3227
|
if (!oldRule) {
|
|
3211
3228
|
return;
|
|
3212
3229
|
}
|
|
@@ -3555,10 +3572,10 @@ class AdvancedFiltersAsyncTypeaheadProvider extends NiceAsyncTypeaheadProvider {
|
|
|
3555
3572
|
this.resource = "advancedFilter";
|
|
3556
3573
|
}
|
|
3557
3574
|
getById(id, options) {
|
|
3558
|
-
return lastValueFrom(this.filterService.searchFilterResourceValue(options.filterConfig, id));
|
|
3575
|
+
return lastValueFrom(this.filterService.searchFilterResourceValue(options.filterConfig, id, { params: options?.queryParams }));
|
|
3559
3576
|
}
|
|
3560
3577
|
async search(searchQuery, page, options) {
|
|
3561
|
-
const res = await lastValueFrom(this.filterService.searchFilterValue(options.filterConfig, searchQuery));
|
|
3578
|
+
const res = await lastValueFrom(this.filterService.searchFilterValue(options.filterConfig, searchQuery, { params: options?.queryParams }));
|
|
3562
3579
|
return {
|
|
3563
3580
|
items: res,
|
|
3564
3581
|
nextPage: null
|
|
@@ -3753,9 +3770,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
|
|
|
3753
3770
|
}] } });
|
|
3754
3771
|
|
|
3755
3772
|
class NiceAdvancedSelectFilterComponent extends FilterComponent {
|
|
3756
|
-
constructor() {
|
|
3757
|
-
super(
|
|
3773
|
+
constructor(filterViewQuery) {
|
|
3774
|
+
super();
|
|
3775
|
+
this.filterViewQuery = filterViewQuery;
|
|
3758
3776
|
this.values = [];
|
|
3777
|
+
this.queryParams$ = this.filterViewQuery.selectQueryParams();
|
|
3759
3778
|
}
|
|
3760
3779
|
async ngOnInit() {
|
|
3761
3780
|
if (!this.filterConfig.lazyLoading) {
|
|
@@ -3779,14 +3798,14 @@ class NiceAdvancedSelectFilterComponent extends FilterComponent {
|
|
|
3779
3798
|
super.writeValue(value);
|
|
3780
3799
|
}
|
|
3781
3800
|
}
|
|
3782
|
-
NiceAdvancedSelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedSelectFilterComponent, deps:
|
|
3801
|
+
NiceAdvancedSelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedSelectFilterComponent, deps: [{ token: NiceFilterViewQuery }], target: i0.ɵɵFactoryTarget.Component });
|
|
3783
3802
|
NiceAdvancedSelectFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAdvancedSelectFilterComponent, selector: "nice-advanced-select-filter", inputs: { filterConfig: "filterConfig" }, providers: [
|
|
3784
3803
|
{
|
|
3785
3804
|
provide: NG_VALUE_ACCESSOR,
|
|
3786
3805
|
useExisting: forwardRef(() => NiceAdvancedSelectFilterComponent),
|
|
3787
3806
|
multi: true
|
|
3788
3807
|
}
|
|
3789
|
-
], 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: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], 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", "preloadResource", "allowNotFoundItems", "panelClass", "bindValue", "bindLabel", "placeholder", "emptyPlaceholder", "optionTemplate", "filterFn", "labelFormatFn", "disabled", "value", "required"], outputs: ["entityRemoved", "selected"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
3808
|
+
], 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: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], 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", "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 });
|
|
3790
3809
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedSelectFilterComponent, decorators: [{
|
|
3791
3810
|
type: Component,
|
|
3792
3811
|
args: [{ selector: "nice-advanced-select-filter", encapsulation: ViewEncapsulation.None, providers: [
|
|
@@ -3795,8 +3814,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
|
|
|
3795
3814
|
useExisting: forwardRef(() => NiceAdvancedSelectFilterComponent),
|
|
3796
3815
|
multi: true
|
|
3797
3816
|
}
|
|
3798
|
-
], 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" }]
|
|
3799
|
-
}], propDecorators: { filterConfig: [{
|
|
3817
|
+
], 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" }]
|
|
3818
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewQuery }]; }, propDecorators: { filterConfig: [{
|
|
3800
3819
|
type: Input
|
|
3801
3820
|
}] } });
|
|
3802
3821
|
|