@recursyve/nice-data-filter-kit 14.3.1 → 14.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/components/nice-filter-view/components/advanced-filters/advanced-filters.component.mjs +6 -3
- package/esm2020/lib/components/nice-filter-view/components/advanced-filters/advanced-filters.form.mjs +4 -10
- package/esm2020/lib/components/nice-filter-view/components/advanced-filters/button/advanced-filters-button.component.mjs +2 -2
- package/esm2020/lib/components/nice-filter-view/components/infinite-scroll-data-view/infinite-scroll-data-view.component.mjs +8 -4
- package/esm2020/lib/components/nice-filter-view/components/search/search.component.mjs +3 -2
- package/esm2020/lib/components/nice-filter-view/directives/mat-paginator.mjs +3 -2
- package/esm2020/lib/components/nice-filter-view/directives/mat-sort.mjs +4 -3
- package/esm2020/lib/components/nice-filter-view/directives/query-params.directive.mjs +2 -2
- package/esm2020/lib/components/nice-filter-view/nice-base-filter-view.component.mjs +13 -4
- package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.service.mjs +10 -10
- package/fesm2015/recursyve-nice-data-filter-kit.mjs +44 -31
- package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/fesm2020/recursyve-nice-data-filter-kit.mjs +45 -32
- package/fesm2020/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/lib/components/nice-filter-view/components/advanced-filters/advanced-filters.form.d.ts +0 -1
- package/lib/components/nice-filter-view/store/nice-filter-view.service.d.ts +8 -4
- package/package.json +2 -2
|
@@ -3021,7 +3021,7 @@ class NiceFilterViewService {
|
|
|
3021
3021
|
this.store.setLoading(false);
|
|
3022
3022
|
}
|
|
3023
3023
|
}
|
|
3024
|
-
setParameters(filterParameters, reload
|
|
3024
|
+
setParameters(filterParameters, reload) {
|
|
3025
3025
|
this.store.setParameters(filterParameters);
|
|
3026
3026
|
if (reload) {
|
|
3027
3027
|
this.filter();
|
|
@@ -3032,7 +3032,7 @@ class NiceFilterViewService {
|
|
|
3032
3032
|
this.setParameters({
|
|
3033
3033
|
...filterParameters,
|
|
3034
3034
|
start: 0
|
|
3035
|
-
}
|
|
3035
|
+
});
|
|
3036
3036
|
this.resetResult(true);
|
|
3037
3037
|
}
|
|
3038
3038
|
setQueryParams(queryParams) {
|
|
@@ -3046,7 +3046,7 @@ class NiceFilterViewService {
|
|
|
3046
3046
|
this.filter();
|
|
3047
3047
|
}
|
|
3048
3048
|
}
|
|
3049
|
-
setRules(rules
|
|
3049
|
+
setRules(rules) {
|
|
3050
3050
|
if (!Array.isArray(rules)) {
|
|
3051
3051
|
rules = [rules];
|
|
3052
3052
|
}
|
|
@@ -3057,9 +3057,9 @@ class NiceFilterViewService {
|
|
|
3057
3057
|
length: filterParameters.length,
|
|
3058
3058
|
rules
|
|
3059
3059
|
};
|
|
3060
|
-
this.setParameters(newRules
|
|
3060
|
+
this.setParameters(newRules);
|
|
3061
3061
|
}
|
|
3062
|
-
upsertRule(id, newRule
|
|
3062
|
+
upsertRule(id, newRule) {
|
|
3063
3063
|
const { filterParameters } = this.store.getValue();
|
|
3064
3064
|
const currentQuery = filterParameters.rules?.[0];
|
|
3065
3065
|
const rule = {
|
|
@@ -3068,7 +3068,7 @@ class NiceFilterViewService {
|
|
|
3068
3068
|
};
|
|
3069
3069
|
const query = { rules: [rule], condition: "and" };
|
|
3070
3070
|
if (!currentQuery || currentQuery.rules.length === 0) {
|
|
3071
|
-
this.setRules(query
|
|
3071
|
+
this.setRules(query);
|
|
3072
3072
|
return;
|
|
3073
3073
|
}
|
|
3074
3074
|
const oldRule = currentQuery.rules.find((r) => r.id === id);
|
|
@@ -3092,9 +3092,9 @@ class NiceFilterViewService {
|
|
|
3092
3092
|
this.setRules({
|
|
3093
3093
|
condition: currentQuery.condition,
|
|
3094
3094
|
rules: newRules
|
|
3095
|
-
}
|
|
3095
|
+
});
|
|
3096
3096
|
}
|
|
3097
|
-
removeRule(id
|
|
3097
|
+
removeRule(id) {
|
|
3098
3098
|
const { filterParameters } = this.store.getValue();
|
|
3099
3099
|
const currentQuery = filterParameters.rules?.[0];
|
|
3100
3100
|
const oldRule = currentQuery.rules.find((r) => r.id === id);
|
|
@@ -3105,7 +3105,7 @@ class NiceFilterViewService {
|
|
|
3105
3105
|
this.setRules({
|
|
3106
3106
|
condition: currentQuery.condition,
|
|
3107
3107
|
rules: newRules
|
|
3108
|
-
}
|
|
3108
|
+
});
|
|
3109
3109
|
}
|
|
3110
3110
|
addValue(value, opts) {
|
|
3111
3111
|
this.store.addValue(value, opts);
|
|
@@ -3369,7 +3369,7 @@ class NiceAdvancedFiltersButtonComponent {
|
|
|
3369
3369
|
}
|
|
3370
3370
|
onSelectedFilter(filter) {
|
|
3371
3371
|
const rule = AdvancedFiltersUtils.createRule(filter);
|
|
3372
|
-
this.service.setRules([{ condition: "and", rules: [rule] }]
|
|
3372
|
+
this.service.setRules([{ condition: "and", rules: [rule] }]);
|
|
3373
3373
|
this.service.updateSubState("showAdvancedFilters", true);
|
|
3374
3374
|
}
|
|
3375
3375
|
}
|
|
@@ -3394,7 +3394,7 @@ __decorate([
|
|
|
3394
3394
|
], FilterFormValues.prototype, "value", void 0);
|
|
3395
3395
|
__decorate([
|
|
3396
3396
|
Control(),
|
|
3397
|
-
AddValidatorIf(({ parent }) => parent.
|
|
3397
|
+
AddValidatorIf(({ parent }) => QBFilterUtils.isDoubleInput(parent.operation), Validators.required),
|
|
3398
3398
|
__metadata("design:type", Object)
|
|
3399
3399
|
], FilterFormValues.prototype, "secondValue", void 0);
|
|
3400
3400
|
class FilterForm {
|
|
@@ -3409,7 +3409,6 @@ class FilterForm {
|
|
|
3409
3409
|
id: rule.id,
|
|
3410
3410
|
operation: rule.operation,
|
|
3411
3411
|
condition: "or",
|
|
3412
|
-
needsTwoValues,
|
|
3413
3412
|
values: [
|
|
3414
3413
|
{
|
|
3415
3414
|
value: needsTwoValues ? rule.value[0] : rule.value,
|
|
@@ -3429,7 +3428,6 @@ class FilterForm {
|
|
|
3429
3428
|
id: firstRule.id,
|
|
3430
3429
|
operation: firstRule.operation,
|
|
3431
3430
|
condition: query.condition,
|
|
3432
|
-
needsTwoValues: firstRuleNeedsTwoValues,
|
|
3433
3431
|
values: query.rules.map((rule) => ({
|
|
3434
3432
|
value: firstRuleNeedsTwoValues ? rule.value[0] : rule.value,
|
|
3435
3433
|
secondValue: firstRuleNeedsTwoValues ? rule.value[1] : undefined
|
|
@@ -3443,7 +3441,7 @@ class FilterForm {
|
|
|
3443
3441
|
return {
|
|
3444
3442
|
id: this.id,
|
|
3445
3443
|
operation: this.operation,
|
|
3446
|
-
value: this.
|
|
3444
|
+
value: QBFilterUtils.isDoubleInput(this.operation) ? [value.value, value.secondValue] : value.value
|
|
3447
3445
|
};
|
|
3448
3446
|
}
|
|
3449
3447
|
return {
|
|
@@ -3451,7 +3449,7 @@ class FilterForm {
|
|
|
3451
3449
|
rules: this.values.map((value) => ({
|
|
3452
3450
|
id: this.id,
|
|
3453
3451
|
operation: this.operation,
|
|
3454
|
-
value: this.
|
|
3452
|
+
value: QBFilterUtils.isDoubleInput(this.operation) ? [value.value, value.secondValue] : value.value
|
|
3455
3453
|
}))
|
|
3456
3454
|
};
|
|
3457
3455
|
}
|
|
@@ -3466,10 +3464,6 @@ __decorate([
|
|
|
3466
3464
|
Required(),
|
|
3467
3465
|
__metadata("design:type", String)
|
|
3468
3466
|
], FilterForm.prototype, "operation", void 0);
|
|
3469
|
-
__decorate([
|
|
3470
|
-
Control(),
|
|
3471
|
-
__metadata("design:type", Boolean)
|
|
3472
|
-
], FilterForm.prototype, "needsTwoValues", void 0);
|
|
3473
3467
|
__decorate([
|
|
3474
3468
|
Control(),
|
|
3475
3469
|
Required(),
|
|
@@ -3778,7 +3772,8 @@ class NiceAdvancedFiltersComponent {
|
|
|
3778
3772
|
onClickDeleteRule(index) {
|
|
3779
3773
|
this.rulesFormArray.removeAt(index);
|
|
3780
3774
|
if (!this.rulesFormArray.length) {
|
|
3781
|
-
this.service.setRules([]
|
|
3775
|
+
this.service.setRules([]);
|
|
3776
|
+
this.service.filter();
|
|
3782
3777
|
this.onClose();
|
|
3783
3778
|
}
|
|
3784
3779
|
}
|
|
@@ -3786,7 +3781,9 @@ class NiceAdvancedFiltersComponent {
|
|
|
3786
3781
|
this.service.updateSubState("showAdvancedFilters", false);
|
|
3787
3782
|
}
|
|
3788
3783
|
onRefresh() {
|
|
3789
|
-
this.service.setRules(this.formGroup.getRawValue().transform()
|
|
3784
|
+
this.service.setRules(this.formGroup.getRawValue().transform());
|
|
3785
|
+
this.service.resetResult(true);
|
|
3786
|
+
this.service.filter();
|
|
3790
3787
|
}
|
|
3791
3788
|
}
|
|
3792
3789
|
NiceAdvancedFiltersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceAdvancedFiltersComponent, deps: [{ token: ADVANCED_FILTER_ICONS, optional: true }, { token: i1$3.GeneratedFormGroup }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -4084,12 +4081,16 @@ class NiceFilterInfiniteScrollDataViewComponent {
|
|
|
4084
4081
|
this.data$ = this.query.selectAll();
|
|
4085
4082
|
}
|
|
4086
4083
|
async loadNextPage() {
|
|
4087
|
-
const { filterParameters } = this.query.getValue();
|
|
4084
|
+
const { filterParameters, filterResult } = this.query.getValue();
|
|
4088
4085
|
this.service.setMode("accumulated");
|
|
4089
|
-
|
|
4086
|
+
if (filterResult && filterResult.values.length >= filterResult.total) {
|
|
4087
|
+
return;
|
|
4088
|
+
}
|
|
4089
|
+
this.service.setParameters({
|
|
4090
4090
|
...filterParameters,
|
|
4091
4091
|
start: filterParameters.start + filterParameters.length
|
|
4092
|
-
}
|
|
4092
|
+
});
|
|
4093
|
+
this.service.filter();
|
|
4093
4094
|
}
|
|
4094
4095
|
}
|
|
4095
4096
|
NiceFilterInfiniteScrollDataViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterInfiniteScrollDataViewComponent, deps: [{ token: NiceFilterViewQuery }, { token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -4123,7 +4124,8 @@ class NiceFilterSearchComponent {
|
|
|
4123
4124
|
this.service.setParameters({
|
|
4124
4125
|
...filterParameters,
|
|
4125
4126
|
search
|
|
4126
|
-
}
|
|
4127
|
+
});
|
|
4128
|
+
this.service.filter();
|
|
4127
4129
|
}))
|
|
4128
4130
|
.subscribe();
|
|
4129
4131
|
}
|
|
@@ -4170,7 +4172,8 @@ class NiceFilterMatPaginatorPaginationDirective {
|
|
|
4170
4172
|
...filterParameters,
|
|
4171
4173
|
start: page.pageIndex * page.pageSize,
|
|
4172
4174
|
length: page.pageSize
|
|
4173
|
-
}
|
|
4175
|
+
});
|
|
4176
|
+
this.service.filter();
|
|
4174
4177
|
});
|
|
4175
4178
|
}
|
|
4176
4179
|
ngOnDestroy() {
|
|
@@ -4211,7 +4214,7 @@ class NiceFilterMatSortSortingDirective {
|
|
|
4211
4214
|
this.service.setParameters({
|
|
4212
4215
|
...values,
|
|
4213
4216
|
order: {}
|
|
4214
|
-
}
|
|
4217
|
+
});
|
|
4215
4218
|
}
|
|
4216
4219
|
else {
|
|
4217
4220
|
this.service.setParameters({
|
|
@@ -4220,8 +4223,9 @@ class NiceFilterMatSortSortingDirective {
|
|
|
4220
4223
|
column: sort.active,
|
|
4221
4224
|
direction: sort.direction
|
|
4222
4225
|
}
|
|
4223
|
-
}
|
|
4226
|
+
});
|
|
4224
4227
|
}
|
|
4228
|
+
this.service.filter();
|
|
4225
4229
|
});
|
|
4226
4230
|
}
|
|
4227
4231
|
ngOnDestroy() {
|
|
@@ -4310,7 +4314,7 @@ class NiceFilterQueryParamsDirective {
|
|
|
4310
4314
|
const { filterParameters, filterResult } = this.query.getValue();
|
|
4311
4315
|
if (FilterUtils.filterChangeNeedsRefresh(filterParameters, params) ||
|
|
4312
4316
|
!filterResult) {
|
|
4313
|
-
this.service.setParameters(params
|
|
4317
|
+
this.service.setParameters(params);
|
|
4314
4318
|
}
|
|
4315
4319
|
if (!this._initialized) {
|
|
4316
4320
|
this._initialized = true;
|
|
@@ -4400,21 +4404,30 @@ class NiceBaseFilterViewComponent {
|
|
|
4400
4404
|
* Reset all rules with a new set of rules.
|
|
4401
4405
|
*/
|
|
4402
4406
|
setRules(rules, reload = true) {
|
|
4403
|
-
this.filterViewService.setRules(rules
|
|
4407
|
+
this.filterViewService.setRules(rules);
|
|
4408
|
+
if (reload) {
|
|
4409
|
+
this.filterViewService.filter();
|
|
4410
|
+
}
|
|
4404
4411
|
}
|
|
4405
4412
|
/**
|
|
4406
4413
|
* Add or update a rule.
|
|
4407
4414
|
* NOTE: This will only check for rules in the first element of the rules array in the current filterParameters.
|
|
4408
4415
|
*/
|
|
4409
4416
|
upsertRule(id, newRule, reload = true) {
|
|
4410
|
-
this.filterViewService.upsertRule(id, newRule
|
|
4417
|
+
this.filterViewService.upsertRule(id, newRule);
|
|
4418
|
+
if (reload) {
|
|
4419
|
+
this.filterViewService.filter();
|
|
4420
|
+
}
|
|
4411
4421
|
}
|
|
4412
4422
|
/**
|
|
4413
4423
|
* Remove a rule.
|
|
4414
4424
|
* NOTE: This will only check for rules in the first element of the rules array in the current filterParameters.
|
|
4415
4425
|
*/
|
|
4416
4426
|
removeRule(id, reload = true) {
|
|
4417
|
-
this.filterViewService.removeRule(id
|
|
4427
|
+
this.filterViewService.removeRule(id);
|
|
4428
|
+
if (reload) {
|
|
4429
|
+
this.filterViewService.filter();
|
|
4430
|
+
}
|
|
4418
4431
|
}
|
|
4419
4432
|
autoLoad(autoLoad) {
|
|
4420
4433
|
const { autoLoad: defaultAutoLoad } = this.filterViewQuery.getValue();
|