@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,20 @@ 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: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.params), { id,
|
|
158
|
+
value })
|
|
159
|
+
});
|
|
157
160
|
}
|
|
158
|
-
searchFilterResourceValue(id, resourceId) {
|
|
159
|
-
return this.http.get(this.url(`filter/config/id
|
|
161
|
+
searchFilterResourceValue(id, resourceId, options) {
|
|
162
|
+
return this.http.get(this.url(`filter/config/id`), {
|
|
163
|
+
params: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.params), { id,
|
|
164
|
+
resourceId })
|
|
165
|
+
});
|
|
160
166
|
}
|
|
161
167
|
url(...args) {
|
|
162
168
|
const [route, queryParams] = this.transformUrlArgs(args);
|
|
@@ -180,6 +186,9 @@ class NiceFilterApi {
|
|
|
180
186
|
const mixinNiceFilterApi = (model) => {
|
|
181
187
|
return (base) => {
|
|
182
188
|
return class extends base {
|
|
189
|
+
constructor(...args) {
|
|
190
|
+
super(...args);
|
|
191
|
+
}
|
|
183
192
|
filter(queryModel, option = {}) {
|
|
184
193
|
return this.post("filter", queryModel, option).pipe(map(x => model ? (Object.assign(Object.assign({}, x), { values: plainToInstance(model, x.values) })) : x));
|
|
185
194
|
}
|
|
@@ -195,28 +204,21 @@ const mixinNiceFilterApi = (model) => {
|
|
|
195
204
|
getFilterConfig(option = {}) {
|
|
196
205
|
return this.get("filter/config", option);
|
|
197
206
|
}
|
|
198
|
-
searchFilterValue(id, value) {
|
|
207
|
+
searchFilterValue(id, value, options) {
|
|
199
208
|
if (value === undefined) {
|
|
200
209
|
value = "";
|
|
201
210
|
}
|
|
202
211
|
return this.get("filter/config/value", {
|
|
203
|
-
params: {
|
|
204
|
-
|
|
205
|
-
value
|
|
206
|
-
}
|
|
212
|
+
params: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.params), { id,
|
|
213
|
+
value })
|
|
207
214
|
});
|
|
208
215
|
}
|
|
209
|
-
searchFilterResourceValue(id, resourceId) {
|
|
216
|
+
searchFilterResourceValue(id, resourceId, options) {
|
|
210
217
|
return this.get("filter/config/id", {
|
|
211
|
-
params: {
|
|
212
|
-
|
|
213
|
-
resourceId
|
|
214
|
-
}
|
|
218
|
+
params: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.params), { id,
|
|
219
|
+
resourceId })
|
|
215
220
|
});
|
|
216
221
|
}
|
|
217
|
-
constructor(...args) {
|
|
218
|
-
super(...args);
|
|
219
|
-
}
|
|
220
222
|
};
|
|
221
223
|
};
|
|
222
224
|
};
|
|
@@ -611,13 +613,13 @@ class NiceFilterService {
|
|
|
611
613
|
var _a;
|
|
612
614
|
return (_a = this.api) === null || _a === void 0 ? void 0 : _a.getFilterConfig(option);
|
|
613
615
|
}
|
|
614
|
-
searchFilterValue(filterConfig, value) {
|
|
616
|
+
searchFilterValue(filterConfig, value, options) {
|
|
615
617
|
var _a;
|
|
616
|
-
return (_a = this.api) === null || _a === void 0 ? void 0 : _a.searchFilterValue(filterConfig.id, value);
|
|
618
|
+
return (_a = this.api) === null || _a === void 0 ? void 0 : _a.searchFilterValue(filterConfig.id, value, options);
|
|
617
619
|
}
|
|
618
|
-
searchFilterResourceValue(filterConfig, resourceId) {
|
|
620
|
+
searchFilterResourceValue(filterConfig, resourceId, options) {
|
|
619
621
|
var _a;
|
|
620
|
-
return (_a = this.api) === null || _a === void 0 ? void 0 : _a.searchFilterResourceValue(filterConfig.id, resourceId);
|
|
622
|
+
return (_a = this.api) === null || _a === void 0 ? void 0 : _a.searchFilterResourceValue(filterConfig.id, resourceId, options);
|
|
621
623
|
}
|
|
622
624
|
}
|
|
623
625
|
NiceFilterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceFilterService, deps: [{ token: NiceFilterApi }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -2983,6 +2985,9 @@ class NiceFilterViewQuery extends QueryEntity {
|
|
|
2983
2985
|
selectFilterResult() {
|
|
2984
2986
|
return this.select("filterResult");
|
|
2985
2987
|
}
|
|
2988
|
+
selectQueryParams() {
|
|
2989
|
+
return this.select("queryParams");
|
|
2990
|
+
}
|
|
2986
2991
|
getParameters() {
|
|
2987
2992
|
return this.store.getParameters(this.store.getValue().filterParameters);
|
|
2988
2993
|
}
|
|
@@ -3047,13 +3052,13 @@ class NiceFilterViewService {
|
|
|
3047
3052
|
}
|
|
3048
3053
|
filter() {
|
|
3049
3054
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3050
|
-
const { filterParameters, disabled } = this.store.getValue();
|
|
3055
|
+
const { filterParameters, disabled, queryParams } = this.store.getValue();
|
|
3051
3056
|
if (disabled) {
|
|
3052
3057
|
return;
|
|
3053
3058
|
}
|
|
3054
3059
|
try {
|
|
3055
3060
|
this.store.setLoading(true);
|
|
3056
|
-
const result = yield firstValueFrom(this.filterService.filter(this.store.getParameters(filterParameters)));
|
|
3061
|
+
const result = yield firstValueFrom(this.filterService.filter(this.store.getParameters(filterParameters), { params: queryParams }));
|
|
3057
3062
|
this.store.setResult(result);
|
|
3058
3063
|
}
|
|
3059
3064
|
catch (e) {
|
|
@@ -3572,11 +3577,11 @@ class AdvancedFiltersAsyncTypeaheadProvider extends NiceAsyncTypeaheadProvider {
|
|
|
3572
3577
|
this.resource = "advancedFilter";
|
|
3573
3578
|
}
|
|
3574
3579
|
getById(id, options) {
|
|
3575
|
-
return lastValueFrom(this.filterService.searchFilterResourceValue(options.filterConfig, id));
|
|
3580
|
+
return lastValueFrom(this.filterService.searchFilterResourceValue(options.filterConfig, id, { params: options === null || options === void 0 ? void 0 : options.queryParams }));
|
|
3576
3581
|
}
|
|
3577
3582
|
search(searchQuery, page, options) {
|
|
3578
3583
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3579
|
-
const res = yield lastValueFrom(this.filterService.searchFilterValue(options.filterConfig, searchQuery));
|
|
3584
|
+
const res = yield lastValueFrom(this.filterService.searchFilterValue(options.filterConfig, searchQuery, { params: options === null || options === void 0 ? void 0 : options.queryParams }));
|
|
3580
3585
|
return {
|
|
3581
3586
|
items: res,
|
|
3582
3587
|
nextPage: null
|
|
@@ -3763,9 +3768,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
3763
3768
|
}] } });
|
|
3764
3769
|
|
|
3765
3770
|
class NiceAdvancedSelectFilterComponent extends FilterComponent {
|
|
3766
|
-
constructor() {
|
|
3767
|
-
super(
|
|
3771
|
+
constructor(filterViewQuery) {
|
|
3772
|
+
super();
|
|
3773
|
+
this.filterViewQuery = filterViewQuery;
|
|
3768
3774
|
this.values = [];
|
|
3775
|
+
this.queryParams$ = this.filterViewQuery.selectQueryParams();
|
|
3769
3776
|
}
|
|
3770
3777
|
ngOnInit() {
|
|
3771
3778
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -3791,14 +3798,14 @@ class NiceAdvancedSelectFilterComponent extends FilterComponent {
|
|
|
3791
3798
|
super.writeValue(value);
|
|
3792
3799
|
}
|
|
3793
3800
|
}
|
|
3794
|
-
NiceAdvancedSelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceAdvancedSelectFilterComponent, deps:
|
|
3801
|
+
NiceAdvancedSelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceAdvancedSelectFilterComponent, deps: [{ token: NiceFilterViewQuery }], target: i0.ɵɵFactoryTarget.Component });
|
|
3795
3802
|
NiceAdvancedSelectFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NiceAdvancedSelectFilterComponent, selector: "nice-advanced-select-filter", inputs: { filterConfig: "filterConfig" }, providers: [
|
|
3796
3803
|
{
|
|
3797
3804
|
provide: NG_VALUE_ACCESSOR,
|
|
3798
3805
|
useExisting: forwardRef(() => NiceAdvancedSelectFilterComponent),
|
|
3799
3806
|
multi: true
|
|
3800
3807
|
}
|
|
3801
|
-
], 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 });
|
|
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: ["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 });
|
|
3802
3809
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NiceAdvancedSelectFilterComponent, decorators: [{
|
|
3803
3810
|
type: Component,
|
|
3804
3811
|
args: [{ selector: "nice-advanced-select-filter", encapsulation: ViewEncapsulation.None, providers: [
|
|
@@ -3807,8 +3814,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
3807
3814
|
useExisting: forwardRef(() => NiceAdvancedSelectFilterComponent),
|
|
3808
3815
|
multi: true
|
|
3809
3816
|
}
|
|
3810
|
-
], 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" }]
|
|
3811
|
-
}], 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: [{
|
|
3812
3819
|
type: Input
|
|
3813
3820
|
}] } });
|
|
3814
3821
|
|