@recursyve/nice-data-filter-kit 14.0.6 → 14.1.0
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/base-list/base-list.module.mjs +1 -1
- package/esm2020/lib/components/multi-state-list/multi-state-list.module.mjs +10 -6
- package/esm2020/lib/components/nice-filter-view/components/common/data.directive.mjs +14 -0
- package/esm2020/lib/components/nice-filter-view/components/custom-data-view/custom-data-view.component.mjs +22 -0
- package/esm2020/lib/components/nice-filter-view/components/export-buttons/export-buttons.component.mjs +85 -0
- package/esm2020/lib/components/nice-filter-view/components/export-buttons/export.directive.mjs +27 -0
- package/esm2020/lib/components/nice-filter-view/components/infinite-scroll-data-view/infinite-scroll-data-view.component.mjs +33 -0
- package/esm2020/lib/components/nice-filter-view/components/search/search.component.mjs +54 -0
- package/esm2020/lib/components/nice-filter-view/directives/mat-paginator.mjs +48 -0
- package/esm2020/lib/components/nice-filter-view/directives/mat-sort.mjs +58 -0
- package/esm2020/lib/components/nice-filter-view/directives/mat-tables.mjs +22 -0
- package/esm2020/lib/components/nice-filter-view/directives/query-params.directive.mjs +81 -0
- package/esm2020/lib/components/nice-filter-view/nice-base-filter-view.component.mjs +89 -0
- package/esm2020/lib/components/nice-filter-view/nice-filter-view.component.mjs +34 -0
- package/esm2020/lib/components/nice-filter-view/nice-filter-view.constant.mjs +5 -0
- package/esm2020/lib/components/nice-filter-view/nice-filter-view.module.mjs +143 -0
- package/esm2020/lib/components/nice-filter-view/public-api.mjs +16 -0
- package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.query.mjs +29 -0
- package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.service.mjs +229 -0
- package/esm2020/lib/components/nice-filter-view/store/nice-filter-view.store.mjs +119 -0
- package/esm2020/lib/components/public-api.mjs +2 -1
- package/esm2020/lib/utils/query-params.utils.mjs +5 -1
- package/fesm2015/recursyve-nice-data-filter-kit.mjs +967 -22
- package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/fesm2020/recursyve-nice-data-filter-kit.mjs +980 -20
- package/fesm2020/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/lib/components/multi-state-list/multi-state-list.module.d.ts +2 -0
- package/lib/components/nice-filter-view/components/common/data.directive.d.ts +8 -0
- package/lib/components/nice-filter-view/components/custom-data-view/custom-data-view.component.d.ts +11 -0
- package/lib/components/nice-filter-view/components/export-buttons/export-buttons.component.d.ts +25 -0
- package/lib/components/nice-filter-view/components/export-buttons/export.directive.d.ts +11 -0
- package/lib/components/nice-filter-view/components/infinite-scroll-data-view/infinite-scroll-data-view.component.d.ts +14 -0
- package/lib/components/nice-filter-view/components/search/search.component.d.ts +20 -0
- package/lib/components/nice-filter-view/directives/mat-paginator.d.ts +16 -0
- package/lib/components/nice-filter-view/directives/mat-sort.d.ts +16 -0
- package/lib/components/nice-filter-view/directives/mat-tables.d.ts +12 -0
- package/lib/components/nice-filter-view/directives/query-params.directive.d.ts +21 -0
- package/lib/components/nice-filter-view/nice-base-filter-view.component.d.ts +55 -0
- package/lib/components/nice-filter-view/nice-filter-view.component.d.ts +12 -0
- package/lib/components/nice-filter-view/nice-filter-view.constant.d.ts +4 -0
- package/lib/components/nice-filter-view/nice-filter-view.module.d.ts +40 -0
- package/lib/components/nice-filter-view/public-api.d.ts +15 -0
- package/lib/components/nice-filter-view/store/nice-filter-view.query.d.ts +15 -0
- package/lib/components/nice-filter-view/store/nice-filter-view.service.d.ts +36 -0
- package/lib/components/nice-filter-view/store/nice-filter-view.store.d.ts +31 -0
- package/lib/components/public-api.d.ts +1 -0
- package/lib/utils/query-params.utils.d.ts +3 -0
- package/package.json +1 -1
- package/src/lib/nice-data-filter.theme.scss +25 -0
|
@@ -4,16 +4,16 @@ import { HttpParams } from '@angular/common/http';
|
|
|
4
4
|
import * as i5$1 from '@recursyve/nice-ui-kit.v2';
|
|
5
5
|
import { isNullOrUndefined, ObjectUtils, FileUtils, ArrayUtils, ExportBottomSheetComponent, NiceLoadingSpinnerModule, NiceTypeaheadModule, NiceExportBottomSheetModule } from '@recursyve/nice-ui-kit.v2';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
|
-
import { Directive, Input, NgModule, Injectable, Inject, InjectionToken, Optional, Pipe, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Output, HostListener, forwardRef, TemplateRef, ContentChild, ContentChildren } from '@angular/core';
|
|
8
|
-
import { Store, StoreConfig, Query, arrayAdd, arrayUpsert, arrayRemove } from '@datorama/akita';
|
|
9
|
-
import { combineLatest, Subject, firstValueFrom, of } from 'rxjs';
|
|
7
|
+
import { Directive, Input, NgModule, Injectable, Inject, InjectionToken, Optional, Pipe, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Output, HostListener, forwardRef, TemplateRef, ContentChild, ContentChildren, ViewChild } from '@angular/core';
|
|
8
|
+
import { Store, StoreConfig, Query, arrayAdd, arrayUpsert, arrayRemove, EntityStore, QueryEntity } from '@datorama/akita';
|
|
9
|
+
import { combineLatest, Subject, firstValueFrom, of, tap } from 'rxjs';
|
|
10
10
|
import { __decorate, __metadata } from 'tslib';
|
|
11
11
|
import * as i2 from '@angular/router';
|
|
12
12
|
import { RouterModule } from '@angular/router';
|
|
13
|
-
import * as
|
|
13
|
+
import * as i3$3 from '@angular/material/bottom-sheet';
|
|
14
14
|
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
|
|
15
15
|
import * as i6 from '@angular/common';
|
|
16
|
-
import { CommonModule } from '@angular/common';
|
|
16
|
+
import { CommonModule, AsyncPipe, NgIf, NgTemplateOutlet } from '@angular/common';
|
|
17
17
|
import * as i1$1 from '@angular/forms';
|
|
18
18
|
import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
19
19
|
import * as i8 from '@angular/material/button';
|
|
@@ -57,6 +57,10 @@ import * as i18 from '@angular/material/badge';
|
|
|
57
57
|
import { MatBadgeModule } from '@angular/material/badge';
|
|
58
58
|
|
|
59
59
|
class QueryParamsUtils {
|
|
60
|
+
static hasFilterParameters(params) {
|
|
61
|
+
const keys = ["start", "length", "order", "search", "rules"];
|
|
62
|
+
return Object.keys(params).some(key => keys.includes(key));
|
|
63
|
+
}
|
|
60
64
|
static extractFilterParameters(params) {
|
|
61
65
|
const filters = {};
|
|
62
66
|
if (!isNullOrUndefined(params.start)) {
|
|
@@ -701,7 +705,7 @@ const DEFAULT_RULES = new InjectionToken("default_rules");
|
|
|
701
705
|
const DEFAULT_PARAMETERS = new InjectionToken("default_parameters");
|
|
702
706
|
const LIST_TABLE = new InjectionToken("list_table");
|
|
703
707
|
const TABLE_COLUMNS = new InjectionToken("table_columns");
|
|
704
|
-
const EXPORTS_SETTINGS = new InjectionToken("exports_settings");
|
|
708
|
+
const EXPORTS_SETTINGS$1 = new InjectionToken("exports_settings");
|
|
705
709
|
const ENABLE_QUERY_BUILDER = new InjectionToken("enable_query_builder");
|
|
706
710
|
const DISABLE_QUERY_PARAMS = new InjectionToken("disable_query_param");
|
|
707
711
|
|
|
@@ -2081,7 +2085,7 @@ class NiceBaseListComponent {
|
|
|
2081
2085
|
}
|
|
2082
2086
|
}
|
|
2083
2087
|
}
|
|
2084
|
-
NiceBaseListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceBaseListComponent, deps: [{ token: ENABLE_QUERY_BUILDER, optional: true }, { token: BASE_LIST_ICONS }, { token: BASE_LIST_LAYOUT }, { token: TABLE_COLUMNS }, { token: EXPORTS_SETTINGS }, { token: NiceBaseListQuery }, { token: NiceBaseListService }, { token: i2.ActivatedRoute }, { token:
|
|
2088
|
+
NiceBaseListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceBaseListComponent, deps: [{ token: ENABLE_QUERY_BUILDER, optional: true }, { token: BASE_LIST_ICONS }, { token: BASE_LIST_LAYOUT }, { token: TABLE_COLUMNS }, { token: EXPORTS_SETTINGS$1 }, { token: NiceBaseListQuery }, { token: NiceBaseListService }, { token: i2.ActivatedRoute }, { token: i3$3.MatBottomSheet }, { token: i2.Router }, { token: i5$1.NiceMediaWatcherService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2085
2089
|
NiceBaseListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceBaseListComponent, selector: "nice-base-list", inputs: { mode: "mode", layout: "layout", layoutContent: "layoutContent", autoChangeLayout: "autoChangeLayout", baseRoute: "baseRoute", routeFn: "routeFn", navigateFn: "navigateFn", autoLoad: "autoLoad", pageTitle: "pageTitle", canExport: "canExport", disableRouting: "disableRouting", customExport: "customExport", queryParams: "queryParams", configQueryParams: "configQueryParams" }, outputs: { newPage: "newPage" }, providers: [
|
|
2086
2090
|
NiceBaseListQuery,
|
|
2087
2091
|
NiceBaseListService,
|
|
@@ -2110,8 +2114,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
|
|
|
2110
2114
|
args: [TABLE_COLUMNS]
|
|
2111
2115
|
}] }, { type: undefined, decorators: [{
|
|
2112
2116
|
type: Inject,
|
|
2113
|
-
args: [EXPORTS_SETTINGS]
|
|
2114
|
-
}] }, { type: NiceBaseListQuery }, { type: NiceBaseListService }, { type: i2.ActivatedRoute }, { type:
|
|
2117
|
+
args: [EXPORTS_SETTINGS$1]
|
|
2118
|
+
}] }, { type: NiceBaseListQuery }, { type: NiceBaseListService }, { type: i2.ActivatedRoute }, { type: i3$3.MatBottomSheet }, { type: i2.Router }, { type: i5$1.NiceMediaWatcherService }]; }, propDecorators: { title: [{
|
|
2115
2119
|
type: ContentChild,
|
|
2116
2120
|
args: [NiceBaseListTitleDirective, { read: TemplateRef }]
|
|
2117
2121
|
}], buttons: [{
|
|
@@ -2394,7 +2398,7 @@ class NiceBaseListModule {
|
|
|
2394
2398
|
useValue: options.layout
|
|
2395
2399
|
} : undefined,
|
|
2396
2400
|
{
|
|
2397
|
-
provide: EXPORTS_SETTINGS,
|
|
2401
|
+
provide: EXPORTS_SETTINGS$1,
|
|
2398
2402
|
useValue: options.exports ?? {
|
|
2399
2403
|
pdf: true,
|
|
2400
2404
|
xlsx: true,
|
|
@@ -2506,7 +2510,7 @@ class NiceMultiStateFilterService extends NiceFilterService {
|
|
|
2506
2510
|
}
|
|
2507
2511
|
}
|
|
2508
2512
|
|
|
2509
|
-
const initialValue = {
|
|
2513
|
+
const initialValue$1 = {
|
|
2510
2514
|
...initialBaseListState
|
|
2511
2515
|
};
|
|
2512
2516
|
let NiceMultiStateListStore = class NiceMultiStateListStore extends NiceBaseListStore {
|
|
@@ -2587,7 +2591,7 @@ class NiceMultiStateListComponent extends NiceBaseListComponent {
|
|
|
2587
2591
|
this.setColumns(columns);
|
|
2588
2592
|
}
|
|
2589
2593
|
}
|
|
2590
|
-
NiceMultiStateListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceMultiStateListComponent, deps: [{ token: ENABLE_QUERY_BUILDER, optional: true }, { token: BASE_LIST_ICONS }, { token: BASE_LIST_LAYOUT }, { token: EXPORTS_SETTINGS }, { token: NiceMultiStateListQuery }, { token: i2.ActivatedRoute }, { token:
|
|
2594
|
+
NiceMultiStateListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceMultiStateListComponent, deps: [{ token: ENABLE_QUERY_BUILDER, optional: true }, { token: BASE_LIST_ICONS }, { token: BASE_LIST_LAYOUT }, { token: EXPORTS_SETTINGS$1 }, { token: NiceMultiStateListQuery }, { token: i2.ActivatedRoute }, { token: i3$3.MatBottomSheet }, { token: i2.Router }, { token: i5$1.NiceMediaWatcherService }, { token: NiceMultiStateListService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2591
2595
|
NiceMultiStateListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceMultiStateListComponent, selector: "nice-multi-state-list", inputs: { state: "state" }, providers: [
|
|
2592
2596
|
NiceMultiStateListQuery,
|
|
2593
2597
|
NiceMultiStateListService,
|
|
@@ -2613,8 +2617,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
|
|
|
2613
2617
|
args: [BASE_LIST_LAYOUT]
|
|
2614
2618
|
}] }, { type: undefined, decorators: [{
|
|
2615
2619
|
type: Inject,
|
|
2616
|
-
args: [EXPORTS_SETTINGS]
|
|
2617
|
-
}] }, { type: NiceMultiStateListQuery }, { type: i2.ActivatedRoute }, { type:
|
|
2620
|
+
args: [EXPORTS_SETTINGS$1]
|
|
2621
|
+
}] }, { type: NiceMultiStateListQuery }, { type: i2.ActivatedRoute }, { type: i3$3.MatBottomSheet }, { type: i2.Router }, { type: i5$1.NiceMediaWatcherService }, { type: NiceMultiStateListService }]; }, propDecorators: { state: [{
|
|
2618
2622
|
type: Input
|
|
2619
2623
|
}] } });
|
|
2620
2624
|
|
|
@@ -2634,18 +2638,22 @@ class NiceMultiStateListModule {
|
|
|
2634
2638
|
useValue: options.layout
|
|
2635
2639
|
} : undefined,
|
|
2636
2640
|
{
|
|
2637
|
-
provide: EXPORTS_SETTINGS,
|
|
2641
|
+
provide: EXPORTS_SETTINGS$1,
|
|
2638
2642
|
useValue: options.exports ?? {
|
|
2639
2643
|
pdf: true,
|
|
2640
2644
|
xlsx: true,
|
|
2641
2645
|
csv: true
|
|
2642
2646
|
}
|
|
2643
2647
|
},
|
|
2648
|
+
{
|
|
2649
|
+
provide: DISABLE_QUERY_PARAMS,
|
|
2650
|
+
useValue: options.disableQueryParams ?? false
|
|
2651
|
+
},
|
|
2652
|
+
options.disableQueryBuilder !== undefined ? {
|
|
2653
|
+
provide: ENABLE_QUERY_BUILDER,
|
|
2654
|
+
useValue: !options.disableQueryBuilder
|
|
2655
|
+
} : null,
|
|
2644
2656
|
...(options.queryBuilder ? [
|
|
2645
|
-
{
|
|
2646
|
-
provide: ENABLE_QUERY_BUILDER,
|
|
2647
|
-
useValue: true
|
|
2648
|
-
},
|
|
2649
2657
|
{
|
|
2650
2658
|
provide: NiceFilterGroupService,
|
|
2651
2659
|
useClass: options.queryBuilder.filterGroupService
|
|
@@ -2729,6 +2737,958 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
|
|
|
2729
2737
|
}]
|
|
2730
2738
|
}] });
|
|
2731
2739
|
|
|
2740
|
+
class NiceFilterDataDirective {
|
|
2741
|
+
constructor(template) {
|
|
2742
|
+
this.template = template;
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
NiceFilterDataDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterDataDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2746
|
+
NiceFilterDataDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterDataDirective, selector: "[niceFilterData]", ngImport: i0 });
|
|
2747
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterDataDirective, decorators: [{
|
|
2748
|
+
type: Directive,
|
|
2749
|
+
args: [{ selector: "[niceFilterData]" }]
|
|
2750
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
2751
|
+
|
|
2752
|
+
const EXPORTS_SETTINGS = new InjectionToken("exports_settings");
|
|
2753
|
+
const FILTER_VIEW_ICONS = new InjectionToken("filter_view_icons");
|
|
2754
|
+
const FILTER_VIEW_STATE = new InjectionToken("filter_view_state");
|
|
2755
|
+
|
|
2756
|
+
const initialValue = {
|
|
2757
|
+
subStates: {},
|
|
2758
|
+
mode: "paginated",
|
|
2759
|
+
autoLoad: true,
|
|
2760
|
+
disabled: false,
|
|
2761
|
+
filterConfigLoading: false,
|
|
2762
|
+
filterConfig: [],
|
|
2763
|
+
filterResult: null,
|
|
2764
|
+
filterParameters: {
|
|
2765
|
+
start: 0,
|
|
2766
|
+
length: 10,
|
|
2767
|
+
order: {},
|
|
2768
|
+
search: "",
|
|
2769
|
+
rules: [],
|
|
2770
|
+
data: {}
|
|
2771
|
+
},
|
|
2772
|
+
baseRules: [],
|
|
2773
|
+
queryParams: null,
|
|
2774
|
+
resetResult: false
|
|
2775
|
+
};
|
|
2776
|
+
let NiceFilterViewStore = class NiceFilterViewStore extends EntityStore {
|
|
2777
|
+
constructor(state) {
|
|
2778
|
+
super({
|
|
2779
|
+
...initialValue,
|
|
2780
|
+
...state
|
|
2781
|
+
});
|
|
2782
|
+
}
|
|
2783
|
+
setFilterConfigLoading(loading) {
|
|
2784
|
+
this.update({ filterConfigLoading: loading });
|
|
2785
|
+
}
|
|
2786
|
+
setParameters(filterParameters) {
|
|
2787
|
+
this.update({ filterParameters });
|
|
2788
|
+
}
|
|
2789
|
+
setResult(filterResult) {
|
|
2790
|
+
const { mode, resetResult } = this.getValue();
|
|
2791
|
+
if (mode === "accumulated") {
|
|
2792
|
+
this.update((state) => ({
|
|
2793
|
+
filterResult: {
|
|
2794
|
+
page: filterResult.page,
|
|
2795
|
+
total: filterResult.total,
|
|
2796
|
+
values: [
|
|
2797
|
+
...(resetResult ? [] : state.filterResult?.values ?? []),
|
|
2798
|
+
...filterResult.values
|
|
2799
|
+
]
|
|
2800
|
+
},
|
|
2801
|
+
resetResult: false
|
|
2802
|
+
}));
|
|
2803
|
+
}
|
|
2804
|
+
else {
|
|
2805
|
+
this.update({
|
|
2806
|
+
filterResult
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
if (mode === "accumulated") {
|
|
2810
|
+
this.add(filterResult.values);
|
|
2811
|
+
}
|
|
2812
|
+
else {
|
|
2813
|
+
this.set(filterResult.values);
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
addValue(value, opts) {
|
|
2817
|
+
const { filterResult } = this.getValue();
|
|
2818
|
+
if (!filterResult) {
|
|
2819
|
+
return;
|
|
2820
|
+
}
|
|
2821
|
+
this.update({
|
|
2822
|
+
filterResult: {
|
|
2823
|
+
...filterResult,
|
|
2824
|
+
values: arrayAdd(filterResult.values, value, opts)
|
|
2825
|
+
}
|
|
2826
|
+
});
|
|
2827
|
+
this.add(value, opts);
|
|
2828
|
+
}
|
|
2829
|
+
upsertValue(value, key = "id") {
|
|
2830
|
+
const { filterResult } = this.getValue();
|
|
2831
|
+
if (!filterResult) {
|
|
2832
|
+
return;
|
|
2833
|
+
}
|
|
2834
|
+
this.update({
|
|
2835
|
+
filterResult: {
|
|
2836
|
+
...filterResult,
|
|
2837
|
+
values: arrayUpsert(filterResult.values, value[key], value)
|
|
2838
|
+
}
|
|
2839
|
+
});
|
|
2840
|
+
this.upsert(value[key], value);
|
|
2841
|
+
}
|
|
2842
|
+
removeValue(value, key = "id") {
|
|
2843
|
+
const { filterResult } = this.getValue();
|
|
2844
|
+
if (!filterResult) {
|
|
2845
|
+
return;
|
|
2846
|
+
}
|
|
2847
|
+
this.update({
|
|
2848
|
+
filterResult: {
|
|
2849
|
+
...filterResult,
|
|
2850
|
+
values: arrayRemove(filterResult.values, value[key])
|
|
2851
|
+
}
|
|
2852
|
+
});
|
|
2853
|
+
this.remove(value[key]);
|
|
2854
|
+
}
|
|
2855
|
+
};
|
|
2856
|
+
NiceFilterViewStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewStore, deps: [{ token: FILTER_VIEW_STATE }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2857
|
+
NiceFilterViewStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewStore });
|
|
2858
|
+
NiceFilterViewStore = __decorate([
|
|
2859
|
+
StoreConfig({ name: "nice-filter-view", resettable: true }),
|
|
2860
|
+
__metadata("design:paramtypes", [Object])
|
|
2861
|
+
], NiceFilterViewStore);
|
|
2862
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewStore, decorators: [{
|
|
2863
|
+
type: Injectable
|
|
2864
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2865
|
+
type: Inject,
|
|
2866
|
+
args: [FILTER_VIEW_STATE]
|
|
2867
|
+
}] }]; } });
|
|
2868
|
+
|
|
2869
|
+
class NiceFilterViewQuery extends QueryEntity {
|
|
2870
|
+
constructor(store) {
|
|
2871
|
+
super(store);
|
|
2872
|
+
this.store = store;
|
|
2873
|
+
}
|
|
2874
|
+
selectFilterConfigLoading() {
|
|
2875
|
+
return this.select("filterConfigLoading");
|
|
2876
|
+
}
|
|
2877
|
+
selectFilterConfig() {
|
|
2878
|
+
return this.select("filterConfig");
|
|
2879
|
+
}
|
|
2880
|
+
selectFilterParameters() {
|
|
2881
|
+
return this.select("filterParameters");
|
|
2882
|
+
}
|
|
2883
|
+
selectFilterResult() {
|
|
2884
|
+
return this.select("filterResult");
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
NiceFilterViewQuery.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewQuery, deps: [{ token: NiceFilterViewStore }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2888
|
+
NiceFilterViewQuery.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewQuery });
|
|
2889
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewQuery, decorators: [{
|
|
2890
|
+
type: Injectable
|
|
2891
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewStore }]; } });
|
|
2892
|
+
|
|
2893
|
+
class NiceFilterCustomDataViewComponent {
|
|
2894
|
+
constructor(query) {
|
|
2895
|
+
this.query = query;
|
|
2896
|
+
this.data$ = this.query.selectAll();
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
NiceFilterCustomDataViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterCustomDataViewComponent, deps: [{ token: NiceFilterViewQuery }], target: i0.ɵɵFactoryTarget.Component });
|
|
2900
|
+
NiceFilterCustomDataViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterCustomDataViewComponent, selector: "nice-filter-custom-data-view, div[nice-filter-custom-data-view]", queries: [{ propertyName: "content", first: true, predicate: NiceFilterDataDirective, descendants: true, read: TemplateRef }], ngImport: i0, template: "<ng-container *ngIf=\"content\">\n <ng-container *ngTemplateOutlet=\"content; context: { $implicit: data$ | async }\"></ng-container>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
|
|
2901
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterCustomDataViewComponent, decorators: [{
|
|
2902
|
+
type: Component,
|
|
2903
|
+
args: [{ selector: "nice-filter-custom-data-view, div[nice-filter-custom-data-view]", encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"content\">\n <ng-container *ngTemplateOutlet=\"content; context: { $implicit: data$ | async }\"></ng-container>\n</ng-container>\n" }]
|
|
2904
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewQuery }]; }, propDecorators: { content: [{
|
|
2905
|
+
type: ContentChild,
|
|
2906
|
+
args: [NiceFilterDataDirective, { read: TemplateRef }]
|
|
2907
|
+
}] } });
|
|
2908
|
+
|
|
2909
|
+
class NiceFilterViewService {
|
|
2910
|
+
constructor(store, filterService) {
|
|
2911
|
+
this.store = store;
|
|
2912
|
+
this.filterService = filterService;
|
|
2913
|
+
}
|
|
2914
|
+
reset() {
|
|
2915
|
+
this.store.reset();
|
|
2916
|
+
}
|
|
2917
|
+
disable() {
|
|
2918
|
+
this.store.update({
|
|
2919
|
+
disabled: true
|
|
2920
|
+
});
|
|
2921
|
+
}
|
|
2922
|
+
enable() {
|
|
2923
|
+
this.store.update({
|
|
2924
|
+
disabled: false
|
|
2925
|
+
});
|
|
2926
|
+
}
|
|
2927
|
+
setAutoLoad(autoLoad) {
|
|
2928
|
+
this.store.update({ autoLoad });
|
|
2929
|
+
}
|
|
2930
|
+
setLoading(loading) {
|
|
2931
|
+
this.store.setLoading(loading);
|
|
2932
|
+
}
|
|
2933
|
+
setMode(mode) {
|
|
2934
|
+
this.store.update({ mode });
|
|
2935
|
+
}
|
|
2936
|
+
async loadConfig(configQueryParams = {}) {
|
|
2937
|
+
this.store.setFilterConfigLoading(true);
|
|
2938
|
+
try {
|
|
2939
|
+
const filterConfig = await firstValueFrom(this.filterService.getFilterConfig({ params: configQueryParams }));
|
|
2940
|
+
this.store.update({
|
|
2941
|
+
filterConfig
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
catch (e) {
|
|
2945
|
+
this.store.setError(e);
|
|
2946
|
+
}
|
|
2947
|
+
finally {
|
|
2948
|
+
this.store.setFilterConfigLoading(false);
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
async filter() {
|
|
2952
|
+
const { filterParameters, disabled } = this.store.getValue();
|
|
2953
|
+
if (disabled) {
|
|
2954
|
+
return;
|
|
2955
|
+
}
|
|
2956
|
+
try {
|
|
2957
|
+
this.store.setLoading(true);
|
|
2958
|
+
const result = await firstValueFrom(this.filterService.filter(this.getParameters(filterParameters)));
|
|
2959
|
+
this.store.setResult(result);
|
|
2960
|
+
}
|
|
2961
|
+
catch (e) {
|
|
2962
|
+
this.store.setError(e);
|
|
2963
|
+
}
|
|
2964
|
+
finally {
|
|
2965
|
+
this.store.setLoading(false);
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
async downloadData(type, downloadFileName) {
|
|
2969
|
+
const { filterParameters, disabled } = this.store.getValue();
|
|
2970
|
+
if (disabled) {
|
|
2971
|
+
return;
|
|
2972
|
+
}
|
|
2973
|
+
try {
|
|
2974
|
+
this.store.setLoading(true);
|
|
2975
|
+
const result = await firstValueFrom(this.filterService.getFile(type, this.getParameters(filterParameters)));
|
|
2976
|
+
FileUtils.downloadFile(`${downloadFileName}.${type}`, result);
|
|
2977
|
+
}
|
|
2978
|
+
catch (e) {
|
|
2979
|
+
this.store.setError(e);
|
|
2980
|
+
}
|
|
2981
|
+
finally {
|
|
2982
|
+
this.store.setLoading(false);
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
async printData() {
|
|
2986
|
+
const { filterParameters, disabled } = this.store.getValue();
|
|
2987
|
+
if (disabled) {
|
|
2988
|
+
return;
|
|
2989
|
+
}
|
|
2990
|
+
try {
|
|
2991
|
+
this.store.setLoading(true);
|
|
2992
|
+
const result = await firstValueFrom(this.filterService.getPrintableHtml(this.getParameters(filterParameters)));
|
|
2993
|
+
FileUtils.openPrintableWindow(result);
|
|
2994
|
+
}
|
|
2995
|
+
catch (e) {
|
|
2996
|
+
this.store.setError(e);
|
|
2997
|
+
}
|
|
2998
|
+
finally {
|
|
2999
|
+
this.store.setLoading(false);
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
setParameters(filterParameters, reload = false) {
|
|
3003
|
+
this.store.setParameters(filterParameters);
|
|
3004
|
+
if (reload) {
|
|
3005
|
+
this.filter();
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
resetPaging() {
|
|
3009
|
+
const { filterParameters } = this.store.getValue();
|
|
3010
|
+
this.setParameters({
|
|
3011
|
+
...filterParameters,
|
|
3012
|
+
start: 0
|
|
3013
|
+
}, false);
|
|
3014
|
+
this.resetResult(true);
|
|
3015
|
+
}
|
|
3016
|
+
setQueryParams(queryParams) {
|
|
3017
|
+
this.store.update({ queryParams });
|
|
3018
|
+
}
|
|
3019
|
+
setBaseRules(rule, reload) {
|
|
3020
|
+
this.store.update({
|
|
3021
|
+
baseRules: rule
|
|
3022
|
+
});
|
|
3023
|
+
if (reload) {
|
|
3024
|
+
this.filter();
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
setRules(rules, reload) {
|
|
3028
|
+
if (!Array.isArray(rules)) {
|
|
3029
|
+
rules = [rules];
|
|
3030
|
+
}
|
|
3031
|
+
const { filterParameters } = this.store.getValue();
|
|
3032
|
+
const newRules = {
|
|
3033
|
+
order: filterParameters.order,
|
|
3034
|
+
rules
|
|
3035
|
+
};
|
|
3036
|
+
this.setParameters(newRules, reload);
|
|
3037
|
+
}
|
|
3038
|
+
upsertRule(id, newRule, reload) {
|
|
3039
|
+
const { filterParameters } = this.store.getValue();
|
|
3040
|
+
const currentQuery = filterParameters.rules?.[0];
|
|
3041
|
+
const rule = {
|
|
3042
|
+
id,
|
|
3043
|
+
...newRule
|
|
3044
|
+
};
|
|
3045
|
+
const query = { rules: [rule], condition: "and" };
|
|
3046
|
+
if (!currentQuery || currentQuery.rules.length === 0) {
|
|
3047
|
+
this.setRules(query, reload);
|
|
3048
|
+
return;
|
|
3049
|
+
}
|
|
3050
|
+
const oldRule = currentQuery.rules.find((r) => r.id === id);
|
|
3051
|
+
let newRules = currentQuery.rules;
|
|
3052
|
+
if (oldRule) {
|
|
3053
|
+
if (newRule) {
|
|
3054
|
+
// Array replace
|
|
3055
|
+
newRules = [
|
|
3056
|
+
...currentQuery.rules.slice(0, currentQuery.rules.indexOf(oldRule)),
|
|
3057
|
+
query,
|
|
3058
|
+
...currentQuery.rules.slice(currentQuery.rules.indexOf(oldRule) + 1, currentQuery.rules.length)
|
|
3059
|
+
];
|
|
3060
|
+
}
|
|
3061
|
+
else {
|
|
3062
|
+
newRules = currentQuery.rules.filter((r) => r.id !== id);
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
else {
|
|
3066
|
+
newRules = [...newRules, query];
|
|
3067
|
+
}
|
|
3068
|
+
this.setRules({
|
|
3069
|
+
condition: currentQuery.condition,
|
|
3070
|
+
rules: newRules
|
|
3071
|
+
}, reload);
|
|
3072
|
+
}
|
|
3073
|
+
removeRule(id, reload) {
|
|
3074
|
+
const { filterParameters } = this.store.getValue();
|
|
3075
|
+
const currentQuery = filterParameters.rules?.[0];
|
|
3076
|
+
const oldRule = currentQuery.rules.find((r) => r.id === id);
|
|
3077
|
+
if (!oldRule) {
|
|
3078
|
+
return;
|
|
3079
|
+
}
|
|
3080
|
+
const newRules = currentQuery.rules.filter((r) => r.id !== id);
|
|
3081
|
+
this.setRules({
|
|
3082
|
+
condition: currentQuery.condition,
|
|
3083
|
+
rules: newRules
|
|
3084
|
+
}, reload);
|
|
3085
|
+
}
|
|
3086
|
+
addValue(value, opts) {
|
|
3087
|
+
this.store.addValue(value, opts);
|
|
3088
|
+
}
|
|
3089
|
+
upsertValue(value, key = "id") {
|
|
3090
|
+
this.store.upsertValue(value, key);
|
|
3091
|
+
}
|
|
3092
|
+
removeValue(value, key = "id") {
|
|
3093
|
+
this.store.removeValue(value, key);
|
|
3094
|
+
}
|
|
3095
|
+
resetResult(waitForNextFilter) {
|
|
3096
|
+
if (!waitForNextFilter) {
|
|
3097
|
+
this.store.update({
|
|
3098
|
+
filterResult: null
|
|
3099
|
+
});
|
|
3100
|
+
}
|
|
3101
|
+
else {
|
|
3102
|
+
this.store.update({
|
|
3103
|
+
resetResult: true
|
|
3104
|
+
});
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
getParameters(filterParameters) {
|
|
3108
|
+
const { baseRules } = this.store.getValue();
|
|
3109
|
+
const parameters = {
|
|
3110
|
+
...filterParameters,
|
|
3111
|
+
rules: filterParameters?.rules ? [...filterParameters.rules] : []
|
|
3112
|
+
};
|
|
3113
|
+
if (baseRules?.length) {
|
|
3114
|
+
parameters.rules.push({
|
|
3115
|
+
condition: "and",
|
|
3116
|
+
rules: baseRules
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
return parameters;
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
NiceFilterViewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewService, deps: [{ token: NiceFilterViewStore }, { token: NiceFilterService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3123
|
+
NiceFilterViewService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewService });
|
|
3124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewService, decorators: [{
|
|
3125
|
+
type: Injectable
|
|
3126
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewStore }, { type: undefined, decorators: [{
|
|
3127
|
+
type: Inject,
|
|
3128
|
+
args: [NiceFilterService]
|
|
3129
|
+
}] }]; } });
|
|
3130
|
+
|
|
3131
|
+
class NiceFilterExportButtonsComponent {
|
|
3132
|
+
constructor(icons, exportsSettings, query, service, bottomSheet) {
|
|
3133
|
+
this.icons = icons;
|
|
3134
|
+
this.exportsSettings = exportsSettings;
|
|
3135
|
+
this.query = query;
|
|
3136
|
+
this.service = service;
|
|
3137
|
+
this.bottomSheet = bottomSheet;
|
|
3138
|
+
this.customExport = [];
|
|
3139
|
+
this.downloadFileName = "data";
|
|
3140
|
+
this.loading$ = this.query.selectLoading();
|
|
3141
|
+
}
|
|
3142
|
+
clickExport() {
|
|
3143
|
+
const exports = [];
|
|
3144
|
+
if (this.exportsSettings.xlsx) {
|
|
3145
|
+
exports.push({
|
|
3146
|
+
type: "xlsx",
|
|
3147
|
+
onClickExport: () => this.clickXlsx()
|
|
3148
|
+
});
|
|
3149
|
+
}
|
|
3150
|
+
if (this.exportsSettings.csv) {
|
|
3151
|
+
exports.push({
|
|
3152
|
+
type: "csv",
|
|
3153
|
+
onClickExport: () => this.clickCsv()
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
if (this.exportsSettings.pdf) {
|
|
3157
|
+
exports.push({
|
|
3158
|
+
type: "pdf",
|
|
3159
|
+
onClickExport: () => this.clickPdf()
|
|
3160
|
+
});
|
|
3161
|
+
}
|
|
3162
|
+
this.bottomSheet.open(ExportBottomSheetComponent, {
|
|
3163
|
+
data: {
|
|
3164
|
+
exportStrategies: [
|
|
3165
|
+
...exports,
|
|
3166
|
+
...this.customExport
|
|
3167
|
+
]
|
|
3168
|
+
}
|
|
3169
|
+
});
|
|
3170
|
+
}
|
|
3171
|
+
clickXlsx() {
|
|
3172
|
+
this.service.downloadData("xlsx", this.downloadFileName);
|
|
3173
|
+
}
|
|
3174
|
+
clickCsv() {
|
|
3175
|
+
this.service.downloadData("csv", this.downloadFileName);
|
|
3176
|
+
}
|
|
3177
|
+
clickPrint() {
|
|
3178
|
+
this.service.printData();
|
|
3179
|
+
}
|
|
3180
|
+
clickPdf() {
|
|
3181
|
+
this.service.downloadData("pdf", this.downloadFileName);
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
NiceFilterExportButtonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterExportButtonsComponent, deps: [{ token: FILTER_VIEW_ICONS }, { token: EXPORTS_SETTINGS }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i3$3.MatBottomSheet }], target: i0.ɵɵFactoryTarget.Component });
|
|
3185
|
+
NiceFilterExportButtonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterExportButtonsComponent, selector: "nice-filter-export-buttons, div[nice-filter-export-buttons]", inputs: { customExport: "customExport", downloadFileName: "downloadFileName" }, ngImport: i0, template: "<button\n (click)=\"clickPrint()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.print' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.print.svgIcon\">{{ icons.print.matIcon }}</mat-icon>\n</button>\n\n<button\n (click)=\"clickExport()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.export' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.download.svgIcon\">{{ icons.download.matIcon }}</mat-icon>\n</button>\n", styles: [""], dependencies: [{ kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i8.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
|
|
3186
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterExportButtonsComponent, decorators: [{
|
|
3187
|
+
type: Component,
|
|
3188
|
+
args: [{ selector: "nice-filter-export-buttons, div[nice-filter-export-buttons]", encapsulation: ViewEncapsulation.None, template: "<button\n (click)=\"clickPrint()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.print' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.print.svgIcon\">{{ icons.print.matIcon }}</mat-icon>\n</button>\n\n<button\n (click)=\"clickExport()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.export' | translate\"\n class=\"export-button\"\n mat-mini-fab\n>\n <mat-icon [svgIcon]=\"icons.download.svgIcon\">{{ icons.download.matIcon }}</mat-icon>\n</button>\n" }]
|
|
3189
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
3190
|
+
type: Inject,
|
|
3191
|
+
args: [FILTER_VIEW_ICONS]
|
|
3192
|
+
}] }, { type: undefined, decorators: [{
|
|
3193
|
+
type: Inject,
|
|
3194
|
+
args: [EXPORTS_SETTINGS]
|
|
3195
|
+
}] }, { type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i3$3.MatBottomSheet }]; }, propDecorators: { customExport: [{
|
|
3196
|
+
type: Input
|
|
3197
|
+
}], downloadFileName: [{
|
|
3198
|
+
type: Input
|
|
3199
|
+
}] } });
|
|
3200
|
+
|
|
3201
|
+
class NiceFilterExportDirective {
|
|
3202
|
+
constructor(service) {
|
|
3203
|
+
this.service = service;
|
|
3204
|
+
this.downloadFileName = "data";
|
|
3205
|
+
}
|
|
3206
|
+
onClick() {
|
|
3207
|
+
this.service.downloadData(this.type, this.downloadFileName);
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
NiceFilterExportDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterExportDirective, deps: [{ token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3211
|
+
NiceFilterExportDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterExportDirective, selector: "[niceFilterExport]", inputs: { type: "type", downloadFileName: "downloadFileName" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
3212
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterExportDirective, decorators: [{
|
|
3213
|
+
type: Directive,
|
|
3214
|
+
args: [{ selector: "[niceFilterExport]" }]
|
|
3215
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewService }]; }, propDecorators: { type: [{
|
|
3216
|
+
type: Input
|
|
3217
|
+
}], downloadFileName: [{
|
|
3218
|
+
type: Input
|
|
3219
|
+
}], onClick: [{
|
|
3220
|
+
type: HostListener,
|
|
3221
|
+
args: ["click"]
|
|
3222
|
+
}] } });
|
|
3223
|
+
|
|
3224
|
+
class NiceFilterInfiniteScrollDataViewComponent {
|
|
3225
|
+
constructor(query, service) {
|
|
3226
|
+
this.query = query;
|
|
3227
|
+
this.service = service;
|
|
3228
|
+
this.data$ = this.query.selectAll();
|
|
3229
|
+
}
|
|
3230
|
+
async loadNextPage() {
|
|
3231
|
+
const { filterParameters } = this.query.getValue();
|
|
3232
|
+
this.service.setMode("paginated");
|
|
3233
|
+
await this.service.setParameters({
|
|
3234
|
+
...filterParameters,
|
|
3235
|
+
start: filterParameters.start + filterParameters.length
|
|
3236
|
+
}, true);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
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 });
|
|
3240
|
+
NiceFilterInfiniteScrollDataViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterInfiniteScrollDataViewComponent, selector: "nice-filter-infinite-scroll-data-view, div[nice-filter-infinite-scroll-data-view]", queries: [{ propertyName: "content", first: true, predicate: NiceFilterDataDirective, descendants: true, read: TemplateRef }], ngImport: i0, template: "<ng-container *ngIf=\"content\">\n <ng-container *ngTemplateOutlet=\"content; context: { $implicit: data$ | async }\"></ng-container>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
|
|
3241
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterInfiniteScrollDataViewComponent, decorators: [{
|
|
3242
|
+
type: Component,
|
|
3243
|
+
args: [{ selector: "nice-filter-infinite-scroll-data-view, div[nice-filter-infinite-scroll-data-view]", encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"content\">\n <ng-container *ngTemplateOutlet=\"content; context: { $implicit: data$ | async }\"></ng-container>\n</ng-container>\n" }]
|
|
3244
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: NiceFilterViewService }]; }, propDecorators: { content: [{
|
|
3245
|
+
type: ContentChild,
|
|
3246
|
+
args: [NiceFilterDataDirective, { read: TemplateRef }]
|
|
3247
|
+
}] } });
|
|
3248
|
+
|
|
3249
|
+
class NiceFilterSearchComponent {
|
|
3250
|
+
constructor(icons, query, service) {
|
|
3251
|
+
this.icons = icons;
|
|
3252
|
+
this.query = query;
|
|
3253
|
+
this.service = service;
|
|
3254
|
+
this.appearance = "default";
|
|
3255
|
+
this.searchQuery$ = this.query.selectFilterParameters().pipe(map(f => f.search));
|
|
3256
|
+
this.unsubscribeAll$ = new Subject();
|
|
3257
|
+
this.searchText$ = new Subject();
|
|
3258
|
+
}
|
|
3259
|
+
ngOnInit() {
|
|
3260
|
+
this.searchText$
|
|
3261
|
+
.pipe(takeUntil(this.unsubscribeAll$), debounceTime(300), distinctUntilChanged(), tap((search) => {
|
|
3262
|
+
const { filterParameters } = this.query.getValue();
|
|
3263
|
+
this.service.setParameters({
|
|
3264
|
+
...filterParameters,
|
|
3265
|
+
search
|
|
3266
|
+
}, true);
|
|
3267
|
+
}))
|
|
3268
|
+
.subscribe();
|
|
3269
|
+
}
|
|
3270
|
+
ngOnDestroy() {
|
|
3271
|
+
this.unsubscribeAll$.next();
|
|
3272
|
+
this.unsubscribeAll$.complete();
|
|
3273
|
+
}
|
|
3274
|
+
onUpdateSearch(search) {
|
|
3275
|
+
this.searchText$.next(search);
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
NiceFilterSearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterSearchComponent, deps: [{ token: FILTER_VIEW_ICONS }, { token: NiceFilterViewQuery }, { token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3279
|
+
NiceFilterSearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterSearchComponent, selector: "nice-filter-search", inputs: { appearance: "appearance" }, ngImport: i0, template: "<div\n class=\"search-wrapper mx-md-0\"\n [class.nice-search-default]=\"appearance === 'default'\"\n [class.nice-search-outlined]=\"appearance === 'outlined'\"\n [class.nice-search-legacy]=\"appearance === 'legacy'\"\n [class.nice-search-custom]=\"appearance === 'custom'\"\n>\n <div class=\"search flex flex-auto justify-start items-center\">\n <mat-icon [svgIcon]=\"icons.search.svgIcon\">{{ icons.search.matIcon }}</mat-icon>\n <input [ngModel]=\"searchQuery$ | async\" (ngModelChange)=\"onUpdateSearch($event)\" [placeholder]=\"'general.search' | translate\" />\n\n <ng-content select=\"[niceFilterSearchButtons]\"></ng-content>\n </div>\n</div>\n", styles: ["nice-filter-search .search-wrapper{width:100%;max-width:480px;overflow:hidden}nice-filter-search .search-wrapper.nice-search-default{box-shadow:0 4px 12px #0000001f;border-radius:5px}nice-filter-search .search-wrapper.nice-search-outlined{border-radius:5px}nice-filter-search .search-wrapper.nice-search-legacy{box-shadow:0 3px 3px -2px #0000000f,0 3px 4px #0000000b,0 1px 8px #00000009;border-radius:28px}nice-filter-search .search-wrapper .search{width:100%;height:48px;line-height:48px;padding:0 18px}nice-filter-search .search-wrapper .search input{width:100%;height:48px;min-height:48px;max-height:48px;padding:0 16px;border:none;outline:none}\n"], dependencies: [{ kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
|
|
3280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterSearchComponent, decorators: [{
|
|
3281
|
+
type: Component,
|
|
3282
|
+
args: [{ selector: "nice-filter-search", encapsulation: ViewEncapsulation.None, template: "<div\n class=\"search-wrapper mx-md-0\"\n [class.nice-search-default]=\"appearance === 'default'\"\n [class.nice-search-outlined]=\"appearance === 'outlined'\"\n [class.nice-search-legacy]=\"appearance === 'legacy'\"\n [class.nice-search-custom]=\"appearance === 'custom'\"\n>\n <div class=\"search flex flex-auto justify-start items-center\">\n <mat-icon [svgIcon]=\"icons.search.svgIcon\">{{ icons.search.matIcon }}</mat-icon>\n <input [ngModel]=\"searchQuery$ | async\" (ngModelChange)=\"onUpdateSearch($event)\" [placeholder]=\"'general.search' | translate\" />\n\n <ng-content select=\"[niceFilterSearchButtons]\"></ng-content>\n </div>\n</div>\n", styles: ["nice-filter-search .search-wrapper{width:100%;max-width:480px;overflow:hidden}nice-filter-search .search-wrapper.nice-search-default{box-shadow:0 4px 12px #0000001f;border-radius:5px}nice-filter-search .search-wrapper.nice-search-outlined{border-radius:5px}nice-filter-search .search-wrapper.nice-search-legacy{box-shadow:0 3px 3px -2px #0000000f,0 3px 4px #0000000b,0 1px 8px #00000009;border-radius:28px}nice-filter-search .search-wrapper .search{width:100%;height:48px;line-height:48px;padding:0 18px}nice-filter-search .search-wrapper .search input{width:100%;height:48px;min-height:48px;max-height:48px;padding:0 16px;border:none;outline:none}\n"] }]
|
|
3283
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
3284
|
+
type: Inject,
|
|
3285
|
+
args: [FILTER_VIEW_ICONS]
|
|
3286
|
+
}] }, { type: NiceFilterViewQuery }, { type: NiceFilterViewService }]; }, propDecorators: { appearance: [{
|
|
3287
|
+
type: Input
|
|
3288
|
+
}] } });
|
|
3289
|
+
|
|
3290
|
+
class NiceFilterMatPaginatorPaginationDirective {
|
|
3291
|
+
constructor(query, service, paginator) {
|
|
3292
|
+
this.query = query;
|
|
3293
|
+
this.service = service;
|
|
3294
|
+
this.paginator = paginator;
|
|
3295
|
+
this.unsubscribeAll$ = new Subject();
|
|
3296
|
+
}
|
|
3297
|
+
ngOnInit() {
|
|
3298
|
+
this.query.selectFilterResult().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
|
|
3299
|
+
if (!res) {
|
|
3300
|
+
return;
|
|
3301
|
+
}
|
|
3302
|
+
const { page, total } = res;
|
|
3303
|
+
this.paginator.pageIndex = page.number;
|
|
3304
|
+
this.paginator.pageSize = page.size;
|
|
3305
|
+
this.paginator.length = total;
|
|
3306
|
+
});
|
|
3307
|
+
this.paginator.page.pipe(takeUntil(this.unsubscribeAll$)).subscribe((page) => {
|
|
3308
|
+
const { filterParameters } = this.query.getValue();
|
|
3309
|
+
this.service.setParameters({
|
|
3310
|
+
...filterParameters,
|
|
3311
|
+
start: page.pageIndex,
|
|
3312
|
+
length: page.pageSize
|
|
3313
|
+
}, true);
|
|
3314
|
+
});
|
|
3315
|
+
}
|
|
3316
|
+
ngOnDestroy() {
|
|
3317
|
+
this.unsubscribeAll$.next();
|
|
3318
|
+
this.unsubscribeAll$.complete();
|
|
3319
|
+
}
|
|
3320
|
+
}
|
|
3321
|
+
NiceFilterMatPaginatorPaginationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterMatPaginatorPaginationDirective, deps: [{ token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i12.MatPaginator }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3322
|
+
NiceFilterMatPaginatorPaginationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterMatPaginatorPaginationDirective, selector: "mat-paginator[niceFilterPagination]", ngImport: i0 });
|
|
3323
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterMatPaginatorPaginationDirective, decorators: [{
|
|
3324
|
+
type: Directive,
|
|
3325
|
+
args: [{ selector: "mat-paginator[niceFilterPagination]" }]
|
|
3326
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i12.MatPaginator }]; } });
|
|
3327
|
+
|
|
3328
|
+
class NiceFilterMatSortSortingDirective {
|
|
3329
|
+
constructor(query, service, sort) {
|
|
3330
|
+
this.query = query;
|
|
3331
|
+
this.service = service;
|
|
3332
|
+
this.sort = sort;
|
|
3333
|
+
this.unsubscribeAll$ = new Subject();
|
|
3334
|
+
}
|
|
3335
|
+
ngOnInit() {
|
|
3336
|
+
this.query.selectFilterParameters().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
|
|
3337
|
+
if (!res) {
|
|
3338
|
+
return;
|
|
3339
|
+
}
|
|
3340
|
+
const { order } = res;
|
|
3341
|
+
this.sort.direction = order.direction;
|
|
3342
|
+
this.sort.active = order.column;
|
|
3343
|
+
});
|
|
3344
|
+
this.sort.sortChange.pipe(takeUntil(this.unsubscribeAll$)).subscribe((sort) => {
|
|
3345
|
+
const { filterParameters } = this.query.getValue();
|
|
3346
|
+
if (!sort.direction) {
|
|
3347
|
+
const { order, ...values } = filterParameters;
|
|
3348
|
+
this.service.setParameters({
|
|
3349
|
+
...values,
|
|
3350
|
+
order: {}
|
|
3351
|
+
}, true);
|
|
3352
|
+
}
|
|
3353
|
+
else {
|
|
3354
|
+
this.service.setParameters({
|
|
3355
|
+
...filterParameters,
|
|
3356
|
+
order: {
|
|
3357
|
+
column: sort.active,
|
|
3358
|
+
direction: sort.direction
|
|
3359
|
+
}
|
|
3360
|
+
}, true);
|
|
3361
|
+
}
|
|
3362
|
+
});
|
|
3363
|
+
}
|
|
3364
|
+
ngOnDestroy() {
|
|
3365
|
+
this.unsubscribeAll$.next();
|
|
3366
|
+
this.unsubscribeAll$.complete();
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
NiceFilterMatSortSortingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterMatSortSortingDirective, deps: [{ token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i14.MatSort }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3370
|
+
NiceFilterMatSortSortingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterMatSortSortingDirective, selector: "mat-table[matSort][niceFilterSorting]", ngImport: i0 });
|
|
3371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterMatSortSortingDirective, decorators: [{
|
|
3372
|
+
type: Directive,
|
|
3373
|
+
args: [{ selector: "mat-table[matSort][niceFilterSorting]" }]
|
|
3374
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i14.MatSort }]; } });
|
|
3375
|
+
|
|
3376
|
+
class NiceFilterMatTableViewDirective {
|
|
3377
|
+
constructor(query, table) {
|
|
3378
|
+
this.query = query;
|
|
3379
|
+
this.table = table;
|
|
3380
|
+
}
|
|
3381
|
+
ngOnInit() {
|
|
3382
|
+
this.table.dataSource = this.query.selectAll();
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
NiceFilterMatTableViewDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterMatTableViewDirective, deps: [{ token: NiceFilterViewQuery }, { token: i13.MatTable }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3386
|
+
NiceFilterMatTableViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterMatTableViewDirective, selector: "mat-table[niceFilterDataView]", ngImport: i0 });
|
|
3387
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterMatTableViewDirective, decorators: [{
|
|
3388
|
+
type: Directive,
|
|
3389
|
+
args: [{ selector: "mat-table[niceFilterDataView]" }]
|
|
3390
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: i13.MatTable }]; } });
|
|
3391
|
+
|
|
3392
|
+
class NiceFilterQueryParamsDirective {
|
|
3393
|
+
constructor(query, service, route, router) {
|
|
3394
|
+
this.query = query;
|
|
3395
|
+
this.service = service;
|
|
3396
|
+
this.route = route;
|
|
3397
|
+
this.router = router;
|
|
3398
|
+
this.init = new EventEmitter();
|
|
3399
|
+
this.unsubscribeAll$ = new Subject();
|
|
3400
|
+
this.initialized = false;
|
|
3401
|
+
}
|
|
3402
|
+
ngOnInit() {
|
|
3403
|
+
this.query.selectFilterParameters().pipe(takeUntil(this.unsubscribeAll$)).subscribe((parameters) => {
|
|
3404
|
+
this.updateQueryParams(parameters);
|
|
3405
|
+
});
|
|
3406
|
+
this.loadQueryParams();
|
|
3407
|
+
}
|
|
3408
|
+
ngOnDestroy() {
|
|
3409
|
+
this.unsubscribeAll$.next();
|
|
3410
|
+
this.unsubscribeAll$.complete();
|
|
3411
|
+
}
|
|
3412
|
+
updateQueryParams(parameters) {
|
|
3413
|
+
if (!this.route) {
|
|
3414
|
+
return;
|
|
3415
|
+
}
|
|
3416
|
+
const params = { ...parameters };
|
|
3417
|
+
const { mode } = this.query.getValue();
|
|
3418
|
+
if (mode === "accumulated") {
|
|
3419
|
+
delete params.start;
|
|
3420
|
+
delete params.length;
|
|
3421
|
+
}
|
|
3422
|
+
this.router.navigate([], {
|
|
3423
|
+
relativeTo: this.route,
|
|
3424
|
+
queryParams: QueryParamsUtils.filterParametersToParamsMap(params),
|
|
3425
|
+
queryParamsHandling: "merge"
|
|
3426
|
+
});
|
|
3427
|
+
}
|
|
3428
|
+
loadQueryParams() {
|
|
3429
|
+
this.route.queryParams
|
|
3430
|
+
.pipe(takeUntil(this.unsubscribeAll$), map((params) => {
|
|
3431
|
+
return {
|
|
3432
|
+
params: QueryParamsUtils.extractFilterParameters(params)
|
|
3433
|
+
};
|
|
3434
|
+
}))
|
|
3435
|
+
.subscribe(({ params }) => {
|
|
3436
|
+
if (!QueryParamsUtils.hasFilterParameters(params) || Object.keys(params).length === 0) {
|
|
3437
|
+
params = { ...this.query.getValue().filterParameters };
|
|
3438
|
+
}
|
|
3439
|
+
const { filterParameters, filterResult } = this.query.getValue();
|
|
3440
|
+
if (FilterUtils.filterChangeNeedsRefresh(filterParameters, params) ||
|
|
3441
|
+
!filterResult) {
|
|
3442
|
+
this.service.setParameters(params, false);
|
|
3443
|
+
}
|
|
3444
|
+
if (!this.initialized) {
|
|
3445
|
+
this.initialized = true;
|
|
3446
|
+
this.init.emit();
|
|
3447
|
+
this.service.filter();
|
|
3448
|
+
}
|
|
3449
|
+
});
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
NiceFilterQueryParamsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterQueryParamsDirective, deps: [{ token: NiceFilterViewQuery }, { token: NiceFilterViewService }, { token: i2.ActivatedRoute }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3453
|
+
NiceFilterQueryParamsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterQueryParamsDirective, selector: "nice-filter-view[niceFilterQueryParams]", outputs: { init: "init" }, ngImport: i0 });
|
|
3454
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterQueryParamsDirective, decorators: [{
|
|
3455
|
+
type: Directive,
|
|
3456
|
+
args: [{ selector: "nice-filter-view[niceFilterQueryParams]" }]
|
|
3457
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewQuery }, { type: NiceFilterViewService }, { type: i2.ActivatedRoute }, { type: i2.Router }]; }, propDecorators: { init: [{
|
|
3458
|
+
type: Output
|
|
3459
|
+
}] } });
|
|
3460
|
+
|
|
3461
|
+
class NiceFilterViewComponent {
|
|
3462
|
+
constructor(service) {
|
|
3463
|
+
this.service = service;
|
|
3464
|
+
this.queryParams = {};
|
|
3465
|
+
}
|
|
3466
|
+
ngOnChanges(changes) {
|
|
3467
|
+
if ("queryParams" in changes) {
|
|
3468
|
+
this.service.setQueryParams(this.queryParams);
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
NiceFilterViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewComponent, deps: [{ token: NiceFilterViewService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3473
|
+
NiceFilterViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceFilterViewComponent, selector: "nice-filter-view", inputs: { queryParams: "queryParams" }, providers: [
|
|
3474
|
+
NiceFilterViewQuery,
|
|
3475
|
+
NiceFilterViewService,
|
|
3476
|
+
NiceFilterViewStore
|
|
3477
|
+
], usesOnChanges: true, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [""], encapsulation: i0.ViewEncapsulation.None });
|
|
3478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewComponent, decorators: [{
|
|
3479
|
+
type: Component,
|
|
3480
|
+
args: [{ selector: "nice-filter-view", encapsulation: ViewEncapsulation.None, providers: [
|
|
3481
|
+
NiceFilterViewQuery,
|
|
3482
|
+
NiceFilterViewService,
|
|
3483
|
+
NiceFilterViewStore
|
|
3484
|
+
], template: "<ng-content></ng-content>\n" }]
|
|
3485
|
+
}], ctorParameters: function () { return [{ type: NiceFilterViewService }]; }, propDecorators: { queryParams: [{
|
|
3486
|
+
type: Input
|
|
3487
|
+
}] } });
|
|
3488
|
+
|
|
3489
|
+
class NiceBaseFilterViewComponent {
|
|
3490
|
+
ngOnInit(autoLoad = true, { mode, loadConfig, configQueryParams } = {}) {
|
|
3491
|
+
if (mode) {
|
|
3492
|
+
this.filterViewService.setMode(mode);
|
|
3493
|
+
}
|
|
3494
|
+
const { autoLoad: defaultAutoLoad } = this.filterViewQuery.getValue();
|
|
3495
|
+
if (autoLoad && defaultAutoLoad) {
|
|
3496
|
+
this.filterViewService.filter();
|
|
3497
|
+
}
|
|
3498
|
+
else {
|
|
3499
|
+
this.filterViewService.setAutoLoad(autoLoad);
|
|
3500
|
+
}
|
|
3501
|
+
if (loadConfig) {
|
|
3502
|
+
this.filterViewService.loadConfig(configQueryParams);
|
|
3503
|
+
}
|
|
3504
|
+
this.filterViewLoading$ = this.filterViewQuery.selectLoading();
|
|
3505
|
+
}
|
|
3506
|
+
/**
|
|
3507
|
+
* Call the filter endpoint with the current filter parameters.
|
|
3508
|
+
*/
|
|
3509
|
+
loadData() {
|
|
3510
|
+
this.filterViewService.filter();
|
|
3511
|
+
}
|
|
3512
|
+
/**
|
|
3513
|
+
* Disable the filter view. This will stop calling any api routes.
|
|
3514
|
+
*/
|
|
3515
|
+
disable() {
|
|
3516
|
+
this.filterViewService.disable();
|
|
3517
|
+
}
|
|
3518
|
+
/**
|
|
3519
|
+
* Enable the filter view. This will resume calling any api routes.
|
|
3520
|
+
*/
|
|
3521
|
+
enable() {
|
|
3522
|
+
this.filterViewService.enable();
|
|
3523
|
+
}
|
|
3524
|
+
/**
|
|
3525
|
+
* Update the loading state
|
|
3526
|
+
*/
|
|
3527
|
+
setLoading(loading) {
|
|
3528
|
+
this.filterViewService.setLoading(loading);
|
|
3529
|
+
}
|
|
3530
|
+
/**
|
|
3531
|
+
* Set a set of rules that won't be saved in the current filterParameters config.
|
|
3532
|
+
* NOTE: These rules will be injected in each filter request.
|
|
3533
|
+
*/
|
|
3534
|
+
setBaseRules(rule, reload = true) {
|
|
3535
|
+
this.filterViewService.setBaseRules(rule, reload);
|
|
3536
|
+
}
|
|
3537
|
+
/**
|
|
3538
|
+
* Reset all rules with a new set of rules.
|
|
3539
|
+
*/
|
|
3540
|
+
setRules(rules, reload = true) {
|
|
3541
|
+
this.filterViewService.setRules(rules, reload);
|
|
3542
|
+
}
|
|
3543
|
+
/**
|
|
3544
|
+
* Add or update a rule.
|
|
3545
|
+
* NOTE: This will only check for rules in the first element of the rules array in the current filterParameters.
|
|
3546
|
+
*/
|
|
3547
|
+
upsertRule(id, newRule, reload = true) {
|
|
3548
|
+
this.filterViewService.upsertRule(id, newRule, reload);
|
|
3549
|
+
}
|
|
3550
|
+
/**
|
|
3551
|
+
* Remove a rule.
|
|
3552
|
+
* NOTE: This will only check for rules in the first element of the rules array in the current filterParameters.
|
|
3553
|
+
*/
|
|
3554
|
+
removeRule(id, reload = true) {
|
|
3555
|
+
this.filterViewService.removeRule(id, reload);
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3558
|
+
NiceBaseFilterViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceBaseFilterViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3559
|
+
NiceBaseFilterViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.3", type: NiceBaseFilterViewComponent, selector: "ng-component", viewQueries: [{ propertyName: "filterViewService", first: true, predicate: NiceFilterViewComponent, descendants: true, read: NiceFilterViewService, static: true }, { propertyName: "filterViewQuery", first: true, predicate: NiceFilterViewComponent, descendants: true, read: NiceFilterViewQuery, static: true }], ngImport: i0, template: ``, isInline: true });
|
|
3560
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceBaseFilterViewComponent, decorators: [{
|
|
3561
|
+
type: Component,
|
|
3562
|
+
args: [{
|
|
3563
|
+
template: ``
|
|
3564
|
+
}]
|
|
3565
|
+
}], propDecorators: { filterViewService: [{
|
|
3566
|
+
type: ViewChild,
|
|
3567
|
+
args: [NiceFilterViewComponent, { read: NiceFilterViewService, static: true }]
|
|
3568
|
+
}], filterViewQuery: [{
|
|
3569
|
+
type: ViewChild,
|
|
3570
|
+
args: [NiceFilterViewComponent, { read: NiceFilterViewQuery, static: true }]
|
|
3571
|
+
}] } });
|
|
3572
|
+
|
|
3573
|
+
class NiceFilterViewModule {
|
|
3574
|
+
static forRoot(options) {
|
|
3575
|
+
return {
|
|
3576
|
+
ngModule: NiceFilterViewModule,
|
|
3577
|
+
providers: [
|
|
3578
|
+
{
|
|
3579
|
+
provide: FILTER_VIEW_ICONS,
|
|
3580
|
+
useValue: {
|
|
3581
|
+
...defaultIcons,
|
|
3582
|
+
...(options?.icons ?? {})
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
].filter(x => !!x)
|
|
3586
|
+
};
|
|
3587
|
+
}
|
|
3588
|
+
static providerFactory(options) {
|
|
3589
|
+
return [
|
|
3590
|
+
{
|
|
3591
|
+
provide: NiceFilterService,
|
|
3592
|
+
useClass: options.filterService
|
|
3593
|
+
},
|
|
3594
|
+
{
|
|
3595
|
+
provide: EXPORTS_SETTINGS,
|
|
3596
|
+
useValue: options.exports ?? {
|
|
3597
|
+
pdf: true,
|
|
3598
|
+
xlsx: true,
|
|
3599
|
+
csv: true
|
|
3600
|
+
}
|
|
3601
|
+
},
|
|
3602
|
+
{
|
|
3603
|
+
provide: FILTER_VIEW_STATE,
|
|
3604
|
+
useValue: options.state ?? {}
|
|
3605
|
+
}
|
|
3606
|
+
].filter(x => !!x);
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
NiceFilterViewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3610
|
+
NiceFilterViewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewModule, declarations: [NiceFilterViewComponent,
|
|
3611
|
+
NiceFilterCustomDataViewComponent,
|
|
3612
|
+
NiceFilterExportButtonsComponent,
|
|
3613
|
+
NiceFilterInfiniteScrollDataViewComponent,
|
|
3614
|
+
NiceFilterSearchComponent,
|
|
3615
|
+
NiceFilterDataDirective,
|
|
3616
|
+
NiceFilterExportDirective,
|
|
3617
|
+
NiceFilterMatTableViewDirective,
|
|
3618
|
+
NiceFilterMatSortSortingDirective,
|
|
3619
|
+
NiceFilterMatPaginatorPaginationDirective,
|
|
3620
|
+
NiceFilterQueryParamsDirective], imports: [TranslateModule,
|
|
3621
|
+
MatIconModule,
|
|
3622
|
+
FormsModule,
|
|
3623
|
+
AsyncPipe,
|
|
3624
|
+
NgIf,
|
|
3625
|
+
NgTemplateOutlet,
|
|
3626
|
+
MatTooltipModule,
|
|
3627
|
+
MatButtonModule,
|
|
3628
|
+
MatBottomSheetModule,
|
|
3629
|
+
NiceExportBottomSheetModule], exports: [NiceFilterViewComponent,
|
|
3630
|
+
NiceFilterCustomDataViewComponent,
|
|
3631
|
+
NiceFilterExportButtonsComponent,
|
|
3632
|
+
NiceFilterInfiniteScrollDataViewComponent,
|
|
3633
|
+
NiceFilterSearchComponent,
|
|
3634
|
+
NiceFilterDataDirective,
|
|
3635
|
+
NiceFilterExportDirective,
|
|
3636
|
+
NiceFilterMatTableViewDirective,
|
|
3637
|
+
NiceFilterMatSortSortingDirective,
|
|
3638
|
+
NiceFilterMatPaginatorPaginationDirective,
|
|
3639
|
+
NiceFilterQueryParamsDirective] });
|
|
3640
|
+
NiceFilterViewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewModule, imports: [TranslateModule,
|
|
3641
|
+
MatIconModule,
|
|
3642
|
+
FormsModule,
|
|
3643
|
+
MatTooltipModule,
|
|
3644
|
+
MatButtonModule,
|
|
3645
|
+
MatBottomSheetModule,
|
|
3646
|
+
NiceExportBottomSheetModule] });
|
|
3647
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceFilterViewModule, decorators: [{
|
|
3648
|
+
type: NgModule,
|
|
3649
|
+
args: [{
|
|
3650
|
+
imports: [
|
|
3651
|
+
TranslateModule,
|
|
3652
|
+
MatIconModule,
|
|
3653
|
+
FormsModule,
|
|
3654
|
+
AsyncPipe,
|
|
3655
|
+
NgIf,
|
|
3656
|
+
NgTemplateOutlet,
|
|
3657
|
+
MatTooltipModule,
|
|
3658
|
+
MatButtonModule,
|
|
3659
|
+
MatBottomSheetModule,
|
|
3660
|
+
NiceExportBottomSheetModule
|
|
3661
|
+
],
|
|
3662
|
+
declarations: [
|
|
3663
|
+
NiceFilterViewComponent,
|
|
3664
|
+
NiceFilterCustomDataViewComponent,
|
|
3665
|
+
NiceFilterExportButtonsComponent,
|
|
3666
|
+
NiceFilterInfiniteScrollDataViewComponent,
|
|
3667
|
+
NiceFilterSearchComponent,
|
|
3668
|
+
NiceFilterDataDirective,
|
|
3669
|
+
NiceFilterExportDirective,
|
|
3670
|
+
NiceFilterMatTableViewDirective,
|
|
3671
|
+
NiceFilterMatSortSortingDirective,
|
|
3672
|
+
NiceFilterMatPaginatorPaginationDirective,
|
|
3673
|
+
NiceFilterQueryParamsDirective
|
|
3674
|
+
],
|
|
3675
|
+
providers: [],
|
|
3676
|
+
exports: [
|
|
3677
|
+
NiceFilterViewComponent,
|
|
3678
|
+
NiceFilterCustomDataViewComponent,
|
|
3679
|
+
NiceFilterExportButtonsComponent,
|
|
3680
|
+
NiceFilterInfiniteScrollDataViewComponent,
|
|
3681
|
+
NiceFilterSearchComponent,
|
|
3682
|
+
NiceFilterDataDirective,
|
|
3683
|
+
NiceFilterExportDirective,
|
|
3684
|
+
NiceFilterMatTableViewDirective,
|
|
3685
|
+
NiceFilterMatSortSortingDirective,
|
|
3686
|
+
NiceFilterMatPaginatorPaginationDirective,
|
|
3687
|
+
NiceFilterQueryParamsDirective
|
|
3688
|
+
],
|
|
3689
|
+
}]
|
|
3690
|
+
}] });
|
|
3691
|
+
|
|
2732
3692
|
class StringUtils {
|
|
2733
3693
|
}
|
|
2734
3694
|
// tslint:disable-next-line:max-line-length
|
|
@@ -2745,5 +3705,5 @@ String.prototype.toTableColumn = function (sortableOrOptions, nullLast) {
|
|
|
2745
3705
|
* Generated bundle index. Do not edit.
|
|
2746
3706
|
*/
|
|
2747
3707
|
|
|
2748
|
-
export { DateFilterComponent, FilterComponent, FilterGroupIconPipe, FilterOperatorTypes, FilterSelectionComponent, FilterType, FilterUtils, LayoutContent, NiceBaseListButtonsDirective, NiceBaseListCardsDirective, NiceBaseListComponent, NiceBaseListCustomContentDirective, NiceBaseListDirectiveModule, NiceBaseListEmptySearchResultStateDirective, NiceBaseListEmptyStateDirective, NiceBaseListFiltersDirective, NiceBaseListModule, NiceBaseListQuery, NiceBaseListService, NiceBaseListStore, NiceBaseListTableDirective, NiceBaseListTitleDirective, NiceCustomDateAdapter, NiceFilterApi, NiceFilterGroupService, NiceFilterService, NiceListState, NiceMultiStateFilterService, NiceMultiStateListComponent, NiceMultiStateListModule, NiceMultiStateListQuery, NiceMultiStateListService, NiceMultiStateListStore, NiceQueryBuilderComponent, NiceQueryBuilderModule, NiceSavedReportService, NumberFilterComponent, OrderUtils, QBFilterUtils, QueryBuilderTriggerDirective, RadioFilterComponent, RuleComponent, SelectFilterComponent, StringUtils, TableColumns, TextFilterComponent, defaultLayout, initialBaseListState, initialValue, mixinNiceFilterApi };
|
|
3708
|
+
export { DateFilterComponent, FilterComponent, FilterGroupIconPipe, FilterOperatorTypes, FilterSelectionComponent, FilterType, FilterUtils, LayoutContent, NiceBaseFilterViewComponent, NiceBaseListButtonsDirective, NiceBaseListCardsDirective, NiceBaseListComponent, NiceBaseListCustomContentDirective, NiceBaseListDirectiveModule, NiceBaseListEmptySearchResultStateDirective, NiceBaseListEmptyStateDirective, NiceBaseListFiltersDirective, NiceBaseListModule, NiceBaseListQuery, NiceBaseListService, NiceBaseListStore, NiceBaseListTableDirective, NiceBaseListTitleDirective, NiceCustomDateAdapter, NiceFilterApi, NiceFilterCustomDataViewComponent, NiceFilterDataDirective, NiceFilterExportButtonsComponent, NiceFilterExportDirective, NiceFilterGroupService, NiceFilterInfiniteScrollDataViewComponent, NiceFilterMatPaginatorPaginationDirective, NiceFilterMatSortSortingDirective, NiceFilterMatTableViewDirective, NiceFilterQueryParamsDirective, NiceFilterSearchComponent, NiceFilterService, NiceFilterViewComponent, NiceFilterViewModule, NiceFilterViewQuery, NiceFilterViewService, NiceListState, NiceMultiStateFilterService, NiceMultiStateListComponent, NiceMultiStateListModule, NiceMultiStateListQuery, NiceMultiStateListService, NiceMultiStateListStore, NiceQueryBuilderComponent, NiceQueryBuilderModule, NiceSavedReportService, NumberFilterComponent, OrderUtils, QBFilterUtils, QueryBuilderTriggerDirective, RadioFilterComponent, RuleComponent, SelectFilterComponent, StringUtils, TableColumns, TextFilterComponent, defaultLayout, initialBaseListState, initialValue$1 as initialValue, mixinNiceFilterApi };
|
|
2749
3709
|
//# sourceMappingURL=recursyve-nice-data-filter-kit.mjs.map
|