@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,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: "14.2.3", ngImport: i0, type: NiceFilterService, deps: [{ token: NiceFilterApi }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -2979,6 +2981,9 @@ class NiceFilterViewQuery extends QueryEntity {
|
|
|
2979
2981
|
selectFilterResult() {
|
|
2980
2982
|
return this.select("filterResult");
|
|
2981
2983
|
}
|
|
2984
|
+
selectQueryParams() {
|
|
2985
|
+
return this.select("queryParams");
|
|
2986
|
+
}
|
|
2982
2987
|
getParameters() {
|
|
2983
2988
|
return this.store.getParameters(this.store.getValue().filterParameters);
|
|
2984
2989
|
}
|
|
@@ -3182,10 +3187,10 @@ class NiceFilterViewService {
|
|
|
3182
3187
|
});
|
|
3183
3188
|
}
|
|
3184
3189
|
removeRule(id) {
|
|
3185
|
-
var _a;
|
|
3190
|
+
var _a, _b;
|
|
3186
3191
|
const { filterParameters } = this.store.getValue();
|
|
3187
3192
|
const currentQuery = (_a = filterParameters.rules) === null || _a === void 0 ? void 0 : _a[0];
|
|
3188
|
-
const oldRule = currentQuery.rules.find((r) => r.id === id);
|
|
3193
|
+
const oldRule = (_b = currentQuery === null || currentQuery === void 0 ? void 0 : currentQuery.rules) === null || _b === void 0 ? void 0 : _b.find((r) => r.id === id);
|
|
3189
3194
|
if (!oldRule) {
|
|
3190
3195
|
return;
|
|
3191
3196
|
}
|
|
@@ -3541,11 +3546,11 @@ class AdvancedFiltersAsyncTypeaheadProvider extends NiceAsyncTypeaheadProvider {
|
|
|
3541
3546
|
this.resource = "advancedFilter";
|
|
3542
3547
|
}
|
|
3543
3548
|
getById(id, options) {
|
|
3544
|
-
return lastValueFrom(this.filterService.searchFilterResourceValue(options.filterConfig, id));
|
|
3549
|
+
return lastValueFrom(this.filterService.searchFilterResourceValue(options.filterConfig, id, { params: options === null || options === void 0 ? void 0 : options.queryParams }));
|
|
3545
3550
|
}
|
|
3546
3551
|
search(searchQuery, page, options) {
|
|
3547
3552
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3548
|
-
const res = yield lastValueFrom(this.filterService.searchFilterValue(options.filterConfig, searchQuery));
|
|
3553
|
+
const res = yield lastValueFrom(this.filterService.searchFilterValue(options.filterConfig, searchQuery, { params: options === null || options === void 0 ? void 0 : options.queryParams }));
|
|
3549
3554
|
return {
|
|
3550
3555
|
items: res,
|
|
3551
3556
|
nextPage: null
|
|
@@ -3732,9 +3737,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
|
|
|
3732
3737
|
}] } });
|
|
3733
3738
|
|
|
3734
3739
|
class NiceAdvancedSelectFilterComponent extends FilterComponent {
|
|
3735
|
-
constructor() {
|
|
3736
|
-
super(
|
|
3740
|
+
constructor(filterViewQuery) {
|
|
3741
|
+
super();
|
|
3742
|
+
this.filterViewQuery = filterViewQuery;
|
|
3737
3743
|
this.values = [];
|
|
3744
|
+
this.queryParams$ = this.filterViewQuery.selectQueryParams();
|
|
3738
3745
|
}
|
|
3739
3746
|
ngOnInit() {
|
|
3740
3747
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -3760,14 +3767,14 @@ class NiceAdvancedSelectFilterComponent extends FilterComponent {
|
|
|
3760
3767
|
super.writeValue(value);
|
|
3761
3768
|
}
|
|
3762
3769
|
}
|
|
3763
|
-
NiceAdvancedSelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedSelectFilterComponent, deps:
|
|
3770
|
+
NiceAdvancedSelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedSelectFilterComponent, deps: [{ token: NiceFilterViewQuery }], target: i0.ɵɵFactoryTarget.Component });
|
|
3764
3771
|
NiceAdvancedSelectFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceAdvancedSelectFilterComponent, selector: "nice-advanced-select-filter", inputs: { filterConfig: "filterConfig" }, providers: [
|
|
3765
3772
|
{
|
|
3766
3773
|
provide: NG_VALUE_ACCESSOR,
|
|
3767
3774
|
useExisting: forwardRef(() => NiceAdvancedSelectFilterComponent),
|
|
3768
3775
|
multi: true
|
|
3769
3776
|
}
|
|
3770
|
-
], 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 });
|
|
3777
|
+
], 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 });
|
|
3771
3778
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedSelectFilterComponent, decorators: [{
|
|
3772
3779
|
type: Component,
|
|
3773
3780
|
args: [{ selector: "nice-advanced-select-filter", encapsulation: ViewEncapsulation.None, providers: [
|
|
@@ -3776,8 +3783,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
|
|
|
3776
3783
|
useExisting: forwardRef(() => NiceAdvancedSelectFilterComponent),
|
|
3777
3784
|
multi: true
|
|
3778
3785
|
}
|
|
3779
|
-
], 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" }]
|
|
3780
|
-
}], propDecorators: { filterConfig: [{
|
|
3786
|
+
], 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" }]
|
|
3787
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewQuery }]; }, propDecorators: { filterConfig: [{
|
|
3781
3788
|
type: Input
|
|
3782
3789
|
}] } });
|
|
3783
3790
|
|