@recursyve/nice-data-filter-kit 12.1.28 → 13.0.1

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.
Files changed (105) hide show
  1. package/_index.scss +1 -7
  2. package/{esm2015/lib/api/dto/saved-reports.dto.js → esm2020/lib/api/dto/saved-reports.dto.mjs} +0 -0
  3. package/esm2020/lib/api/filter.api.mjs +51 -0
  4. package/{esm2015/lib/api/models/saved-reports.model.js → esm2020/lib/api/models/saved-reports.model.mjs} +0 -0
  5. package/{esm2015/lib/api/public-api.js → esm2020/lib/api/public-api.mjs} +0 -0
  6. package/esm2020/lib/api/saved-report.api.mjs +48 -0
  7. package/esm2020/lib/components/base-list/base-list.component.mjs +288 -0
  8. package/{esm2015/lib/components/base-list/base-list.constant.js → esm2020/lib/components/base-list/base-list.constant.mjs} +0 -0
  9. package/esm2020/lib/components/base-list/base-list.module.mjs +171 -0
  10. package/{esm2015/lib/components/base-list/directives/base-list-buttons.directive.js → esm2020/lib/components/base-list/directives/base-list-buttons.directive.mjs} +3 -3
  11. package/{esm2015/lib/components/base-list/directives/base-list-cards.directive.js → esm2020/lib/components/base-list/directives/base-list-cards.directive.mjs} +3 -3
  12. package/{esm2015/lib/components/base-list/directives/base-list-custom-content.directive.js → esm2020/lib/components/base-list/directives/base-list-custom-content.directive.mjs} +3 -3
  13. package/esm2020/lib/components/base-list/directives/base-list-directives.module.mjs +45 -0
  14. package/esm2020/lib/components/base-list/directives/base-list-filters.directive.mjs +14 -0
  15. package/{esm2015/lib/components/base-list/directives/base-list-table.directive.js → esm2020/lib/components/base-list/directives/base-list-table.directive.mjs} +3 -3
  16. package/{esm2015/lib/components/base-list/directives/base-list-title.directive.js → esm2020/lib/components/base-list/directives/base-list-title.directive.mjs} +3 -3
  17. package/{esm2015/lib/components/base-list/models/columns.model.js → esm2020/lib/components/base-list/models/columns.model.mjs} +0 -0
  18. package/{esm2015/lib/components/base-list/models/export.model.js → esm2020/lib/components/base-list/models/export.model.mjs} +0 -0
  19. package/esm2020/lib/components/base-list/models/layout.model.mjs +149 -0
  20. package/esm2020/lib/components/base-list/providers/base-filter.service.mjs +34 -0
  21. package/{esm2015/lib/components/base-list/providers/base-list-saved-report.service.js → esm2020/lib/components/base-list/providers/base-list-saved-report.service.mjs} +3 -3
  22. package/esm2020/lib/components/base-list/public-api.mjs +17 -0
  23. package/esm2020/lib/components/base-list/store/base-list.query.mjs +35 -0
  24. package/esm2020/lib/components/base-list/store/base-list.service.mjs +341 -0
  25. package/esm2020/lib/components/base-list/store/base-list.store.mjs +81 -0
  26. package/{esm2015/lib/components/multi-state-list/models/list-states.model.js → esm2020/lib/components/multi-state-list/models/list-states.model.mjs} +0 -0
  27. package/esm2020/lib/components/multi-state-list/multi-state-list.component.mjs +71 -0
  28. package/{esm2015/lib/components/multi-state-list/multi-state-list.constant.js → esm2020/lib/components/multi-state-list/multi-state-list.constant.mjs} +0 -0
  29. package/{esm2015/lib/components/multi-state-list/multi-state-list.module.js → esm2020/lib/components/multi-state-list/multi-state-list.module.mjs} +6 -14
  30. package/{esm2015/lib/components/multi-state-list/providers/multi-state-filter.service.js → esm2020/lib/components/multi-state-list/providers/multi-state-filter.service.mjs} +0 -0
  31. package/{esm2015/lib/components/multi-state-list/public-api.js → esm2020/lib/components/multi-state-list/public-api.mjs} +0 -0
  32. package/{esm2015/lib/components/multi-state-list/store/multi-state-list.query.js → esm2020/lib/components/multi-state-list/store/multi-state-list.query.mjs} +3 -3
  33. package/{esm2015/lib/components/multi-state-list/store/multi-state-list.service.js → esm2020/lib/components/multi-state-list/store/multi-state-list.service.mjs} +5 -6
  34. package/esm2020/lib/components/multi-state-list/store/multi-state-list.store.mjs +24 -0
  35. package/{esm2015/lib/components/public-api.js → esm2020/lib/components/public-api.mjs} +0 -0
  36. package/esm2020/lib/components/query-builder/filter-selection/filter-selection.component.mjs +41 -0
  37. package/{esm2015/lib/components/query-builder/pipes/filter-group-icon.pipe.js → esm2020/lib/components/query-builder/pipes/filter-group-icon.pipe.mjs} +3 -3
  38. package/{esm2015/lib/components/query-builder/providers/filter-group.service.js → esm2020/lib/components/query-builder/providers/filter-group.service.mjs} +0 -0
  39. package/{esm2015/lib/components/query-builder/public-api.js → esm2020/lib/components/query-builder/public-api.mjs} +0 -0
  40. package/{esm2015/lib/components/query-builder/query-builder-trigger.directive.js → esm2020/lib/components/query-builder/query-builder-trigger.directive.mjs} +3 -3
  41. package/esm2020/lib/components/query-builder/query-builder.component.mjs +93 -0
  42. package/{esm2015/lib/components/query-builder/query-builder.form.js → esm2020/lib/components/query-builder/query-builder.form.mjs} +0 -0
  43. package/esm2020/lib/components/query-builder/query-builder.module.mjs +116 -0
  44. package/esm2020/lib/components/query-builder/rule/components/date/date-filter.component.mjs +29 -0
  45. package/{esm2015/lib/components/query-builder/rule/components/filter.component.js → esm2020/lib/components/query-builder/rule/components/filter.component.mjs} +3 -3
  46. package/esm2020/lib/components/query-builder/rule/components/number/number-filter.component.mjs +28 -0
  47. package/esm2020/lib/components/query-builder/rule/components/radio/radio-filter.component.mjs +30 -0
  48. package/esm2020/lib/components/query-builder/rule/components/select/select-filter.component.mjs +83 -0
  49. package/esm2020/lib/components/query-builder/rule/components/text/text-filter.component.mjs +31 -0
  50. package/esm2020/lib/components/query-builder/rule/rule.component.mjs +78 -0
  51. package/{esm2015/lib/components/query-builder/utils/qb-filter.utils.js → esm2020/lib/components/query-builder/utils/qb-filter.utils.mjs} +23 -9
  52. package/{esm2015/lib/models/filter.model.js → esm2020/lib/models/filter.model.mjs} +0 -0
  53. package/{esm2015/lib/models/public-api.js → esm2020/lib/models/public-api.mjs} +0 -0
  54. package/{esm2015/lib/models/query.model.js → esm2020/lib/models/query.model.mjs} +0 -0
  55. package/{esm2015/lib/utils/date.adapter.js → esm2020/lib/utils/date.adapter.mjs} +3 -3
  56. package/esm2020/lib/utils/filter.utils.mjs +40 -0
  57. package/{esm2015/lib/utils/public-api.js → esm2020/lib/utils/public-api.mjs} +0 -0
  58. package/{esm2015/lib/utils/query-params.utils.js → esm2020/lib/utils/query-params.utils.mjs} +0 -0
  59. package/{esm2015/lib/utils/string.utils.js → esm2020/lib/utils/string.utils.mjs} +0 -0
  60. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  61. package/{esm2015/recursyve-nice-data-filter-kit.js → esm2020/recursyve-nice-data-filter-kit.mjs} +0 -0
  62. package/fesm2015/recursyve-nice-data-filter-kit.mjs +2448 -0
  63. package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -0
  64. package/fesm2020/recursyve-nice-data-filter-kit.mjs +2446 -0
  65. package/fesm2020/recursyve-nice-data-filter-kit.mjs.map +1 -0
  66. package/lib/components/base-list/base-list.component.d.ts +3 -1
  67. package/lib/components/base-list/base-list.module.d.ts +15 -16
  68. package/lib/components/base-list/directives/base-list-directives.module.d.ts +2 -1
  69. package/lib/components/base-list/directives/base-list-filters.directive.d.ts +8 -0
  70. package/lib/components/base-list/models/layout.model.d.ts +1 -5
  71. package/lib/components/base-list/public-api.d.ts +1 -0
  72. package/lib/components/base-list/store/base-list.service.d.ts +1 -0
  73. package/lib/components/multi-state-list/multi-state-list.module.d.ts +15 -16
  74. package/lib/components/query-builder/query-builder.module.d.ts +10 -11
  75. package/package.json +30 -16
  76. package/src/lib/components/base-list/base-list.theme.scss +5 -5
  77. package/src/lib/components/query-builder/rule/rule.theme.scss +1 -1
  78. package/src/lib/nice-data-filter.theme.scss +7 -0
  79. package/bundles/recursyve-nice-data-filter-kit.umd.js +0 -3153
  80. package/bundles/recursyve-nice-data-filter-kit.umd.js.map +0 -1
  81. package/esm2015/lib/api/filter.api.js +0 -52
  82. package/esm2015/lib/api/saved-report.api.js +0 -49
  83. package/esm2015/lib/components/base-list/base-list.component.js +0 -290
  84. package/esm2015/lib/components/base-list/base-list.module.js +0 -180
  85. package/esm2015/lib/components/base-list/directives/base-list-directives.module.js +0 -40
  86. package/esm2015/lib/components/base-list/models/layout.model.js +0 -155
  87. package/esm2015/lib/components/base-list/providers/base-filter.service.js +0 -40
  88. package/esm2015/lib/components/base-list/public-api.js +0 -16
  89. package/esm2015/lib/components/base-list/store/base-list.query.js +0 -35
  90. package/esm2015/lib/components/base-list/store/base-list.service.js +0 -327
  91. package/esm2015/lib/components/base-list/store/base-list.store.js +0 -78
  92. package/esm2015/lib/components/multi-state-list/multi-state-list.component.js +0 -75
  93. package/esm2015/lib/components/multi-state-list/store/multi-state-list.store.js +0 -22
  94. package/esm2015/lib/components/query-builder/filter-selection/filter-selection.component.js +0 -48
  95. package/esm2015/lib/components/query-builder/query-builder.component.js +0 -100
  96. package/esm2015/lib/components/query-builder/query-builder.module.js +0 -120
  97. package/esm2015/lib/components/query-builder/rule/components/date/date-filter.component.js +0 -35
  98. package/esm2015/lib/components/query-builder/rule/components/number/number-filter.component.js +0 -34
  99. package/esm2015/lib/components/query-builder/rule/components/radio/radio-filter.component.js +0 -36
  100. package/esm2015/lib/components/query-builder/rule/components/select/select-filter.component.js +0 -94
  101. package/esm2015/lib/components/query-builder/rule/components/text/text-filter.component.js +0 -37
  102. package/esm2015/lib/components/query-builder/rule/rule.component.js +0 -86
  103. package/esm2015/lib/utils/filter.utils.js +0 -41
  104. package/fesm2015/recursyve-nice-data-filter-kit.js +0 -2485
  105. package/fesm2015/recursyve-nice-data-filter-kit.js.map +0 -1
@@ -0,0 +1,2446 @@
1
+ import { HttpParams } from '@angular/common/http';
2
+ import * as i3$1 from '@recursyve/nice-ui-kit.v2';
3
+ import { isNullOrUndefined, ObjectUtils, FileUtils, ArrayUtils, ExportBottomSheetComponent, NiceLoadingSpinnerModule, NiceTypeaheadModule, NiceExportBottomSheetModule } from '@recursyve/nice-ui-kit.v2';
4
+ import * as i0 from '@angular/core';
5
+ import { Directive, Input, NgModule, Injectable, InjectionToken, Optional, Inject, Component, forwardRef, ViewEncapsulation, Pipe, EventEmitter, ChangeDetectionStrategy, Output, HostListener, TemplateRef, ContentChild, ContentChildren } from '@angular/core';
6
+ import { Store, StoreConfig, Query, arrayUpsert, arrayRemove } from '@datorama/akita';
7
+ import { __decorate, __metadata } from 'tslib';
8
+ import * as i3 from '@angular/router';
9
+ import { RouterModule } from '@angular/router';
10
+ import { Subject, firstValueFrom, of } from 'rxjs';
11
+ import { takeUntil, map, debounceTime, switchMap, distinctUntilChanged } from 'rxjs/operators';
12
+ import * as i5$2 from '@angular/flex-layout';
13
+ import * as i4$1 from '@angular/material/bottom-sheet';
14
+ import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
15
+ import * as i6 from '@angular/material/icon';
16
+ import { MatIconModule } from '@angular/material/icon';
17
+ import * as i7 from '@angular/material/button';
18
+ import { MatButtonModule } from '@angular/material/button';
19
+ import * as i8 from '@angular/material/paginator';
20
+ import { MatPaginatorModule } from '@angular/material/paginator';
21
+ import * as i9 from '@angular/material/card';
22
+ import { MatCardModule } from '@angular/material/card';
23
+ import * as i1$1 from '@angular/forms';
24
+ import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
25
+ import * as i1$5 from '@recursyve/ngx-form-generator';
26
+ import { Control, Required, Array as Array$1, GeneratedFormGroup, ngxFormGeneratorFactory } from '@recursyve/ngx-form-generator';
27
+ import * as i1 from '@angular/material/form-field';
28
+ import * as i5$1 from '@angular/material/select';
29
+ import { MatSelectModule } from '@angular/material/select';
30
+ import * as i5 from '@angular/material/core';
31
+ import { NativeDateAdapter, MAT_DATE_LOCALE, MatRippleModule, DateAdapter } from '@angular/material/core';
32
+ import * as i2 from '@angular/material/input';
33
+ import { MatInputModule } from '@angular/material/input';
34
+ import * as i4 from 'ngx-mask';
35
+ import { NgxMaskModule } from 'ngx-mask';
36
+ import * as i1$2 from '@angular/material/radio';
37
+ import { MatRadioModule } from '@angular/material/radio';
38
+ import * as i13 from '@angular/common';
39
+ import { CommonModule } from '@angular/common';
40
+ import * as i2$1 from '@angular/material/datepicker';
41
+ import { MatDatepickerModule } from '@angular/material/datepicker';
42
+ import * as i1$3 from '@angular/cdk/overlay';
43
+ import { OverlayModule } from '@angular/cdk/overlay';
44
+ import * as i2$3 from '@angular/cdk/platform';
45
+ import { ComponentPortal } from '@angular/cdk/portal';
46
+ import * as i2$2 from '@angular/material/list';
47
+ import { MatListModule } from '@angular/material/list';
48
+ import * as i1$4 from '@ngx-translate/core';
49
+ import { TranslateModule } from '@ngx-translate/core';
50
+ import * as i11 from '@angular/material/table';
51
+ import { MatTableModule } from '@angular/material/table';
52
+ import * as i12 from '@angular/material/sort';
53
+ import { MatSortModule } from '@angular/material/sort';
54
+ import * as i16 from '@angular/material/tooltip';
55
+ import { MatTooltipModule } from '@angular/material/tooltip';
56
+ import * as i17 from '@angular/material/badge';
57
+ import { MatBadgeModule } from '@angular/material/badge';
58
+
59
+ class QueryParamsUtils {
60
+ static extractFilterParameters(params) {
61
+ const filters = {};
62
+ if (!isNullOrUndefined(params.start)) {
63
+ filters.start = Number(params.start);
64
+ }
65
+ if (!isNullOrUndefined(params.length)) {
66
+ filters.length = Number(params.length);
67
+ }
68
+ if (!isNullOrUndefined(params.order)) {
69
+ try {
70
+ filters.order = JSON.parse(params.order);
71
+ }
72
+ catch (e) {
73
+ delete filters.order;
74
+ }
75
+ }
76
+ if (!isNullOrUndefined(params.search)) {
77
+ filters.search = params.search;
78
+ }
79
+ if (!isNullOrUndefined(params.rules)) {
80
+ try {
81
+ filters.rules = JSON.parse(params.rules);
82
+ }
83
+ catch (e) {
84
+ delete filters.rules;
85
+ }
86
+ }
87
+ return filters;
88
+ }
89
+ static filterParametersToParamsMap(filterParameters) {
90
+ const params = {};
91
+ if (!isNullOrUndefined(filterParameters.start)) {
92
+ params.start = filterParameters.start;
93
+ }
94
+ if (!isNullOrUndefined(filterParameters.length)) {
95
+ params.length = filterParameters.length;
96
+ }
97
+ if (!isNullOrUndefined(filterParameters.order)) {
98
+ params.order = JSON.stringify(filterParameters.order);
99
+ }
100
+ else {
101
+ params.order = null;
102
+ }
103
+ if (!isNullOrUndefined(filterParameters.search)) {
104
+ params.search = filterParameters.search;
105
+ }
106
+ if (!isNullOrUndefined(filterParameters.rules)) {
107
+ params.rules = JSON.stringify(filterParameters.rules);
108
+ }
109
+ return params;
110
+ }
111
+ static fromObject(obj) {
112
+ Object.entries(obj).forEach(([key, value]) => {
113
+ if (value === undefined) {
114
+ delete obj[key];
115
+ }
116
+ });
117
+ return new HttpParams({
118
+ fromObject: obj
119
+ }).toString();
120
+ }
121
+ }
122
+
123
+ class NiceFilterApi {
124
+ constructor(filterApiUrl, path, http) {
125
+ this.filterApiUrl = filterApiUrl;
126
+ this.path = path;
127
+ this.http = http;
128
+ }
129
+ filter(queryModel) {
130
+ return this.http.post(this.url("filter"), queryModel);
131
+ }
132
+ filterCount(queryModel) {
133
+ return this.http.post(this.url("filter-count"), queryModel);
134
+ }
135
+ downloadData(type, queryModel) {
136
+ return this.http.post(this.url(`download/${type}`), queryModel, { responseType: "blob" });
137
+ }
138
+ getPrintableHtml(queryModel) {
139
+ return this.http.post(this.url(`download/html`), queryModel, { responseType: "text" });
140
+ }
141
+ getFilterConfig() {
142
+ return this.http.get(this.url("filter/config"));
143
+ }
144
+ searchFilterValue(id, value) {
145
+ if (value === undefined) {
146
+ value = "";
147
+ }
148
+ return this.http.get(this.url(`filter/config/value?id=${id}&value=${value}`));
149
+ }
150
+ searchFilterResourceValue(id, resourceId) {
151
+ return this.http.get(this.url(`filter/config/id?id=${id}&resourceId=${resourceId}`));
152
+ }
153
+ url(...args) {
154
+ const [route, queryParams] = this.transformUrlArgs(args);
155
+ const params = queryParams ? `?${QueryParamsUtils.fromObject(queryParams)}` : "";
156
+ if (route) {
157
+ return `${this.filterApiUrl}/${this.path}/${route}${params}`;
158
+ }
159
+ return `${this.filterApiUrl}/${this.path}${params}`;
160
+ }
161
+ transformUrlArgs(args) {
162
+ const [routeOfQueryParams, query] = args;
163
+ if (args.length === 1) {
164
+ if (typeof routeOfQueryParams === "string") {
165
+ return [routeOfQueryParams];
166
+ }
167
+ return ["", routeOfQueryParams];
168
+ }
169
+ return [routeOfQueryParams ?? "", query];
170
+ }
171
+ }
172
+
173
+ class NiceBaseListButtonsDirective {
174
+ constructor(template) {
175
+ this.template = template;
176
+ this.position = "suffix";
177
+ }
178
+ }
179
+ NiceBaseListButtonsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListButtonsDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
180
+ NiceBaseListButtonsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NiceBaseListButtonsDirective, selector: "[niceListButton]", inputs: { position: "position" }, ngImport: i0 });
181
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListButtonsDirective, decorators: [{
182
+ type: Directive,
183
+ args: [{ selector: "[niceListButton]" }]
184
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { position: [{
185
+ type: Input
186
+ }] } });
187
+
188
+ class NiceBaseListCardsDirective {
189
+ constructor(template) {
190
+ this.template = template;
191
+ }
192
+ }
193
+ NiceBaseListCardsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListCardsDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
194
+ NiceBaseListCardsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NiceBaseListCardsDirective, selector: "[niceListCards]", ngImport: i0 });
195
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListCardsDirective, decorators: [{
196
+ type: Directive,
197
+ args: [{ selector: "[niceListCards]" }]
198
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
199
+
200
+ class NiceBaseListCustomContentDirective {
201
+ constructor(template) {
202
+ this.template = template;
203
+ }
204
+ }
205
+ NiceBaseListCustomContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListCustomContentDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
206
+ NiceBaseListCustomContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NiceBaseListCustomContentDirective, selector: "[niceListContent]", ngImport: i0 });
207
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListCustomContentDirective, decorators: [{
208
+ type: Directive,
209
+ args: [{ selector: "[niceListContent]" }]
210
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
211
+
212
+ class NiceBaseListFiltersDirective {
213
+ constructor(template) {
214
+ this.template = template;
215
+ }
216
+ }
217
+ NiceBaseListFiltersDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListFiltersDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
218
+ NiceBaseListFiltersDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NiceBaseListFiltersDirective, selector: "[niceListFilters]", ngImport: i0 });
219
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListFiltersDirective, decorators: [{
220
+ type: Directive,
221
+ args: [{ selector: "[niceListFilters]" }]
222
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
223
+
224
+ class NiceBaseListTableDirective {
225
+ constructor(template) {
226
+ this.template = template;
227
+ }
228
+ }
229
+ NiceBaseListTableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListTableDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
230
+ NiceBaseListTableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NiceBaseListTableDirective, selector: "[niceListTable]", ngImport: i0 });
231
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListTableDirective, decorators: [{
232
+ type: Directive,
233
+ args: [{ selector: "[niceListTable]" }]
234
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
235
+
236
+ class NiceBaseListTitleDirective {
237
+ constructor(template) {
238
+ this.template = template;
239
+ }
240
+ }
241
+ NiceBaseListTitleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListTitleDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
242
+ NiceBaseListTitleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: NiceBaseListTitleDirective, selector: "[niceListTitle]", ngImport: i0 });
243
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListTitleDirective, decorators: [{
244
+ type: Directive,
245
+ args: [{ selector: "[niceListTitle]" }]
246
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
247
+
248
+ class NiceBaseListDirectiveModule {
249
+ }
250
+ NiceBaseListDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
251
+ NiceBaseListDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListDirectiveModule, declarations: [NiceBaseListButtonsDirective,
252
+ NiceBaseListTitleDirective,
253
+ NiceBaseListTableDirective,
254
+ NiceBaseListCardsDirective,
255
+ NiceBaseListCustomContentDirective,
256
+ NiceBaseListFiltersDirective], exports: [NiceBaseListButtonsDirective,
257
+ NiceBaseListTitleDirective,
258
+ NiceBaseListTableDirective,
259
+ NiceBaseListCardsDirective,
260
+ NiceBaseListCustomContentDirective,
261
+ NiceBaseListFiltersDirective] });
262
+ NiceBaseListDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListDirectiveModule });
263
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListDirectiveModule, decorators: [{
264
+ type: NgModule,
265
+ args: [{
266
+ declarations: [
267
+ NiceBaseListButtonsDirective,
268
+ NiceBaseListTitleDirective,
269
+ NiceBaseListTableDirective,
270
+ NiceBaseListCardsDirective,
271
+ NiceBaseListCustomContentDirective,
272
+ NiceBaseListFiltersDirective
273
+ ],
274
+ exports: [
275
+ NiceBaseListButtonsDirective,
276
+ NiceBaseListTitleDirective,
277
+ NiceBaseListTableDirective,
278
+ NiceBaseListCardsDirective,
279
+ NiceBaseListCustomContentDirective,
280
+ NiceBaseListFiltersDirective
281
+ ]
282
+ }]
283
+ }] });
284
+
285
+ class TableColumns {
286
+ constructor(id, sortable = true) {
287
+ this.id = id;
288
+ this.sortable = sortable;
289
+ }
290
+ }
291
+
292
+ var LayoutContent;
293
+ (function (LayoutContent) {
294
+ LayoutContent["Table"] = "table";
295
+ LayoutContent["Cards"] = "cards";
296
+ LayoutContent["Custom"] = "custom";
297
+ })(LayoutContent || (LayoutContent = {}));
298
+ const defaultLayout = {
299
+ default: {
300
+ classes: ["flex flex-col"],
301
+ items: [
302
+ {
303
+ classes: ["flex flex-row mb-8"],
304
+ items: [
305
+ {
306
+ name: "title",
307
+ classes: ["flex flex-full max-w-1/3"],
308
+ },
309
+ {
310
+ classes: ["flex flex-row flex-auto flex-shrink-0 justify-center items-center"],
311
+ items: [
312
+ {
313
+ name: "search",
314
+ classes: ["flex flex-auto flex-shrink-0"],
315
+ },
316
+ {
317
+ classes: ["flex flex-auto flex-shrink-0 justify-end"],
318
+ items: [
319
+ {
320
+ name: "prefixButtons",
321
+ classes: ["flex justify-end items-center"],
322
+ },
323
+ {
324
+ name: "exportButtons",
325
+ classes: ["flex justify-end items-center"],
326
+ },
327
+ {
328
+ name: "suffixButtons",
329
+ classes: ["flex justify-end items-center"],
330
+ }
331
+ ]
332
+ }
333
+ ]
334
+ }
335
+ ]
336
+ },
337
+ {
338
+ name: "queryBuilder"
339
+ },
340
+ {
341
+ name: "filters"
342
+ },
343
+ {
344
+ name: "content"
345
+ },
346
+ {
347
+ name: "pagination"
348
+ }
349
+ ]
350
+ },
351
+ sm: {
352
+ classes: ["flex flex-col"],
353
+ items: [
354
+ {
355
+ classes: ["flex flex-row justify-center items-center mb-8"],
356
+ items: [
357
+ {
358
+ name: "title",
359
+ classes: ["flex flex-full max-w-1/2"]
360
+ },
361
+ {
362
+ classes: ["flex flex-auto flex-shrink-0 justify-end items-center"],
363
+ items: [
364
+ {
365
+ name: "prefixButtons"
366
+ },
367
+ {
368
+ name: "exportButtons"
369
+ },
370
+ {
371
+ name: "suffixButtons"
372
+ }
373
+ ]
374
+ }
375
+ ]
376
+ },
377
+ {
378
+ name: "search",
379
+ classes: ["flex justify-center items-center mb-8"]
380
+ },
381
+ {
382
+ name: "queryBuilder"
383
+ },
384
+ {
385
+ name: "filters"
386
+ },
387
+ {
388
+ name: "content"
389
+ },
390
+ {
391
+ name: "pagination"
392
+ }
393
+ ]
394
+ },
395
+ xs: {
396
+ classes: ["flex flex-col"],
397
+ items: [
398
+ {
399
+ classes: ["flex flex-row justify-center items-center mb-8"],
400
+ items: [
401
+ {
402
+ name: "title",
403
+ classes: ["flex flex-full max-w-1/2"]
404
+ },
405
+ {
406
+ classes: ["flex flex-auto flex-shrink-0 justify-end items-center"],
407
+ items: [
408
+ {
409
+ name: "prefixButtons"
410
+ },
411
+ {
412
+ name: "exportButtons"
413
+ },
414
+ {
415
+ name: "suffixButtons"
416
+ }
417
+ ]
418
+ }
419
+ ]
420
+ },
421
+ {
422
+ name: "search",
423
+ classes: ["flex justify-center items-center mb-8"]
424
+ },
425
+ {
426
+ name: "queryBuilder"
427
+ },
428
+ {
429
+ name: "filters"
430
+ },
431
+ {
432
+ name: "content"
433
+ },
434
+ {
435
+ name: "pagination"
436
+ }
437
+ ]
438
+ }
439
+ };
440
+
441
+ class FilterUtils {
442
+ static parametersToRequest(filterParameters) {
443
+ return {
444
+ page: {
445
+ number: Math.ceil((filterParameters.start ?? 0) / (filterParameters.length ?? 1)),
446
+ size: filterParameters.length ?? 0
447
+ },
448
+ search: {
449
+ value: filterParameters.search ?? ""
450
+ },
451
+ query: {
452
+ condition: "and",
453
+ rules: filterParameters.rules ?? []
454
+ },
455
+ order: filterParameters.order ?? undefined,
456
+ data: filterParameters.data
457
+ };
458
+ }
459
+ static filterChangeNeedsRefresh(currentFilters, newFilters) {
460
+ const newFilterKeys = Object.keys(newFilters).sort();
461
+ if (newFilterKeys.length === 0) {
462
+ return true;
463
+ }
464
+ return newFilterKeys.some((key) => {
465
+ const currentValue = currentFilters[key];
466
+ const newValue = currentFilters[key];
467
+ if (Array.isArray(currentValue)) {
468
+ return !ObjectUtils.areObjectsEqual(currentValue, newValue);
469
+ }
470
+ else if (typeof currentValue === "object" && currentValue !== null) {
471
+ return !ObjectUtils.areObjectsEqual(currentValue, newValue);
472
+ }
473
+ else {
474
+ return currentValue !== newValue;
475
+ }
476
+ });
477
+ }
478
+ }
479
+
480
+ class NiceFilterService {
481
+ constructor(api) {
482
+ this.api = api;
483
+ }
484
+ filter(params) {
485
+ return this.api?.filter(FilterUtils.parametersToRequest(params));
486
+ }
487
+ getFile(type, parameters) {
488
+ return this.api?.downloadData(type, FilterUtils.parametersToRequest(parameters));
489
+ }
490
+ getPrintableHtml(parameters) {
491
+ return this.api?.getPrintableHtml(FilterUtils.parametersToRequest(parameters));
492
+ }
493
+ getFilterConfig() {
494
+ return this.api?.getFilterConfig();
495
+ }
496
+ searchFilterValue(filterConfig, value) {
497
+ return this.api?.searchFilterValue(filterConfig.id, value);
498
+ }
499
+ searchFilterResourceValue(filterConfig, resourceId) {
500
+ return this.api?.searchFilterResourceValue(filterConfig.id, resourceId);
501
+ }
502
+ }
503
+ NiceFilterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceFilterService, deps: [{ token: NiceFilterApi }], target: i0.ɵɵFactoryTarget.Injectable });
504
+ NiceFilterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceFilterService });
505
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceFilterService, decorators: [{
506
+ type: Injectable
507
+ }], ctorParameters: function () { return [{ type: NiceFilterApi }]; } });
508
+
509
+ class NiceSavedReportsApi {
510
+ constructor(filterApiUrl, path, http) {
511
+ this.filterApiUrl = filterApiUrl;
512
+ this.path = path;
513
+ this.http = http;
514
+ }
515
+ create(dto) {
516
+ return this.http.post(this.url(), dto);
517
+ }
518
+ getAll() {
519
+ return this.http.get(this.url());
520
+ }
521
+ getByTable(table) {
522
+ return this.http.get(this.url(`${table}`));
523
+ }
524
+ getTopByTable(table) {
525
+ return this.http.get(this.url(`${table}/top`));
526
+ }
527
+ hit(id) {
528
+ return this.http.put(this.url(`${id}/hit`), null);
529
+ }
530
+ update(id, dto) {
531
+ return this.http.put(this.url(`${id}`), dto);
532
+ }
533
+ delete(id) {
534
+ return this.http.delete(this.url(`${id}`));
535
+ }
536
+ url(...args) {
537
+ const [route, queryParams] = this.transformUrlArgs(args);
538
+ const params = queryParams ? `?${QueryParamsUtils.fromObject(queryParams)}` : "";
539
+ if (route) {
540
+ return `${this.filterApiUrl}/${this.path}/${route}${params}`;
541
+ }
542
+ return `${this.filterApiUrl}/${this.path}${params}`;
543
+ }
544
+ transformUrlArgs(args) {
545
+ const [routeOfQueryParams, query] = args;
546
+ if (args.length === 1) {
547
+ if (typeof routeOfQueryParams === "string") {
548
+ return [routeOfQueryParams];
549
+ }
550
+ return ["", routeOfQueryParams];
551
+ }
552
+ return [routeOfQueryParams ?? "", query];
553
+ }
554
+ }
555
+
556
+ class NiceSavedReportService {
557
+ constructor(api) {
558
+ this.api = api;
559
+ }
560
+ create(report) {
561
+ return this.api.create(report);
562
+ }
563
+ update(id, report) {
564
+ return this.api.update(id, report);
565
+ }
566
+ remove(id) {
567
+ return this.api.delete(id);
568
+ }
569
+ getByTableName(table) {
570
+ return this.api.getByTable(table);
571
+ }
572
+ getTopByTableName(table) {
573
+ return this.api.getTopByTable(table);
574
+ }
575
+ hit(id) {
576
+ return this.api.hit(id);
577
+ }
578
+ }
579
+ NiceSavedReportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceSavedReportService, deps: [{ token: NiceSavedReportsApi }], target: i0.ɵɵFactoryTarget.Injectable });
580
+ NiceSavedReportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceSavedReportService });
581
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceSavedReportService, decorators: [{
582
+ type: Injectable
583
+ }], ctorParameters: function () { return [{ type: NiceSavedReportsApi }]; } });
584
+
585
+ const BASE_LIST_LAYOUT = new InjectionToken("base_list_layout");
586
+ const DEFAULT_PARAMETERS = new InjectionToken("default_parameters");
587
+ const LIST_TABLE = new InjectionToken("list_table");
588
+ const TABLE_COLUMNS = new InjectionToken("table_columns");
589
+ const EXPORTS_SETTINGS = new InjectionToken("exports_settings");
590
+ const ENABLE_QUERY_BUILDER = new InjectionToken("enable_query_builder");
591
+
592
+ const initialBaseListState = {
593
+ disabled: false,
594
+ mergePageResults: false,
595
+ resetPaging: false,
596
+ filterConfigLoading: false,
597
+ filterResult: null,
598
+ filterParameters: {
599
+ start: 0,
600
+ length: 10,
601
+ order: {},
602
+ search: "",
603
+ rules: [],
604
+ data: {}
605
+ },
606
+ filterConfig: [],
607
+ showQueryBuilder: false,
608
+ defaultRules: []
609
+ };
610
+ let NiceBaseListStore = class NiceBaseListStore extends Store {
611
+ constructor(parameters) {
612
+ super({
613
+ ...initialBaseListState,
614
+ filterParameters: {
615
+ ...initialBaseListState.filterParameters,
616
+ ...(parameters ?? {})
617
+ }
618
+ });
619
+ }
620
+ setFilterConfigLoading(loading) {
621
+ this.update({
622
+ filterConfigLoading: loading
623
+ });
624
+ }
625
+ setResult(filterResult, reset = false) {
626
+ const { mergePageResults } = this.getValue();
627
+ if (mergePageResults && !reset) {
628
+ this.update((state) => ({
629
+ filterResult: {
630
+ page: filterResult.page,
631
+ total: filterResult.total,
632
+ values: state.resetPaging ? filterResult.values : [
633
+ ...(state.filterResult?.values ?? []),
634
+ ...filterResult.values
635
+ ]
636
+ },
637
+ resetPaging: false
638
+ }));
639
+ }
640
+ else {
641
+ this.update({
642
+ filterResult
643
+ });
644
+ }
645
+ }
646
+ setParameters(filterParameters) {
647
+ this.update({
648
+ filterParameters
649
+ });
650
+ }
651
+ };
652
+ NiceBaseListStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListStore, deps: [{ token: DEFAULT_PARAMETERS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
653
+ NiceBaseListStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListStore });
654
+ NiceBaseListStore = __decorate([
655
+ StoreConfig({ name: "base-list", resettable: true }),
656
+ __metadata("design:paramtypes", [Object])
657
+ ], NiceBaseListStore);
658
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListStore, decorators: [{
659
+ type: Injectable
660
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
661
+ type: Optional
662
+ }, {
663
+ type: Inject,
664
+ args: [DEFAULT_PARAMETERS]
665
+ }] }]; } });
666
+
667
+ class NiceBaseListQuery extends Query {
668
+ constructor(store) {
669
+ super(store);
670
+ this.store = store;
671
+ }
672
+ selectData() {
673
+ return this.select(s => s.filterResult?.values ?? []);
674
+ }
675
+ selectFilterParameters() {
676
+ return this.select(s => s.filterParameters);
677
+ }
678
+ selectFilterResult() {
679
+ return this.select(s => s.filterResult);
680
+ }
681
+ selectFilterConfig() {
682
+ return this.select(s => s.filterConfig);
683
+ }
684
+ selectFilterConfigLoading() {
685
+ return this.select(s => s.filterConfigLoading);
686
+ }
687
+ selectShowQueryBuilder() {
688
+ return this.select(s => s.showQueryBuilder);
689
+ }
690
+ }
691
+ NiceBaseListQuery.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListQuery, deps: [{ token: NiceBaseListStore }], target: i0.ɵɵFactoryTarget.Injectable });
692
+ NiceBaseListQuery.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListQuery });
693
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListQuery, decorators: [{
694
+ type: Injectable
695
+ }], ctorParameters: function () { return [{ type: NiceBaseListStore }]; } });
696
+
697
+ var FilterType;
698
+ (function (FilterType) {
699
+ FilterType["Text"] = "text";
700
+ FilterType["Number"] = "number";
701
+ FilterType["Date"] = "date";
702
+ FilterType["Select"] = "select";
703
+ FilterType["Radio"] = "radio";
704
+ })(FilterType || (FilterType = {}));
705
+
706
+ var FilterOperatorTypes;
707
+ (function (FilterOperatorTypes) {
708
+ FilterOperatorTypes["Equal"] = "equal";
709
+ FilterOperatorTypes["NotEqual"] = "not_equal";
710
+ FilterOperatorTypes["In"] = "in";
711
+ FilterOperatorTypes["NotIn"] = "not_in";
712
+ FilterOperatorTypes["Less"] = "less";
713
+ FilterOperatorTypes["LessOrEqual"] = "less_or_equal";
714
+ FilterOperatorTypes["Greater"] = "greater";
715
+ FilterOperatorTypes["GreaterOrEqual"] = "greater_or_equal";
716
+ FilterOperatorTypes["Between"] = "between";
717
+ FilterOperatorTypes["NotBetween"] = "not_between";
718
+ FilterOperatorTypes["IsNull"] = "is_null";
719
+ FilterOperatorTypes["IsNotNull"] = "is_not_null";
720
+ FilterOperatorTypes["BeginsWith"] = "begins_with";
721
+ FilterOperatorTypes["NotBeginsWith"] = "not_begins_with";
722
+ FilterOperatorTypes["EndsWith"] = "ends_with";
723
+ FilterOperatorTypes["NotEndsWith"] = "not_ends_with";
724
+ FilterOperatorTypes["Contains"] = "contains";
725
+ FilterOperatorTypes["NotContains"] = "not_contains";
726
+ FilterOperatorTypes["IsEmpty"] = "is_empty";
727
+ FilterOperatorTypes["IsNotEmpty"] = "is_not_empty";
728
+ FilterOperatorTypes["None"] = "none";
729
+ })(FilterOperatorTypes || (FilterOperatorTypes = {}));
730
+
731
+ class QBFilterUtils {
732
+ static isSingleInput(filterOperator) {
733
+ if (!filterOperator) {
734
+ return false;
735
+ }
736
+ return QBFilterUtils.singleInputOperators.includes(filterOperator);
737
+ }
738
+ static isDoubleInput(filterOperator) {
739
+ if (!filterOperator) {
740
+ return false;
741
+ }
742
+ return QBFilterUtils.doubleInputOperators.includes(filterOperator);
743
+ }
744
+ static isNoInput(filterOperator) {
745
+ if (!filterOperator) {
746
+ return false;
747
+ }
748
+ return QBFilterUtils.noInputOperators.includes(filterOperator);
749
+ }
750
+ static createRule(config, operator) {
751
+ const base = {
752
+ id: config.id,
753
+ operation: operator || config.operators[0].id
754
+ };
755
+ switch (config.type) {
756
+ case FilterType.Text:
757
+ return {
758
+ ...base,
759
+ value: QBFilterUtils.isDoubleInput(operator) ? ["", ""] : ""
760
+ };
761
+ case FilterType.Select:
762
+ return {
763
+ ...base,
764
+ value: QBFilterUtils.isDoubleInput(operator) ? [null, null] : null
765
+ };
766
+ case FilterType.Date:
767
+ return {
768
+ ...base,
769
+ value: QBFilterUtils.isDoubleInput(operator) ? [new Date(), new Date()] : new Date()
770
+ };
771
+ case FilterType.Radio:
772
+ return {
773
+ ...base,
774
+ value: QBFilterUtils.isDoubleInput(operator)
775
+ ? [config.options?.[0].key, config.options?.[0].key]
776
+ : config.options?.[0].key
777
+ };
778
+ case FilterType.Number:
779
+ return {
780
+ ...base,
781
+ value: QBFilterUtils.isDoubleInput(operator) ? [0, 0] : 0
782
+ };
783
+ }
784
+ }
785
+ static createQueryModel(config) {
786
+ return {
787
+ condition: "or",
788
+ rules: [QBFilterUtils.createRule(config)]
789
+ };
790
+ }
791
+ }
792
+ QBFilterUtils.noInputOperators = [
793
+ FilterOperatorTypes.IsEmpty,
794
+ FilterOperatorTypes.IsNotEmpty,
795
+ FilterOperatorTypes.IsNull,
796
+ FilterOperatorTypes.IsNotNull,
797
+ FilterOperatorTypes.None
798
+ ];
799
+ QBFilterUtils.singleInputOperators = [
800
+ FilterOperatorTypes.Equal,
801
+ FilterOperatorTypes.NotEqual,
802
+ FilterOperatorTypes.Less,
803
+ FilterOperatorTypes.LessOrEqual,
804
+ FilterOperatorTypes.Greater,
805
+ FilterOperatorTypes.GreaterOrEqual,
806
+ FilterOperatorTypes.BeginsWith,
807
+ FilterOperatorTypes.NotBeginsWith,
808
+ FilterOperatorTypes.EndsWith,
809
+ FilterOperatorTypes.NotEndsWith,
810
+ FilterOperatorTypes.Contains,
811
+ FilterOperatorTypes.NotContains
812
+ ];
813
+ QBFilterUtils.doubleInputOperators = [
814
+ FilterOperatorTypes.Between,
815
+ FilterOperatorTypes.NotBetween
816
+ ];
817
+
818
+ class NiceBaseListService {
819
+ constructor(store, filterService, activatedRoute, router, appRef) {
820
+ this.store = store;
821
+ this.filterService = filterService;
822
+ this.activatedRoute = activatedRoute;
823
+ this.router = router;
824
+ this.appRef = appRef;
825
+ this.queryParamsLoaded$ = new Subject();
826
+ this.downloadFileName = "data";
827
+ this.unsubscribeAll$ = new Subject();
828
+ this.loadingData = false;
829
+ }
830
+ async init() {
831
+ this.store.setFilterConfigLoading(true);
832
+ try {
833
+ const filterConfig = await firstValueFrom(this.filterService.getFilterConfig());
834
+ this.store.update({
835
+ filterConfig
836
+ });
837
+ }
838
+ catch (e) {
839
+ this.store.setError(e);
840
+ }
841
+ finally {
842
+ this.store.setFilterConfigLoading(false);
843
+ }
844
+ }
845
+ resetStore() {
846
+ this.store.reset();
847
+ }
848
+ resetData() {
849
+ this.store.update({
850
+ filterResult: null
851
+ });
852
+ }
853
+ closeSubscriptions() {
854
+ this.unsubscribeAll$.next(null);
855
+ this.unsubscribeAll$.complete();
856
+ this.queryParamsLoaded$.complete();
857
+ }
858
+ disableList() {
859
+ this.store.update({
860
+ disabled: true
861
+ });
862
+ }
863
+ enableList() {
864
+ this.store.update({
865
+ disabled: false
866
+ });
867
+ }
868
+ setLoading(loading) {
869
+ this.store.setLoading(loading);
870
+ }
871
+ setMode(mode) {
872
+ this.store.update({
873
+ mergePageResults: mode === "infinite-scroll"
874
+ });
875
+ }
876
+ loadQueryParams(autoLoad) {
877
+ this.activatedRoute?.queryParams
878
+ .pipe(takeUntil(this.unsubscribeAll$), map((params) => {
879
+ return {
880
+ params: QueryParamsUtils.extractFilterParameters(params)
881
+ };
882
+ }))
883
+ .subscribe(({ params }) => {
884
+ if (!params || Object.keys(params).length === 0) {
885
+ params = this.store.getValue().filterParameters;
886
+ }
887
+ const { filterParameters, filterResult } = this.store.getValue();
888
+ if (FilterUtils.filterChangeNeedsRefresh(filterParameters, params) ||
889
+ !filterResult) {
890
+ if (autoLoad) {
891
+ this.loadData(params, false);
892
+ }
893
+ else {
894
+ this.setParameters(params, false);
895
+ }
896
+ }
897
+ this.queryParamsLoaded$.next(null);
898
+ });
899
+ }
900
+ async resetAndLoadData(parameters, updateQueryParams = true) {
901
+ return this.loadData(parameters, updateQueryParams, true);
902
+ }
903
+ async loadData(parameters, updateQueryParams = true, reset = false) {
904
+ const { disabled } = this.store.getValue();
905
+ try {
906
+ const filterParameters = this.mergeParameters(parameters);
907
+ if (!disabled) {
908
+ this.store.setLoading(true);
909
+ this.loadingData = true;
910
+ const result = await firstValueFrom(this.filterService.filter(this.getParameters(filterParameters)));
911
+ this.store.setResult(result, reset);
912
+ }
913
+ if (filterParameters) {
914
+ this.setParameters(filterParameters, disabled ? false : updateQueryParams);
915
+ }
916
+ }
917
+ catch (e) {
918
+ this.store.setError(e);
919
+ }
920
+ finally {
921
+ this.store.setLoading(false);
922
+ this.loadingData = false;
923
+ }
924
+ }
925
+ async searchData(search) {
926
+ const { filterParameters } = this.store.getValue();
927
+ await this.loadData({
928
+ ...filterParameters,
929
+ search
930
+ });
931
+ }
932
+ async loadNewPage(start, length) {
933
+ const { filterParameters } = this.store.getValue();
934
+ await this.loadData({
935
+ ...filterParameters,
936
+ start,
937
+ length
938
+ });
939
+ }
940
+ async loadNextPage() {
941
+ const { filterParameters } = this.store.getValue();
942
+ await this.loadData({
943
+ ...filterParameters,
944
+ start: filterParameters.start + filterParameters.length
945
+ });
946
+ }
947
+ async resetPaging() {
948
+ const { filterParameters } = this.store.getValue();
949
+ this.store.setParameters({
950
+ ...filterParameters,
951
+ start: 0
952
+ });
953
+ this.store.update({
954
+ resetPaging: true
955
+ });
956
+ }
957
+ async downloadData(type, parameters, updateQueryParams = true) {
958
+ try {
959
+ this.store.setLoading(true);
960
+ this.loadingData = true;
961
+ const filterParameters = this.mergeParameters(parameters);
962
+ if (filterParameters) {
963
+ this.setParameters(filterParameters, updateQueryParams);
964
+ }
965
+ const result = await firstValueFrom(this.filterService.getFile(type, this.getParameters(filterParameters)));
966
+ FileUtils.downloadFile(`${this.downloadFileName}.${type}`, result);
967
+ }
968
+ catch (e) {
969
+ this.store.setError(e);
970
+ }
971
+ finally {
972
+ this.store.setLoading(false);
973
+ this.loadingData = false;
974
+ }
975
+ }
976
+ async printData(parameters, updateQueryParams = true) {
977
+ try {
978
+ this.store.setLoading(true);
979
+ this.loadingData = true;
980
+ const filterParameters = this.mergeParameters(parameters);
981
+ if (filterParameters) {
982
+ this.setParameters(filterParameters, updateQueryParams);
983
+ }
984
+ const result = await firstValueFrom(this.filterService.getPrintableHtml(this.getParameters(filterParameters)));
985
+ FileUtils.openPrintableWindow(result);
986
+ }
987
+ catch (e) {
988
+ this.store.setError(e);
989
+ }
990
+ finally {
991
+ this.store.setLoading(false);
992
+ this.loadingData = false;
993
+ }
994
+ }
995
+ updateRule(id, newRule) {
996
+ const { filterParameters } = this.store.getValue();
997
+ const rules = filterParameters.rules?.[0];
998
+ if (!rules || rules.rules.length === 0) {
999
+ this.updateRules([newRule]);
1000
+ return;
1001
+ }
1002
+ const oldRule = rules.rules.find((r) => r.id === id);
1003
+ let newRules = rules.rules;
1004
+ if (oldRule) {
1005
+ if (newRule) {
1006
+ // Array replace
1007
+ newRules = [
1008
+ ...rules.rules.slice(0, rules.rules.indexOf(oldRule)),
1009
+ newRule,
1010
+ ...rules.rules.slice(rules.rules.indexOf(oldRule) + 1, rules.rules.length)
1011
+ ];
1012
+ }
1013
+ else {
1014
+ newRules = rules.rules.filter((r) => r.id !== id);
1015
+ }
1016
+ }
1017
+ else {
1018
+ newRules = [...newRules, newRule];
1019
+ }
1020
+ this.updateRules(newRules);
1021
+ }
1022
+ updateDefaultRules(rule) {
1023
+ this.store.update({
1024
+ defaultRules: rule
1025
+ });
1026
+ }
1027
+ async updateGlobalRules(rules, updateQueryParams = true) {
1028
+ const { filterParameters } = this.store.getValue();
1029
+ const newRules = {
1030
+ ...filterParameters,
1031
+ rules
1032
+ };
1033
+ await this.loadData(newRules, updateQueryParams);
1034
+ }
1035
+ addRuleFromConfig(config) {
1036
+ const { filterParameters } = this.store.getValue();
1037
+ const newRules = {
1038
+ ...filterParameters,
1039
+ rules: [
1040
+ ...filterParameters.rules,
1041
+ QBFilterUtils.createQueryModel(config)
1042
+ ]
1043
+ };
1044
+ this.store.update({
1045
+ showQueryBuilder: true
1046
+ });
1047
+ this.loadData(newRules, true);
1048
+ }
1049
+ updateRules(rules) {
1050
+ const { filterParameters } = this.store.getValue();
1051
+ const newRules = {
1052
+ order: filterParameters.order,
1053
+ rules: [
1054
+ {
1055
+ condition: "and",
1056
+ rules
1057
+ }
1058
+ ]
1059
+ };
1060
+ this.loadData(newRules, true);
1061
+ }
1062
+ toggleQueryBuilder() {
1063
+ this.store.update((state) => ({
1064
+ showQueryBuilder: !state.showQueryBuilder
1065
+ }));
1066
+ }
1067
+ updateListValue(value, key = "id") {
1068
+ const { filterResult } = this.store.getValue();
1069
+ if (!filterResult) {
1070
+ return;
1071
+ }
1072
+ this.store.update({
1073
+ filterResult: {
1074
+ ...filterResult,
1075
+ values: arrayUpsert(filterResult.values, value[key], value)
1076
+ }
1077
+ });
1078
+ }
1079
+ removeListValue(value, key = "id") {
1080
+ const { filterResult } = this.store.getValue();
1081
+ if (!filterResult) {
1082
+ return;
1083
+ }
1084
+ this.store.update({
1085
+ filterResult: {
1086
+ ...filterResult,
1087
+ values: arrayRemove(filterResult.values, value[key])
1088
+ }
1089
+ });
1090
+ }
1091
+ async updateQueryParams(queryParams) {
1092
+ if (!this.activatedRoute) {
1093
+ return;
1094
+ }
1095
+ await this.router.navigate([], {
1096
+ relativeTo: this.activatedRoute,
1097
+ queryParams,
1098
+ queryParamsHandling: "merge"
1099
+ });
1100
+ }
1101
+ getParameters(filterParameters) {
1102
+ const { defaultRules } = this.store.getValue();
1103
+ const parameters = {
1104
+ ...filterParameters,
1105
+ rules: filterParameters?.rules ? [...filterParameters.rules] : []
1106
+ };
1107
+ if (defaultRules?.length) {
1108
+ parameters.rules.push({
1109
+ condition: "and",
1110
+ rules: defaultRules
1111
+ });
1112
+ }
1113
+ return parameters;
1114
+ }
1115
+ mergeParameters(parameters) {
1116
+ const { filterParameters } = this.store.getValue();
1117
+ if (!parameters) {
1118
+ return filterParameters;
1119
+ }
1120
+ return {
1121
+ ...filterParameters,
1122
+ ...parameters,
1123
+ order: filterParameters.order && !parameters.order
1124
+ ? undefined
1125
+ : {
1126
+ ...filterParameters.order,
1127
+ ...parameters.order
1128
+ }
1129
+ };
1130
+ }
1131
+ setParameters(parameters, updateQueryParams = true) {
1132
+ this.store.setParameters(parameters);
1133
+ if (updateQueryParams) {
1134
+ this.updateQueryParams(QueryParamsUtils.filterParametersToParamsMap(parameters));
1135
+ }
1136
+ }
1137
+ }
1138
+ NiceBaseListService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListService, deps: [{ token: NiceBaseListStore }, { token: NiceFilterService }, { token: i3.ActivatedRoute }, { token: i3.Router }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable });
1139
+ NiceBaseListService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListService });
1140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListService, decorators: [{
1141
+ type: Injectable
1142
+ }], ctorParameters: function () { return [{ type: NiceBaseListStore }, { type: NiceFilterService }, { type: i3.ActivatedRoute }, { type: i3.Router }, { type: i0.ApplicationRef }]; } });
1143
+
1144
+ class QueryRuleForm {
1145
+ constructor(rule) {
1146
+ if (!rule) {
1147
+ return;
1148
+ }
1149
+ this.id = rule.id;
1150
+ this.operation = rule.operation;
1151
+ if (QBFilterUtils.isDoubleInput(rule.operation)) {
1152
+ this.value = rule.value[0];
1153
+ this.secondValue = rule.value[1];
1154
+ }
1155
+ else {
1156
+ this.value = rule.value;
1157
+ }
1158
+ }
1159
+ transform() {
1160
+ return {
1161
+ id: this.id,
1162
+ operation: this.operation,
1163
+ value: this.secondValue === undefined ? this.value : [this.value, this.secondValue]
1164
+ };
1165
+ }
1166
+ }
1167
+ __decorate([
1168
+ Control(),
1169
+ Required(),
1170
+ __metadata("design:type", String)
1171
+ ], QueryRuleForm.prototype, "id", void 0);
1172
+ __decorate([
1173
+ Control(),
1174
+ Required(),
1175
+ __metadata("design:type", String)
1176
+ ], QueryRuleForm.prototype, "operation", void 0);
1177
+ __decorate([
1178
+ Control(),
1179
+ Required(),
1180
+ __metadata("design:type", Object)
1181
+ ], QueryRuleForm.prototype, "value", void 0);
1182
+ __decorate([
1183
+ Control(),
1184
+ Required(),
1185
+ __metadata("design:type", Object)
1186
+ ], QueryRuleForm.prototype, "secondValue", void 0);
1187
+ class QueryForm {
1188
+ }
1189
+ __decorate([
1190
+ Control(),
1191
+ Required(),
1192
+ __metadata("design:type", String)
1193
+ ], QueryForm.prototype, "condition", void 0);
1194
+ __decorate([
1195
+ Array$1(QueryRuleForm),
1196
+ __metadata("design:type", Array$1)
1197
+ ], QueryForm.prototype, "rules", void 0);
1198
+ class QueryBuilderForm {
1199
+ constructor(rules) {
1200
+ if (!rules) {
1201
+ rules = [];
1202
+ }
1203
+ this.rules = rules.map(x => ({
1204
+ condition: x.condition,
1205
+ rules: x.rules.map(rule => new QueryRuleForm(rule))
1206
+ }));
1207
+ }
1208
+ transform() {
1209
+ return this.rules.map(x => ({
1210
+ condition: x.condition,
1211
+ rules: x.rules.map(rule => rule.transform())
1212
+ }));
1213
+ }
1214
+ }
1215
+ __decorate([
1216
+ Array$1(QueryForm),
1217
+ __metadata("design:type", Array$1)
1218
+ ], QueryBuilderForm.prototype, "rules", void 0);
1219
+
1220
+ class FilterComponent {
1221
+ constructor() {
1222
+ this.valueIndex = -1;
1223
+ this.propagateChanges = (_) => { };
1224
+ }
1225
+ get value() {
1226
+ if (this.valueIndex < 0) {
1227
+ return this._value;
1228
+ }
1229
+ else if (this._value instanceof Array) {
1230
+ return this._value[this.valueIndex];
1231
+ }
1232
+ return undefined;
1233
+ }
1234
+ registerOnTouched(fn) {
1235
+ // NO-OP
1236
+ }
1237
+ registerOnChange(fn) {
1238
+ this.propagateChanges = fn;
1239
+ }
1240
+ writeValue(value) {
1241
+ this._value = value;
1242
+ }
1243
+ onValueChange(value) {
1244
+ if (this.valueIndex < 0) {
1245
+ this.propagateChanges(value);
1246
+ }
1247
+ else if (this._value instanceof Array) {
1248
+ const v = [...this._value];
1249
+ v[this.valueIndex] = value;
1250
+ this.propagateChanges(v);
1251
+ }
1252
+ }
1253
+ }
1254
+ FilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1255
+ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: FilterComponent, selector: "ng-component", inputs: { valueIndex: "valueIndex" }, ngImport: i0, template: ``, isInline: true });
1256
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: FilterComponent, decorators: [{
1257
+ type: Component,
1258
+ args: [{ template: `` }]
1259
+ }], propDecorators: { valueIndex: [{
1260
+ type: Input
1261
+ }] } });
1262
+
1263
+ class TextFilterComponent extends FilterComponent {
1264
+ }
1265
+ TextFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TextFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1266
+ TextFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: TextFilterComponent, selector: "nice-text-filter", inputs: { filterConfig: "filterConfig" }, providers: [
1267
+ {
1268
+ provide: NG_VALUE_ACCESSOR,
1269
+ useExisting: forwardRef(() => TextFilterComponent),
1270
+ multi: true
1271
+ }
1272
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field class=\"flex flex-auto\">\n <input matInput [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\" [mask]=\"(filterConfig?.mask) || ''\" [validation]=\"false\" type=\"text\" />\n</mat-form-field>\n", components: [{ type: i1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], directives: [{ type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { 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]" }, { type: i4.MaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "showTemplate", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime"] }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], encapsulation: i0.ViewEncapsulation.None });
1273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TextFilterComponent, decorators: [{
1274
+ type: Component,
1275
+ args: [{ selector: "nice-text-filter", encapsulation: ViewEncapsulation.None, providers: [
1276
+ {
1277
+ provide: NG_VALUE_ACCESSOR,
1278
+ useExisting: forwardRef(() => TextFilterComponent),
1279
+ multi: true
1280
+ }
1281
+ ], template: "<mat-form-field class=\"flex flex-auto\">\n <input matInput [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\" [mask]=\"(filterConfig?.mask) || ''\" [validation]=\"false\" type=\"text\" />\n</mat-form-field>\n" }]
1282
+ }], propDecorators: { filterConfig: [{
1283
+ type: Input
1284
+ }] } });
1285
+
1286
+ class NumberFilterComponent extends FilterComponent {
1287
+ }
1288
+ NumberFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NumberFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1289
+ NumberFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: NumberFilterComponent, selector: "nice-number-filter", providers: [
1290
+ {
1291
+ provide: NG_VALUE_ACCESSOR,
1292
+ useExisting: forwardRef(() => NumberFilterComponent),
1293
+ multi: true
1294
+ }
1295
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field class=\"flex flex-auto\">\n <input matInput [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\" type=\"number\" />\n</mat-form-field>\n", components: [{ type: i1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], directives: [{ type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i1$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { 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]" }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], encapsulation: i0.ViewEncapsulation.None });
1296
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NumberFilterComponent, decorators: [{
1297
+ type: Component,
1298
+ args: [{ selector: "nice-number-filter", encapsulation: ViewEncapsulation.None, providers: [
1299
+ {
1300
+ provide: NG_VALUE_ACCESSOR,
1301
+ useExisting: forwardRef(() => NumberFilterComponent),
1302
+ multi: true
1303
+ }
1304
+ ], template: "<mat-form-field class=\"flex flex-auto\">\n <input matInput [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\" type=\"number\" />\n</mat-form-field>\n" }]
1305
+ }] });
1306
+
1307
+ class RadioFilterComponent extends FilterComponent {
1308
+ }
1309
+ RadioFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: RadioFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1310
+ RadioFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: RadioFilterComponent, selector: "nice-radio-filter", inputs: { filterConfig: "filterConfig" }, providers: [
1311
+ {
1312
+ provide: NG_VALUE_ACCESSOR,
1313
+ useExisting: forwardRef(() => RadioFilterComponent),
1314
+ multi: true
1315
+ }
1316
+ ], usesInheritance: true, ngImport: i0, template: "<mat-radio-group class=\"flex flex-auto\" [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\">\n <mat-radio-button class=\"mx-4\" *ngFor=\"let option of filterConfig.options\" [value]=\"option?.key\">\n {{ option?.name }}\n </mat-radio-button>\n</mat-radio-group>\n", components: [{ type: i1$2.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }], directives: [{ type: i1$2.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], encapsulation: i0.ViewEncapsulation.None });
1317
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: RadioFilterComponent, decorators: [{
1318
+ type: Component,
1319
+ args: [{ selector: "nice-radio-filter", encapsulation: ViewEncapsulation.None, providers: [
1320
+ {
1321
+ provide: NG_VALUE_ACCESSOR,
1322
+ useExisting: forwardRef(() => RadioFilterComponent),
1323
+ multi: true
1324
+ }
1325
+ ], template: "<mat-radio-group class=\"flex flex-auto\" [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\">\n <mat-radio-button class=\"mx-4\" *ngFor=\"let option of filterConfig.options\" [value]=\"option?.key\">\n {{ option?.name }}\n </mat-radio-button>\n</mat-radio-group>\n" }]
1326
+ }], propDecorators: { filterConfig: [{
1327
+ type: Input
1328
+ }] } });
1329
+
1330
+ class SelectFilterComponent extends FilterComponent {
1331
+ constructor(filterService) {
1332
+ super();
1333
+ this.filterService = filterService;
1334
+ this.values = [];
1335
+ this.search$ = new Subject();
1336
+ }
1337
+ async ngOnInit() {
1338
+ if (!this.filterConfig.lazyLoading) {
1339
+ this.values = this.filterConfig.values;
1340
+ }
1341
+ this.searchSub$ = this.search$
1342
+ .pipe(debounceTime(300), switchMap(value => {
1343
+ if (this.filterConfig.lazyLoading) {
1344
+ return this.filterService.searchFilterValue(this.filterConfig, value);
1345
+ }
1346
+ return of(this.filterConfig.values);
1347
+ }))
1348
+ .subscribe(values => {
1349
+ this.values = values;
1350
+ });
1351
+ }
1352
+ ngOnChanges(changes) {
1353
+ if ("filterConfig" in changes) {
1354
+ if (!this.filterConfig.lazyLoading) {
1355
+ this.values = this.filterConfig.values;
1356
+ }
1357
+ }
1358
+ }
1359
+ async searchValue() {
1360
+ if (this.value && !this.values.find(v => v.id === this.value)) {
1361
+ const value = await this.filterService
1362
+ .searchFilterResourceValue(this.filterConfig, this.value)
1363
+ .toPromise();
1364
+ this.values = [...this.values, value];
1365
+ }
1366
+ }
1367
+ onValueChange(value) {
1368
+ super.onValueChange(value);
1369
+ this.searchValue();
1370
+ }
1371
+ ngOnDestroy() {
1372
+ this.searchSub$.unsubscribe();
1373
+ }
1374
+ writeValue(value) {
1375
+ super.writeValue(value);
1376
+ this.searchValue();
1377
+ }
1378
+ }
1379
+ SelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SelectFilterComponent, deps: [{ token: NiceFilterService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1380
+ SelectFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: SelectFilterComponent, selector: "nice-select-filter", inputs: { filterConfig: "filterConfig" }, providers: [
1381
+ {
1382
+ provide: NG_VALUE_ACCESSOR,
1383
+ useExisting: forwardRef(() => SelectFilterComponent),
1384
+ multi: true
1385
+ }
1386
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<mat-form-field class=\"flex flex-auto\">\n <nice-typeahead\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n [typeahead]=\"search$\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n</mat-form-field>\n", components: [{ type: i1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$1.NiceTypeaheadComponent, selector: "nice-typeahead", inputs: ["items", "labelFormatFn", "required", "disabled", "placeholder", "emptyPlaceholder", "allowNotFoundItems", "panelClass", "bindValue", "bindLabel", "typeahead", "page$", "loading", "loadingPage", "searchFn", "optionTemplate"], outputs: ["change"] }], directives: [{ type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], encapsulation: i0.ViewEncapsulation.None });
1387
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SelectFilterComponent, decorators: [{
1388
+ type: Component,
1389
+ args: [{ selector: "nice-select-filter", encapsulation: ViewEncapsulation.None, providers: [
1390
+ {
1391
+ provide: NG_VALUE_ACCESSOR,
1392
+ useExisting: forwardRef(() => SelectFilterComponent),
1393
+ multi: true
1394
+ }
1395
+ ], template: "<mat-form-field class=\"flex flex-auto\">\n <nice-typeahead\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [items]=\"values\"\n [typeahead]=\"search$\"\n bindValue=\"id\"\n bindLabel=\"name\"\n ></nice-typeahead>\n</mat-form-field>\n" }]
1396
+ }], ctorParameters: function () { return [{ type: NiceFilterService, decorators: [{
1397
+ type: Optional
1398
+ }] }]; }, propDecorators: { filterConfig: [{
1399
+ type: Input
1400
+ }] } });
1401
+
1402
+ class DateFilterComponent extends FilterComponent {
1403
+ }
1404
+ DateFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DateFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1405
+ DateFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: DateFilterComponent, selector: "nice-date-filter", providers: [
1406
+ {
1407
+ provide: NG_VALUE_ACCESSOR,
1408
+ useExisting: forwardRef(() => DateFilterComponent),
1409
+ multi: true
1410
+ }
1411
+ ], usesInheritance: true, ngImport: i0, template: "<mat-form-field class=\"flex flex-auto\">\n <input matInput [matDatepicker]=\"picker\" [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\" />\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n</mat-form-field>\n", components: [{ type: i1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { type: i2$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }], directives: [{ type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i2$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { 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]" }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1.MatSuffix, selector: "[matSuffix]" }], encapsulation: i0.ViewEncapsulation.None });
1412
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DateFilterComponent, decorators: [{
1413
+ type: Component,
1414
+ args: [{ selector: "nice-date-filter", encapsulation: ViewEncapsulation.None, providers: [
1415
+ {
1416
+ provide: NG_VALUE_ACCESSOR,
1417
+ useExisting: forwardRef(() => DateFilterComponent),
1418
+ multi: true
1419
+ }
1420
+ ], template: "<mat-form-field class=\"flex flex-auto\">\n <input matInput [matDatepicker]=\"picker\" [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\" />\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n</mat-form-field>\n" }]
1421
+ }] });
1422
+
1423
+ class NiceFilterGroupService {
1424
+ }
1425
+
1426
+ class FilterGroupIconPipe {
1427
+ constructor(service) {
1428
+ this.service = service;
1429
+ }
1430
+ transform(value) {
1431
+ return this.service.getFilterGroupIconClass(value);
1432
+ }
1433
+ }
1434
+ FilterGroupIconPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: FilterGroupIconPipe, deps: [{ token: NiceFilterGroupService }], target: i0.ɵɵFactoryTarget.Pipe });
1435
+ FilterGroupIconPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: FilterGroupIconPipe, name: "filterGroupIcon" });
1436
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: FilterGroupIconPipe, decorators: [{
1437
+ type: Pipe,
1438
+ args: [{
1439
+ name: "filterGroupIcon"
1440
+ }]
1441
+ }], ctorParameters: function () { return [{ type: NiceFilterGroupService }]; } });
1442
+
1443
+ class FilterSelectionComponent {
1444
+ constructor() {
1445
+ this.filterSelected = new EventEmitter();
1446
+ }
1447
+ get filterGroups() {
1448
+ const groups = ArrayUtils.uniqueObjects(this.filterConfigs.map(x => x.group), x => x?.key);
1449
+ const result = [];
1450
+ for (const group of groups) {
1451
+ if (!group) {
1452
+ continue;
1453
+ }
1454
+ result.push([group, this.filterConfigs.filter(x => x.group?.key === group.key)]);
1455
+ }
1456
+ return result.sort(([, a], [, b]) => b.length - a.length);
1457
+ }
1458
+ selectFilter(filterConfigurationModel) {
1459
+ this.filterSelected.emit(filterConfigurationModel);
1460
+ }
1461
+ }
1462
+ FilterSelectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: FilterSelectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1463
+ FilterSelectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: FilterSelectionComponent, selector: "nice-filter-selection", inputs: { filterConfigs: "filterConfigs", loading: "loading" }, outputs: { filterSelected: "filterSelected" }, ngImport: i0, template: "<mat-card class=\"flex flex-row flex-wrap filter-selection-container\" [niceLoadingOverlay]=\"loading\">\n <mat-list class=\"flex flex-col flex-full\" [class.double-groups]=\"filterGroups.length > 1\" *ngFor=\"let group of filterGroups\">\n <mat-list-item>\n <i mat-list-icon class=\"text-accent fal\" [ngClass]=\"group[0].key | filterGroupIcon\"></i>\n <strong mat-line>{{ group[0].name }}</strong>\n </mat-list-item>\n <mat-list-item (click)=\"selectFilter(filter)\" mat-ripple class=\"filter\" *ngFor=\"let filter of group[1]\">\n {{ filter?.name }}\n </mat-list-item>\n </mat-list>\n</mat-card>\n", styles: ["nice-filter-selection .filter-selection-container{min-width:150px;min-height:150px;max-width:600px;padding:8px}nice-filter-selection .filter-selection-container .mat-list.double-groups{max-width:50%}nice-filter-selection .filter-selection-container .mat-list:not(.double-groups){max-width:100%}nice-filter-selection .mat-list-item{height:auto!important;min-height:32px!important;padding:16px}nice-filter-selection .mat-list-item strong{font-weight:700!important}nice-filter-selection .mat-list-item.filter{padding:8px 48px;cursor:pointer;-webkit-user-select:none;user-select:none;font-size:14px!important}@media screen and (max-width: 959px){nice-filter-selection .mat-list-item.filter{padding:8px 24px}}\n"], components: [{ type: i9.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i2$2.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { type: i2$2.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }], directives: [{ type: i3$1.NiceLoadingDirective, selector: "[niceLoadingOverlay]", inputs: ["niceLoadingOverlay"] }, { type: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$2.MatListIconCssMatStyler, selector: "[mat-list-icon], [matListIcon]" }, { type: i13.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.MatLine, selector: "[mat-line], [matLine]" }, { type: i5.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }], pipes: { "filterGroupIcon": FilterGroupIconPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: FilterSelectionComponent, decorators: [{
1465
+ type: Component,
1466
+ args: [{ selector: "nice-filter-selection", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-card class=\"flex flex-row flex-wrap filter-selection-container\" [niceLoadingOverlay]=\"loading\">\n <mat-list class=\"flex flex-col flex-full\" [class.double-groups]=\"filterGroups.length > 1\" *ngFor=\"let group of filterGroups\">\n <mat-list-item>\n <i mat-list-icon class=\"text-accent fal\" [ngClass]=\"group[0].key | filterGroupIcon\"></i>\n <strong mat-line>{{ group[0].name }}</strong>\n </mat-list-item>\n <mat-list-item (click)=\"selectFilter(filter)\" mat-ripple class=\"filter\" *ngFor=\"let filter of group[1]\">\n {{ filter?.name }}\n </mat-list-item>\n </mat-list>\n</mat-card>\n", styles: ["nice-filter-selection .filter-selection-container{min-width:150px;min-height:150px;max-width:600px;padding:8px}nice-filter-selection .filter-selection-container .mat-list.double-groups{max-width:50%}nice-filter-selection .filter-selection-container .mat-list:not(.double-groups){max-width:100%}nice-filter-selection .mat-list-item{height:auto!important;min-height:32px!important;padding:16px}nice-filter-selection .mat-list-item strong{font-weight:700!important}nice-filter-selection .mat-list-item.filter{padding:8px 48px;cursor:pointer;-webkit-user-select:none;user-select:none;font-size:14px!important}@media screen and (max-width: 959px){nice-filter-selection .mat-list-item.filter{padding:8px 24px}}\n"] }]
1467
+ }], propDecorators: { filterConfigs: [{
1468
+ type: Input
1469
+ }], loading: [{
1470
+ type: Input
1471
+ }], filterSelected: [{
1472
+ type: Output
1473
+ }] } });
1474
+
1475
+ class QueryBuilderTriggerDirective {
1476
+ constructor(overlayPositionBuilder, elementRef, overlay, platform) {
1477
+ this.overlayPositionBuilder = overlayPositionBuilder;
1478
+ this.elementRef = elementRef;
1479
+ this.overlay = overlay;
1480
+ this.platform = platform;
1481
+ this.queryBuilderFilterSelected = new EventEmitter();
1482
+ }
1483
+ set queryBuilderFilters(queryBuilderFilters) {
1484
+ if (queryBuilderFilters) {
1485
+ this._queryBuilderFilters = queryBuilderFilters;
1486
+ }
1487
+ this.updateFilterSelectionComponent();
1488
+ }
1489
+ set queryBuilderFiltersLoading(queryBuilderFiltersLoading) {
1490
+ this._queryBuilderFiltersLoading = queryBuilderFiltersLoading;
1491
+ this.updateFilterSelectionComponent();
1492
+ }
1493
+ click() {
1494
+ const positionStrategy = this.overlayPositionBuilder.flexibleConnectedTo(this.elementRef).withPositions([
1495
+ {
1496
+ originX: "center",
1497
+ originY: "bottom",
1498
+ overlayX: this.isMobile() ? "end" : "center",
1499
+ overlayY: "top"
1500
+ }
1501
+ ]);
1502
+ this.overlayRef = this.overlay.create({
1503
+ positionStrategy,
1504
+ hasBackdrop: true,
1505
+ backdropClass: "cdk-overlay-transparent-backdrop"
1506
+ });
1507
+ const filterSelectionPortal = new ComponentPortal(FilterSelectionComponent);
1508
+ this.filterSelectionRef = this.overlayRef.attach(filterSelectionPortal);
1509
+ this.updateFilterSelectionComponent();
1510
+ this.overlayRef.backdropClick().subscribe(() => this.close());
1511
+ }
1512
+ close() {
1513
+ this.overlayRef.dispose();
1514
+ }
1515
+ updateFilterSelectionComponent() {
1516
+ if (!this.filterSelectionRef) {
1517
+ return;
1518
+ }
1519
+ this.filterSelectionRef.instance.filterConfigs = this._queryBuilderFilters;
1520
+ this.filterSelectionRef.instance.loading = this._queryBuilderFiltersLoading;
1521
+ this.filterSelectionRef.instance.filterSelected.subscribe((filter) => {
1522
+ this.queryBuilderFilterSelected.emit(filter);
1523
+ this.close();
1524
+ });
1525
+ }
1526
+ isMobile() {
1527
+ return this.platform.ANDROID || this.platform.IOS;
1528
+ }
1529
+ }
1530
+ QueryBuilderTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: QueryBuilderTriggerDirective, deps: [{ token: i1$3.OverlayPositionBuilder }, { token: i0.ElementRef }, { token: i1$3.Overlay }, { token: i2$3.Platform }], target: i0.ɵɵFactoryTarget.Directive });
1531
+ QueryBuilderTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: QueryBuilderTriggerDirective, selector: "[niceQueryBuilderTrigger]", inputs: { queryBuilderFilters: "queryBuilderFilters", queryBuilderFiltersLoading: "queryBuilderFiltersLoading" }, outputs: { queryBuilderFilterSelected: "queryBuilderFilterSelected" }, host: { listeners: { "click": "click()" } }, ngImport: i0 });
1532
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: QueryBuilderTriggerDirective, decorators: [{
1533
+ type: Directive,
1534
+ args: [{ selector: "[niceQueryBuilderTrigger]" }]
1535
+ }], ctorParameters: function () { return [{ type: i1$3.OverlayPositionBuilder }, { type: i0.ElementRef }, { type: i1$3.Overlay }, { type: i2$3.Platform }]; }, propDecorators: { queryBuilderFilters: [{
1536
+ type: Input
1537
+ }], queryBuilderFiltersLoading: [{
1538
+ type: Input
1539
+ }], queryBuilderFilterSelected: [{
1540
+ type: Output
1541
+ }], click: [{
1542
+ type: HostListener,
1543
+ args: ["click"]
1544
+ }] } });
1545
+
1546
+ class RuleComponent {
1547
+ constructor(formGroupName) {
1548
+ this.formGroupName = formGroupName;
1549
+ this.remove = new EventEmitter();
1550
+ }
1551
+ get filterConfig() {
1552
+ const rule = this.rules.at(0).value;
1553
+ return this.filterConfigs?.find(f => f.id === rule.id);
1554
+ }
1555
+ get isSingleInput() {
1556
+ return !this.isDoubleInput && !this.isNoInput;
1557
+ }
1558
+ get isDoubleInput() {
1559
+ return QBFilterUtils.isDoubleInput(this.filterOperator);
1560
+ }
1561
+ get isNoInput() {
1562
+ return QBFilterUtils.isNoInput(this.filterOperator);
1563
+ }
1564
+ ngOnInit() {
1565
+ this.formGroup = this.formGroupName.control;
1566
+ this.rules = this.formGroup.get("rules");
1567
+ this.filterOperator = this.rules.at(0).value.operation;
1568
+ }
1569
+ onUpdateFilterConfig(config) {
1570
+ const rule = QBFilterUtils.createRule(config);
1571
+ this.rules.patchValue([rule]);
1572
+ this.filterOperator = rule.operation;
1573
+ }
1574
+ onClickOr() {
1575
+ this.rules.push(QBFilterUtils.createRule(this.filterConfig, this.filterOperator));
1576
+ }
1577
+ onUpdateFilterOperator(operator) {
1578
+ this.filterOperator = operator;
1579
+ for (const rule of this.rules.controls) {
1580
+ rule.get("operation")?.patchValue(this.filterOperator);
1581
+ if (this.isDoubleInput) {
1582
+ rule.get("value")?.patchValue([rule.value.value, rule.value.value]);
1583
+ }
1584
+ }
1585
+ }
1586
+ onClickDelete(index) {
1587
+ if (this.rules.length > 1) {
1588
+ this.rules.removeAt(index);
1589
+ }
1590
+ else {
1591
+ this.remove.emit();
1592
+ }
1593
+ }
1594
+ }
1595
+ RuleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: RuleComponent, deps: [{ token: i1$1.FormGroupName }], target: i0.ɵɵFactoryTarget.Component });
1596
+ RuleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: RuleComponent, selector: "nice-rule", inputs: { filterConfigs: "filterConfigs" }, outputs: { remove: "remove" }, ngImport: i0, template: "<div class=\"flex flex-row justify-start items-center gap-2.5\">\n <button\n class=\"select-filter\"\n mat-raised-button\n color=\"accent\"\n niceQueryBuilderTrigger\n [queryBuilderFilters]=\"filterConfigs\"\n (queryBuilderFilterSelected)=\"onUpdateFilterConfig($event)\"\n >\n <div class=\"flex flex-row justify-between items-center\">\n <div class=\"config-name\">{{ filterConfig?.name }}</div>\n <mat-icon class=\"config-name-icon\">arrow_drop_down</mat-icon>\n </div>\n </button>\n <div class=\"flex flex-col md:flex-row flex-auto justify-start items-center gap-2.5\">\n <mat-form-field class=\"rule-form-field\">\n <mat-select\n class=\"rule-operator\"\n [ngModel]=\"filterOperator\"\n (ngModelChange)=\"onUpdateFilterOperator($event)\"\n >\n <mat-option *ngFor=\"let operator of filterConfig?.operators\" [value]=\"operator.id\">\n {{ operator?.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n <div class=\"flex flex-col md:flex-row flex-wrap\" [formGroup]=\"formGroup\">\n <ng-container formArrayName=\"rules\">\n <div\n class=\"rule-container flex flex-col md:flex-row flex-full justify-start items-center gap-2.5\"\n [class.is-double-input]=\"!!isDoubleInput\"\n [formGroupName]=\"i\"\n *ngFor=\"let rule of rules.controls; let i = index\"\n >\n <ng-container *ngIf=\"isSingleInput\">\n <ng-container [ngSwitch]=\"filterConfig?.type\">\n <nice-text-filter *ngSwitchCase=\"'text'\" class=\"flex flex-auto\" formControlName=\"value\" [filterConfig]=\"filterConfig\"></nice-text-filter>\n <nice-number-filter *ngSwitchCase=\"'number'\" class=\"flex flex-auto\" formControlName=\"value\"></nice-number-filter>\n <nice-radio-filter\n *ngSwitchCase=\"'radio'\"\n class=\"flex flex-auto mb-4\"\n formControlName=\"value\"\n [filterConfig]=\"filterConfig\"\n ></nice-radio-filter>\n <nice-select-filter\n *ngSwitchCase=\"'select'\"\n class=\"flex flex-auto\"\n formControlName=\"value\"\n [filterConfig]=\"filterConfig\"\n ></nice-select-filter>\n <nice-date-filter *ngSwitchCase=\"'date'\" class=\"flex flex-auto\" formControlName=\"value\"></nice-date-filter>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"isDoubleInput\">\n <ng-container [ngSwitch]=\"filterConfig?.type\">\n <nice-text-filter\n *ngSwitchCase=\"'text'\"\n [valueIndex]=\"0\"\n [filterConfig]=\"filterConfig\"\n class=\"flex flex-auto\"\n formControlName=\"secondValue\"\n ></nice-text-filter>\n <nice-number-filter\n *ngSwitchCase=\"'number'\"\n [valueIndex]=\"0\"\n class=\"flex flex-auto\"\n formControlName=\"secondValue\"\n ></nice-number-filter>\n <nice-radio-filter\n *ngSwitchCase=\"'radio'\"\n class=\"flex flex-auto mb-4\"\n formControlName=\"secondValue\"\n [filterConfig]=\"filterConfig\"\n [valueIndex]=\"0\"\n ></nice-radio-filter>\n <nice-select-filter\n *ngSwitchCase=\"'select'\"\n class=\"flex flex-auto\"\n formControlName=\"secondValue\"\n [filterConfig]=\"filterConfig\"\n [valueIndex]=\"0\"\n ></nice-select-filter>\n <nice-date-filter\n *ngSwitchCase=\"'date'\"\n [valueIndex]=\"0\"\n class=\"flex flex-auto\"\n formControlName=\"secondValue\"\n ></nice-date-filter>\n </ng-container>\n <h3 class=\"aligned-text\">\n {{ \"components.query_builder.rule.conditions.and\" | translate }}\n </h3>\n <ng-container [ngSwitch]=\"filterConfig?.type\">\n <nice-text-filter\n *ngSwitchCase=\"'text'\"\n [valueIndex]=\"1\"\n [filterConfig]=\"filterConfig\"\n class=\"flex flex-auto\"\n formControlName=\"value\"\n ></nice-text-filter>\n <nice-number-filter\n *ngSwitchCase=\"'number'\"\n [valueIndex]=\"1\"\n class=\"flex flex-auto\"\n formControlName=\"value\"\n ></nice-number-filter>\n <nice-radio-filter\n *ngSwitchCase=\"'radio'\"\n class=\"flex flex-auto mb-4\"\n formControlName=\"value\"\n [filterConfig]=\"filterConfig\"\n [valueIndex]=\"1\"\n ></nice-radio-filter>\n <nice-select-filter\n *ngSwitchCase=\"'select'\"\n class=\"flex flex-auto\"\n formControlName=\"value\"\n [filterConfig]=\"filterConfig\"\n [valueIndex]=\"1\"\n ></nice-select-filter>\n <nice-date-filter\n *ngSwitchCase=\"'date'\"\n [valueIndex]=\"1\"\n class=\"flex flex-auto\"\n formControlName=\"value\"\n ></nice-date-filter>\n </ng-container>\n </ng-container>\n <div class=\"flex flex-row gap-2\">\n <button mat-mini-fab class=\"or-button aligned-button\" (click)=\"onClickOr()\">\n {{ \"components.query_builder.rule.conditions.or\" | translate }}\n </button>\n <button class=\"aligned-button\" mat-icon-button color=\"warn\" (click)=\"onClickDelete(i)\">\n <mat-icon>delete</mat-icon>\n </button>\n </div>\n\n </div>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: ["nice-rule{background:transparent}nice-rule .select-filter{@apply flex flex-full;height:36px;max-width:150px}nice-rule .config-name{@apply flex flex-full flex-grow-0 truncate;max-width:90px}nice-rule .config-name-icon{@apply flex flex-full;max-width:24px}nice-rule .rule-operator{@apply flex flex-full;max-width:100%}@screen md{nice-rule .rule-operator {max-width: 150px;}}nice-rule .aligned-button,nice-rule .select-filter{margin-bottom:1.25em}nice-rule .aligned-text{margin-bottom:2em}nice-rule .filter-select{margin-top:-14px}nice-rule .mat-form-field-infix{border:none;max-width:150px}@screen md{nice-rule .mat-form-field-infix {max-width: none;}}nice-rule .rule-form-field{flex:0 0 188px;max-width:188px;min-width:188px;width:90%}@screen md{nice-rule .rule-form-field {width: auto;}}nice-rule .rule-container{padding:0;max-width:100%}@screen md{nice-rule .rule-container:not(.is-double-input) {max-width: 50%;}}@screen{nice-rule .rule-container {padding-left: 12px; padding-right: 12px;}}\n"], components: [{ type: i7.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"] }, { type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i5$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: TextFilterComponent, selector: "nice-text-filter", inputs: ["filterConfig"] }, { type: NumberFilterComponent, selector: "nice-number-filter" }, { type: RadioFilterComponent, selector: "nice-radio-filter", inputs: ["filterConfig"] }, { type: SelectFilterComponent, selector: "nice-select-filter", inputs: ["filterConfig"] }, { type: DateFilterComponent, selector: "nice-date-filter" }], directives: [{ type: QueryBuilderTriggerDirective, selector: "[niceQueryBuilderTrigger]", inputs: ["queryBuilderFilters", "queryBuilderFiltersLoading"], outputs: ["queryBuilderFilterSelected"] }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i1$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], pipes: { "translate": i1$4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
1597
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: RuleComponent, decorators: [{
1598
+ type: Component,
1599
+ args: [{ selector: "nice-rule", encapsulation: ViewEncapsulation.None, template: "<div class=\"flex flex-row justify-start items-center gap-2.5\">\n <button\n class=\"select-filter\"\n mat-raised-button\n color=\"accent\"\n niceQueryBuilderTrigger\n [queryBuilderFilters]=\"filterConfigs\"\n (queryBuilderFilterSelected)=\"onUpdateFilterConfig($event)\"\n >\n <div class=\"flex flex-row justify-between items-center\">\n <div class=\"config-name\">{{ filterConfig?.name }}</div>\n <mat-icon class=\"config-name-icon\">arrow_drop_down</mat-icon>\n </div>\n </button>\n <div class=\"flex flex-col md:flex-row flex-auto justify-start items-center gap-2.5\">\n <mat-form-field class=\"rule-form-field\">\n <mat-select\n class=\"rule-operator\"\n [ngModel]=\"filterOperator\"\n (ngModelChange)=\"onUpdateFilterOperator($event)\"\n >\n <mat-option *ngFor=\"let operator of filterConfig?.operators\" [value]=\"operator.id\">\n {{ operator?.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n <div class=\"flex flex-col md:flex-row flex-wrap\" [formGroup]=\"formGroup\">\n <ng-container formArrayName=\"rules\">\n <div\n class=\"rule-container flex flex-col md:flex-row flex-full justify-start items-center gap-2.5\"\n [class.is-double-input]=\"!!isDoubleInput\"\n [formGroupName]=\"i\"\n *ngFor=\"let rule of rules.controls; let i = index\"\n >\n <ng-container *ngIf=\"isSingleInput\">\n <ng-container [ngSwitch]=\"filterConfig?.type\">\n <nice-text-filter *ngSwitchCase=\"'text'\" class=\"flex flex-auto\" formControlName=\"value\" [filterConfig]=\"filterConfig\"></nice-text-filter>\n <nice-number-filter *ngSwitchCase=\"'number'\" class=\"flex flex-auto\" formControlName=\"value\"></nice-number-filter>\n <nice-radio-filter\n *ngSwitchCase=\"'radio'\"\n class=\"flex flex-auto mb-4\"\n formControlName=\"value\"\n [filterConfig]=\"filterConfig\"\n ></nice-radio-filter>\n <nice-select-filter\n *ngSwitchCase=\"'select'\"\n class=\"flex flex-auto\"\n formControlName=\"value\"\n [filterConfig]=\"filterConfig\"\n ></nice-select-filter>\n <nice-date-filter *ngSwitchCase=\"'date'\" class=\"flex flex-auto\" formControlName=\"value\"></nice-date-filter>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"isDoubleInput\">\n <ng-container [ngSwitch]=\"filterConfig?.type\">\n <nice-text-filter\n *ngSwitchCase=\"'text'\"\n [valueIndex]=\"0\"\n [filterConfig]=\"filterConfig\"\n class=\"flex flex-auto\"\n formControlName=\"secondValue\"\n ></nice-text-filter>\n <nice-number-filter\n *ngSwitchCase=\"'number'\"\n [valueIndex]=\"0\"\n class=\"flex flex-auto\"\n formControlName=\"secondValue\"\n ></nice-number-filter>\n <nice-radio-filter\n *ngSwitchCase=\"'radio'\"\n class=\"flex flex-auto mb-4\"\n formControlName=\"secondValue\"\n [filterConfig]=\"filterConfig\"\n [valueIndex]=\"0\"\n ></nice-radio-filter>\n <nice-select-filter\n *ngSwitchCase=\"'select'\"\n class=\"flex flex-auto\"\n formControlName=\"secondValue\"\n [filterConfig]=\"filterConfig\"\n [valueIndex]=\"0\"\n ></nice-select-filter>\n <nice-date-filter\n *ngSwitchCase=\"'date'\"\n [valueIndex]=\"0\"\n class=\"flex flex-auto\"\n formControlName=\"secondValue\"\n ></nice-date-filter>\n </ng-container>\n <h3 class=\"aligned-text\">\n {{ \"components.query_builder.rule.conditions.and\" | translate }}\n </h3>\n <ng-container [ngSwitch]=\"filterConfig?.type\">\n <nice-text-filter\n *ngSwitchCase=\"'text'\"\n [valueIndex]=\"1\"\n [filterConfig]=\"filterConfig\"\n class=\"flex flex-auto\"\n formControlName=\"value\"\n ></nice-text-filter>\n <nice-number-filter\n *ngSwitchCase=\"'number'\"\n [valueIndex]=\"1\"\n class=\"flex flex-auto\"\n formControlName=\"value\"\n ></nice-number-filter>\n <nice-radio-filter\n *ngSwitchCase=\"'radio'\"\n class=\"flex flex-auto mb-4\"\n formControlName=\"value\"\n [filterConfig]=\"filterConfig\"\n [valueIndex]=\"1\"\n ></nice-radio-filter>\n <nice-select-filter\n *ngSwitchCase=\"'select'\"\n class=\"flex flex-auto\"\n formControlName=\"value\"\n [filterConfig]=\"filterConfig\"\n [valueIndex]=\"1\"\n ></nice-select-filter>\n <nice-date-filter\n *ngSwitchCase=\"'date'\"\n [valueIndex]=\"1\"\n class=\"flex flex-auto\"\n formControlName=\"value\"\n ></nice-date-filter>\n </ng-container>\n </ng-container>\n <div class=\"flex flex-row gap-2\">\n <button mat-mini-fab class=\"or-button aligned-button\" (click)=\"onClickOr()\">\n {{ \"components.query_builder.rule.conditions.or\" | translate }}\n </button>\n <button class=\"aligned-button\" mat-icon-button color=\"warn\" (click)=\"onClickDelete(i)\">\n <mat-icon>delete</mat-icon>\n </button>\n </div>\n\n </div>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: ["nice-rule{background:transparent}nice-rule .select-filter{@apply flex flex-full;height:36px;max-width:150px}nice-rule .config-name{@apply flex flex-full flex-grow-0 truncate;max-width:90px}nice-rule .config-name-icon{@apply flex flex-full;max-width:24px}nice-rule .rule-operator{@apply flex flex-full;max-width:100%}@screen md{nice-rule .rule-operator {max-width: 150px;}}nice-rule .aligned-button,nice-rule .select-filter{margin-bottom:1.25em}nice-rule .aligned-text{margin-bottom:2em}nice-rule .filter-select{margin-top:-14px}nice-rule .mat-form-field-infix{border:none;max-width:150px}@screen md{nice-rule .mat-form-field-infix {max-width: none;}}nice-rule .rule-form-field{flex:0 0 188px;max-width:188px;min-width:188px;width:90%}@screen md{nice-rule .rule-form-field {width: auto;}}nice-rule .rule-container{padding:0;max-width:100%}@screen md{nice-rule .rule-container:not(.is-double-input) {max-width: 50%;}}@screen{nice-rule .rule-container {padding-left: 12px; padding-right: 12px;}}\n"] }]
1600
+ }], ctorParameters: function () { return [{ type: i1$1.FormGroupName }]; }, propDecorators: { filterConfigs: [{
1601
+ type: Input
1602
+ }], remove: [{
1603
+ type: Output
1604
+ }] } });
1605
+
1606
+ class QueryBuilderComponent {
1607
+ constructor(formGroup) {
1608
+ this.formGroup = formGroup;
1609
+ this.close = new EventEmitter();
1610
+ this.createReport = new EventEmitter();
1611
+ this.updateReport = new EventEmitter();
1612
+ this.propagateChanges = (_) => { };
1613
+ this.rules = this.formGroup.get("rules");
1614
+ }
1615
+ get canSave() {
1616
+ return !this.currentSavedReport;
1617
+ }
1618
+ registerOnChange(fn) {
1619
+ this.propagateChanges = fn;
1620
+ }
1621
+ registerOnTouched(fn) { }
1622
+ writeValue(rules) {
1623
+ this.rules.clear();
1624
+ this.formGroup.patchValue(new QueryBuilderForm(rules));
1625
+ }
1626
+ onClickAddRule(filterConfigurationModel) {
1627
+ this.rules.push(QBFilterUtils.createQueryModel(filterConfigurationModel));
1628
+ }
1629
+ onClickDeleteRule(id) {
1630
+ this.rules.removeAt(id);
1631
+ if (this.rules.length === 0) {
1632
+ this.close.emit();
1633
+ this.onClickApply();
1634
+ }
1635
+ }
1636
+ onClickApply() {
1637
+ this.propagateChanges(this.formGroup.getRawValue().transform());
1638
+ }
1639
+ onClickSaveReport() {
1640
+ this.createReport.emit();
1641
+ }
1642
+ onClickUpdateReport() {
1643
+ this.updateReport.emit();
1644
+ }
1645
+ }
1646
+ QueryBuilderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: QueryBuilderComponent, deps: [{ token: i1$5.GeneratedFormGroup }], target: i0.ɵɵFactoryTarget.Component });
1647
+ QueryBuilderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: QueryBuilderComponent, selector: "nice-query-builder", inputs: { filterConfigs: "filterConfigs", currentSavedReport: "currentSavedReport", loading: "loading" }, outputs: { close: "close", createReport: "createReport", updateReport: "updateReport" }, providers: [
1648
+ {
1649
+ provide: NG_VALUE_ACCESSOR,
1650
+ useExisting: forwardRef(() => QueryBuilderComponent),
1651
+ multi: true
1652
+ },
1653
+ {
1654
+ provide: GeneratedFormGroup,
1655
+ useFactory: ngxFormGeneratorFactory(QueryBuilderForm)
1656
+ }
1657
+ ], ngImport: i0, template: "<div class=\"rules-container flex flex-col\" *ngIf=\"!loading\" [formGroup]=\"formGroup\">\n <ng-container formArrayName=\"rules\">\n <nice-rule\n *ngFor=\"let rule of rules.controls; let i = index\"\n (remove)=\"onClickDeleteRule(i)\"\n [filterConfigs]=\"filterConfigs\"\n [formGroupName]=\"i\"\n ></nice-rule>\n </ng-container>\n <div class=\"flex justify-between\">\n <button\n class=\"add-button add-rule-button\"\n mat-mini-fab\n niceQueryBuilderTrigger\n [queryBuilderFilters]=\"filterConfigs\"\n (queryBuilderFilterSelected)=\"onClickAddRule($event)\"\n >\n <mat-icon>add</mat-icon>\n </button>\n <div class=\"flex flex-col md:flex-row gap-4\">\n <!-- TODO: Support saved reports -->\n <!--<button mat-button color=\"primary\" (click)=\"onClickSaveReport()\" *ngIf=\"canSave\">\n <mat-icon class=\"mr-8\" fxHide.lt-md>save</mat-icon>\n {{ \"components.query_builder.save_report\" | translate }}\n </button>\n <button mat-button color=\"primary\" (click)=\"onClickUpdateReport()\" *ngIf=\"!canSave\">\n <mat-icon class=\"mr-8\" fxHide.lt-md>save</mat-icon>\n {{ \"components.query_builder.update_report\" | translate }}\n </button>-->\n <button mat-stroked-button color=\"accent\" (click)=\"onClickApply()\">\n {{ \"components.query_builder.update\" | translate }}\n <mat-icon class=\"ml-8\">refresh</mat-icon>\n </button>\n </div>\n </div>\n</div>\n", styles: ["nice-query-builder .rules-container{position:relative}nice-query-builder .rules-container:before{content:\"\";position:absolute;top:32px;bottom:32px;left:46px;width:4px;background:rgba(0,0,0,.12)}nice-query-builder .save-report-button{height:36px}nice-query-builder .add-rule-button{margin-left:28px;margin-right:28px}\n"], components: [{ type: RuleComponent, selector: "nice-rule", inputs: ["filterConfigs"], outputs: ["remove"] }, { type: i7.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"] }, { type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { type: QueryBuilderTriggerDirective, selector: "[niceQueryBuilderTrigger]", inputs: ["queryBuilderFilters", "queryBuilderFiltersLoading"], outputs: ["queryBuilderFilterSelected"] }], pipes: { "translate": i1$4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
1658
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: QueryBuilderComponent, decorators: [{
1659
+ type: Component,
1660
+ args: [{ selector: "nice-query-builder", encapsulation: ViewEncapsulation.None, providers: [
1661
+ {
1662
+ provide: NG_VALUE_ACCESSOR,
1663
+ useExisting: forwardRef(() => QueryBuilderComponent),
1664
+ multi: true
1665
+ },
1666
+ {
1667
+ provide: GeneratedFormGroup,
1668
+ useFactory: ngxFormGeneratorFactory(QueryBuilderForm)
1669
+ }
1670
+ ], template: "<div class=\"rules-container flex flex-col\" *ngIf=\"!loading\" [formGroup]=\"formGroup\">\n <ng-container formArrayName=\"rules\">\n <nice-rule\n *ngFor=\"let rule of rules.controls; let i = index\"\n (remove)=\"onClickDeleteRule(i)\"\n [filterConfigs]=\"filterConfigs\"\n [formGroupName]=\"i\"\n ></nice-rule>\n </ng-container>\n <div class=\"flex justify-between\">\n <button\n class=\"add-button add-rule-button\"\n mat-mini-fab\n niceQueryBuilderTrigger\n [queryBuilderFilters]=\"filterConfigs\"\n (queryBuilderFilterSelected)=\"onClickAddRule($event)\"\n >\n <mat-icon>add</mat-icon>\n </button>\n <div class=\"flex flex-col md:flex-row gap-4\">\n <!-- TODO: Support saved reports -->\n <!--<button mat-button color=\"primary\" (click)=\"onClickSaveReport()\" *ngIf=\"canSave\">\n <mat-icon class=\"mr-8\" fxHide.lt-md>save</mat-icon>\n {{ \"components.query_builder.save_report\" | translate }}\n </button>\n <button mat-button color=\"primary\" (click)=\"onClickUpdateReport()\" *ngIf=\"!canSave\">\n <mat-icon class=\"mr-8\" fxHide.lt-md>save</mat-icon>\n {{ \"components.query_builder.update_report\" | translate }}\n </button>-->\n <button mat-stroked-button color=\"accent\" (click)=\"onClickApply()\">\n {{ \"components.query_builder.update\" | translate }}\n <mat-icon class=\"ml-8\">refresh</mat-icon>\n </button>\n </div>\n </div>\n</div>\n", styles: ["nice-query-builder .rules-container{position:relative}nice-query-builder .rules-container:before{content:\"\";position:absolute;top:32px;bottom:32px;left:46px;width:4px;background:rgba(0,0,0,.12)}nice-query-builder .save-report-button{height:36px}nice-query-builder .add-rule-button{margin-left:28px;margin-right:28px}\n"] }]
1671
+ }], ctorParameters: function () { return [{ type: i1$5.GeneratedFormGroup }]; }, propDecorators: { filterConfigs: [{
1672
+ type: Input
1673
+ }], currentSavedReport: [{
1674
+ type: Input
1675
+ }], loading: [{
1676
+ type: Input
1677
+ }], close: [{
1678
+ type: Output
1679
+ }], createReport: [{
1680
+ type: Output
1681
+ }], updateReport: [{
1682
+ type: Output
1683
+ }] } });
1684
+
1685
+ class NiceBaseListComponent {
1686
+ constructor(enableQueryBuilder, listLayout, columns, exportsSettings, query, service, activatedRoute, bottomSheet, router, mediaObserver) {
1687
+ this.enableQueryBuilder = enableQueryBuilder;
1688
+ this.listLayout = listLayout;
1689
+ this.columns = columns;
1690
+ this.exportsSettings = exportsSettings;
1691
+ this.query = query;
1692
+ this.service = service;
1693
+ this.activatedRoute = activatedRoute;
1694
+ this.bottomSheet = bottomSheet;
1695
+ this.router = router;
1696
+ this.mediaObserver = mediaObserver;
1697
+ this.mode = "normal";
1698
+ this.layout = "page";
1699
+ this.layoutContent = LayoutContent.Table;
1700
+ this.autoChangeLayout = true;
1701
+ this.autoLoad = true;
1702
+ this.canExport = true;
1703
+ this.disableRouting = false;
1704
+ this.customExport = [];
1705
+ this.newPage = new EventEmitter();
1706
+ this.defaultPageSizeOptions = [10, 25, 50, 100];
1707
+ this.columnNames = [];
1708
+ this.loading$ = this.query.selectLoading();
1709
+ this.filterResult$ = this.query.selectFilterResult();
1710
+ this.data$ = this.query.selectData();
1711
+ this.recordsFiltered$ = this.filterResult$.pipe(map(f => f && f.total));
1712
+ this.showQueryBuilder$ = this.query.selectShowQueryBuilder();
1713
+ this.filterParameters$ = this.query.selectFilterParameters();
1714
+ this.index$ = this.filterParameters$.pipe(map(f => Math.floor((f.start ?? 0) / (f.length ?? 1))));
1715
+ this.length$ = this.filterParameters$.pipe(map(f => f.length));
1716
+ this.isEmpty$ = this.recordsFiltered$.pipe(map(r => r === 0));
1717
+ this.searchQuery$ = this.filterParameters$.pipe(map(f => f.search));
1718
+ this.filterConfig$ = this.query.selectFilterConfig();
1719
+ this.sortColumn$ = this.filterParameters$.pipe(map(f => (f.order && f.order.column) ?? ""));
1720
+ this.sortDirection$ = this.filterParameters$.pipe(map(f => f.order && f.order.direction));
1721
+ this.filterConfigLoading$ = this.query.selectFilterConfigLoading();
1722
+ this.rules$ = this.filterParameters$.pipe(map(parameters => parameters.rules));
1723
+ this.rulesCount$ = this.filterParameters$.pipe(map(parameters => parameters.rules?.length ?? 0));
1724
+ this.searchText$ = new Subject();
1725
+ this.setColumn(columns);
1726
+ }
1727
+ get prefixButtons() {
1728
+ return this.buttons?.find(x => x.position === "prefix")?.template;
1729
+ }
1730
+ get suffixButtons() {
1731
+ return this.buttons?.find(x => x.position === "suffix")?.template;
1732
+ }
1733
+ async ngOnInit() {
1734
+ await this.service.init();
1735
+ this.service.loadQueryParams(this.autoLoad);
1736
+ this.searchText$
1737
+ .pipe(debounceTime(300), distinctUntilChanged(), switchMap((search) => {
1738
+ this.service.resetPaging();
1739
+ return this.service.searchData(search);
1740
+ }))
1741
+ .subscribe();
1742
+ this.mediaObserver.asObservable().subscribe(() => {
1743
+ if (!this.autoChangeLayout) {
1744
+ return;
1745
+ }
1746
+ if (this.mediaObserver.isActive("lt-md") && this.layoutContent === LayoutContent.Table) {
1747
+ this.layoutContent = LayoutContent.Cards;
1748
+ }
1749
+ else {
1750
+ this.layoutContent = LayoutContent.Table;
1751
+ }
1752
+ });
1753
+ }
1754
+ ngOnDestroy() {
1755
+ this.service.closeSubscriptions();
1756
+ }
1757
+ ngOnChanges(changes) {
1758
+ if ("mode" in changes) {
1759
+ this.service.setMode(changes.mode.currentValue);
1760
+ }
1761
+ }
1762
+ setLoading(loading) {
1763
+ this.service.setLoading(loading);
1764
+ }
1765
+ clickToggleShowQueryBuilder() {
1766
+ this.service.toggleQueryBuilder();
1767
+ }
1768
+ onUpdateRules(rules) {
1769
+ this.service.updateGlobalRules(rules);
1770
+ }
1771
+ onQueryBuilderFilterSelected(filterConfigurationModel) {
1772
+ this.service.addRuleFromConfig(filterConfigurationModel);
1773
+ }
1774
+ onUpdatePage(pageEvent) {
1775
+ this.service.loadNewPage(pageEvent.pageIndex * pageEvent.pageSize, pageEvent.pageSize);
1776
+ this.newPage.emit(pageEvent);
1777
+ }
1778
+ onUpdateSearch(search) {
1779
+ this.searchText$.next(search);
1780
+ }
1781
+ getFilterRule$(id) {
1782
+ return this.filterParameters$.pipe(map(f => {
1783
+ return (f.rules &&
1784
+ f.rules[0] &&
1785
+ f.rules[0].rules &&
1786
+ f.rules[0].rules.find((r) => r.id === id));
1787
+ }));
1788
+ }
1789
+ onUpdateSort(sort) {
1790
+ if (!sort.active || !sort.direction) {
1791
+ sort = {
1792
+ active: "id",
1793
+ direction: "asc"
1794
+ };
1795
+ }
1796
+ this.service.loadData({
1797
+ order: sort.active && sort.direction ? { column: sort.active, direction: sort.direction } : null
1798
+ });
1799
+ }
1800
+ updateRule(id, newRule) {
1801
+ this.service.updateRule(id, newRule);
1802
+ }
1803
+ updateRules(rules) {
1804
+ this.service.updateRules(rules);
1805
+ }
1806
+ clickExport() {
1807
+ const exports = [];
1808
+ if (this.exportsSettings.xlsx) {
1809
+ exports.push({
1810
+ type: "xlsx",
1811
+ onClickExport: () => this.clickXlsx()
1812
+ });
1813
+ }
1814
+ else if (this.exportsSettings.csv) {
1815
+ exports.push({
1816
+ type: "csv",
1817
+ onClickExport: () => this.clickCsv()
1818
+ });
1819
+ }
1820
+ else if (this.exportsSettings.pdf) {
1821
+ exports.push({
1822
+ type: "pdf",
1823
+ onClickExport: () => this.clickPdf()
1824
+ });
1825
+ }
1826
+ this.bottomSheet.open(ExportBottomSheetComponent, {
1827
+ data: {
1828
+ exportStrategies: [
1829
+ ...exports,
1830
+ ...this.customExport
1831
+ ]
1832
+ }
1833
+ });
1834
+ }
1835
+ navigate(item) {
1836
+ if (this.navigateFn) {
1837
+ this.navigateFn(this.baseRoute, item);
1838
+ }
1839
+ else {
1840
+ const route = this.routeFn ? this.routeFn(item) : [(this.baseRoute || "") + item?.id];
1841
+ this.router.navigate(typeof route === "string" ? [route] : route, { relativeTo: this.activatedRoute });
1842
+ }
1843
+ }
1844
+ clickXlsx() {
1845
+ this.service.downloadData("xlsx");
1846
+ }
1847
+ clickCsv() {
1848
+ this.service.downloadData("csv");
1849
+ }
1850
+ clickPrint() {
1851
+ this.service.printData();
1852
+ }
1853
+ clickPdf() {
1854
+ this.service.downloadData("pdf");
1855
+ }
1856
+ setColumn(columns) {
1857
+ this.columns = columns;
1858
+ this.columnNames = columns.map(x => x.id);
1859
+ }
1860
+ }
1861
+ NiceBaseListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListComponent, deps: [{ token: ENABLE_QUERY_BUILDER, optional: true }, { token: BASE_LIST_LAYOUT }, { token: TABLE_COLUMNS }, { token: EXPORTS_SETTINGS }, { token: NiceBaseListQuery }, { token: NiceBaseListService }, { token: i3.ActivatedRoute }, { token: i4$1.MatBottomSheet }, { token: i3.Router }, { token: i5$2.MediaObserver }], target: i0.ɵɵFactoryTarget.Component });
1862
+ NiceBaseListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.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" }, outputs: { newPage: "newPage" }, providers: [
1863
+ NiceBaseListQuery,
1864
+ NiceBaseListService,
1865
+ NiceBaseListStore
1866
+ ], queries: [{ propertyName: "title", first: true, predicate: NiceBaseListTitleDirective, descendants: true, read: TemplateRef }, { propertyName: "table", first: true, predicate: NiceBaseListTableDirective, descendants: true, read: TemplateRef }, { propertyName: "cards", first: true, predicate: NiceBaseListCardsDirective, descendants: true, read: TemplateRef }, { propertyName: "customContent", first: true, predicate: NiceBaseListCustomContentDirective, descendants: true, read: TemplateRef }, { propertyName: "filters", first: true, predicate: NiceBaseListFiltersDirective, descendants: true, read: TemplateRef }, { propertyName: "buttons", predicate: NiceBaseListButtonsDirective }], usesOnChanges: true, ngImport: i0, template: "<div class=\"list page-layout carded fullwidth inner-scroll\" *ngIf=\"layout === 'page'; else content\">\n <div class=\"center\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </div>\n</div>\n\n<ng-template #content>\n <ng-container *ngIf=\"listLayout.xl\">\n <div class=\"hidden xl:block\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.xl }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.lg\">\n <div class=\"hidden lg:block xl:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.lg }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.md\">\n <div class=\"hidden md:block lg:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.md }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.sm\">\n <div class=\"hidden sm:block md:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.sm }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.xs\">\n <div class=\"block sm:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.xs }\"></ng-container>\n </div>\n </ng-container>\n\n <div\n [class.hidden]=\"!!listLayout.xs\"\n [class.block]=\"!listLayout.xs\"\n [class.sm:hidden]=\"!!listLayout.sm\"\n [class.sm:block]=\"!listLayout.sm\"\n [class.md:hidden]=\"!!listLayout.md\"\n [class.md:block]=\"!listLayout.md\"\n [class.lg:hidden]=\"!!listLayout.lg\"\n [class.lg:block]=\"!listLayout.lg\"\n [class.xl:hidden]=\"!!listLayout.xl\"\n [class.xl:block]=\"!listLayout.xl\"\n >\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.default }\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #pageLayout let-layout=\"layout\">\n <ng-container *ngIf=\"layout?.length; else isObject\">\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: { classes: ['flex flex-col'], items: layout } }\"></ng-container>\n </ng-container>\n\n <ng-template #isObject>\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: layout }\"></ng-container>\n </ng-template>\n</ng-template>\n\n<ng-template #contentLayout let-layout=\"layout\">\n <div [ngClass]=\"layout.classes\">\n <ng-container *ngFor=\"let item of layout.items\">\n <ng-container *ngIf=\"item.name; else childIsLayout\">\n <ng-container *ngTemplateOutlet=\"layoutItem; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-template #childIsLayout>\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: item }\"></ng-container>\n </ng-template>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #layoutItem let-item=\"item\">\n <ng-container *ngIf=\"item.name === 'title' && title\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"title\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'search'\">\n <div [ngClass]=\"item.classes\">\n <div class=\"search-wrapper mx-md-0\">\n <div class=\"search flex flex-auto justify-start items-center\">\n <mat-icon>search</mat-icon>\n <input [ngModel]=\"searchQuery$ | async\" (ngModelChange)=\"onUpdateSearch($event)\" [placeholder]=\"'general.search' | translate\" />\n <ng-container *ngIf=\"enableQueryBuilder\">\n <button\n *ngIf=\"!(showQueryBuilder$ | async) && !(rulesCount$ | async)\"\n mat-icon-button\n niceQueryBuilderTrigger\n [queryBuilderFilters]=\"filterConfig$ | async\"\n [queryBuilderFiltersLoading]=\"(filterConfigLoading$ | async) || false\"\n (queryBuilderFilterSelected)=\"onQueryBuilderFilterSelected($event)\"\n [matTooltip]=\"'general.query_builder.show_advanced_search' | translate\"\n >\n <mat-icon\n [matBadge]=\"rulesCount$ | async\"\n [matBadgeHidden]=\"!(rulesCount$ | async)\"\n matBadgeColor=\"accent\"\n >\n filter_list\n </mat-icon>\n </button>\n <button\n mat-icon-button\n *ngIf=\"!(showQueryBuilder$ | async) && (rulesCount$ | async)\"\n [disabled]=\"filterConfigLoading$ | async\"\n (click)=\"clickToggleShowQueryBuilder()\"\n [matTooltip]=\"'general.query_builder.show_advanced_search' | translate\"\n >\n <mat-icon\n [matBadge]=\"rulesCount$ | async\"\n [matBadgeHidden]=\"!(rulesCount$ | async)\"\n matBadgeColor=\"accent\"\n >\n filter_list\n </mat-icon>\n </button>\n <button\n mat-icon-button\n *ngIf=\"showQueryBuilder$ | async\"\n (click)=\"clickToggleShowQueryBuilder()\"\n [matTooltip]=\"'general.query_builder.close_advanced_search' | translate\"\n >\n <mat-icon>\n clear\n </mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'prefixButtons' && prefixButtons\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"prefixButtons\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'suffixButtons' && suffixButtons\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"suffixButtons\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'exportButtons' && canExport\">\n <div [ngClass]=\"item.classes\" [class.mr-2]=\"!!suffixButtons\" [class.ml-2]=\"!!prefixButtons\">\n <button\n (click)=\"clickPrint()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.print' | translate\"\n class=\"list-button mr-2\"\n mat-mini-fab\n >\n <mat-icon>print</mat-icon>\n </button>\n\n <button\n (click)=\"clickExport()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.export' | translate\"\n class=\"list-button mr-2\"\n mat-mini-fab\n >\n <mat-icon>cloud_download</mat-icon>\n </button>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'content'\">\n <ng-container *ngIf=\"layoutContent === 'table' && table\">\n <ng-container *ngTemplateOutlet=\"tableLayout; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"layoutContent === 'cards' && cards\">\n <ng-container *ngTemplateOutlet=\"cardsLayout; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"layoutContent === 'custom' && customContent\">\n <ng-container *ngTemplateOutlet=\"customLayout; context: { item: item }\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'pagination' && layoutContent !== 'custom'\">\n <div [ngClass]=\"item.classes\">\n <mat-paginator\n (page)=\"onUpdatePage($event)\"\n [length]=\"recordsFiltered$ | async\"\n [pageIndex]=\"index$ | async\"\n [pageSizeOptions]=\"defaultPageSizeOptions\"\n [pageSize]=\"length$ | async\"\n [showFirstLastButtons]=\"true\"\n >\n </mat-paginator>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'queryBuilder' && enableQueryBuilder\">\n <div class=\"flex flex-col\" *ngIf=\"showQueryBuilder$ | async\">\n <mat-card class=\"my-4\" [niceLoadingOverlay]=\"filterConfigLoading$ | async\">\n <mat-card-content class=\"flex flex-col\">\n <div class=\"flex flex-auto\">\n <nice-query-builder\n [filterConfigs]=\"filterConfig$ | async\"\n [ngModel]=\"rules$ | async\"\n (ngModelChange)=\"onUpdateRules($event)\"\n (close)=\"clickToggleShowQueryBuilder()\"\n ></nice-query-builder>\n </div>\n </mat-card-content>\n </mat-card>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'filters' && filters\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"filters\"></ng-container>\n </div>\n </ng-container>\n</ng-template>\n\n<ng-template #tableLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <div\n [niceLoadingOverlay]=\"loading$ | async\"\n class=\"content-card base-list flex flex-col justify-between\"\n >\n <mat-table\n (matSortChange)=\"onUpdateSort($event)\"\n [dataSource]=\"data$\"\n [matSortActive]=\"(sortColumn$ | async) || ''\"\n [matSortDirection]=\"(sortDirection$ | async) || ''\"\n class=\"flex flex-col flex-auto\"\n matSort\n >\n <mat-header-row *matHeaderRowDef=\"columnNames; sticky: true\"></mat-header-row>\n\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.id\">\n <ng-container *ngIf=\"column.sortable\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, header: true }\"\n ></ng-container>\n </mat-header-cell>\n </ng-container>\n <ng-container *ngIf=\"!column.sortable\">\n <mat-header-cell *matHeaderCellDef>\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, header: true }\"\n ></ng-container>\n </mat-header-cell>\n </ng-container>\n\n <mat-cell *matCellDef=\"let item\">\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, data: true, item: item }\"\n ></ng-container>\n </mat-cell>\n </ng-container>\n\n <ng-container *ngIf=\"disableRouting; else withRouting\">\n <mat-row *matRowDef=\"let item; columns: columnNames;\" class=\"item\"></mat-row>\n </ng-container>\n\n <ng-template #withRouting>\n <mat-row\n *matRowDef=\"let item; columns: columnNames;\"\n (click)=\"navigate(item)\"\n class=\"item clickable\"\n matRipple\n >\n </mat-row>\n </ng-template>\n </mat-table>\n </div>\n </div>\n</ng-template>\n\n<ng-template #cardsLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngFor=\"let data of data$ | async\">\n <ng-container *ngTemplateOutlet=\"cards; context: { item: data }\"></ng-container>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #customLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"customContent; context: { data: data$ | async }\"></ng-container>\n </div>\n</ng-template>\n", components: [{ type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i7.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"] }, { type: i8.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { type: i9.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: QueryBuilderComponent, selector: "nice-query-builder", inputs: ["filterConfigs", "currentSavedReport", "loading"], outputs: ["close", "createReport", "updateReport"] }, { type: i11.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { type: i11.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i12.MatSortHeader, selector: "[mat-sort-header]", inputs: ["disabled", "mat-sort-header", "arrowPosition", "start", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { type: i11.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }], directives: [{ type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i13.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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]" }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: QueryBuilderTriggerDirective, selector: "[niceQueryBuilderTrigger]", inputs: ["queryBuilderFilters", "queryBuilderFiltersLoading"], outputs: ["queryBuilderFilterSelected"] }, { type: i16.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i17.MatBadge, selector: "[matBadge]", inputs: ["matBadgeDisabled", "matBadgeColor", "matBadgeOverlap", "matBadgePosition", "matBadge", "matBadgeDescription", "matBadgeSize", "matBadgeHidden"] }, { type: i3$1.NiceLoadingDirective, selector: "[niceLoadingOverlay]", inputs: ["niceLoadingOverlay"] }, { type: i9.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { type: i12.MatSort, selector: "[matSort]", inputs: ["matSortDisabled", "matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { type: i11.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i11.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i11.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i11.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i11.MatCellDef, selector: "[matCellDef]" }, { type: i11.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i11.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { type: i5.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }], pipes: { "async": i13.AsyncPipe, "translate": i1$4.TranslatePipe } });
1867
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListComponent, decorators: [{
1868
+ type: Component,
1869
+ args: [{ selector: "nice-base-list", providers: [
1870
+ NiceBaseListQuery,
1871
+ NiceBaseListService,
1872
+ NiceBaseListStore
1873
+ ], template: "<div class=\"list page-layout carded fullwidth inner-scroll\" *ngIf=\"layout === 'page'; else content\">\n <div class=\"center\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </div>\n</div>\n\n<ng-template #content>\n <ng-container *ngIf=\"listLayout.xl\">\n <div class=\"hidden xl:block\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.xl }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.lg\">\n <div class=\"hidden lg:block xl:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.lg }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.md\">\n <div class=\"hidden md:block lg:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.md }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.sm\">\n <div class=\"hidden sm:block md:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.sm }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.xs\">\n <div class=\"block sm:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.xs }\"></ng-container>\n </div>\n </ng-container>\n\n <div\n [class.hidden]=\"!!listLayout.xs\"\n [class.block]=\"!listLayout.xs\"\n [class.sm:hidden]=\"!!listLayout.sm\"\n [class.sm:block]=\"!listLayout.sm\"\n [class.md:hidden]=\"!!listLayout.md\"\n [class.md:block]=\"!listLayout.md\"\n [class.lg:hidden]=\"!!listLayout.lg\"\n [class.lg:block]=\"!listLayout.lg\"\n [class.xl:hidden]=\"!!listLayout.xl\"\n [class.xl:block]=\"!listLayout.xl\"\n >\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.default }\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #pageLayout let-layout=\"layout\">\n <ng-container *ngIf=\"layout?.length; else isObject\">\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: { classes: ['flex flex-col'], items: layout } }\"></ng-container>\n </ng-container>\n\n <ng-template #isObject>\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: layout }\"></ng-container>\n </ng-template>\n</ng-template>\n\n<ng-template #contentLayout let-layout=\"layout\">\n <div [ngClass]=\"layout.classes\">\n <ng-container *ngFor=\"let item of layout.items\">\n <ng-container *ngIf=\"item.name; else childIsLayout\">\n <ng-container *ngTemplateOutlet=\"layoutItem; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-template #childIsLayout>\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: item }\"></ng-container>\n </ng-template>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #layoutItem let-item=\"item\">\n <ng-container *ngIf=\"item.name === 'title' && title\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"title\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'search'\">\n <div [ngClass]=\"item.classes\">\n <div class=\"search-wrapper mx-md-0\">\n <div class=\"search flex flex-auto justify-start items-center\">\n <mat-icon>search</mat-icon>\n <input [ngModel]=\"searchQuery$ | async\" (ngModelChange)=\"onUpdateSearch($event)\" [placeholder]=\"'general.search' | translate\" />\n <ng-container *ngIf=\"enableQueryBuilder\">\n <button\n *ngIf=\"!(showQueryBuilder$ | async) && !(rulesCount$ | async)\"\n mat-icon-button\n niceQueryBuilderTrigger\n [queryBuilderFilters]=\"filterConfig$ | async\"\n [queryBuilderFiltersLoading]=\"(filterConfigLoading$ | async) || false\"\n (queryBuilderFilterSelected)=\"onQueryBuilderFilterSelected($event)\"\n [matTooltip]=\"'general.query_builder.show_advanced_search' | translate\"\n >\n <mat-icon\n [matBadge]=\"rulesCount$ | async\"\n [matBadgeHidden]=\"!(rulesCount$ | async)\"\n matBadgeColor=\"accent\"\n >\n filter_list\n </mat-icon>\n </button>\n <button\n mat-icon-button\n *ngIf=\"!(showQueryBuilder$ | async) && (rulesCount$ | async)\"\n [disabled]=\"filterConfigLoading$ | async\"\n (click)=\"clickToggleShowQueryBuilder()\"\n [matTooltip]=\"'general.query_builder.show_advanced_search' | translate\"\n >\n <mat-icon\n [matBadge]=\"rulesCount$ | async\"\n [matBadgeHidden]=\"!(rulesCount$ | async)\"\n matBadgeColor=\"accent\"\n >\n filter_list\n </mat-icon>\n </button>\n <button\n mat-icon-button\n *ngIf=\"showQueryBuilder$ | async\"\n (click)=\"clickToggleShowQueryBuilder()\"\n [matTooltip]=\"'general.query_builder.close_advanced_search' | translate\"\n >\n <mat-icon>\n clear\n </mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'prefixButtons' && prefixButtons\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"prefixButtons\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'suffixButtons' && suffixButtons\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"suffixButtons\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'exportButtons' && canExport\">\n <div [ngClass]=\"item.classes\" [class.mr-2]=\"!!suffixButtons\" [class.ml-2]=\"!!prefixButtons\">\n <button\n (click)=\"clickPrint()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.print' | translate\"\n class=\"list-button mr-2\"\n mat-mini-fab\n >\n <mat-icon>print</mat-icon>\n </button>\n\n <button\n (click)=\"clickExport()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.export' | translate\"\n class=\"list-button mr-2\"\n mat-mini-fab\n >\n <mat-icon>cloud_download</mat-icon>\n </button>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'content'\">\n <ng-container *ngIf=\"layoutContent === 'table' && table\">\n <ng-container *ngTemplateOutlet=\"tableLayout; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"layoutContent === 'cards' && cards\">\n <ng-container *ngTemplateOutlet=\"cardsLayout; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"layoutContent === 'custom' && customContent\">\n <ng-container *ngTemplateOutlet=\"customLayout; context: { item: item }\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'pagination' && layoutContent !== 'custom'\">\n <div [ngClass]=\"item.classes\">\n <mat-paginator\n (page)=\"onUpdatePage($event)\"\n [length]=\"recordsFiltered$ | async\"\n [pageIndex]=\"index$ | async\"\n [pageSizeOptions]=\"defaultPageSizeOptions\"\n [pageSize]=\"length$ | async\"\n [showFirstLastButtons]=\"true\"\n >\n </mat-paginator>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'queryBuilder' && enableQueryBuilder\">\n <div class=\"flex flex-col\" *ngIf=\"showQueryBuilder$ | async\">\n <mat-card class=\"my-4\" [niceLoadingOverlay]=\"filterConfigLoading$ | async\">\n <mat-card-content class=\"flex flex-col\">\n <div class=\"flex flex-auto\">\n <nice-query-builder\n [filterConfigs]=\"filterConfig$ | async\"\n [ngModel]=\"rules$ | async\"\n (ngModelChange)=\"onUpdateRules($event)\"\n (close)=\"clickToggleShowQueryBuilder()\"\n ></nice-query-builder>\n </div>\n </mat-card-content>\n </mat-card>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'filters' && filters\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"filters\"></ng-container>\n </div>\n </ng-container>\n</ng-template>\n\n<ng-template #tableLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <div\n [niceLoadingOverlay]=\"loading$ | async\"\n class=\"content-card base-list flex flex-col justify-between\"\n >\n <mat-table\n (matSortChange)=\"onUpdateSort($event)\"\n [dataSource]=\"data$\"\n [matSortActive]=\"(sortColumn$ | async) || ''\"\n [matSortDirection]=\"(sortDirection$ | async) || ''\"\n class=\"flex flex-col flex-auto\"\n matSort\n >\n <mat-header-row *matHeaderRowDef=\"columnNames; sticky: true\"></mat-header-row>\n\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.id\">\n <ng-container *ngIf=\"column.sortable\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, header: true }\"\n ></ng-container>\n </mat-header-cell>\n </ng-container>\n <ng-container *ngIf=\"!column.sortable\">\n <mat-header-cell *matHeaderCellDef>\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, header: true }\"\n ></ng-container>\n </mat-header-cell>\n </ng-container>\n\n <mat-cell *matCellDef=\"let item\">\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, data: true, item: item }\"\n ></ng-container>\n </mat-cell>\n </ng-container>\n\n <ng-container *ngIf=\"disableRouting; else withRouting\">\n <mat-row *matRowDef=\"let item; columns: columnNames;\" class=\"item\"></mat-row>\n </ng-container>\n\n <ng-template #withRouting>\n <mat-row\n *matRowDef=\"let item; columns: columnNames;\"\n (click)=\"navigate(item)\"\n class=\"item clickable\"\n matRipple\n >\n </mat-row>\n </ng-template>\n </mat-table>\n </div>\n </div>\n</ng-template>\n\n<ng-template #cardsLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngFor=\"let data of data$ | async\">\n <ng-container *ngTemplateOutlet=\"cards; context: { item: data }\"></ng-container>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #customLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"customContent; context: { data: data$ | async }\"></ng-container>\n </div>\n</ng-template>\n" }]
1874
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1875
+ type: Optional
1876
+ }, {
1877
+ type: Inject,
1878
+ args: [ENABLE_QUERY_BUILDER]
1879
+ }] }, { type: undefined, decorators: [{
1880
+ type: Inject,
1881
+ args: [BASE_LIST_LAYOUT]
1882
+ }] }, { type: undefined, decorators: [{
1883
+ type: Inject,
1884
+ args: [TABLE_COLUMNS]
1885
+ }] }, { type: undefined, decorators: [{
1886
+ type: Inject,
1887
+ args: [EXPORTS_SETTINGS]
1888
+ }] }, { type: NiceBaseListQuery }, { type: NiceBaseListService }, { type: i3.ActivatedRoute }, { type: i4$1.MatBottomSheet }, { type: i3.Router }, { type: i5$2.MediaObserver }]; }, propDecorators: { title: [{
1889
+ type: ContentChild,
1890
+ args: [NiceBaseListTitleDirective, { read: TemplateRef }]
1891
+ }], buttons: [{
1892
+ type: ContentChildren,
1893
+ args: [NiceBaseListButtonsDirective]
1894
+ }], table: [{
1895
+ type: ContentChild,
1896
+ args: [NiceBaseListTableDirective, { read: TemplateRef }]
1897
+ }], cards: [{
1898
+ type: ContentChild,
1899
+ args: [NiceBaseListCardsDirective, { read: TemplateRef }]
1900
+ }], customContent: [{
1901
+ type: ContentChild,
1902
+ args: [NiceBaseListCustomContentDirective, { read: TemplateRef }]
1903
+ }], filters: [{
1904
+ type: ContentChild,
1905
+ args: [NiceBaseListFiltersDirective, { read: TemplateRef }]
1906
+ }], mode: [{
1907
+ type: Input
1908
+ }], layout: [{
1909
+ type: Input
1910
+ }], layoutContent: [{
1911
+ type: Input
1912
+ }], autoChangeLayout: [{
1913
+ type: Input
1914
+ }], baseRoute: [{
1915
+ type: Input
1916
+ }], routeFn: [{
1917
+ type: Input
1918
+ }], navigateFn: [{
1919
+ type: Input
1920
+ }], autoLoad: [{
1921
+ type: Input
1922
+ }], pageTitle: [{
1923
+ type: Input
1924
+ }], canExport: [{
1925
+ type: Input
1926
+ }], disableRouting: [{
1927
+ type: Input
1928
+ }], customExport: [{
1929
+ type: Input
1930
+ }], newPage: [{
1931
+ type: Output
1932
+ }] } });
1933
+
1934
+ class NiceCustomDateAdapter extends NativeDateAdapter {
1935
+ constructor(translateService, locale, platform) {
1936
+ super(locale, platform);
1937
+ this.translateService = translateService;
1938
+ this.setLocale(this.translateService.getDefaultLang());
1939
+ // @ts-ignore
1940
+ this._format = (dtf, date) => {
1941
+ return dtf.format(date);
1942
+ };
1943
+ }
1944
+ format(date, displayFormat) {
1945
+ return super.format(date, displayFormat);
1946
+ }
1947
+ getDate(date) {
1948
+ return date.getUTCDate();
1949
+ }
1950
+ getMonth(date) {
1951
+ return date.getUTCMonth();
1952
+ }
1953
+ getYear(date) {
1954
+ return date.getUTCFullYear();
1955
+ }
1956
+ }
1957
+ NiceCustomDateAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceCustomDateAdapter, deps: [{ token: i1$4.TranslateService }, { token: MAT_DATE_LOCALE }, { token: i2$3.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
1958
+ NiceCustomDateAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceCustomDateAdapter });
1959
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceCustomDateAdapter, decorators: [{
1960
+ type: Injectable
1961
+ }], ctorParameters: function () { return [{ type: i1$4.TranslateService }, { type: undefined, decorators: [{
1962
+ type: Inject,
1963
+ args: [MAT_DATE_LOCALE]
1964
+ }] }, { type: i2$3.Platform }]; } });
1965
+
1966
+ class QueryBuilderModule {
1967
+ }
1968
+ QueryBuilderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: QueryBuilderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1969
+ QueryBuilderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: QueryBuilderModule, declarations: [QueryBuilderComponent,
1970
+ QueryBuilderTriggerDirective,
1971
+ FilterSelectionComponent,
1972
+ RuleComponent,
1973
+ SelectFilterComponent,
1974
+ TextFilterComponent,
1975
+ NumberFilterComponent,
1976
+ RadioFilterComponent,
1977
+ DateFilterComponent,
1978
+ FilterGroupIconPipe], imports: [CommonModule,
1979
+ FormsModule,
1980
+ TranslateModule,
1981
+ OverlayModule,
1982
+ MatCardModule,
1983
+ MatListModule,
1984
+ MatButtonModule,
1985
+ MatRippleModule,
1986
+ MatIconModule,
1987
+ MatSelectModule,
1988
+ MatInputModule,
1989
+ MatDatepickerModule,
1990
+ MatRadioModule,
1991
+ NiceLoadingSpinnerModule,
1992
+ NiceTypeaheadModule,
1993
+ ReactiveFormsModule,
1994
+ NgxMaskModule], exports: [QueryBuilderComponent, QueryBuilderTriggerDirective] });
1995
+ QueryBuilderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: QueryBuilderModule, providers: [{ provide: DateAdapter, useClass: NiceCustomDateAdapter }], imports: [[
1996
+ CommonModule,
1997
+ FormsModule,
1998
+ TranslateModule,
1999
+ OverlayModule,
2000
+ MatCardModule,
2001
+ MatListModule,
2002
+ MatButtonModule,
2003
+ MatRippleModule,
2004
+ MatIconModule,
2005
+ MatSelectModule,
2006
+ MatInputModule,
2007
+ MatDatepickerModule,
2008
+ MatRadioModule,
2009
+ NiceLoadingSpinnerModule,
2010
+ NiceTypeaheadModule,
2011
+ ReactiveFormsModule,
2012
+ NgxMaskModule
2013
+ ]] });
2014
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: QueryBuilderModule, decorators: [{
2015
+ type: NgModule,
2016
+ args: [{
2017
+ imports: [
2018
+ CommonModule,
2019
+ FormsModule,
2020
+ TranslateModule,
2021
+ OverlayModule,
2022
+ MatCardModule,
2023
+ MatListModule,
2024
+ MatButtonModule,
2025
+ MatRippleModule,
2026
+ MatIconModule,
2027
+ MatSelectModule,
2028
+ MatInputModule,
2029
+ MatDatepickerModule,
2030
+ MatRadioModule,
2031
+ NiceLoadingSpinnerModule,
2032
+ NiceTypeaheadModule,
2033
+ ReactiveFormsModule,
2034
+ NgxMaskModule
2035
+ ],
2036
+ declarations: [
2037
+ QueryBuilderComponent,
2038
+ QueryBuilderTriggerDirective,
2039
+ FilterSelectionComponent,
2040
+ RuleComponent,
2041
+ SelectFilterComponent,
2042
+ TextFilterComponent,
2043
+ NumberFilterComponent,
2044
+ RadioFilterComponent,
2045
+ DateFilterComponent,
2046
+ FilterGroupIconPipe
2047
+ ],
2048
+ providers: [{ provide: DateAdapter, useClass: NiceCustomDateAdapter }],
2049
+ exports: [QueryBuilderComponent, QueryBuilderTriggerDirective]
2050
+ }]
2051
+ }] });
2052
+
2053
+ class NiceBaseListModule {
2054
+ static forRoot(options) {
2055
+ return {
2056
+ ngModule: NiceBaseListModule,
2057
+ providers: [
2058
+ {
2059
+ provide: BASE_LIST_LAYOUT,
2060
+ useValue: options?.layout ?? defaultLayout
2061
+ },
2062
+ ...(options?.queryBuilder ? [
2063
+ {
2064
+ provide: ENABLE_QUERY_BUILDER,
2065
+ useValue: true
2066
+ },
2067
+ {
2068
+ provide: NiceFilterGroupService,
2069
+ useClass: options.queryBuilder.filterGroupService
2070
+ },
2071
+ options.queryBuilder.savedReportService ? {
2072
+ provide: NiceSavedReportService,
2073
+ useClass: options.queryBuilder.savedReportService
2074
+ } : undefined
2075
+ ] : [])
2076
+ ].filter(x => !!x)
2077
+ };
2078
+ }
2079
+ static providerFactory(options) {
2080
+ return [
2081
+ {
2082
+ provide: NiceFilterService,
2083
+ useClass: options.filterService
2084
+ },
2085
+ {
2086
+ provide: LIST_TABLE,
2087
+ useValue: options.table
2088
+ },
2089
+ {
2090
+ provide: TABLE_COLUMNS,
2091
+ useValue: options.columns,
2092
+ },
2093
+ {
2094
+ provide: DEFAULT_PARAMETERS,
2095
+ useValue: options.defaultParameters
2096
+ },
2097
+ options.layout ? {
2098
+ provide: BASE_LIST_LAYOUT,
2099
+ useValue: options.layout
2100
+ } : undefined,
2101
+ {
2102
+ provide: EXPORTS_SETTINGS,
2103
+ useValue: options.exports ?? {
2104
+ pdf: true,
2105
+ xlsx: true,
2106
+ csv: true
2107
+ }
2108
+ },
2109
+ options.disableQueryBuilder !== undefined ? {
2110
+ provide: ENABLE_QUERY_BUILDER,
2111
+ useValue: !options.disableQueryBuilder
2112
+ } : null,
2113
+ ...(options.queryBuilder ? [
2114
+ {
2115
+ provide: NiceFilterGroupService,
2116
+ useClass: options.queryBuilder.filterGroupService
2117
+ },
2118
+ options.queryBuilder.savedReportService ? {
2119
+ provide: NiceSavedReportService,
2120
+ useClass: options.queryBuilder.savedReportService
2121
+ } : undefined
2122
+ ] : [])
2123
+ ].filter(x => !!x);
2124
+ }
2125
+ }
2126
+ NiceBaseListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2127
+ NiceBaseListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListModule, declarations: [NiceBaseListComponent], imports: [NiceExportBottomSheetModule,
2128
+ NiceBaseListDirectiveModule,
2129
+ CommonModule,
2130
+ FormsModule,
2131
+ RouterModule,
2132
+ MatButtonModule,
2133
+ MatIconModule,
2134
+ MatTooltipModule,
2135
+ MatCardModule,
2136
+ MatPaginatorModule,
2137
+ TranslateModule,
2138
+ NiceLoadingSpinnerModule,
2139
+ MatTableModule,
2140
+ MatSortModule,
2141
+ MatRippleModule,
2142
+ MatBottomSheetModule,
2143
+ QueryBuilderModule,
2144
+ MatBadgeModule], exports: [NiceBaseListComponent,
2145
+ NiceBaseListDirectiveModule] });
2146
+ NiceBaseListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListModule, imports: [[
2147
+ NiceExportBottomSheetModule,
2148
+ NiceBaseListDirectiveModule,
2149
+ CommonModule,
2150
+ FormsModule,
2151
+ RouterModule,
2152
+ MatButtonModule,
2153
+ MatIconModule,
2154
+ MatTooltipModule,
2155
+ MatCardModule,
2156
+ MatPaginatorModule,
2157
+ TranslateModule,
2158
+ NiceLoadingSpinnerModule,
2159
+ MatTableModule,
2160
+ MatSortModule,
2161
+ MatRippleModule,
2162
+ MatBottomSheetModule,
2163
+ QueryBuilderModule,
2164
+ MatBadgeModule
2165
+ ], NiceBaseListDirectiveModule] });
2166
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListModule, decorators: [{
2167
+ type: NgModule,
2168
+ args: [{
2169
+ imports: [
2170
+ NiceExportBottomSheetModule,
2171
+ NiceBaseListDirectiveModule,
2172
+ CommonModule,
2173
+ FormsModule,
2174
+ RouterModule,
2175
+ MatButtonModule,
2176
+ MatIconModule,
2177
+ MatTooltipModule,
2178
+ MatCardModule,
2179
+ MatPaginatorModule,
2180
+ TranslateModule,
2181
+ NiceLoadingSpinnerModule,
2182
+ MatTableModule,
2183
+ MatSortModule,
2184
+ MatRippleModule,
2185
+ MatBottomSheetModule,
2186
+ QueryBuilderModule,
2187
+ MatBadgeModule
2188
+ ],
2189
+ declarations: [
2190
+ NiceBaseListComponent
2191
+ ],
2192
+ exports: [
2193
+ NiceBaseListComponent,
2194
+ NiceBaseListDirectiveModule
2195
+ ]
2196
+ }]
2197
+ }] });
2198
+
2199
+ class NiceListState {
2200
+ }
2201
+
2202
+ class NiceMultiStateFilterService extends NiceFilterService {
2203
+ constructor(filters) {
2204
+ super();
2205
+ this.filters = filters;
2206
+ }
2207
+ switchState(state) {
2208
+ this.api = this.filters[state];
2209
+ }
2210
+ }
2211
+
2212
+ const initialValue = {
2213
+ ...initialBaseListState
2214
+ };
2215
+ let NiceMultiStateListStore = class NiceMultiStateListStore extends NiceBaseListStore {
2216
+ constructor() {
2217
+ super(null);
2218
+ }
2219
+ };
2220
+ NiceMultiStateListStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2221
+ NiceMultiStateListStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListStore });
2222
+ NiceMultiStateListStore = __decorate([
2223
+ StoreConfig({ name: "multi-state-list", resettable: true }),
2224
+ __metadata("design:paramtypes", [])
2225
+ ], NiceMultiStateListStore);
2226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListStore, decorators: [{
2227
+ type: Injectable
2228
+ }], ctorParameters: function () { return []; } });
2229
+
2230
+ class NiceMultiStateListQuery extends NiceBaseListQuery {
2231
+ constructor(store) {
2232
+ super(store);
2233
+ this.store = store;
2234
+ }
2235
+ }
2236
+ NiceMultiStateListQuery.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListQuery, deps: [{ token: NiceMultiStateListStore }], target: i0.ɵɵFactoryTarget.Injectable });
2237
+ NiceMultiStateListQuery.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListQuery });
2238
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListQuery, decorators: [{
2239
+ type: Injectable
2240
+ }], ctorParameters: function () { return [{ type: NiceMultiStateListStore }]; } });
2241
+
2242
+ const LIST_STATES = new InjectionToken("list_states");
2243
+
2244
+ class NiceMultiStateListService extends NiceBaseListService {
2245
+ constructor(states, store, activatedRoute, router, appRef, multiFilterService) {
2246
+ super(store, multiFilterService, activatedRoute, router, appRef);
2247
+ this.states = states;
2248
+ this.multiFilterService = multiFilterService;
2249
+ }
2250
+ reset() {
2251
+ this.store.reset();
2252
+ }
2253
+ setStateDefaultFilter(state, parameters) {
2254
+ this.states[state].defaultParameters = parameters;
2255
+ }
2256
+ switchState(state) {
2257
+ const newState = this.states[state];
2258
+ if (!state) {
2259
+ return [];
2260
+ }
2261
+ this.multiFilterService.switchState(state);
2262
+ this.reset();
2263
+ this.init();
2264
+ this.loadData(newState.defaultParameters ?? initialBaseListState.filterParameters);
2265
+ return newState.columns;
2266
+ }
2267
+ }
2268
+ NiceMultiStateListService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListService, deps: [{ token: LIST_STATES }, { token: NiceMultiStateListStore }, { token: i3.ActivatedRoute }, { token: i3.Router }, { token: i0.ApplicationRef }, { token: NiceMultiStateFilterService }], target: i0.ɵɵFactoryTarget.Injectable });
2269
+ NiceMultiStateListService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListService });
2270
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListService, decorators: [{
2271
+ type: Injectable
2272
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2273
+ type: Inject,
2274
+ args: [LIST_STATES]
2275
+ }] }, { type: NiceMultiStateListStore }, { type: i3.ActivatedRoute }, { type: i3.Router }, { type: i0.ApplicationRef }, { type: NiceMultiStateFilterService }]; } });
2276
+
2277
+ class NiceMultiStateListComponent extends NiceBaseListComponent {
2278
+ constructor(enableQueryBuilder, listLayout, exportsSetting, query, activatedRoute, bottomSheet, router, mediaObserver, multiStateListService) {
2279
+ super(enableQueryBuilder, listLayout, [], exportsSetting, query, multiStateListService, activatedRoute, bottomSheet, router, mediaObserver);
2280
+ this.multiStateListService = multiStateListService;
2281
+ }
2282
+ set state(state) {
2283
+ this.switchState(state);
2284
+ }
2285
+ switchState(state) {
2286
+ const columns = this.multiStateListService.switchState(state);
2287
+ this.setColumn(columns);
2288
+ }
2289
+ }
2290
+ NiceMultiStateListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListComponent, deps: [{ token: ENABLE_QUERY_BUILDER, optional: true }, { token: BASE_LIST_LAYOUT }, { token: EXPORTS_SETTINGS }, { token: NiceMultiStateListQuery }, { token: i3.ActivatedRoute }, { token: i4$1.MatBottomSheet }, { token: i3.Router }, { token: i5$2.MediaObserver }, { token: NiceMultiStateListService }], target: i0.ɵɵFactoryTarget.Component });
2291
+ NiceMultiStateListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: NiceMultiStateListComponent, selector: "nice-multi-state-list", inputs: { state: "state" }, providers: [
2292
+ NiceMultiStateListQuery,
2293
+ NiceMultiStateListService,
2294
+ NiceMultiStateListStore
2295
+ ], usesInheritance: true, ngImport: i0, template: "<div class=\"list page-layout carded fullwidth inner-scroll\" *ngIf=\"layout === 'page'; else content\">\n <div class=\"center\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </div>\n</div>\n\n<ng-template #content>\n <ng-container *ngIf=\"listLayout.xl\">\n <div class=\"hidden xl:block\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.xl }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.lg\">\n <div class=\"hidden lg:block xl:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.lg }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.md\">\n <div class=\"hidden md:block lg:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.md }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.sm\">\n <div class=\"hidden sm:block md:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.sm }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.xs\">\n <div class=\"block sm:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.xs }\"></ng-container>\n </div>\n </ng-container>\n\n <div\n [class.hidden]=\"!!listLayout.xs\"\n [class.block]=\"!listLayout.xs\"\n [class.sm:hidden]=\"!!listLayout.sm\"\n [class.sm:block]=\"!listLayout.sm\"\n [class.md:hidden]=\"!!listLayout.md\"\n [class.md:block]=\"!listLayout.md\"\n [class.lg:hidden]=\"!!listLayout.lg\"\n [class.lg:block]=\"!listLayout.lg\"\n [class.xl:hidden]=\"!!listLayout.xl\"\n [class.xl:block]=\"!listLayout.xl\"\n >\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.default }\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #pageLayout let-layout=\"layout\">\n <ng-container *ngIf=\"layout?.length; else isObject\">\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: { classes: ['flex flex-col'], items: layout } }\"></ng-container>\n </ng-container>\n\n <ng-template #isObject>\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: layout }\"></ng-container>\n </ng-template>\n</ng-template>\n\n<ng-template #contentLayout let-layout=\"layout\">\n <div [ngClass]=\"layout.classes\">\n <ng-container *ngFor=\"let item of layout.items\">\n <ng-container *ngIf=\"item.name; else childIsLayout\">\n <ng-container *ngTemplateOutlet=\"layoutItem; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-template #childIsLayout>\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: item }\"></ng-container>\n </ng-template>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #layoutItem let-item=\"item\">\n <ng-container *ngIf=\"item.name === 'title' && title\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"title\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'search'\">\n <div [ngClass]=\"item.classes\">\n <div class=\"search-wrapper mx-md-0\">\n <div class=\"search flex flex-auto justify-start items-center\">\n <mat-icon>search</mat-icon>\n <input [ngModel]=\"searchQuery$ | async\" (ngModelChange)=\"onUpdateSearch($event)\" [placeholder]=\"'general.search' | translate\" />\n <ng-container *ngIf=\"enableQueryBuilder\">\n <button\n *ngIf=\"!(showQueryBuilder$ | async) && !(rulesCount$ | async)\"\n mat-icon-button\n niceQueryBuilderTrigger\n [queryBuilderFilters]=\"filterConfig$ | async\"\n [queryBuilderFiltersLoading]=\"(filterConfigLoading$ | async) || false\"\n (queryBuilderFilterSelected)=\"onQueryBuilderFilterSelected($event)\"\n [matTooltip]=\"'general.query_builder.show_advanced_search' | translate\"\n >\n <mat-icon\n [matBadge]=\"rulesCount$ | async\"\n [matBadgeHidden]=\"!(rulesCount$ | async)\"\n matBadgeColor=\"accent\"\n >\n filter_list\n </mat-icon>\n </button>\n <button\n mat-icon-button\n *ngIf=\"!(showQueryBuilder$ | async) && (rulesCount$ | async)\"\n [disabled]=\"filterConfigLoading$ | async\"\n (click)=\"clickToggleShowQueryBuilder()\"\n [matTooltip]=\"'general.query_builder.show_advanced_search' | translate\"\n >\n <mat-icon\n [matBadge]=\"rulesCount$ | async\"\n [matBadgeHidden]=\"!(rulesCount$ | async)\"\n matBadgeColor=\"accent\"\n >\n filter_list\n </mat-icon>\n </button>\n <button\n mat-icon-button\n *ngIf=\"showQueryBuilder$ | async\"\n (click)=\"clickToggleShowQueryBuilder()\"\n [matTooltip]=\"'general.query_builder.close_advanced_search' | translate\"\n >\n <mat-icon>\n clear\n </mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'prefixButtons' && prefixButtons\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"prefixButtons\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'suffixButtons' && suffixButtons\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"suffixButtons\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'exportButtons' && canExport\">\n <div [ngClass]=\"item.classes\" [class.mr-2]=\"!!suffixButtons\" [class.ml-2]=\"!!prefixButtons\">\n <button\n (click)=\"clickPrint()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.print' | translate\"\n class=\"list-button mr-2\"\n mat-mini-fab\n >\n <mat-icon>print</mat-icon>\n </button>\n\n <button\n (click)=\"clickExport()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.export' | translate\"\n class=\"list-button mr-2\"\n mat-mini-fab\n >\n <mat-icon>cloud_download</mat-icon>\n </button>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'content'\">\n <ng-container *ngIf=\"layoutContent === 'table' && table\">\n <ng-container *ngTemplateOutlet=\"tableLayout; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"layoutContent === 'cards' && cards\">\n <ng-container *ngTemplateOutlet=\"cardsLayout; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"layoutContent === 'custom' && customContent\">\n <ng-container *ngTemplateOutlet=\"customLayout; context: { item: item }\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'pagination' && layoutContent !== 'custom'\">\n <div [ngClass]=\"item.classes\">\n <mat-paginator\n (page)=\"onUpdatePage($event)\"\n [length]=\"recordsFiltered$ | async\"\n [pageIndex]=\"index$ | async\"\n [pageSizeOptions]=\"defaultPageSizeOptions\"\n [pageSize]=\"length$ | async\"\n [showFirstLastButtons]=\"true\"\n >\n </mat-paginator>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'queryBuilder' && enableQueryBuilder\">\n <div class=\"flex flex-col\" *ngIf=\"showQueryBuilder$ | async\">\n <mat-card class=\"my-4\" [niceLoadingOverlay]=\"filterConfigLoading$ | async\">\n <mat-card-content class=\"flex flex-col\">\n <div class=\"flex flex-auto\">\n <nice-query-builder\n [filterConfigs]=\"filterConfig$ | async\"\n [ngModel]=\"rules$ | async\"\n (ngModelChange)=\"onUpdateRules($event)\"\n (close)=\"clickToggleShowQueryBuilder()\"\n ></nice-query-builder>\n </div>\n </mat-card-content>\n </mat-card>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'filters' && filters\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"filters\"></ng-container>\n </div>\n </ng-container>\n</ng-template>\n\n<ng-template #tableLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <div\n [niceLoadingOverlay]=\"loading$ | async\"\n class=\"content-card base-list flex flex-col justify-between\"\n >\n <mat-table\n (matSortChange)=\"onUpdateSort($event)\"\n [dataSource]=\"data$\"\n [matSortActive]=\"(sortColumn$ | async) || ''\"\n [matSortDirection]=\"(sortDirection$ | async) || ''\"\n class=\"flex flex-col flex-auto\"\n matSort\n >\n <mat-header-row *matHeaderRowDef=\"columnNames; sticky: true\"></mat-header-row>\n\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.id\">\n <ng-container *ngIf=\"column.sortable\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, header: true }\"\n ></ng-container>\n </mat-header-cell>\n </ng-container>\n <ng-container *ngIf=\"!column.sortable\">\n <mat-header-cell *matHeaderCellDef>\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, header: true }\"\n ></ng-container>\n </mat-header-cell>\n </ng-container>\n\n <mat-cell *matCellDef=\"let item\">\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, data: true, item: item }\"\n ></ng-container>\n </mat-cell>\n </ng-container>\n\n <ng-container *ngIf=\"disableRouting; else withRouting\">\n <mat-row *matRowDef=\"let item; columns: columnNames;\" class=\"item\"></mat-row>\n </ng-container>\n\n <ng-template #withRouting>\n <mat-row\n *matRowDef=\"let item; columns: columnNames;\"\n (click)=\"navigate(item)\"\n class=\"item clickable\"\n matRipple\n >\n </mat-row>\n </ng-template>\n </mat-table>\n </div>\n </div>\n</ng-template>\n\n<ng-template #cardsLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngFor=\"let data of data$ | async\">\n <ng-container *ngTemplateOutlet=\"cards; context: { item: data }\"></ng-container>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #customLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"customContent; context: { data: data$ | async }\"></ng-container>\n </div>\n</ng-template>\n", components: [{ type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i7.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"] }, { type: i8.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { type: i9.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: QueryBuilderComponent, selector: "nice-query-builder", inputs: ["filterConfigs", "currentSavedReport", "loading"], outputs: ["close", "createReport", "updateReport"] }, { type: i11.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { type: i11.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i12.MatSortHeader, selector: "[mat-sort-header]", inputs: ["disabled", "mat-sort-header", "arrowPosition", "start", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { type: i11.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }], directives: [{ type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i13.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i13.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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]" }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: QueryBuilderTriggerDirective, selector: "[niceQueryBuilderTrigger]", inputs: ["queryBuilderFilters", "queryBuilderFiltersLoading"], outputs: ["queryBuilderFilterSelected"] }, { type: i16.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i17.MatBadge, selector: "[matBadge]", inputs: ["matBadgeDisabled", "matBadgeColor", "matBadgeOverlap", "matBadgePosition", "matBadge", "matBadgeDescription", "matBadgeSize", "matBadgeHidden"] }, { type: i3$1.NiceLoadingDirective, selector: "[niceLoadingOverlay]", inputs: ["niceLoadingOverlay"] }, { type: i9.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { type: i12.MatSort, selector: "[matSort]", inputs: ["matSortDisabled", "matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { type: i11.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i11.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i11.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i11.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i11.MatCellDef, selector: "[matCellDef]" }, { type: i11.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i11.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { type: i5.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }], pipes: { "async": i13.AsyncPipe, "translate": i1$4.TranslatePipe } });
2296
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListComponent, decorators: [{
2297
+ type: Component,
2298
+ args: [{ selector: "nice-multi-state-list", providers: [
2299
+ NiceMultiStateListQuery,
2300
+ NiceMultiStateListService,
2301
+ NiceMultiStateListStore
2302
+ ], template: "<div class=\"list page-layout carded fullwidth inner-scroll\" *ngIf=\"layout === 'page'; else content\">\n <div class=\"center\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </div>\n</div>\n\n<ng-template #content>\n <ng-container *ngIf=\"listLayout.xl\">\n <div class=\"hidden xl:block\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.xl }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.lg\">\n <div class=\"hidden lg:block xl:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.lg }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.md\">\n <div class=\"hidden md:block lg:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.md }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.sm\">\n <div class=\"hidden sm:block md:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.sm }\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"listLayout.xs\">\n <div class=\"block sm:hidden\">\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.xs }\"></ng-container>\n </div>\n </ng-container>\n\n <div\n [class.hidden]=\"!!listLayout.xs\"\n [class.block]=\"!listLayout.xs\"\n [class.sm:hidden]=\"!!listLayout.sm\"\n [class.sm:block]=\"!listLayout.sm\"\n [class.md:hidden]=\"!!listLayout.md\"\n [class.md:block]=\"!listLayout.md\"\n [class.lg:hidden]=\"!!listLayout.lg\"\n [class.lg:block]=\"!listLayout.lg\"\n [class.xl:hidden]=\"!!listLayout.xl\"\n [class.xl:block]=\"!listLayout.xl\"\n >\n <ng-container *ngTemplateOutlet=\"pageLayout; context: { layout: listLayout.default }\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #pageLayout let-layout=\"layout\">\n <ng-container *ngIf=\"layout?.length; else isObject\">\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: { classes: ['flex flex-col'], items: layout } }\"></ng-container>\n </ng-container>\n\n <ng-template #isObject>\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: layout }\"></ng-container>\n </ng-template>\n</ng-template>\n\n<ng-template #contentLayout let-layout=\"layout\">\n <div [ngClass]=\"layout.classes\">\n <ng-container *ngFor=\"let item of layout.items\">\n <ng-container *ngIf=\"item.name; else childIsLayout\">\n <ng-container *ngTemplateOutlet=\"layoutItem; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-template #childIsLayout>\n <ng-container *ngTemplateOutlet=\"contentLayout; context: { layout: item }\"></ng-container>\n </ng-template>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #layoutItem let-item=\"item\">\n <ng-container *ngIf=\"item.name === 'title' && title\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"title\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'search'\">\n <div [ngClass]=\"item.classes\">\n <div class=\"search-wrapper mx-md-0\">\n <div class=\"search flex flex-auto justify-start items-center\">\n <mat-icon>search</mat-icon>\n <input [ngModel]=\"searchQuery$ | async\" (ngModelChange)=\"onUpdateSearch($event)\" [placeholder]=\"'general.search' | translate\" />\n <ng-container *ngIf=\"enableQueryBuilder\">\n <button\n *ngIf=\"!(showQueryBuilder$ | async) && !(rulesCount$ | async)\"\n mat-icon-button\n niceQueryBuilderTrigger\n [queryBuilderFilters]=\"filterConfig$ | async\"\n [queryBuilderFiltersLoading]=\"(filterConfigLoading$ | async) || false\"\n (queryBuilderFilterSelected)=\"onQueryBuilderFilterSelected($event)\"\n [matTooltip]=\"'general.query_builder.show_advanced_search' | translate\"\n >\n <mat-icon\n [matBadge]=\"rulesCount$ | async\"\n [matBadgeHidden]=\"!(rulesCount$ | async)\"\n matBadgeColor=\"accent\"\n >\n filter_list\n </mat-icon>\n </button>\n <button\n mat-icon-button\n *ngIf=\"!(showQueryBuilder$ | async) && (rulesCount$ | async)\"\n [disabled]=\"filterConfigLoading$ | async\"\n (click)=\"clickToggleShowQueryBuilder()\"\n [matTooltip]=\"'general.query_builder.show_advanced_search' | translate\"\n >\n <mat-icon\n [matBadge]=\"rulesCount$ | async\"\n [matBadgeHidden]=\"!(rulesCount$ | async)\"\n matBadgeColor=\"accent\"\n >\n filter_list\n </mat-icon>\n </button>\n <button\n mat-icon-button\n *ngIf=\"showQueryBuilder$ | async\"\n (click)=\"clickToggleShowQueryBuilder()\"\n [matTooltip]=\"'general.query_builder.close_advanced_search' | translate\"\n >\n <mat-icon>\n clear\n </mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'prefixButtons' && prefixButtons\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"prefixButtons\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'suffixButtons' && suffixButtons\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"suffixButtons\"></ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'exportButtons' && canExport\">\n <div [ngClass]=\"item.classes\" [class.mr-2]=\"!!suffixButtons\" [class.ml-2]=\"!!prefixButtons\">\n <button\n (click)=\"clickPrint()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.print' | translate\"\n class=\"list-button mr-2\"\n mat-mini-fab\n >\n <mat-icon>print</mat-icon>\n </button>\n\n <button\n (click)=\"clickExport()\"\n [disabled]=\"loading$ | async\"\n [matTooltip]=\"'general.export' | translate\"\n class=\"list-button mr-2\"\n mat-mini-fab\n >\n <mat-icon>cloud_download</mat-icon>\n </button>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'content'\">\n <ng-container *ngIf=\"layoutContent === 'table' && table\">\n <ng-container *ngTemplateOutlet=\"tableLayout; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"layoutContent === 'cards' && cards\">\n <ng-container *ngTemplateOutlet=\"cardsLayout; context: { item: item }\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"layoutContent === 'custom' && customContent\">\n <ng-container *ngTemplateOutlet=\"customLayout; context: { item: item }\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'pagination' && layoutContent !== 'custom'\">\n <div [ngClass]=\"item.classes\">\n <mat-paginator\n (page)=\"onUpdatePage($event)\"\n [length]=\"recordsFiltered$ | async\"\n [pageIndex]=\"index$ | async\"\n [pageSizeOptions]=\"defaultPageSizeOptions\"\n [pageSize]=\"length$ | async\"\n [showFirstLastButtons]=\"true\"\n >\n </mat-paginator>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'queryBuilder' && enableQueryBuilder\">\n <div class=\"flex flex-col\" *ngIf=\"showQueryBuilder$ | async\">\n <mat-card class=\"my-4\" [niceLoadingOverlay]=\"filterConfigLoading$ | async\">\n <mat-card-content class=\"flex flex-col\">\n <div class=\"flex flex-auto\">\n <nice-query-builder\n [filterConfigs]=\"filterConfig$ | async\"\n [ngModel]=\"rules$ | async\"\n (ngModelChange)=\"onUpdateRules($event)\"\n (close)=\"clickToggleShowQueryBuilder()\"\n ></nice-query-builder>\n </div>\n </mat-card-content>\n </mat-card>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"item.name === 'filters' && filters\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"filters\"></ng-container>\n </div>\n </ng-container>\n</ng-template>\n\n<ng-template #tableLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <div\n [niceLoadingOverlay]=\"loading$ | async\"\n class=\"content-card base-list flex flex-col justify-between\"\n >\n <mat-table\n (matSortChange)=\"onUpdateSort($event)\"\n [dataSource]=\"data$\"\n [matSortActive]=\"(sortColumn$ | async) || ''\"\n [matSortDirection]=\"(sortDirection$ | async) || ''\"\n class=\"flex flex-col flex-auto\"\n matSort\n >\n <mat-header-row *matHeaderRowDef=\"columnNames; sticky: true\"></mat-header-row>\n\n <ng-container *ngFor=\"let column of columns\" [matColumnDef]=\"column.id\">\n <ng-container *ngIf=\"column.sortable\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, header: true }\"\n ></ng-container>\n </mat-header-cell>\n </ng-container>\n <ng-container *ngIf=\"!column.sortable\">\n <mat-header-cell *matHeaderCellDef>\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, header: true }\"\n ></ng-container>\n </mat-header-cell>\n </ng-container>\n\n <mat-cell *matCellDef=\"let item\">\n <ng-container\n *ngTemplateOutlet=\"table; context: { column: column.id, data: true, item: item }\"\n ></ng-container>\n </mat-cell>\n </ng-container>\n\n <ng-container *ngIf=\"disableRouting; else withRouting\">\n <mat-row *matRowDef=\"let item; columns: columnNames;\" class=\"item\"></mat-row>\n </ng-container>\n\n <ng-template #withRouting>\n <mat-row\n *matRowDef=\"let item; columns: columnNames;\"\n (click)=\"navigate(item)\"\n class=\"item clickable\"\n matRipple\n >\n </mat-row>\n </ng-template>\n </mat-table>\n </div>\n </div>\n</ng-template>\n\n<ng-template #cardsLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngFor=\"let data of data$ | async\">\n <ng-container *ngTemplateOutlet=\"cards; context: { item: data }\"></ng-container>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #customLayout let-item=\"item\">\n <div [ngClass]=\"item.classes\">\n <ng-container *ngTemplateOutlet=\"customContent; context: { data: data$ | async }\"></ng-container>\n </div>\n</ng-template>\n" }]
2303
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2304
+ type: Optional
2305
+ }, {
2306
+ type: Inject,
2307
+ args: [ENABLE_QUERY_BUILDER]
2308
+ }] }, { type: undefined, decorators: [{
2309
+ type: Inject,
2310
+ args: [BASE_LIST_LAYOUT]
2311
+ }] }, { type: undefined, decorators: [{
2312
+ type: Inject,
2313
+ args: [EXPORTS_SETTINGS]
2314
+ }] }, { type: NiceMultiStateListQuery }, { type: i3.ActivatedRoute }, { type: i4$1.MatBottomSheet }, { type: i3.Router }, { type: i5$2.MediaObserver }, { type: NiceMultiStateListService }]; }, propDecorators: { state: [{
2315
+ type: Input
2316
+ }] } });
2317
+
2318
+ class NiceMultiStateListModule {
2319
+ static providerFactory(options) {
2320
+ return [
2321
+ {
2322
+ provide: NiceMultiStateFilterService,
2323
+ useExisting: options.filterService
2324
+ },
2325
+ {
2326
+ provide: LIST_STATES,
2327
+ useValue: options.states
2328
+ },
2329
+ options.layout ? {
2330
+ provide: BASE_LIST_LAYOUT,
2331
+ useValue: options.layout
2332
+ } : undefined,
2333
+ {
2334
+ provide: EXPORTS_SETTINGS,
2335
+ useValue: options.exports ?? {
2336
+ pdf: true,
2337
+ xlsx: true,
2338
+ csv: true
2339
+ }
2340
+ },
2341
+ ...(options.queryBuilder ? [
2342
+ {
2343
+ provide: ENABLE_QUERY_BUILDER,
2344
+ useValue: true
2345
+ },
2346
+ {
2347
+ provide: NiceFilterGroupService,
2348
+ useClass: options.queryBuilder.filterGroupService
2349
+ },
2350
+ options.queryBuilder.savedReportService ? {
2351
+ provide: NiceSavedReportService,
2352
+ useClass: options.queryBuilder.savedReportService
2353
+ } : undefined
2354
+ ] : [])
2355
+ ].filter(x => !!x);
2356
+ }
2357
+ }
2358
+ NiceMultiStateListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2359
+ NiceMultiStateListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListModule, declarations: [NiceMultiStateListComponent], imports: [NiceExportBottomSheetModule,
2360
+ NiceBaseListDirectiveModule,
2361
+ CommonModule,
2362
+ FormsModule,
2363
+ RouterModule,
2364
+ MatButtonModule,
2365
+ MatIconModule,
2366
+ MatTooltipModule,
2367
+ MatCardModule,
2368
+ MatPaginatorModule,
2369
+ TranslateModule,
2370
+ NiceLoadingSpinnerModule,
2371
+ MatTableModule,
2372
+ MatSortModule,
2373
+ MatRippleModule,
2374
+ MatBottomSheetModule,
2375
+ QueryBuilderModule,
2376
+ MatBadgeModule], exports: [NiceMultiStateListComponent,
2377
+ NiceBaseListDirectiveModule] });
2378
+ NiceMultiStateListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListModule, imports: [[
2379
+ NiceExportBottomSheetModule,
2380
+ NiceBaseListDirectiveModule,
2381
+ CommonModule,
2382
+ FormsModule,
2383
+ RouterModule,
2384
+ MatButtonModule,
2385
+ MatIconModule,
2386
+ MatTooltipModule,
2387
+ MatCardModule,
2388
+ MatPaginatorModule,
2389
+ TranslateModule,
2390
+ NiceLoadingSpinnerModule,
2391
+ MatTableModule,
2392
+ MatSortModule,
2393
+ MatRippleModule,
2394
+ MatBottomSheetModule,
2395
+ QueryBuilderModule,
2396
+ MatBadgeModule
2397
+ ], NiceBaseListDirectiveModule] });
2398
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListModule, decorators: [{
2399
+ type: NgModule,
2400
+ args: [{
2401
+ imports: [
2402
+ NiceExportBottomSheetModule,
2403
+ NiceBaseListDirectiveModule,
2404
+ CommonModule,
2405
+ FormsModule,
2406
+ RouterModule,
2407
+ MatButtonModule,
2408
+ MatIconModule,
2409
+ MatTooltipModule,
2410
+ MatCardModule,
2411
+ MatPaginatorModule,
2412
+ TranslateModule,
2413
+ NiceLoadingSpinnerModule,
2414
+ MatTableModule,
2415
+ MatSortModule,
2416
+ MatRippleModule,
2417
+ MatBottomSheetModule,
2418
+ QueryBuilderModule,
2419
+ MatBadgeModule
2420
+ ],
2421
+ declarations: [
2422
+ NiceMultiStateListComponent
2423
+ ],
2424
+ exports: [
2425
+ NiceMultiStateListComponent,
2426
+ NiceBaseListDirectiveModule
2427
+ ]
2428
+ }]
2429
+ }] });
2430
+
2431
+ class StringUtils {
2432
+ }
2433
+ String.prototype.toTableColumn = function (sortable) {
2434
+ return new TableColumns(this.toString(), sortable);
2435
+ };
2436
+
2437
+ /*
2438
+ * Public API Surface of nice-data-filter-kit
2439
+ */
2440
+
2441
+ /**
2442
+ * Generated bundle index. Do not edit.
2443
+ */
2444
+
2445
+ export { DateFilterComponent, FilterComponent, FilterGroupIconPipe, FilterOperatorTypes, FilterSelectionComponent, FilterType, FilterUtils, LayoutContent, NiceBaseListButtonsDirective, NiceBaseListCardsDirective, NiceBaseListComponent, NiceBaseListCustomContentDirective, NiceBaseListDirectiveModule, NiceBaseListFiltersDirective, NiceBaseListModule, NiceBaseListQuery, NiceBaseListService, NiceBaseListStore, NiceBaseListTableDirective, NiceBaseListTitleDirective, NiceCustomDateAdapter, NiceFilterApi, NiceFilterGroupService, NiceFilterService, NiceListState, NiceMultiStateFilterService, NiceMultiStateListComponent, NiceMultiStateListModule, NiceMultiStateListQuery, NiceMultiStateListService, NiceMultiStateListStore, NiceSavedReportService, NumberFilterComponent, QBFilterUtils, QueryBuilderComponent, QueryBuilderModule, QueryBuilderTriggerDirective, RadioFilterComponent, RuleComponent, SelectFilterComponent, StringUtils, TableColumns, TextFilterComponent, defaultLayout, initialBaseListState, initialValue };
2446
+ //# sourceMappingURL=recursyve-nice-data-filter-kit.mjs.map