ngx-angular-query-builder 20.0.0 → 22.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,964 +1,1317 @@
1
- import * as i2 from '@angular/forms';
2
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule } from '@angular/forms';
3
- import * as i0 from '@angular/core';
4
- import { Directive, Input, forwardRef, ContentChild, ContentChildren, ViewChild, HostBinding, Component, NgModule } from '@angular/core';
5
- import * as i1 from '@angular/common';
6
- import { CommonModule } from '@angular/common';
7
-
8
- class QueryOperatorDirective {
9
- constructor(template) {
10
- this.template = template;
11
- }
12
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryOperatorDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
13
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: QueryOperatorDirective, isStandalone: false, selector: "[queryOperator]", ngImport: i0 }); }
14
- }
15
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryOperatorDirective, decorators: [{
16
- type: Directive,
17
- args: [{
18
- selector: "[queryOperator]",
19
- standalone: false
20
- }]
21
- }], ctorParameters: () => [{ type: i0.TemplateRef }] });
22
-
23
- class QueryFieldDirective {
24
- constructor(template) {
25
- this.template = template;
26
- }
27
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryFieldDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
28
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: QueryFieldDirective, isStandalone: false, selector: "[queryField]", ngImport: i0 }); }
29
- }
30
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryFieldDirective, decorators: [{
31
- type: Directive,
32
- args: [{
33
- selector: "[queryField]",
34
- standalone: false
35
- }]
36
- }], ctorParameters: () => [{ type: i0.TemplateRef }] });
37
-
38
- class QueryEntityDirective {
39
- constructor(template) {
40
- this.template = template;
41
- }
42
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryEntityDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
43
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: QueryEntityDirective, isStandalone: false, selector: "[queryEntity]", ngImport: i0 }); }
44
- }
45
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryEntityDirective, decorators: [{
46
- type: Directive,
47
- args: [{
48
- selector: "[queryEntity]",
49
- standalone: false
50
- }]
51
- }], ctorParameters: () => [{ type: i0.TemplateRef }] });
52
-
53
- class QuerySwitchGroupDirective {
54
- constructor(template) {
55
- this.template = template;
56
- }
57
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QuerySwitchGroupDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
58
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: QuerySwitchGroupDirective, isStandalone: false, selector: "[querySwitchGroup]", ngImport: i0 }); }
59
- }
60
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QuerySwitchGroupDirective, decorators: [{
61
- type: Directive,
62
- args: [{
63
- selector: "[querySwitchGroup]",
64
- standalone: false
65
- }]
66
- }], ctorParameters: () => [{ type: i0.TemplateRef }] });
67
-
68
- class QueryButtonGroupDirective {
69
- constructor(template) {
70
- this.template = template;
71
- }
72
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryButtonGroupDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
73
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: QueryButtonGroupDirective, isStandalone: false, selector: "[queryButtonGroup]", ngImport: i0 }); }
74
- }
75
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryButtonGroupDirective, decorators: [{
76
- type: Directive,
77
- args: [{
78
- selector: "[queryButtonGroup]",
79
- standalone: false
80
- }]
81
- }], ctorParameters: () => [{ type: i0.TemplateRef }] });
82
-
83
- class QueryInputDirective {
84
- /** Unique name for query input type. */
85
- get queryInputType() {
86
- return this._type;
87
- }
88
- set queryInputType(value) {
89
- // If the directive is set without a type (updated programatically), then this setter will
90
- // trigger with an empty string and should not overwrite the programatically set value.
91
- if (!value) {
92
- return;
93
- }
94
- this._type = value;
95
- }
96
- constructor(template) {
97
- this.template = template;
98
- }
99
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryInputDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
100
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: QueryInputDirective, isStandalone: false, selector: "[queryInput]", inputs: { queryInputType: "queryInputType" }, ngImport: i0 }); }
101
- }
102
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryInputDirective, decorators: [{
103
- type: Directive,
104
- args: [{
105
- selector: "[queryInput]",
106
- standalone: false
107
- }]
108
- }], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { queryInputType: [{
109
- type: Input
110
- }] } });
111
-
112
- class QueryRemoveButtonDirective {
113
- constructor(template) {
114
- this.template = template;
115
- }
116
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryRemoveButtonDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
117
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: QueryRemoveButtonDirective, isStandalone: false, selector: "[queryRemoveButton]", ngImport: i0 }); }
118
- }
119
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryRemoveButtonDirective, decorators: [{
120
- type: Directive,
121
- args: [{
122
- selector: "[queryRemoveButton]",
123
- standalone: false
124
- }]
125
- }], ctorParameters: () => [{ type: i0.TemplateRef }] });
126
-
127
- class QueryEmptyWarningDirective {
128
- constructor(template) {
129
- this.template = template;
130
- }
131
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryEmptyWarningDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
132
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: QueryEmptyWarningDirective, isStandalone: false, selector: "[queryEmptyWarning]", ngImport: i0 }); }
133
- }
134
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryEmptyWarningDirective, decorators: [{
135
- type: Directive,
136
- args: [{
137
- selector: "[queryEmptyWarning]",
138
- standalone: false
139
- }]
140
- }], ctorParameters: () => [{ type: i0.TemplateRef }] });
141
-
142
- class QueryArrowIconDirective {
143
- constructor(template) {
144
- this.template = template;
145
- }
146
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryArrowIconDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
147
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.35", type: QueryArrowIconDirective, isStandalone: false, selector: "[queryArrowIcon]", ngImport: i0 }); }
148
- }
149
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryArrowIconDirective, decorators: [{
150
- type: Directive,
151
- args: [{
152
- selector: "[queryArrowIcon]",
153
- standalone: false
154
- }]
155
- }], ctorParameters: () => [{ type: i0.TemplateRef }] });
156
-
1
+ import * as i2 from "@angular/forms";
2
+ import { FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR } from "@angular/forms";
3
+ import * as i0 from "@angular/core";
4
+ import { ChangeDetectionStrategy, Component, ContentChild, ContentChildren, Directive, HostBinding, Input, NgModule, ViewChild, forwardRef } from "@angular/core";
5
+ import * as i1 from "@angular/common";
6
+ import { CommonModule } from "@angular/common";
7
+ var QueryOperatorDirective = class QueryOperatorDirective {
8
+ constructor(template) {
9
+ this.template = template;
10
+ }
11
+ static {
12
+ this.ɵfac = i0.ɵɵngDeclareFactory({
13
+ minVersion: "12.0.0",
14
+ version: "22.3.0",
15
+ ngImport: i0,
16
+ type: QueryOperatorDirective,
17
+ deps: [{ token: i0.TemplateRef }],
18
+ target: i0.ɵɵFactoryTarget.Directive
19
+ });
20
+ }
21
+ static {
22
+ this.ɵdir = i0.ɵɵngDeclareDirective({
23
+ minVersion: "14.0.0",
24
+ version: "22.3.0",
25
+ type: QueryOperatorDirective,
26
+ isStandalone: false,
27
+ selector: "[queryOperator]",
28
+ ngImport: i0
29
+ });
30
+ }
31
+ };
32
+ i0.ɵɵngDeclareClassMetadata({
33
+ minVersion: "12.0.0",
34
+ version: "22.3.0",
35
+ ngImport: i0,
36
+ type: QueryOperatorDirective,
37
+ decorators: [{
38
+ type: Directive,
39
+ args: [{
40
+ selector: "[queryOperator]",
41
+ standalone: false
42
+ }]
43
+ }],
44
+ ctorParameters: () => [{ type: i0.TemplateRef }]
45
+ });
46
+ var QueryFieldDirective = class QueryFieldDirective {
47
+ constructor(template) {
48
+ this.template = template;
49
+ }
50
+ static {
51
+ this.ɵfac = i0.ɵɵngDeclareFactory({
52
+ minVersion: "12.0.0",
53
+ version: "22.3.0",
54
+ ngImport: i0,
55
+ type: QueryFieldDirective,
56
+ deps: [{ token: i0.TemplateRef }],
57
+ target: i0.ɵɵFactoryTarget.Directive
58
+ });
59
+ }
60
+ static {
61
+ this.ɵdir = i0.ɵɵngDeclareDirective({
62
+ minVersion: "14.0.0",
63
+ version: "22.3.0",
64
+ type: QueryFieldDirective,
65
+ isStandalone: false,
66
+ selector: "[queryField]",
67
+ ngImport: i0
68
+ });
69
+ }
70
+ };
71
+ i0.ɵɵngDeclareClassMetadata({
72
+ minVersion: "12.0.0",
73
+ version: "22.3.0",
74
+ ngImport: i0,
75
+ type: QueryFieldDirective,
76
+ decorators: [{
77
+ type: Directive,
78
+ args: [{
79
+ selector: "[queryField]",
80
+ standalone: false
81
+ }]
82
+ }],
83
+ ctorParameters: () => [{ type: i0.TemplateRef }]
84
+ });
85
+ var QueryEntityDirective = class QueryEntityDirective {
86
+ constructor(template) {
87
+ this.template = template;
88
+ }
89
+ static {
90
+ this.ɵfac = i0.ɵɵngDeclareFactory({
91
+ minVersion: "12.0.0",
92
+ version: "22.3.0",
93
+ ngImport: i0,
94
+ type: QueryEntityDirective,
95
+ deps: [{ token: i0.TemplateRef }],
96
+ target: i0.ɵɵFactoryTarget.Directive
97
+ });
98
+ }
99
+ static {
100
+ this.ɵdir = i0.ɵɵngDeclareDirective({
101
+ minVersion: "14.0.0",
102
+ version: "22.3.0",
103
+ type: QueryEntityDirective,
104
+ isStandalone: false,
105
+ selector: "[queryEntity]",
106
+ ngImport: i0
107
+ });
108
+ }
109
+ };
110
+ i0.ɵɵngDeclareClassMetadata({
111
+ minVersion: "12.0.0",
112
+ version: "22.3.0",
113
+ ngImport: i0,
114
+ type: QueryEntityDirective,
115
+ decorators: [{
116
+ type: Directive,
117
+ args: [{
118
+ selector: "[queryEntity]",
119
+ standalone: false
120
+ }]
121
+ }],
122
+ ctorParameters: () => [{ type: i0.TemplateRef }]
123
+ });
124
+ var QuerySwitchGroupDirective = class QuerySwitchGroupDirective {
125
+ constructor(template) {
126
+ this.template = template;
127
+ }
128
+ static {
129
+ this.ɵfac = i0.ɵɵngDeclareFactory({
130
+ minVersion: "12.0.0",
131
+ version: "22.3.0",
132
+ ngImport: i0,
133
+ type: QuerySwitchGroupDirective,
134
+ deps: [{ token: i0.TemplateRef }],
135
+ target: i0.ɵɵFactoryTarget.Directive
136
+ });
137
+ }
138
+ static {
139
+ this.ɵdir = i0.ɵɵngDeclareDirective({
140
+ minVersion: "14.0.0",
141
+ version: "22.3.0",
142
+ type: QuerySwitchGroupDirective,
143
+ isStandalone: false,
144
+ selector: "[querySwitchGroup]",
145
+ ngImport: i0
146
+ });
147
+ }
148
+ };
149
+ i0.ɵɵngDeclareClassMetadata({
150
+ minVersion: "12.0.0",
151
+ version: "22.3.0",
152
+ ngImport: i0,
153
+ type: QuerySwitchGroupDirective,
154
+ decorators: [{
155
+ type: Directive,
156
+ args: [{
157
+ selector: "[querySwitchGroup]",
158
+ standalone: false
159
+ }]
160
+ }],
161
+ ctorParameters: () => [{ type: i0.TemplateRef }]
162
+ });
163
+ var QueryButtonGroupDirective = class QueryButtonGroupDirective {
164
+ constructor(template) {
165
+ this.template = template;
166
+ }
167
+ static {
168
+ this.ɵfac = i0.ɵɵngDeclareFactory({
169
+ minVersion: "12.0.0",
170
+ version: "22.3.0",
171
+ ngImport: i0,
172
+ type: QueryButtonGroupDirective,
173
+ deps: [{ token: i0.TemplateRef }],
174
+ target: i0.ɵɵFactoryTarget.Directive
175
+ });
176
+ }
177
+ static {
178
+ this.ɵdir = i0.ɵɵngDeclareDirective({
179
+ minVersion: "14.0.0",
180
+ version: "22.3.0",
181
+ type: QueryButtonGroupDirective,
182
+ isStandalone: false,
183
+ selector: "[queryButtonGroup]",
184
+ ngImport: i0
185
+ });
186
+ }
187
+ };
188
+ i0.ɵɵngDeclareClassMetadata({
189
+ minVersion: "12.0.0",
190
+ version: "22.3.0",
191
+ ngImport: i0,
192
+ type: QueryButtonGroupDirective,
193
+ decorators: [{
194
+ type: Directive,
195
+ args: [{
196
+ selector: "[queryButtonGroup]",
197
+ standalone: false
198
+ }]
199
+ }],
200
+ ctorParameters: () => [{ type: i0.TemplateRef }]
201
+ });
202
+ var QueryInputDirective = class QueryInputDirective {
203
+ get queryInputType() {
204
+ return this._type;
205
+ }
206
+ set queryInputType(value) {
207
+ if (!value) return;
208
+ this._type = value;
209
+ }
210
+ constructor(template) {
211
+ this.template = template;
212
+ }
213
+ static {
214
+ this.ɵfac = i0.ɵɵngDeclareFactory({
215
+ minVersion: "12.0.0",
216
+ version: "22.3.0",
217
+ ngImport: i0,
218
+ type: QueryInputDirective,
219
+ deps: [{ token: i0.TemplateRef }],
220
+ target: i0.ɵɵFactoryTarget.Directive
221
+ });
222
+ }
223
+ static {
224
+ this.ɵdir = i0.ɵɵngDeclareDirective({
225
+ minVersion: "14.0.0",
226
+ version: "22.3.0",
227
+ type: QueryInputDirective,
228
+ isStandalone: false,
229
+ selector: "[queryInput]",
230
+ inputs: { queryInputType: "queryInputType" },
231
+ ngImport: i0
232
+ });
233
+ }
234
+ };
235
+ i0.ɵɵngDeclareClassMetadata({
236
+ minVersion: "12.0.0",
237
+ version: "22.3.0",
238
+ ngImport: i0,
239
+ type: QueryInputDirective,
240
+ decorators: [{
241
+ type: Directive,
242
+ args: [{
243
+ selector: "[queryInput]",
244
+ standalone: false
245
+ }]
246
+ }],
247
+ ctorParameters: () => [{ type: i0.TemplateRef }],
248
+ propDecorators: { queryInputType: [{ type: Input }] }
249
+ });
250
+ var QueryRemoveButtonDirective = class QueryRemoveButtonDirective {
251
+ constructor(template) {
252
+ this.template = template;
253
+ }
254
+ static {
255
+ this.ɵfac = i0.ɵɵngDeclareFactory({
256
+ minVersion: "12.0.0",
257
+ version: "22.3.0",
258
+ ngImport: i0,
259
+ type: QueryRemoveButtonDirective,
260
+ deps: [{ token: i0.TemplateRef }],
261
+ target: i0.ɵɵFactoryTarget.Directive
262
+ });
263
+ }
264
+ static {
265
+ this.ɵdir = i0.ɵɵngDeclareDirective({
266
+ minVersion: "14.0.0",
267
+ version: "22.3.0",
268
+ type: QueryRemoveButtonDirective,
269
+ isStandalone: false,
270
+ selector: "[queryRemoveButton]",
271
+ ngImport: i0
272
+ });
273
+ }
274
+ };
275
+ i0.ɵɵngDeclareClassMetadata({
276
+ minVersion: "12.0.0",
277
+ version: "22.3.0",
278
+ ngImport: i0,
279
+ type: QueryRemoveButtonDirective,
280
+ decorators: [{
281
+ type: Directive,
282
+ args: [{
283
+ selector: "[queryRemoveButton]",
284
+ standalone: false
285
+ }]
286
+ }],
287
+ ctorParameters: () => [{ type: i0.TemplateRef }]
288
+ });
289
+ var QueryEmptyWarningDirective = class QueryEmptyWarningDirective {
290
+ constructor(template) {
291
+ this.template = template;
292
+ }
293
+ static {
294
+ this.ɵfac = i0.ɵɵngDeclareFactory({
295
+ minVersion: "12.0.0",
296
+ version: "22.3.0",
297
+ ngImport: i0,
298
+ type: QueryEmptyWarningDirective,
299
+ deps: [{ token: i0.TemplateRef }],
300
+ target: i0.ɵɵFactoryTarget.Directive
301
+ });
302
+ }
303
+ static {
304
+ this.ɵdir = i0.ɵɵngDeclareDirective({
305
+ minVersion: "14.0.0",
306
+ version: "22.3.0",
307
+ type: QueryEmptyWarningDirective,
308
+ isStandalone: false,
309
+ selector: "[queryEmptyWarning]",
310
+ ngImport: i0
311
+ });
312
+ }
313
+ };
314
+ i0.ɵɵngDeclareClassMetadata({
315
+ minVersion: "12.0.0",
316
+ version: "22.3.0",
317
+ ngImport: i0,
318
+ type: QueryEmptyWarningDirective,
319
+ decorators: [{
320
+ type: Directive,
321
+ args: [{
322
+ selector: "[queryEmptyWarning]",
323
+ standalone: false
324
+ }]
325
+ }],
326
+ ctorParameters: () => [{ type: i0.TemplateRef }]
327
+ });
328
+ var QueryArrowIconDirective = class QueryArrowIconDirective {
329
+ constructor(template) {
330
+ this.template = template;
331
+ }
332
+ static {
333
+ this.ɵfac = i0.ɵɵngDeclareFactory({
334
+ minVersion: "12.0.0",
335
+ version: "22.3.0",
336
+ ngImport: i0,
337
+ type: QueryArrowIconDirective,
338
+ deps: [{ token: i0.TemplateRef }],
339
+ target: i0.ɵɵFactoryTarget.Directive
340
+ });
341
+ }
342
+ static {
343
+ this.ɵdir = i0.ɵɵngDeclareDirective({
344
+ minVersion: "14.0.0",
345
+ version: "22.3.0",
346
+ type: QueryArrowIconDirective,
347
+ isStandalone: false,
348
+ selector: "[queryArrowIcon]",
349
+ ngImport: i0
350
+ });
351
+ }
352
+ };
353
+ i0.ɵɵngDeclareClassMetadata({
354
+ minVersion: "12.0.0",
355
+ version: "22.3.0",
356
+ ngImport: i0,
357
+ type: QueryArrowIconDirective,
358
+ decorators: [{
359
+ type: Directive,
360
+ args: [{
361
+ selector: "[queryArrowIcon]",
362
+ standalone: false
363
+ }]
364
+ }],
365
+ ctorParameters: () => [{ type: i0.TemplateRef }]
366
+ });
157
367
  const CONTROL_VALUE_ACCESSOR = {
158
- provide: NG_VALUE_ACCESSOR,
159
- useExisting: forwardRef(() => QueryBuilderComponent),
160
- multi: true
368
+ provide: NG_VALUE_ACCESSOR,
369
+ useExisting: forwardRef(() => QueryBuilderComponent),
370
+ multi: true
161
371
  };
162
372
  const VALIDATOR = {
163
- provide: NG_VALIDATORS,
164
- useExisting: forwardRef(() => QueryBuilderComponent),
165
- multi: true
373
+ provide: NG_VALIDATORS,
374
+ useExisting: forwardRef(() => QueryBuilderComponent),
375
+ multi: true
166
376
  };
167
- class QueryBuilderComponent {
168
- get condition() {
169
- return this.data?.condition;
170
- }
171
- constructor(changeDetectorRef) {
172
- this.changeDetectorRef = changeDetectorRef;
173
- this.defaultClassNames = {
174
- arrowIconButton: "q-arrow-icon-button",
175
- arrowIcon: "q-icon q-arrow-icon",
176
- removeIcon: "q-icon q-remove-icon",
177
- addIcon: "q-icon q-add-icon",
178
- button: "q-button",
179
- buttonGroup: "q-button-group",
180
- removeButton: "q-remove-button",
181
- switchGroup: "q-switch-group",
182
- switchLabel: "q-switch-label",
183
- switchRadio: "q-switch-radio",
184
- rightAlign: "q-right-align",
185
- transition: "q-transition",
186
- collapsed: "q-collapsed",
187
- treeContainer: "q-tree-container",
188
- tree: "q-tree",
189
- row: "q-row",
190
- connector: "q-connector",
191
- rule: "q-rule",
192
- ruleSet: "q-ruleset",
193
- invalidRuleSet: "q-invalid-ruleset",
194
- emptyWarning: "q-empty-warning",
195
- fieldControl: "q-field-control",
196
- fieldControlSize: "q-control-size",
197
- entityControl: "q-entity-control",
198
- entityControlSize: "q-control-size",
199
- operatorControl: "q-operator-control",
200
- operatorControlSize: "q-control-size",
201
- inputControl: "q-input-control",
202
- inputControlSize: "q-control-size"
203
- };
204
- this.defaultOperatorMap = {
205
- string: ["=", "!=", "contains", "like"],
206
- number: ["=", "!=", ">", ">=", "<", "<="],
207
- time: ["=", "!=", ">", ">=", "<", "<="],
208
- date: ["=", "!=", ">", ">=", "<", "<="],
209
- category: ["=", "!=", "in", "not in"],
210
- boolean: ["="]
211
- };
212
- this.disabled = false;
213
- this.data = { condition: "and", rules: [] };
214
- this.allowRuleset = true;
215
- this.allowCollapse = false;
216
- this.emptyMessage = "A ruleset cannot be empty. Please add a rule or remove it all together.";
217
- this.classNames = {};
218
- this.operatorMap = {};
219
- this.config = { fields: {} };
220
- this.persistValueOnFieldChange = false;
221
- this.defaultTemplateTypes = [
222
- "string",
223
- "number",
224
- "time",
225
- "date",
226
- "category",
227
- "boolean",
228
- "multiselect"
229
- ];
230
- this.defaultPersistValueTypes = ["string", "number", "time", "date", "boolean"];
231
- this.defaultEmptyList = [];
232
- this.operatorsCache = {};
233
- this.inputContextCache = new Map();
234
- this.operatorContextCache = new Map();
235
- this.fieldContextCache = new Map();
236
- this.entityContextCache = new Map();
237
- this.removeButtonContextCache = new Map();
238
- // ----------END----------
239
- this.getDisabledState = () => {
240
- return this.disabled;
241
- };
242
- this.fields = [];
243
- this.filterFields = [];
244
- this.entities = [];
245
- }
246
- // ----------OnChanges Implementation----------
247
- ngOnChanges(changes) {
248
- const config = this.config;
249
- const type = typeof config;
250
- if (type === "object") {
251
- this.fields = Object.keys(config.fields).map((value) => {
252
- const field = config.fields[value];
253
- field.value = field.value || value;
254
- return field;
255
- });
256
- if (config.entities) {
257
- this.entities = Object.keys(config.entities).map((value) => {
258
- const entity = config.entities ? config.entities[value] : [];
259
- entity.value = entity.value || value;
260
- return entity;
261
- });
262
- }
263
- else {
264
- this.entities = [];
265
- }
266
- this.operatorsCache = {};
267
- }
268
- else {
269
- throw new Error(`Expected 'config' must be a valid object, got ${type} instead.`);
270
- }
271
- }
272
- // ----------Validator Implementation----------
273
- validate(control) {
274
- const errors = {};
275
- const ruleErrorStore = [];
276
- let hasErrors = false;
277
- if (!this.config.allowEmptyRulesets && this.checkEmptyRuleInRuleset(this.data)) {
278
- errors.empty = "Empty rulesets are not allowed.";
279
- hasErrors = true;
280
- }
281
- this.validateRulesInRuleset(this.data, ruleErrorStore);
282
- if (ruleErrorStore.length) {
283
- errors.rules = ruleErrorStore;
284
- hasErrors = true;
285
- }
286
- return hasErrors ? errors : null;
287
- }
288
- // ----------ControlValueAccessor Implementation----------
289
- get value() {
290
- return this.data;
291
- }
292
- set value(value) {
293
- // When component is initialized without a formControl, null is passed to value
294
- this.data = value || { condition: "and", rules: [] };
295
- this.handleDataChange();
296
- }
297
- writeValue(obj) {
298
- this.value = obj;
299
- }
300
- registerOnChange(fn) {
301
- this.onChangeCallback = () => fn(this.data);
302
- }
303
- registerOnTouched(fn) {
304
- this.onTouchedCallback = () => fn(this.data);
305
- }
306
- setDisabledState(isDisabled) {
307
- this.disabled = isDisabled;
308
- this.changeDetectorRef.detectChanges();
309
- }
310
- findTemplateForRule(rule) {
311
- const type = this.getInputType(rule.field, rule.operator);
312
- if (type) {
313
- const queryInput = this.findQueryInput(type);
314
- if (queryInput) {
315
- return queryInput.template;
316
- }
317
- else {
318
- if (this.defaultTemplateTypes.indexOf(type) === -1) {
319
- console.warn(`Could not find template for field with type: ${type}`);
320
- }
321
- return null;
322
- }
323
- }
324
- }
325
- findQueryInput(type) {
326
- const templates = this.parentInputTemplates || this.inputTemplates || [];
327
- return templates.find((item) => item.queryInputType === type);
328
- }
329
- getOperators(field) {
330
- if (this.operatorsCache[field]) {
331
- return this.operatorsCache[field];
332
- }
333
- let operators = this.defaultEmptyList;
334
- const fieldObject = this.config.fields[field];
335
- if (this.config.getOperators) {
336
- return this.config.getOperators(field, fieldObject);
337
- }
338
- const type = fieldObject.type;
339
- if (fieldObject && fieldObject.operators) {
340
- operators = fieldObject.operators;
341
- }
342
- else if (type) {
343
- operators =
344
- (this.operatorMap && this.operatorMap[type]) ||
345
- this.defaultOperatorMap[type] ||
346
- this.defaultEmptyList;
347
- if (operators.length === 0) {
348
- console.warn(`No operators found for field '${field}' with type ${fieldObject.type}. ` +
349
- `Please define an 'operators' property on the field or use the 'operatorMap' binding to fix this.`);
350
- }
351
- if (fieldObject.nullable) {
352
- operators = operators.concat(["is null", "is not null"]);
353
- }
354
- }
355
- else {
356
- console.warn(`No 'type' property found on field: '${field}'`);
357
- }
358
- // Cache reference to array object, so it won't be computed next time and trigger a rerender.
359
- this.operatorsCache[field] = operators;
360
- return operators;
361
- }
362
- getFields(entity) {
363
- if (this.entities?.length && entity) {
364
- return this.fields.filter((field) => {
365
- return field && field.entity === entity;
366
- });
367
- }
368
- else {
369
- return this.fields;
370
- }
371
- }
372
- getInputType(field, operator) {
373
- if (this.config.getInputType) {
374
- return this.config.getInputType(field, operator);
375
- }
376
- if (!this.config.fields[field]) {
377
- throw new Error(`No configuration for field '${field}' could be found! Please add it to config.fields.`);
378
- }
379
- const type = this.config.fields[field].type;
380
- switch (operator) {
381
- case "is null":
382
- case "is not null":
383
- return null; // No displayed component
384
- case "in":
385
- case "not in":
386
- return type === "category" || type === "boolean" ? "multiselect" : type;
387
- default:
388
- return type;
389
- }
390
- }
391
- getOptions(field) {
392
- if (this.config.getOptions) {
393
- return this.config.getOptions(field);
394
- }
395
- return this.config.fields[field].options || this.defaultEmptyList;
396
- }
397
- getClassNames(...args) {
398
- const clsLookup = this.classNames ? this.classNames : this.defaultClassNames;
399
- const defaultClassNames = this.defaultClassNames;
400
- const classNames = args
401
- .map((id) => clsLookup[id] || defaultClassNames[id])
402
- .filter((c) => !!c);
403
- return classNames.length ? classNames.join(" ") : [];
404
- }
405
- getDefaultField(entity) {
406
- if (!entity) {
407
- return null;
408
- }
409
- else if (entity.defaultField !== undefined) {
410
- return this.getDefaultValue(entity.defaultField);
411
- }
412
- else {
413
- const entityFields = this.fields.filter((field) => {
414
- return field && field.entity === entity.value;
415
- });
416
- if (entityFields && entityFields.length) {
417
- return entityFields[0];
418
- }
419
- else {
420
- console.warn(`No fields found for entity '${entity.name}'. ` +
421
- `A 'defaultOperator' is also not specified on the field config. Operator value will default to null.`);
422
- return null;
423
- }
424
- }
425
- }
426
- getDefaultOperator(field) {
427
- if (field && field.defaultOperator !== undefined) {
428
- return this.getDefaultValue(field.defaultOperator);
429
- }
430
- else {
431
- const operators = this.getOperators(field.value);
432
- if (operators && operators.length) {
433
- return operators[0];
434
- }
435
- else {
436
- console.warn(`No operators found for field '${field.value}'. ` +
437
- `A 'defaultOperator' is also not specified on the field config. Operator value will default to null.`);
438
- return null;
439
- }
440
- }
441
- }
442
- addRule(parent) {
443
- if (this.disabled) {
444
- return;
445
- }
446
- parent = parent || this.data;
447
- if (this.config.addRule) {
448
- this.config.addRule(parent);
449
- }
450
- else {
451
- const field = this.fields[0];
452
- parent.rules = parent.rules.concat([
453
- {
454
- field: field.value,
455
- operator: this.getDefaultOperator(field),
456
- value: this.getDefaultValue(field.defaultValue),
457
- entity: field.entity
458
- }
459
- ]);
460
- }
461
- this.handleTouched();
462
- this.handleDataChange();
463
- }
464
- removeRule(rule, parent) {
465
- if (this.disabled) {
466
- return;
467
- }
468
- parent = parent || this.data;
469
- if (this.config.removeRule) {
470
- this.config.removeRule(rule, parent);
471
- }
472
- else {
473
- parent.rules = parent.rules.filter((r) => r !== rule);
474
- }
475
- this.inputContextCache.delete(rule);
476
- this.operatorContextCache.delete(rule);
477
- this.fieldContextCache.delete(rule);
478
- this.entityContextCache.delete(rule);
479
- this.removeButtonContextCache.delete(rule);
480
- this.handleTouched();
481
- this.handleDataChange();
482
- }
483
- addRuleSet(parent) {
484
- if (this.disabled) {
485
- return;
486
- }
487
- parent = parent || this.data;
488
- if (this.config.addRuleSet) {
489
- this.config.addRuleSet(parent);
490
- }
491
- else {
492
- parent.rules = parent.rules.concat([{ condition: "and", rules: [] }]);
493
- }
494
- this.handleTouched();
495
- this.handleDataChange();
496
- }
497
- removeRuleSet(ruleset, parent) {
498
- if (this.disabled) {
499
- return;
500
- }
501
- ruleset = ruleset || this.data;
502
- parent = parent || this.parentValue;
503
- if (this.config.removeRuleSet) {
504
- this.config.removeRuleSet(ruleset, parent);
505
- }
506
- else if (parent) {
507
- parent.rules = parent.rules.filter((r) => r !== ruleset);
508
- }
509
- this.handleTouched();
510
- this.handleDataChange();
511
- }
512
- transitionEnd(e) {
513
- this.treeContainer.nativeElement.style.maxHeight = null;
514
- }
515
- toggleCollapse() {
516
- this.computedTreeContainerHeight();
517
- setTimeout(() => {
518
- this.data.collapsed = !this.data.collapsed;
519
- }, 100);
520
- }
521
- computedTreeContainerHeight() {
522
- const nativeElement = this.treeContainer.nativeElement;
523
- if (nativeElement && nativeElement.firstElementChild) {
524
- nativeElement.style.maxHeight = nativeElement.firstElementChild.clientHeight + 8 + "px";
525
- }
526
- }
527
- changeCondition(value) {
528
- if (this.disabled) {
529
- return;
530
- }
531
- this.data.condition = value;
532
- this.handleTouched();
533
- this.handleDataChange();
534
- }
535
- changeOperator(rule) {
536
- if (this.disabled) {
537
- return;
538
- }
539
- if (this.config.coerceValueForOperator) {
540
- rule.value = this.config.coerceValueForOperator(rule.operator, rule.value, rule);
541
- }
542
- else {
543
- rule.value = this.coerceValueForOperator(rule.operator, rule.value, rule);
544
- }
545
- this.handleTouched();
546
- this.handleDataChange();
547
- }
548
- coerceValueForOperator(operator, value, rule) {
549
- const inputType = this.getInputType(rule.field, operator);
550
- if (inputType === "multiselect" && !Array.isArray(value)) {
551
- return [value];
552
- }
553
- return value;
554
- }
555
- changeInput() {
556
- if (this.disabled) {
557
- return;
558
- }
559
- this.handleTouched();
560
- this.handleDataChange();
561
- }
562
- changeField(fieldValue, rule) {
563
- if (this.disabled) {
564
- return;
565
- }
566
- const inputContext = this.inputContextCache.get(rule);
567
- const currentField = inputContext && inputContext.field;
568
- const nextField = this.config.fields[fieldValue];
569
- const nextValue = this.calculateFieldChangeValue(currentField, nextField, rule.value);
570
- if (nextValue !== undefined) {
571
- rule.value = nextValue;
572
- }
573
- else {
574
- delete rule.value;
575
- }
576
- rule.operator = this.getDefaultOperator(nextField);
577
- // Create new context objects so templates will automatically update
578
- this.inputContextCache.delete(rule);
579
- this.operatorContextCache.delete(rule);
580
- this.fieldContextCache.delete(rule);
581
- this.entityContextCache.delete(rule);
582
- this.getInputContext(rule);
583
- this.getFieldContext(rule);
584
- this.getOperatorContext(rule);
585
- this.getEntityContext(rule);
586
- this.handleTouched();
587
- this.handleDataChange();
588
- }
589
- changeEntity(entityValue, rule, index, data) {
590
- if (this.disabled) {
591
- return;
592
- }
593
- let i = index;
594
- let rs = data;
595
- const entity = this.entities.find((e) => e.value === entityValue);
596
- const defaultField = this.getDefaultField(entity);
597
- if (!rs) {
598
- rs = this.data;
599
- i = rs.rules.findIndex((x) => x === rule);
600
- }
601
- rule.field = defaultField.value;
602
- rs.rules[i] = rule;
603
- if (defaultField) {
604
- this.changeField(defaultField.value, rule);
605
- }
606
- else {
607
- this.handleTouched();
608
- this.handleDataChange();
609
- }
610
- }
611
- getDefaultValue(defaultValue) {
612
- switch (typeof defaultValue) {
613
- case "function":
614
- return defaultValue();
615
- default:
616
- return defaultValue;
617
- }
618
- }
619
- getOperatorTemplate() {
620
- const t = this.parentOperatorTemplate || this.operatorTemplate;
621
- return t ? t.template : null;
622
- }
623
- getFieldTemplate() {
624
- const t = this.parentFieldTemplate || this.fieldTemplate;
625
- return t ? t.template : null;
626
- }
627
- getEntityTemplate() {
628
- const t = this.parentEntityTemplate || this.entityTemplate;
629
- return t ? t.template : null;
630
- }
631
- getArrowIconTemplate() {
632
- const t = this.parentArrowIconTemplate || this.arrowIconTemplate;
633
- return t ? t.template : null;
634
- }
635
- getButtonGroupTemplate() {
636
- const t = this.parentButtonGroupTemplate || this.buttonGroupTemplate;
637
- return t ? t.template : null;
638
- }
639
- getSwitchGroupTemplate() {
640
- const t = this.parentSwitchGroupTemplate || this.switchGroupTemplate;
641
- return t ? t.template : null;
642
- }
643
- getRemoveButtonTemplate() {
644
- const t = this.parentRemoveButtonTemplate || this.removeButtonTemplate;
645
- return t ? t.template : null;
646
- }
647
- getEmptyWarningTemplate() {
648
- const t = this.parentEmptyWarningTemplate || this.emptyWarningTemplate;
649
- return t ? t.template : null;
650
- }
651
- getQueryItemClassName(local) {
652
- let cls = this.getClassNames("row", "connector", "transition");
653
- cls += " " + this.getClassNames(local.ruleset ? "ruleSet" : "rule");
654
- if (local.invalid) {
655
- cls += " " + this.getClassNames("invalidRuleSet");
656
- }
657
- return cls;
658
- }
659
- getButtonGroupContext() {
660
- if (!this.buttonGroupContext) {
661
- this.buttonGroupContext = {
662
- addRule: this.addRule.bind(this),
663
- addRuleSet: this.allowRuleset && this.addRuleSet.bind(this),
664
- removeRuleSet: this.allowRuleset && this.parentValue && this.removeRuleSet.bind(this),
665
- getDisabledState: this.getDisabledState,
666
- $implicit: this.data
667
- };
668
- }
669
- return this.buttonGroupContext;
670
- }
671
- getRemoveButtonContext(rule) {
672
- if (!this.removeButtonContextCache.has(rule)) {
673
- this.removeButtonContextCache.set(rule, {
674
- removeRule: this.removeRule.bind(this),
675
- getDisabledState: this.getDisabledState,
676
- $implicit: rule
677
- });
678
- }
679
- return this.removeButtonContextCache.get(rule);
680
- }
681
- getFieldContext(rule) {
682
- if (!this.fieldContextCache.has(rule)) {
683
- this.fieldContextCache.set(rule, {
684
- onChange: this.changeField.bind(this),
685
- getFields: this.getFields.bind(this),
686
- getDisabledState: this.getDisabledState,
687
- fields: this.fields,
688
- $implicit: rule
689
- });
690
- }
691
- return this.fieldContextCache.get(rule);
692
- }
693
- getEntityContext(rule) {
694
- if (!this.entityContextCache.has(rule)) {
695
- this.entityContextCache.set(rule, {
696
- onChange: this.changeEntity.bind(this),
697
- getDisabledState: this.getDisabledState,
698
- entities: this.entities,
699
- $implicit: rule
700
- });
701
- }
702
- return this.entityContextCache.get(rule);
703
- }
704
- getSwitchGroupContext() {
705
- return {
706
- onChange: this.changeCondition.bind(this),
707
- getDisabledState: this.getDisabledState,
708
- $implicit: this.data
709
- };
710
- }
711
- getArrowIconContext() {
712
- return {
713
- getDisabledState: this.getDisabledState,
714
- $implicit: this.data
715
- };
716
- }
717
- getEmptyWarningContext() {
718
- return {
719
- getDisabledState: this.getDisabledState,
720
- message: this.emptyMessage,
721
- $implicit: this.data
722
- };
723
- }
724
- getOperatorContext(rule) {
725
- if (!this.operatorContextCache.has(rule)) {
726
- this.operatorContextCache.set(rule, {
727
- onChange: this.changeOperator.bind(this),
728
- getDisabledState: this.getDisabledState,
729
- operators: this.getOperators(rule.field),
730
- $implicit: rule
731
- });
732
- }
733
- return this.operatorContextCache.get(rule);
734
- }
735
- getInputContext(rule) {
736
- if (!this.inputContextCache.has(rule)) {
737
- this.inputContextCache.set(rule, {
738
- onChange: this.changeInput.bind(this),
739
- getDisabledState: this.getDisabledState,
740
- options: this.getOptions(rule.field),
741
- field: this.config.fields[rule.field],
742
- $implicit: rule
743
- });
744
- }
745
- return this.inputContextCache.get(rule);
746
- }
747
- calculateFieldChangeValue(currentField, nextField, currentValue) {
748
- if (this.config.calculateFieldChangeValue != null) {
749
- return this.config.calculateFieldChangeValue(currentField, nextField, currentValue);
750
- }
751
- const canKeepValue = () => {
752
- if (currentField == null || nextField == null) {
753
- return false;
754
- }
755
- return (currentField.type === nextField.type &&
756
- this.defaultPersistValueTypes.indexOf(currentField.type) !== -1);
757
- };
758
- if (this.persistValueOnFieldChange && canKeepValue()) {
759
- return currentValue;
760
- }
761
- if (nextField && nextField.defaultValue !== undefined) {
762
- return this.getDefaultValue(nextField.defaultValue);
763
- }
764
- return undefined;
765
- }
766
- checkEmptyRuleInRuleset(ruleset) {
767
- if (!ruleset || !ruleset.rules || ruleset.rules.length === 0) {
768
- return true;
769
- }
770
- else {
771
- return ruleset.rules.some((item) => {
772
- if (item.rules) {
773
- return this.checkEmptyRuleInRuleset(item);
774
- }
775
- else {
776
- return false;
777
- }
778
- });
779
- }
780
- }
781
- validateRulesInRuleset(ruleset, errorStore) {
782
- if (ruleset && ruleset.rules && ruleset.rules.length > 0) {
783
- ruleset.rules.forEach((item) => {
784
- if (item.rules) {
785
- return this.validateRulesInRuleset(item, errorStore);
786
- }
787
- else if (item.field) {
788
- const field = this.config.fields[item.field];
789
- if (field && field.validator) {
790
- const error = field.validator(item, ruleset);
791
- if (error != null) {
792
- errorStore.push(error);
793
- }
794
- }
795
- }
796
- });
797
- }
798
- }
799
- handleDataChange() {
800
- this.changeDetectorRef.markForCheck();
801
- if (this.onChangeCallback) {
802
- this.onChangeCallback();
803
- }
804
- if (this.parentChangeCallback) {
805
- this.parentChangeCallback();
806
- }
807
- }
808
- handleTouched() {
809
- if (this.onTouchedCallback) {
810
- this.onTouchedCallback();
811
- }
812
- if (this.parentTouchedCallback) {
813
- this.parentTouchedCallback();
814
- }
815
- }
816
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryBuilderComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
817
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.35", type: QueryBuilderComponent, isStandalone: false, selector: "query-builder", inputs: { disabled: "disabled", data: "data", allowRuleset: "allowRuleset", allowCollapse: "allowCollapse", emptyMessage: "emptyMessage", classNames: "classNames", operatorMap: "operatorMap", parentValue: "parentValue", config: "config", parentArrowIconTemplate: "parentArrowIconTemplate", parentInputTemplates: "parentInputTemplates", parentOperatorTemplate: "parentOperatorTemplate", parentFieldTemplate: "parentFieldTemplate", parentEntityTemplate: "parentEntityTemplate", parentSwitchGroupTemplate: "parentSwitchGroupTemplate", parentButtonGroupTemplate: "parentButtonGroupTemplate", parentRemoveButtonTemplate: "parentRemoveButtonTemplate", parentEmptyWarningTemplate: "parentEmptyWarningTemplate", parentChangeCallback: "parentChangeCallback", parentTouchedCallback: "parentTouchedCallback", persistValueOnFieldChange: "persistValueOnFieldChange", value: "value" }, host: { properties: { "attr.query-builder-condition": "this.condition" } }, providers: [CONTROL_VALUE_ACCESSOR, VALIDATOR], queries: [{ propertyName: "buttonGroupTemplate", first: true, predicate: QueryButtonGroupDirective, descendants: true }, { propertyName: "switchGroupTemplate", first: true, predicate: QuerySwitchGroupDirective, descendants: true }, { propertyName: "fieldTemplate", first: true, predicate: QueryFieldDirective, descendants: true }, { propertyName: "entityTemplate", first: true, predicate: QueryEntityDirective, descendants: true }, { propertyName: "operatorTemplate", first: true, predicate: QueryOperatorDirective, descendants: true }, { propertyName: "removeButtonTemplate", first: true, predicate: QueryRemoveButtonDirective, descendants: true }, { propertyName: "emptyWarningTemplate", first: true, predicate: QueryEmptyWarningDirective, descendants: true }, { propertyName: "arrowIconTemplate", first: true, predicate: QueryArrowIconDirective, descendants: true }, { propertyName: "inputTemplates", predicate: QueryInputDirective, descendants: true }], viewQueries: [{ propertyName: "treeContainer", first: true, predicate: ["treeContainer"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div [ngClass]=\"getClassNames('switchRow')\">\n <ng-template #defaultArrowIcon>\n <i [ngClass]=\"getClassNames('arrowIcon')\"></i>\n </ng-template>\n\n <a\n *ngIf=\"allowCollapse\"\n (click)=\"toggleCollapse()\"\n [ngClass]=\"getClassNames('arrowIconButton', data.collapsed ? 'collapsed' : '')\"\n >\n <ng-container *ngIf=\"getArrowIconTemplate() as template; else defaultArrowIcon\">\n <ng-container *ngTemplateOutlet=\"template; context: getArrowIconContext()\"></ng-container>\n </ng-container>\n </a>\n\n <ng-container *ngIf=\"getButtonGroupTemplate() as template; else defaultButtonGroup\">\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <ng-container *ngTemplateOutlet=\"template; context: getButtonGroupContext()\"></ng-container>\n </div>\n </ng-container>\n\n <ng-template #defaultButtonGroup>\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <button\n type=\"button\"\n (click)=\"addRule()\"\n [ngClass]=\"getClassNames('button')\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('addIcon')\"></i> Rule\n </button>\n <button\n type=\"button\"\n (click)=\"addRuleSet()\"\n [ngClass]=\"getClassNames('button')\"\n *ngIf=\"allowRuleset\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('addIcon')\"></i> Ruleset\n </button>\n <ng-container *ngIf=\"!!parentValue && allowRuleset\">\n <button\n type=\"button\"\n (click)=\"removeRuleSet()\"\n [ngClass]=\"getClassNames('button', 'removeButton')\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('removeIcon')\"></i>\n </button>\n </ng-container>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"getSwitchGroupTemplate() as template; else defaultSwitchGroup\">\n <ng-container *ngTemplateOutlet=\"template; context: getSwitchGroupContext()\"></ng-container>\n </ng-container>\n\n <ng-template #defaultSwitchGroup>\n <div [ngClass]=\"getClassNames('switchGroup', 'transition')\" *ngIf=\"data\">\n <div [ngClass]=\"getClassNames('switchControl')\">\n <input\n type=\"radio\"\n [ngClass]=\"getClassNames('switchRadio')\"\n [(ngModel)]=\"data.condition\"\n [disabled]=\"disabled\"\n value=\"and\"\n #andOption\n />\n <label (click)=\"changeCondition(andOption.value)\" [ngClass]=\"getClassNames('switchLabel')\"\n >AND</label\n >\n </div>\n <div [ngClass]=\"getClassNames('switchControl')\">\n <input\n type=\"radio\"\n [ngClass]=\"getClassNames('switchRadio')\"\n [(ngModel)]=\"data.condition\"\n [disabled]=\"disabled\"\n value=\"or\"\n #orOption\n />\n <label (click)=\"changeCondition(orOption.value)\" [ngClass]=\"getClassNames('switchLabel')\"\n >OR</label\n >\n </div>\n </div>\n </ng-template>\n</div>\n\n<div\n #treeContainer\n (transitionend)=\"transitionEnd($event)\"\n [ngClass]=\"getClassNames('treeContainer', data.collapsed ? 'collapsed' : '')\"\n>\n <ul [ngClass]=\"getClassNames('tree')\" *ngIf=\"data && data.rules\">\n <ng-container *ngFor=\"let rule of data.rules; let i = index\">\n <ng-container\n *ngIf=\"{\n ruleset: !!rule.rules,\n invalid: !config.allowEmptyRulesets && rule.rules && rule.rules.length === 0\n } as local\"\n >\n <li [ngClass]=\"getQueryItemClassName(local)\">\n <ng-container *ngIf=\"!local.ruleset\">\n <ng-container *ngIf=\"getRemoveButtonTemplate() as template; else defaultRemoveButton\">\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getRemoveButtonContext(rule)\"\n ></ng-container>\n </div>\n </ng-container>\n\n <ng-template #defaultRemoveButton>\n <div [ngClass]=\"getClassNames('removeButtonSize', 'rightAlign')\">\n <button\n type=\"button\"\n [ngClass]=\"getClassNames('button', 'removeButton')\"\n (click)=\"removeRule(rule, data)\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('removeIcon')\"></i>\n </button>\n </div>\n </ng-template>\n\n <div *ngIf=\"entities?.length\" class=\"q-inline-block-display\">\n <ng-container *ngIf=\"getEntityTemplate() as template; else defaultEntity\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getEntityContext(rule)\"\n ></ng-container>\n </ng-container>\n </div>\n\n <ng-template #defaultEntity>\n <div [ngClass]=\"getClassNames('entityControlSize')\">\n <select\n [ngClass]=\"getClassNames('entityControl')\"\n [(ngModel)]=\"rule.entity\"\n (ngModelChange)=\"changeEntity($event, rule, i, data)\"\n [disabled]=\"disabled\"\n >\n <option *ngFor=\"let entity of entities\" [ngValue]=\"entity.value\">\n {{ entity.name }}\n </option>\n </select>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"getFieldTemplate() as template; else defaultField\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getFieldContext(rule)\"\n ></ng-container>\n </ng-container>\n\n <ng-template #defaultField>\n <div [ngClass]=\"getClassNames('fieldControlSize')\">\n <select\n [ngClass]=\"getClassNames('fieldControl')\"\n [(ngModel)]=\"rule.field\"\n (ngModelChange)=\"changeField($event, rule)\"\n [disabled]=\"disabled\"\n >\n <option *ngFor=\"let field of getFields(rule.entity)\" [ngValue]=\"field.value\">\n {{ field.name }}\n </option>\n </select>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"getOperatorTemplate() as template; else defaultOperator\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getOperatorContext(rule)\"\n ></ng-container>\n </ng-container>\n\n <ng-template #defaultOperator>\n <div [ngClass]=\"getClassNames('operatorControlSize')\">\n <select\n [ngClass]=\"getClassNames('operatorControl')\"\n [(ngModel)]=\"rule.operator\"\n (ngModelChange)=\"changeOperator(rule)\"\n [disabled]=\"disabled\"\n >\n <option *ngFor=\"let operator of getOperators(rule.field)\" [ngValue]=\"operator\">\n {{ operator }}\n </option>\n </select>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"findTemplateForRule(rule) as template; else defaultInput\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getInputContext(rule)\"\n ></ng-container>\n </ng-container>\n\n <ng-template #defaultInput>\n <div\n [ngClass]=\"getClassNames('inputControlSize')\"\n [ngSwitch]=\"getInputType(rule.field, rule.operator)\"\n >\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'string'\"\n type=\"text\"\n />\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'number'\"\n type=\"number\"\n />\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'date'\"\n type=\"date\"\n />\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'time'\"\n type=\"time\"\n />\n <select\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'category'\"\n >\n <option *ngFor=\"let opt of getOptions(rule.field)\" [ngValue]=\"opt.value\">\n {{ opt.name }}\n </option>\n </select>\n <ng-container *ngSwitchCase=\"'multiselect'\">\n <select\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n multiple\n >\n <option *ngFor=\"let opt of getOptions(rule.field)\" [ngValue]=\"opt.value\">\n {{ opt.name }}\n </option>\n </select>\n </ng-container>\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'boolean'\"\n type=\"checkbox\"\n />\n </div>\n </ng-template>\n </ng-container>\n <query-builder\n *ngIf=\"local.ruleset\"\n [data]=\"rule\"\n [disabled]=\"disabled\"\n [parentTouchedCallback]=\"parentTouchedCallback || onTouchedCallback\"\n [parentChangeCallback]=\"parentChangeCallback || onChangeCallback\"\n [parentInputTemplates]=\"parentInputTemplates || inputTemplates\"\n [parentOperatorTemplate]=\"parentOperatorTemplate || operatorTemplate\"\n [parentFieldTemplate]=\"parentFieldTemplate || fieldTemplate\"\n [parentEntityTemplate]=\"parentEntityTemplate || entityTemplate\"\n [parentSwitchGroupTemplate]=\"parentSwitchGroupTemplate || switchGroupTemplate\"\n [parentButtonGroupTemplate]=\"parentButtonGroupTemplate || buttonGroupTemplate\"\n [parentRemoveButtonTemplate]=\"parentRemoveButtonTemplate || removeButtonTemplate\"\n [parentEmptyWarningTemplate]=\"parentEmptyWarningTemplate || emptyWarningTemplate\"\n [parentArrowIconTemplate]=\"parentArrowIconTemplate || arrowIconTemplate\"\n [parentValue]=\"data\"\n [classNames]=\"classNames\"\n [config]=\"config\"\n [allowRuleset]=\"allowRuleset\"\n [allowCollapse]=\"allowCollapse\"\n [emptyMessage]=\"emptyMessage\"\n [operatorMap]=\"operatorMap\"\n >\n </query-builder>\n\n <ng-container *ngIf=\"getEmptyWarningTemplate() as template; else defaultEmptyWarning\">\n <ng-container *ngIf=\"local.invalid\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getEmptyWarningContext()\"\n ></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #defaultEmptyWarning>\n <p [ngClass]=\"getClassNames('emptyWarning')\" *ngIf=\"local.invalid\">\n {{ emptyMessage }}\n </p>\n </ng-template>\n </li>\n </ng-container>\n </ng-container>\n </ul>\n</div>\n", styles: ["@charset \"UTF-8\";:host{display:block;width:100%}:host .q-icon{font-style:normal;font-size:12px}:host .q-remove-icon:before{content:\"\\274c\"}:host .q-arrow-icon-button{float:left;margin:4px 6px 4px 0;transform:rotate(90deg);transition:linear .25s transform;cursor:pointer}:host .q-arrow-icon-button.q-collapsed{transform:rotate(0)}:host .q-arrow-icon:before{content:\"\\25b6\"}:host .q-add-icon{color:#555}:host .q-add-icon:before{content:\"\\2795\"}:host .q-remove-button{color:#b3415d;width:31px}:host .q-switch-group,:host .q-button-group{font-family:Lucida Grande,Tahoma,Verdana,sans-serif;overflow:hidden}:host .q-right-align{float:right}:host .q-button{margin-left:8px;padding:0 8px;background-color:#fff}:host .q-button:disabled{display:none}:host .q-control-size{display:inline-block;vertical-align:top;padding-right:10px}:host .q-input-control,:host .q-operator-control,:host .q-field-control,:host .q-entity-control{display:inline-block;padding:5px 8px;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;box-sizing:border-box;width:auto;min-width:180px}:host .q-input-control:disabled,:host .q-operator-control:disabled,:host .q-field-control:disabled,:host .q-entity-control:disabled{border-color:transparent}:host .q-operator-control,:host .q-field-control,:host .q-entity-control,:host .q-input-control:not([type=checkbox]){min-height:32px;-webkit-appearance:none}:host .q-switch-label,:host .q-button{float:left;margin-bottom:0;font-size:14px;line-height:30px;font-weight:400;text-align:center;text-shadow:none;border:1px solid rgba(0,0,0,.2);box-sizing:border-box}:host .q-switch-label:hover,:host .q-button:hover{cursor:pointer;background-color:#f0f0f0}:host .q-switch-label{background-color:#e4e4e4;padding:0 8px}:host .q-switch-radio{position:absolute;clip:rect(0,0,0,0);height:1px;width:1px;border:0;overflow:hidden}:host .q-switch-radio:checked+.q-switch-label{border:1px solid rgb(97,158,215);background:#fff;color:#3176b3}:host .q-switch-radio:disabled+.q-switch-label{display:none}:host .q-switch-radio:checked:disabled+.q-switch-label{display:initial;color:initial;cursor:default;border-color:transparent}:host .q-invalid-ruleset{border:1px solid rgba(179,65,93,.5)!important;background:#b3415d1a!important}:host .q-empty-warning{color:#8d252e;text-align:center}:host .q-ruleset{border:1px solid #ccc}:host .q-rule{border:1px solid #ccc;background:#fff}:host .q-transition{-webkit-transition:all .1s ease-in-out;-moz-transition:all .1s ease-in-out;-ms-transition:all .1s ease-in-out;-o-transition:all .1s ease-in-out;transition:all .1s ease-in-out}:host .q-tree-container{width:100%;overflow:hidden;transition:ease-in .25s max-height}:host .q-tree-container.q-collapsed{max-height:0!important}:host .q-tree{list-style:none;margin:4px 0 2px}:host .q-row{padding:6px 8px;margin-top:6px}:host .q-connector{position:relative}:host .q-connector:before{top:-5px;border-width:0 0 2px 2px}:host .q-connector:after{border-width:0 0 0 2px;top:50%}:host .q-connector:before,:host .q-connector:after{content:\"\";left:-12px;border-color:#ccc;border-style:solid;width:9px;height:calc(50% + 6px);position:absolute}:host .q-connector:last-child:after{content:none}:host .q-inline-block-display{display:inline-block;vertical-align:top}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.SelectMultipleControlValueAccessor, selector: "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: QueryBuilderComponent, selector: "query-builder", inputs: ["disabled", "data", "allowRuleset", "allowCollapse", "emptyMessage", "classNames", "operatorMap", "parentValue", "config", "parentArrowIconTemplate", "parentInputTemplates", "parentOperatorTemplate", "parentFieldTemplate", "parentEntityTemplate", "parentSwitchGroupTemplate", "parentButtonGroupTemplate", "parentRemoveButtonTemplate", "parentEmptyWarningTemplate", "parentChangeCallback", "parentTouchedCallback", "persistValueOnFieldChange", "value"] }] }); }
818
- }
819
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: QueryBuilderComponent, decorators: [{
820
- type: Component,
821
- args: [{ selector: "query-builder", providers: [CONTROL_VALUE_ACCESSOR, VALIDATOR], standalone: false, template: "<div [ngClass]=\"getClassNames('switchRow')\">\n <ng-template #defaultArrowIcon>\n <i [ngClass]=\"getClassNames('arrowIcon')\"></i>\n </ng-template>\n\n <a\n *ngIf=\"allowCollapse\"\n (click)=\"toggleCollapse()\"\n [ngClass]=\"getClassNames('arrowIconButton', data.collapsed ? 'collapsed' : '')\"\n >\n <ng-container *ngIf=\"getArrowIconTemplate() as template; else defaultArrowIcon\">\n <ng-container *ngTemplateOutlet=\"template; context: getArrowIconContext()\"></ng-container>\n </ng-container>\n </a>\n\n <ng-container *ngIf=\"getButtonGroupTemplate() as template; else defaultButtonGroup\">\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <ng-container *ngTemplateOutlet=\"template; context: getButtonGroupContext()\"></ng-container>\n </div>\n </ng-container>\n\n <ng-template #defaultButtonGroup>\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <button\n type=\"button\"\n (click)=\"addRule()\"\n [ngClass]=\"getClassNames('button')\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('addIcon')\"></i> Rule\n </button>\n <button\n type=\"button\"\n (click)=\"addRuleSet()\"\n [ngClass]=\"getClassNames('button')\"\n *ngIf=\"allowRuleset\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('addIcon')\"></i> Ruleset\n </button>\n <ng-container *ngIf=\"!!parentValue && allowRuleset\">\n <button\n type=\"button\"\n (click)=\"removeRuleSet()\"\n [ngClass]=\"getClassNames('button', 'removeButton')\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('removeIcon')\"></i>\n </button>\n </ng-container>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"getSwitchGroupTemplate() as template; else defaultSwitchGroup\">\n <ng-container *ngTemplateOutlet=\"template; context: getSwitchGroupContext()\"></ng-container>\n </ng-container>\n\n <ng-template #defaultSwitchGroup>\n <div [ngClass]=\"getClassNames('switchGroup', 'transition')\" *ngIf=\"data\">\n <div [ngClass]=\"getClassNames('switchControl')\">\n <input\n type=\"radio\"\n [ngClass]=\"getClassNames('switchRadio')\"\n [(ngModel)]=\"data.condition\"\n [disabled]=\"disabled\"\n value=\"and\"\n #andOption\n />\n <label (click)=\"changeCondition(andOption.value)\" [ngClass]=\"getClassNames('switchLabel')\"\n >AND</label\n >\n </div>\n <div [ngClass]=\"getClassNames('switchControl')\">\n <input\n type=\"radio\"\n [ngClass]=\"getClassNames('switchRadio')\"\n [(ngModel)]=\"data.condition\"\n [disabled]=\"disabled\"\n value=\"or\"\n #orOption\n />\n <label (click)=\"changeCondition(orOption.value)\" [ngClass]=\"getClassNames('switchLabel')\"\n >OR</label\n >\n </div>\n </div>\n </ng-template>\n</div>\n\n<div\n #treeContainer\n (transitionend)=\"transitionEnd($event)\"\n [ngClass]=\"getClassNames('treeContainer', data.collapsed ? 'collapsed' : '')\"\n>\n <ul [ngClass]=\"getClassNames('tree')\" *ngIf=\"data && data.rules\">\n <ng-container *ngFor=\"let rule of data.rules; let i = index\">\n <ng-container\n *ngIf=\"{\n ruleset: !!rule.rules,\n invalid: !config.allowEmptyRulesets && rule.rules && rule.rules.length === 0\n } as local\"\n >\n <li [ngClass]=\"getQueryItemClassName(local)\">\n <ng-container *ngIf=\"!local.ruleset\">\n <ng-container *ngIf=\"getRemoveButtonTemplate() as template; else defaultRemoveButton\">\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getRemoveButtonContext(rule)\"\n ></ng-container>\n </div>\n </ng-container>\n\n <ng-template #defaultRemoveButton>\n <div [ngClass]=\"getClassNames('removeButtonSize', 'rightAlign')\">\n <button\n type=\"button\"\n [ngClass]=\"getClassNames('button', 'removeButton')\"\n (click)=\"removeRule(rule, data)\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('removeIcon')\"></i>\n </button>\n </div>\n </ng-template>\n\n <div *ngIf=\"entities?.length\" class=\"q-inline-block-display\">\n <ng-container *ngIf=\"getEntityTemplate() as template; else defaultEntity\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getEntityContext(rule)\"\n ></ng-container>\n </ng-container>\n </div>\n\n <ng-template #defaultEntity>\n <div [ngClass]=\"getClassNames('entityControlSize')\">\n <select\n [ngClass]=\"getClassNames('entityControl')\"\n [(ngModel)]=\"rule.entity\"\n (ngModelChange)=\"changeEntity($event, rule, i, data)\"\n [disabled]=\"disabled\"\n >\n <option *ngFor=\"let entity of entities\" [ngValue]=\"entity.value\">\n {{ entity.name }}\n </option>\n </select>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"getFieldTemplate() as template; else defaultField\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getFieldContext(rule)\"\n ></ng-container>\n </ng-container>\n\n <ng-template #defaultField>\n <div [ngClass]=\"getClassNames('fieldControlSize')\">\n <select\n [ngClass]=\"getClassNames('fieldControl')\"\n [(ngModel)]=\"rule.field\"\n (ngModelChange)=\"changeField($event, rule)\"\n [disabled]=\"disabled\"\n >\n <option *ngFor=\"let field of getFields(rule.entity)\" [ngValue]=\"field.value\">\n {{ field.name }}\n </option>\n </select>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"getOperatorTemplate() as template; else defaultOperator\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getOperatorContext(rule)\"\n ></ng-container>\n </ng-container>\n\n <ng-template #defaultOperator>\n <div [ngClass]=\"getClassNames('operatorControlSize')\">\n <select\n [ngClass]=\"getClassNames('operatorControl')\"\n [(ngModel)]=\"rule.operator\"\n (ngModelChange)=\"changeOperator(rule)\"\n [disabled]=\"disabled\"\n >\n <option *ngFor=\"let operator of getOperators(rule.field)\" [ngValue]=\"operator\">\n {{ operator }}\n </option>\n </select>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"findTemplateForRule(rule) as template; else defaultInput\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getInputContext(rule)\"\n ></ng-container>\n </ng-container>\n\n <ng-template #defaultInput>\n <div\n [ngClass]=\"getClassNames('inputControlSize')\"\n [ngSwitch]=\"getInputType(rule.field, rule.operator)\"\n >\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'string'\"\n type=\"text\"\n />\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'number'\"\n type=\"number\"\n />\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'date'\"\n type=\"date\"\n />\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'time'\"\n type=\"time\"\n />\n <select\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'category'\"\n >\n <option *ngFor=\"let opt of getOptions(rule.field)\" [ngValue]=\"opt.value\">\n {{ opt.name }}\n </option>\n </select>\n <ng-container *ngSwitchCase=\"'multiselect'\">\n <select\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n multiple\n >\n <option *ngFor=\"let opt of getOptions(rule.field)\" [ngValue]=\"opt.value\">\n {{ opt.name }}\n </option>\n </select>\n </ng-container>\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n *ngSwitchCase=\"'boolean'\"\n type=\"checkbox\"\n />\n </div>\n </ng-template>\n </ng-container>\n <query-builder\n *ngIf=\"local.ruleset\"\n [data]=\"rule\"\n [disabled]=\"disabled\"\n [parentTouchedCallback]=\"parentTouchedCallback || onTouchedCallback\"\n [parentChangeCallback]=\"parentChangeCallback || onChangeCallback\"\n [parentInputTemplates]=\"parentInputTemplates || inputTemplates\"\n [parentOperatorTemplate]=\"parentOperatorTemplate || operatorTemplate\"\n [parentFieldTemplate]=\"parentFieldTemplate || fieldTemplate\"\n [parentEntityTemplate]=\"parentEntityTemplate || entityTemplate\"\n [parentSwitchGroupTemplate]=\"parentSwitchGroupTemplate || switchGroupTemplate\"\n [parentButtonGroupTemplate]=\"parentButtonGroupTemplate || buttonGroupTemplate\"\n [parentRemoveButtonTemplate]=\"parentRemoveButtonTemplate || removeButtonTemplate\"\n [parentEmptyWarningTemplate]=\"parentEmptyWarningTemplate || emptyWarningTemplate\"\n [parentArrowIconTemplate]=\"parentArrowIconTemplate || arrowIconTemplate\"\n [parentValue]=\"data\"\n [classNames]=\"classNames\"\n [config]=\"config\"\n [allowRuleset]=\"allowRuleset\"\n [allowCollapse]=\"allowCollapse\"\n [emptyMessage]=\"emptyMessage\"\n [operatorMap]=\"operatorMap\"\n >\n </query-builder>\n\n <ng-container *ngIf=\"getEmptyWarningTemplate() as template; else defaultEmptyWarning\">\n <ng-container *ngIf=\"local.invalid\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getEmptyWarningContext()\"\n ></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #defaultEmptyWarning>\n <p [ngClass]=\"getClassNames('emptyWarning')\" *ngIf=\"local.invalid\">\n {{ emptyMessage }}\n </p>\n </ng-template>\n </li>\n </ng-container>\n </ng-container>\n </ul>\n</div>\n", styles: ["@charset \"UTF-8\";:host{display:block;width:100%}:host .q-icon{font-style:normal;font-size:12px}:host .q-remove-icon:before{content:\"\\274c\"}:host .q-arrow-icon-button{float:left;margin:4px 6px 4px 0;transform:rotate(90deg);transition:linear .25s transform;cursor:pointer}:host .q-arrow-icon-button.q-collapsed{transform:rotate(0)}:host .q-arrow-icon:before{content:\"\\25b6\"}:host .q-add-icon{color:#555}:host .q-add-icon:before{content:\"\\2795\"}:host .q-remove-button{color:#b3415d;width:31px}:host .q-switch-group,:host .q-button-group{font-family:Lucida Grande,Tahoma,Verdana,sans-serif;overflow:hidden}:host .q-right-align{float:right}:host .q-button{margin-left:8px;padding:0 8px;background-color:#fff}:host .q-button:disabled{display:none}:host .q-control-size{display:inline-block;vertical-align:top;padding-right:10px}:host .q-input-control,:host .q-operator-control,:host .q-field-control,:host .q-entity-control{display:inline-block;padding:5px 8px;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;box-sizing:border-box;width:auto;min-width:180px}:host .q-input-control:disabled,:host .q-operator-control:disabled,:host .q-field-control:disabled,:host .q-entity-control:disabled{border-color:transparent}:host .q-operator-control,:host .q-field-control,:host .q-entity-control,:host .q-input-control:not([type=checkbox]){min-height:32px;-webkit-appearance:none}:host .q-switch-label,:host .q-button{float:left;margin-bottom:0;font-size:14px;line-height:30px;font-weight:400;text-align:center;text-shadow:none;border:1px solid rgba(0,0,0,.2);box-sizing:border-box}:host .q-switch-label:hover,:host .q-button:hover{cursor:pointer;background-color:#f0f0f0}:host .q-switch-label{background-color:#e4e4e4;padding:0 8px}:host .q-switch-radio{position:absolute;clip:rect(0,0,0,0);height:1px;width:1px;border:0;overflow:hidden}:host .q-switch-radio:checked+.q-switch-label{border:1px solid rgb(97,158,215);background:#fff;color:#3176b3}:host .q-switch-radio:disabled+.q-switch-label{display:none}:host .q-switch-radio:checked:disabled+.q-switch-label{display:initial;color:initial;cursor:default;border-color:transparent}:host .q-invalid-ruleset{border:1px solid rgba(179,65,93,.5)!important;background:#b3415d1a!important}:host .q-empty-warning{color:#8d252e;text-align:center}:host .q-ruleset{border:1px solid #ccc}:host .q-rule{border:1px solid #ccc;background:#fff}:host .q-transition{-webkit-transition:all .1s ease-in-out;-moz-transition:all .1s ease-in-out;-ms-transition:all .1s ease-in-out;-o-transition:all .1s ease-in-out;transition:all .1s ease-in-out}:host .q-tree-container{width:100%;overflow:hidden;transition:ease-in .25s max-height}:host .q-tree-container.q-collapsed{max-height:0!important}:host .q-tree{list-style:none;margin:4px 0 2px}:host .q-row{padding:6px 8px;margin-top:6px}:host .q-connector{position:relative}:host .q-connector:before{top:-5px;border-width:0 0 2px 2px}:host .q-connector:after{border-width:0 0 0 2px;top:50%}:host .q-connector:before,:host .q-connector:after{content:\"\";left:-12px;border-color:#ccc;border-style:solid;width:9px;height:calc(50% + 6px);position:absolute}:host .q-connector:last-child:after{content:none}:host .q-inline-block-display{display:inline-block;vertical-align:top}\n"] }]
822
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { disabled: [{
823
- type: Input
824
- }], data: [{
825
- type: Input
826
- }], condition: [{
827
- type: HostBinding,
828
- args: ["attr.query-builder-condition"]
829
- }], allowRuleset: [{
830
- type: Input
831
- }], allowCollapse: [{
832
- type: Input
833
- }], emptyMessage: [{
834
- type: Input
835
- }], classNames: [{
836
- type: Input
837
- }], operatorMap: [{
838
- type: Input
839
- }], parentValue: [{
840
- type: Input
841
- }], config: [{
842
- type: Input
843
- }], parentArrowIconTemplate: [{
844
- type: Input
845
- }], parentInputTemplates: [{
846
- type: Input
847
- }], parentOperatorTemplate: [{
848
- type: Input
849
- }], parentFieldTemplate: [{
850
- type: Input
851
- }], parentEntityTemplate: [{
852
- type: Input
853
- }], parentSwitchGroupTemplate: [{
854
- type: Input
855
- }], parentButtonGroupTemplate: [{
856
- type: Input
857
- }], parentRemoveButtonTemplate: [{
858
- type: Input
859
- }], parentEmptyWarningTemplate: [{
860
- type: Input
861
- }], parentChangeCallback: [{
862
- type: Input
863
- }], parentTouchedCallback: [{
864
- type: Input
865
- }], persistValueOnFieldChange: [{
866
- type: Input
867
- }], treeContainer: [{
868
- type: ViewChild,
869
- args: ["treeContainer", { static: true }]
870
- }], buttonGroupTemplate: [{
871
- type: ContentChild,
872
- args: [QueryButtonGroupDirective]
873
- }], switchGroupTemplate: [{
874
- type: ContentChild,
875
- args: [QuerySwitchGroupDirective]
876
- }], fieldTemplate: [{
877
- type: ContentChild,
878
- args: [QueryFieldDirective]
879
- }], entityTemplate: [{
880
- type: ContentChild,
881
- args: [QueryEntityDirective]
882
- }], operatorTemplate: [{
883
- type: ContentChild,
884
- args: [QueryOperatorDirective]
885
- }], removeButtonTemplate: [{
886
- type: ContentChild,
887
- args: [QueryRemoveButtonDirective]
888
- }], emptyWarningTemplate: [{
889
- type: ContentChild,
890
- args: [QueryEmptyWarningDirective]
891
- }], inputTemplates: [{
892
- type: ContentChildren,
893
- args: [QueryInputDirective, { descendants: true }]
894
- }], arrowIconTemplate: [{
895
- type: ContentChild,
896
- args: [QueryArrowIconDirective]
897
- }], value: [{
898
- type: Input
899
- }] } });
900
-
901
- class NgxAngularQueryBuilderModule {
902
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: NgxAngularQueryBuilderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
903
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.35", ngImport: i0, type: NgxAngularQueryBuilderModule, declarations: [QueryBuilderComponent,
904
- QueryInputDirective,
905
- QueryOperatorDirective,
906
- QueryFieldDirective,
907
- QueryEntityDirective,
908
- QueryButtonGroupDirective,
909
- QuerySwitchGroupDirective,
910
- QueryRemoveButtonDirective,
911
- QueryEmptyWarningDirective,
912
- QueryArrowIconDirective], imports: [CommonModule, FormsModule], exports: [QueryBuilderComponent,
913
- QueryInputDirective,
914
- QueryOperatorDirective,
915
- QueryFieldDirective,
916
- QueryEntityDirective,
917
- QueryButtonGroupDirective,
918
- QuerySwitchGroupDirective,
919
- QueryRemoveButtonDirective,
920
- QueryEmptyWarningDirective,
921
- QueryArrowIconDirective] }); }
922
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: NgxAngularQueryBuilderModule, imports: [CommonModule, FormsModule] }); }
923
- }
924
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: NgxAngularQueryBuilderModule, decorators: [{
925
- type: NgModule,
926
- args: [{
927
- imports: [CommonModule, FormsModule],
928
- declarations: [
929
- QueryBuilderComponent,
930
- QueryInputDirective,
931
- QueryOperatorDirective,
932
- QueryFieldDirective,
933
- QueryEntityDirective,
934
- QueryButtonGroupDirective,
935
- QuerySwitchGroupDirective,
936
- QueryRemoveButtonDirective,
937
- QueryEmptyWarningDirective,
938
- QueryArrowIconDirective
939
- ],
940
- exports: [
941
- QueryBuilderComponent,
942
- QueryInputDirective,
943
- QueryOperatorDirective,
944
- QueryFieldDirective,
945
- QueryEntityDirective,
946
- QueryButtonGroupDirective,
947
- QuerySwitchGroupDirective,
948
- QueryRemoveButtonDirective,
949
- QueryEmptyWarningDirective,
950
- QueryArrowIconDirective
951
- ]
952
- }]
953
- }] });
954
-
955
- /*
956
- * Public API Surface of ngx-angular-query-builder
957
- */
958
-
959
- /**
960
- * Generated bundle index. Do not edit.
961
- */
962
-
377
+ var QueryBuilderComponent = class QueryBuilderComponent {
378
+ get condition() {
379
+ return this.data?.condition;
380
+ }
381
+ constructor(changeDetectorRef) {
382
+ this.changeDetectorRef = changeDetectorRef;
383
+ this.defaultClassNames = {
384
+ arrowIconButton: "q-arrow-icon-button",
385
+ arrowIcon: "q-icon q-arrow-icon",
386
+ removeIcon: "q-icon q-remove-icon",
387
+ addIcon: "q-icon q-add-icon",
388
+ button: "q-button",
389
+ buttonGroup: "q-button-group",
390
+ removeButton: "q-remove-button",
391
+ switchGroup: "q-switch-group",
392
+ switchLabel: "q-switch-label",
393
+ switchRadio: "q-switch-radio",
394
+ rightAlign: "q-right-align",
395
+ transition: "q-transition",
396
+ collapsed: "q-collapsed",
397
+ treeContainer: "q-tree-container",
398
+ tree: "q-tree",
399
+ row: "q-row",
400
+ connector: "q-connector",
401
+ rule: "q-rule",
402
+ ruleSet: "q-ruleset",
403
+ invalidRuleSet: "q-invalid-ruleset",
404
+ emptyWarning: "q-empty-warning",
405
+ fieldControl: "q-field-control",
406
+ fieldControlSize: "q-control-size",
407
+ entityControl: "q-entity-control",
408
+ entityControlSize: "q-control-size",
409
+ operatorControl: "q-operator-control",
410
+ operatorControlSize: "q-control-size",
411
+ inputControl: "q-input-control",
412
+ inputControlSize: "q-control-size"
413
+ };
414
+ this.defaultOperatorMap = {
415
+ string: [
416
+ "=",
417
+ "!=",
418
+ "contains",
419
+ "like"
420
+ ],
421
+ number: [
422
+ "=",
423
+ "!=",
424
+ ">",
425
+ ">=",
426
+ "<",
427
+ "<="
428
+ ],
429
+ time: [
430
+ "=",
431
+ "!=",
432
+ ">",
433
+ ">=",
434
+ "<",
435
+ "<="
436
+ ],
437
+ date: [
438
+ "=",
439
+ "!=",
440
+ ">",
441
+ ">=",
442
+ "<",
443
+ "<="
444
+ ],
445
+ category: [
446
+ "=",
447
+ "!=",
448
+ "in",
449
+ "not in"
450
+ ],
451
+ boolean: ["="]
452
+ };
453
+ this.disabled = false;
454
+ this.data = {
455
+ condition: "and",
456
+ rules: []
457
+ };
458
+ this.allowRuleset = true;
459
+ this.allowCollapse = false;
460
+ this.emptyMessage = "A ruleset cannot be empty. Please add a rule or remove it all together.";
461
+ this.classNames = {};
462
+ this.operatorMap = {};
463
+ this.config = { fields: {} };
464
+ this.persistValueOnFieldChange = false;
465
+ this.defaultTemplateTypes = [
466
+ "string",
467
+ "number",
468
+ "time",
469
+ "date",
470
+ "category",
471
+ "boolean",
472
+ "multiselect"
473
+ ];
474
+ this.defaultPersistValueTypes = [
475
+ "string",
476
+ "number",
477
+ "time",
478
+ "date",
479
+ "boolean"
480
+ ];
481
+ this.defaultEmptyList = [];
482
+ this.operatorsCache = {};
483
+ this.inputContextCache = /* @__PURE__ */ new Map();
484
+ this.operatorContextCache = /* @__PURE__ */ new Map();
485
+ this.fieldContextCache = /* @__PURE__ */ new Map();
486
+ this.entityContextCache = /* @__PURE__ */ new Map();
487
+ this.removeButtonContextCache = /* @__PURE__ */ new Map();
488
+ this.getDisabledState = () => {
489
+ return this.disabled;
490
+ };
491
+ this.fields = [];
492
+ this.filterFields = [];
493
+ this.entities = [];
494
+ }
495
+ ngOnChanges(changes) {
496
+ const config = this.config;
497
+ const type = typeof config;
498
+ if (type === "object") {
499
+ this.fields = Object.keys(config.fields).map((value) => {
500
+ const field = config.fields[value];
501
+ field.value = field.value || value;
502
+ return field;
503
+ });
504
+ if (config.entities) this.entities = Object.keys(config.entities).map((value) => {
505
+ const entity = config.entities ? config.entities[value] : [];
506
+ entity.value = entity.value || value;
507
+ return entity;
508
+ });
509
+ else this.entities = [];
510
+ this.operatorsCache = {};
511
+ } else throw new Error(`Expected 'config' must be a valid object, got ${type} instead.`);
512
+ }
513
+ validate(control) {
514
+ const errors = {};
515
+ const ruleErrorStore = [];
516
+ let hasErrors = false;
517
+ if (!this.config.allowEmptyRulesets && this.checkEmptyRuleInRuleset(this.data)) {
518
+ errors.empty = "Empty rulesets are not allowed.";
519
+ hasErrors = true;
520
+ }
521
+ this.validateRulesInRuleset(this.data, ruleErrorStore);
522
+ if (ruleErrorStore.length) {
523
+ errors.rules = ruleErrorStore;
524
+ hasErrors = true;
525
+ }
526
+ return hasErrors ? errors : null;
527
+ }
528
+ get value() {
529
+ return this.data;
530
+ }
531
+ set value(value) {
532
+ this.data = value || {
533
+ condition: "and",
534
+ rules: []
535
+ };
536
+ this.handleDataChange();
537
+ }
538
+ writeValue(obj) {
539
+ this.value = obj;
540
+ }
541
+ registerOnChange(fn) {
542
+ this.onChangeCallback = () => fn(this.data);
543
+ }
544
+ registerOnTouched(fn) {
545
+ this.onTouchedCallback = () => fn(this.data);
546
+ }
547
+ setDisabledState(isDisabled) {
548
+ this.disabled = isDisabled;
549
+ this.changeDetectorRef.detectChanges();
550
+ }
551
+ findTemplateForRule(rule) {
552
+ const type = this.getInputType(rule.field, rule.operator);
553
+ if (type) {
554
+ const queryInput = this.findQueryInput(type);
555
+ if (queryInput) return queryInput.template;
556
+ else {
557
+ if (this.defaultTemplateTypes.indexOf(type) === -1) console.warn(`Could not find template for field with type: ${type}`);
558
+ return null;
559
+ }
560
+ }
561
+ }
562
+ findQueryInput(type) {
563
+ return (this.parentInputTemplates || this.inputTemplates || []).find((item) => item.queryInputType === type);
564
+ }
565
+ getOperators(field) {
566
+ if (this.operatorsCache[field]) return this.operatorsCache[field];
567
+ let operators = this.defaultEmptyList;
568
+ const fieldObject = this.config.fields[field];
569
+ if (this.config.getOperators) return this.config.getOperators(field, fieldObject);
570
+ const type = fieldObject.type;
571
+ if (fieldObject && fieldObject.operators) operators = fieldObject.operators;
572
+ else if (type) {
573
+ operators = this.operatorMap && this.operatorMap[type] || this.defaultOperatorMap[type] || this.defaultEmptyList;
574
+ if (operators.length === 0) console.warn(`No operators found for field '${field}' with type ${fieldObject.type}. Please define an 'operators' property on the field or use the 'operatorMap' binding to fix this.`);
575
+ if (fieldObject.nullable) operators = operators.concat(["is null", "is not null"]);
576
+ } else console.warn(`No 'type' property found on field: '${field}'`);
577
+ this.operatorsCache[field] = operators;
578
+ return operators;
579
+ }
580
+ getFields(entity) {
581
+ if (this.entities?.length && entity) return this.fields.filter((field) => {
582
+ return field && field.entity === entity;
583
+ });
584
+ else return this.fields;
585
+ }
586
+ getInputType(field, operator) {
587
+ if (this.config.getInputType) return this.config.getInputType(field, operator);
588
+ if (!this.config.fields[field]) throw new Error(`No configuration for field '${field}' could be found! Please add it to config.fields.`);
589
+ const type = this.config.fields[field].type;
590
+ switch (operator) {
591
+ case "is null":
592
+ case "is not null": return null;
593
+ case "in":
594
+ case "not in": return type === "category" || type === "boolean" ? "multiselect" : type;
595
+ default: return type;
596
+ }
597
+ }
598
+ getOptions(field) {
599
+ if (this.config.getOptions) return this.config.getOptions(field);
600
+ return this.config.fields[field].options || this.defaultEmptyList;
601
+ }
602
+ getClassNames(...args) {
603
+ const clsLookup = this.classNames ? this.classNames : this.defaultClassNames;
604
+ const defaultClassNames = this.defaultClassNames;
605
+ const classNames = args.map((id) => clsLookup[id] || defaultClassNames[id]).filter((c) => !!c);
606
+ return classNames.length ? classNames.join(" ") : [];
607
+ }
608
+ getDefaultField(entity) {
609
+ if (!entity) return null;
610
+ else if (entity.defaultField !== void 0) return this.getDefaultValue(entity.defaultField);
611
+ else {
612
+ const entityFields = this.fields.filter((field) => {
613
+ return field && field.entity === entity.value;
614
+ });
615
+ if (entityFields && entityFields.length) return entityFields[0];
616
+ else {
617
+ console.warn(`No fields found for entity '${entity.name}'. A 'defaultOperator' is also not specified on the field config. Operator value will default to null.`);
618
+ return null;
619
+ }
620
+ }
621
+ }
622
+ getDefaultOperator(field) {
623
+ if (field && field.defaultOperator !== void 0) return this.getDefaultValue(field.defaultOperator);
624
+ else {
625
+ const operators = this.getOperators(field.value);
626
+ if (operators && operators.length) return operators[0];
627
+ else {
628
+ console.warn(`No operators found for field '${field.value}'. A 'defaultOperator' is also not specified on the field config. Operator value will default to null.`);
629
+ return null;
630
+ }
631
+ }
632
+ }
633
+ addRule(parent) {
634
+ if (this.disabled) return;
635
+ parent = parent || this.data;
636
+ if (this.config.addRule) this.config.addRule(parent);
637
+ else {
638
+ const field = this.fields[0];
639
+ parent.rules = parent.rules.concat([{
640
+ field: field.value,
641
+ operator: this.getDefaultOperator(field),
642
+ value: this.getDefaultValue(field.defaultValue),
643
+ entity: field.entity
644
+ }]);
645
+ }
646
+ this.handleTouched();
647
+ this.handleDataChange();
648
+ }
649
+ removeRule(rule, parent) {
650
+ if (this.disabled) return;
651
+ parent = parent || this.data;
652
+ if (this.config.removeRule) this.config.removeRule(rule, parent);
653
+ else parent.rules = parent.rules.filter((r) => r !== rule);
654
+ this.inputContextCache.delete(rule);
655
+ this.operatorContextCache.delete(rule);
656
+ this.fieldContextCache.delete(rule);
657
+ this.entityContextCache.delete(rule);
658
+ this.removeButtonContextCache.delete(rule);
659
+ this.handleTouched();
660
+ this.handleDataChange();
661
+ }
662
+ addRuleSet(parent) {
663
+ if (this.disabled) return;
664
+ parent = parent || this.data;
665
+ if (this.config.addRuleSet) this.config.addRuleSet(parent);
666
+ else parent.rules = parent.rules.concat([{
667
+ condition: "and",
668
+ rules: []
669
+ }]);
670
+ this.handleTouched();
671
+ this.handleDataChange();
672
+ }
673
+ removeRuleSet(ruleset, parent) {
674
+ if (this.disabled) return;
675
+ ruleset = ruleset || this.data;
676
+ parent = parent || this.parentValue;
677
+ if (this.config.removeRuleSet) this.config.removeRuleSet(ruleset, parent);
678
+ else if (parent) parent.rules = parent.rules.filter((r) => r !== ruleset);
679
+ this.handleTouched();
680
+ this.handleDataChange();
681
+ }
682
+ transitionEnd(e) {
683
+ this.treeContainer.nativeElement.style.maxHeight = null;
684
+ }
685
+ toggleCollapse() {
686
+ this.computedTreeContainerHeight();
687
+ setTimeout(() => {
688
+ this.data.collapsed = !this.data.collapsed;
689
+ }, 100);
690
+ }
691
+ computedTreeContainerHeight() {
692
+ const nativeElement = this.treeContainer.nativeElement;
693
+ if (nativeElement && nativeElement.firstElementChild) nativeElement.style.maxHeight = nativeElement.firstElementChild.clientHeight + 8 + "px";
694
+ }
695
+ changeCondition(value) {
696
+ if (this.disabled) return;
697
+ this.data.condition = value;
698
+ this.handleTouched();
699
+ this.handleDataChange();
700
+ }
701
+ changeOperator(rule) {
702
+ if (this.disabled) return;
703
+ if (this.config.coerceValueForOperator) rule.value = this.config.coerceValueForOperator(rule.operator, rule.value, rule);
704
+ else rule.value = this.coerceValueForOperator(rule.operator, rule.value, rule);
705
+ this.handleTouched();
706
+ this.handleDataChange();
707
+ }
708
+ coerceValueForOperator(operator, value, rule) {
709
+ if (this.getInputType(rule.field, operator) === "multiselect" && !Array.isArray(value)) return [value];
710
+ return value;
711
+ }
712
+ changeInput() {
713
+ if (this.disabled) return;
714
+ this.handleTouched();
715
+ this.handleDataChange();
716
+ }
717
+ changeField(fieldValue, rule) {
718
+ if (this.disabled) return;
719
+ const inputContext = this.inputContextCache.get(rule);
720
+ const currentField = inputContext && inputContext.field;
721
+ const nextField = this.config.fields[fieldValue];
722
+ const nextValue = this.calculateFieldChangeValue(currentField, nextField, rule.value);
723
+ if (nextValue !== void 0) rule.value = nextValue;
724
+ else delete rule.value;
725
+ rule.operator = this.getDefaultOperator(nextField);
726
+ this.inputContextCache.delete(rule);
727
+ this.operatorContextCache.delete(rule);
728
+ this.fieldContextCache.delete(rule);
729
+ this.entityContextCache.delete(rule);
730
+ this.getInputContext(rule);
731
+ this.getFieldContext(rule);
732
+ this.getOperatorContext(rule);
733
+ this.getEntityContext(rule);
734
+ this.handleTouched();
735
+ this.handleDataChange();
736
+ }
737
+ changeEntity(entityValue, rule, index, data) {
738
+ if (this.disabled) return;
739
+ let i = index;
740
+ let rs = data;
741
+ const entity = this.entities.find((e) => e.value === entityValue);
742
+ const defaultField = this.getDefaultField(entity);
743
+ if (!rs) {
744
+ rs = this.data;
745
+ i = rs.rules.findIndex((x) => x === rule);
746
+ }
747
+ rule.field = defaultField.value;
748
+ rs.rules[i] = rule;
749
+ if (defaultField) this.changeField(defaultField.value, rule);
750
+ else {
751
+ this.handleTouched();
752
+ this.handleDataChange();
753
+ }
754
+ }
755
+ getDefaultValue(defaultValue) {
756
+ switch (typeof defaultValue) {
757
+ case "function": return defaultValue();
758
+ default: return defaultValue;
759
+ }
760
+ }
761
+ getOperatorTemplate() {
762
+ const t = this.parentOperatorTemplate || this.operatorTemplate;
763
+ return t ? t.template : null;
764
+ }
765
+ getFieldTemplate() {
766
+ const t = this.parentFieldTemplate || this.fieldTemplate;
767
+ return t ? t.template : null;
768
+ }
769
+ getEntityTemplate() {
770
+ const t = this.parentEntityTemplate || this.entityTemplate;
771
+ return t ? t.template : null;
772
+ }
773
+ getArrowIconTemplate() {
774
+ const t = this.parentArrowIconTemplate || this.arrowIconTemplate;
775
+ return t ? t.template : null;
776
+ }
777
+ getButtonGroupTemplate() {
778
+ const t = this.parentButtonGroupTemplate || this.buttonGroupTemplate;
779
+ return t ? t.template : null;
780
+ }
781
+ getSwitchGroupTemplate() {
782
+ const t = this.parentSwitchGroupTemplate || this.switchGroupTemplate;
783
+ return t ? t.template : null;
784
+ }
785
+ getRemoveButtonTemplate() {
786
+ const t = this.parentRemoveButtonTemplate || this.removeButtonTemplate;
787
+ return t ? t.template : null;
788
+ }
789
+ getEmptyWarningTemplate() {
790
+ const t = this.parentEmptyWarningTemplate || this.emptyWarningTemplate;
791
+ return t ? t.template : null;
792
+ }
793
+ getQueryItemClassName(local) {
794
+ let cls = this.getClassNames("row", "connector", "transition");
795
+ cls += " " + this.getClassNames(local.ruleset ? "ruleSet" : "rule");
796
+ if (local.invalid) cls += " " + this.getClassNames("invalidRuleSet");
797
+ return cls;
798
+ }
799
+ getButtonGroupContext() {
800
+ if (!this.buttonGroupContext) this.buttonGroupContext = {
801
+ addRule: this.addRule.bind(this),
802
+ addRuleSet: this.allowRuleset && this.addRuleSet.bind(this),
803
+ removeRuleSet: this.allowRuleset && this.parentValue && this.removeRuleSet.bind(this),
804
+ getDisabledState: this.getDisabledState,
805
+ $implicit: this.data
806
+ };
807
+ return this.buttonGroupContext;
808
+ }
809
+ getRemoveButtonContext(rule) {
810
+ if (!this.removeButtonContextCache.has(rule)) this.removeButtonContextCache.set(rule, {
811
+ removeRule: this.removeRule.bind(this),
812
+ getDisabledState: this.getDisabledState,
813
+ $implicit: rule
814
+ });
815
+ return this.removeButtonContextCache.get(rule);
816
+ }
817
+ getFieldContext(rule) {
818
+ if (!this.fieldContextCache.has(rule)) this.fieldContextCache.set(rule, {
819
+ onChange: this.changeField.bind(this),
820
+ getFields: this.getFields.bind(this),
821
+ getDisabledState: this.getDisabledState,
822
+ fields: this.fields,
823
+ $implicit: rule
824
+ });
825
+ return this.fieldContextCache.get(rule);
826
+ }
827
+ getEntityContext(rule) {
828
+ if (!this.entityContextCache.has(rule)) this.entityContextCache.set(rule, {
829
+ onChange: this.changeEntity.bind(this),
830
+ getDisabledState: this.getDisabledState,
831
+ entities: this.entities,
832
+ $implicit: rule
833
+ });
834
+ return this.entityContextCache.get(rule);
835
+ }
836
+ getSwitchGroupContext() {
837
+ return {
838
+ onChange: this.changeCondition.bind(this),
839
+ getDisabledState: this.getDisabledState,
840
+ $implicit: this.data
841
+ };
842
+ }
843
+ getArrowIconContext() {
844
+ return {
845
+ getDisabledState: this.getDisabledState,
846
+ $implicit: this.data
847
+ };
848
+ }
849
+ getEmptyWarningContext() {
850
+ return {
851
+ getDisabledState: this.getDisabledState,
852
+ message: this.emptyMessage,
853
+ $implicit: this.data
854
+ };
855
+ }
856
+ getOperatorContext(rule) {
857
+ if (!this.operatorContextCache.has(rule)) this.operatorContextCache.set(rule, {
858
+ onChange: this.changeOperator.bind(this),
859
+ getDisabledState: this.getDisabledState,
860
+ operators: this.getOperators(rule.field),
861
+ $implicit: rule
862
+ });
863
+ return this.operatorContextCache.get(rule);
864
+ }
865
+ getInputContext(rule) {
866
+ if (!this.inputContextCache.has(rule)) this.inputContextCache.set(rule, {
867
+ onChange: this.changeInput.bind(this),
868
+ getDisabledState: this.getDisabledState,
869
+ options: this.getOptions(rule.field),
870
+ field: this.config.fields[rule.field],
871
+ $implicit: rule
872
+ });
873
+ return this.inputContextCache.get(rule);
874
+ }
875
+ calculateFieldChangeValue(currentField, nextField, currentValue) {
876
+ if (this.config.calculateFieldChangeValue != null) return this.config.calculateFieldChangeValue(currentField, nextField, currentValue);
877
+ const canKeepValue = () => {
878
+ if (currentField == null || nextField == null) return false;
879
+ return currentField.type === nextField.type && this.defaultPersistValueTypes.indexOf(currentField.type) !== -1;
880
+ };
881
+ if (this.persistValueOnFieldChange && canKeepValue()) return currentValue;
882
+ if (nextField && nextField.defaultValue !== void 0) return this.getDefaultValue(nextField.defaultValue);
883
+ }
884
+ checkEmptyRuleInRuleset(ruleset) {
885
+ if (!ruleset || !ruleset.rules || ruleset.rules.length === 0) return true;
886
+ else return ruleset.rules.some((item) => {
887
+ if (item.rules) return this.checkEmptyRuleInRuleset(item);
888
+ else return false;
889
+ });
890
+ }
891
+ validateRulesInRuleset(ruleset, errorStore) {
892
+ if (ruleset && ruleset.rules && ruleset.rules.length > 0) ruleset.rules.forEach((item) => {
893
+ if (item.rules) return this.validateRulesInRuleset(item, errorStore);
894
+ else if (item.field) {
895
+ const field = this.config.fields[item.field];
896
+ if (field && field.validator) {
897
+ const error = field.validator(item, ruleset);
898
+ if (error != null) errorStore.push(error);
899
+ }
900
+ }
901
+ });
902
+ }
903
+ handleDataChange() {
904
+ this.changeDetectorRef.markForCheck();
905
+ if (this.onChangeCallback) this.onChangeCallback();
906
+ if (this.parentChangeCallback) this.parentChangeCallback();
907
+ }
908
+ handleTouched() {
909
+ if (this.onTouchedCallback) this.onTouchedCallback();
910
+ if (this.parentTouchedCallback) this.parentTouchedCallback();
911
+ }
912
+ static {
913
+ this.ɵfac = i0.ɵɵngDeclareFactory({
914
+ minVersion: "12.0.0",
915
+ version: "22.3.0",
916
+ ngImport: i0,
917
+ type: QueryBuilderComponent,
918
+ deps: [{ token: i0.ChangeDetectorRef }],
919
+ target: i0.ɵɵFactoryTarget.Component
920
+ });
921
+ }
922
+ static {
923
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
924
+ minVersion: "17.0.0",
925
+ version: "22.3.0",
926
+ type: QueryBuilderComponent,
927
+ isStandalone: false,
928
+ selector: "query-builder",
929
+ inputs: {
930
+ disabled: "disabled",
931
+ data: "data",
932
+ allowRuleset: "allowRuleset",
933
+ allowCollapse: "allowCollapse",
934
+ emptyMessage: "emptyMessage",
935
+ classNames: "classNames",
936
+ operatorMap: "operatorMap",
937
+ parentValue: "parentValue",
938
+ config: "config",
939
+ parentArrowIconTemplate: "parentArrowIconTemplate",
940
+ parentInputTemplates: "parentInputTemplates",
941
+ parentOperatorTemplate: "parentOperatorTemplate",
942
+ parentFieldTemplate: "parentFieldTemplate",
943
+ parentEntityTemplate: "parentEntityTemplate",
944
+ parentSwitchGroupTemplate: "parentSwitchGroupTemplate",
945
+ parentButtonGroupTemplate: "parentButtonGroupTemplate",
946
+ parentRemoveButtonTemplate: "parentRemoveButtonTemplate",
947
+ parentEmptyWarningTemplate: "parentEmptyWarningTemplate",
948
+ parentChangeCallback: "parentChangeCallback",
949
+ parentTouchedCallback: "parentTouchedCallback",
950
+ persistValueOnFieldChange: "persistValueOnFieldChange",
951
+ value: "value"
952
+ },
953
+ host: { properties: { "attr.query-builder-condition": "this.condition" } },
954
+ providers: [CONTROL_VALUE_ACCESSOR, VALIDATOR],
955
+ queries: [
956
+ {
957
+ propertyName: "buttonGroupTemplate",
958
+ first: true,
959
+ predicate: QueryButtonGroupDirective,
960
+ descendants: true
961
+ },
962
+ {
963
+ propertyName: "switchGroupTemplate",
964
+ first: true,
965
+ predicate: QuerySwitchGroupDirective,
966
+ descendants: true
967
+ },
968
+ {
969
+ propertyName: "fieldTemplate",
970
+ first: true,
971
+ predicate: QueryFieldDirective,
972
+ descendants: true
973
+ },
974
+ {
975
+ propertyName: "entityTemplate",
976
+ first: true,
977
+ predicate: QueryEntityDirective,
978
+ descendants: true
979
+ },
980
+ {
981
+ propertyName: "operatorTemplate",
982
+ first: true,
983
+ predicate: QueryOperatorDirective,
984
+ descendants: true
985
+ },
986
+ {
987
+ propertyName: "removeButtonTemplate",
988
+ first: true,
989
+ predicate: QueryRemoveButtonDirective,
990
+ descendants: true
991
+ },
992
+ {
993
+ propertyName: "emptyWarningTemplate",
994
+ first: true,
995
+ predicate: QueryEmptyWarningDirective,
996
+ descendants: true
997
+ },
998
+ {
999
+ propertyName: "arrowIconTemplate",
1000
+ first: true,
1001
+ predicate: QueryArrowIconDirective,
1002
+ descendants: true
1003
+ },
1004
+ {
1005
+ propertyName: "inputTemplates",
1006
+ predicate: QueryInputDirective,
1007
+ descendants: true
1008
+ }
1009
+ ],
1010
+ viewQueries: [{
1011
+ propertyName: "treeContainer",
1012
+ first: true,
1013
+ predicate: ["treeContainer"],
1014
+ descendants: true,
1015
+ static: true
1016
+ }],
1017
+ usesOnChanges: true,
1018
+ ngImport: i0,
1019
+ template: "<div [ngClass]=\"getClassNames('switchRow')\">\n @if (allowCollapse) {\n <a\n (click)=\"toggleCollapse()\"\n [ngClass]=\"getClassNames('arrowIconButton', data.collapsed ? 'collapsed' : '')\"\n >\n @if (getArrowIconTemplate(); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: getArrowIconContext()\"></ng-container>\n } @else {\n <i [ngClass]=\"getClassNames('arrowIcon')\"></i>\n }\n </a>\n }\n\n @if (getButtonGroupTemplate(); as template) {\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <ng-container *ngTemplateOutlet=\"template; context: getButtonGroupContext()\"></ng-container>\n </div>\n } @else {\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <button\n type=\"button\"\n (click)=\"addRule()\"\n [ngClass]=\"getClassNames('button')\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('addIcon')\"></i> Rule\n </button>\n @if (allowRuleset) {\n <button\n type=\"button\"\n (click)=\"addRuleSet()\"\n [ngClass]=\"getClassNames('button')\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('addIcon')\"></i> Ruleset\n </button>\n }\n @if (!!parentValue && allowRuleset) {\n <button\n type=\"button\"\n (click)=\"removeRuleSet()\"\n [ngClass]=\"getClassNames('button', 'removeButton')\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('removeIcon')\"></i>\n </button>\n }\n </div>\n }\n\n @if (getSwitchGroupTemplate(); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: getSwitchGroupContext()\"></ng-container>\n } @else {\n @if (data) {\n <div [ngClass]=\"getClassNames('switchGroup', 'transition')\">\n <div [ngClass]=\"getClassNames('switchControl')\">\n <input\n type=\"radio\"\n [ngClass]=\"getClassNames('switchRadio')\"\n [(ngModel)]=\"data.condition\"\n [disabled]=\"disabled\"\n value=\"and\"\n #andOption\n />\n <label (click)=\"changeCondition(andOption.value)\" [ngClass]=\"getClassNames('switchLabel')\"\n >AND</label\n >\n </div>\n <div [ngClass]=\"getClassNames('switchControl')\">\n <input\n type=\"radio\"\n [ngClass]=\"getClassNames('switchRadio')\"\n [(ngModel)]=\"data.condition\"\n [disabled]=\"disabled\"\n value=\"or\"\n #orOption\n />\n <label (click)=\"changeCondition(orOption.value)\" [ngClass]=\"getClassNames('switchLabel')\"\n >OR</label\n >\n </div>\n </div>\n }\n }\n</div>\n\n<div\n #treeContainer\n (transitionend)=\"transitionEnd($event)\"\n [ngClass]=\"getClassNames('treeContainer', data.collapsed ? 'collapsed' : '')\"\n>\n @if (data && data.rules) {\n <ul [ngClass]=\"getClassNames('tree')\">\n @for (rule of data.rules; track rule; let i = $index) {\n @if (\n {\n ruleset: !!rule.rules,\n invalid: !config.allowEmptyRulesets && rule.rules && rule.rules.length === 0\n };\n as local\n ) {\n <li [ngClass]=\"getQueryItemClassName(local)\">\n @if (!local.ruleset) {\n @if (getRemoveButtonTemplate(); as template) {\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getRemoveButtonContext(rule)\"\n ></ng-container>\n </div>\n } @else {\n <div [ngClass]=\"getClassNames('removeButtonSize', 'rightAlign')\">\n <button\n type=\"button\"\n [ngClass]=\"getClassNames('button', 'removeButton')\"\n (click)=\"removeRule(rule, data)\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('removeIcon')\"></i>\n </button>\n </div>\n }\n @if (entities?.length) {\n <div class=\"q-inline-block-display\">\n @if (getEntityTemplate(); as template) {\n <ng-container\n *ngTemplateOutlet=\"template; context: getEntityContext(rule)\"\n ></ng-container>\n } @else {\n <div [ngClass]=\"getClassNames('entityControlSize')\">\n <select\n [ngClass]=\"getClassNames('entityControl')\"\n [(ngModel)]=\"rule.entity\"\n (ngModelChange)=\"changeEntity($event, rule, i, data)\"\n [disabled]=\"disabled\"\n >\n @for (entity of entities; track entity) {\n <option [ngValue]=\"entity.value\">\n {{ entity.name }}\n </option>\n }\n </select>\n </div>\n }\n </div>\n }\n @if (getFieldTemplate(); as template) {\n <ng-container\n *ngTemplateOutlet=\"template; context: getFieldContext(rule)\"\n ></ng-container>\n } @else {\n <div [ngClass]=\"getClassNames('fieldControlSize')\">\n <select\n [ngClass]=\"getClassNames('fieldControl')\"\n [(ngModel)]=\"rule.field\"\n (ngModelChange)=\"changeField($event, rule)\"\n [disabled]=\"disabled\"\n >\n @for (field of getFields(rule.entity); track field) {\n <option [ngValue]=\"field.value\">\n {{ field.name }}\n </option>\n }\n </select>\n </div>\n }\n @if (getOperatorTemplate(); as template) {\n <ng-container\n *ngTemplateOutlet=\"template; context: getOperatorContext(rule)\"\n ></ng-container>\n } @else {\n <div [ngClass]=\"getClassNames('operatorControlSize')\">\n <select\n [ngClass]=\"getClassNames('operatorControl')\"\n [(ngModel)]=\"rule.operator\"\n (ngModelChange)=\"changeOperator(rule)\"\n [disabled]=\"disabled\"\n >\n @for (operator of getOperators(rule.field); track operator) {\n <option [ngValue]=\"operator\">\n {{ operator }}\n </option>\n }\n </select>\n </div>\n }\n @if (findTemplateForRule(rule); as template) {\n <ng-container\n *ngTemplateOutlet=\"template; context: getInputContext(rule)\"\n ></ng-container>\n } @else {\n <div [ngClass]=\"getClassNames('inputControlSize')\">\n @switch (getInputType(rule.field, rule.operator)) {\n @case (\"string\") {\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n type=\"text\"\n />\n }\n @case (\"number\") {\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n type=\"number\"\n />\n }\n @case (\"date\") {\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n type=\"date\"\n />\n }\n @case (\"time\") {\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n type=\"time\"\n />\n }\n @case (\"category\") {\n <select\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n >\n @for (opt of getOptions(rule.field); track opt) {\n <option [ngValue]=\"opt.value\">\n {{ opt.name }}\n </option>\n }\n </select>\n }\n @case (\"multiselect\") {\n <select\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n multiple\n >\n @for (opt of getOptions(rule.field); track opt) {\n <option [ngValue]=\"opt.value\">\n {{ opt.name }}\n </option>\n }\n </select>\n }\n @case (\"boolean\") {\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n type=\"checkbox\"\n />\n }\n }\n </div>\n }\n }\n @if (local.ruleset) {\n <query-builder\n [data]=\"rule\"\n [disabled]=\"disabled\"\n [parentTouchedCallback]=\"parentTouchedCallback || onTouchedCallback\"\n [parentChangeCallback]=\"parentChangeCallback || onChangeCallback\"\n [parentInputTemplates]=\"parentInputTemplates || inputTemplates\"\n [parentOperatorTemplate]=\"parentOperatorTemplate || operatorTemplate\"\n [parentFieldTemplate]=\"parentFieldTemplate || fieldTemplate\"\n [parentEntityTemplate]=\"parentEntityTemplate || entityTemplate\"\n [parentSwitchGroupTemplate]=\"parentSwitchGroupTemplate || switchGroupTemplate\"\n [parentButtonGroupTemplate]=\"parentButtonGroupTemplate || buttonGroupTemplate\"\n [parentRemoveButtonTemplate]=\"parentRemoveButtonTemplate || removeButtonTemplate\"\n [parentEmptyWarningTemplate]=\"parentEmptyWarningTemplate || emptyWarningTemplate\"\n [parentArrowIconTemplate]=\"parentArrowIconTemplate || arrowIconTemplate\"\n [parentValue]=\"data\"\n [classNames]=\"classNames\"\n [config]=\"config\"\n [allowRuleset]=\"allowRuleset\"\n [allowCollapse]=\"allowCollapse\"\n [emptyMessage]=\"emptyMessage\"\n [operatorMap]=\"operatorMap\"\n >\n </query-builder>\n }\n @if (getEmptyWarningTemplate(); as template) {\n @if (local.invalid) {\n <ng-container\n *ngTemplateOutlet=\"template; context: getEmptyWarningContext()\"\n ></ng-container>\n }\n } @else {\n @if (local.invalid) {\n <p [ngClass]=\"getClassNames('emptyWarning')\">\n {{ emptyMessage }}\n </p>\n }\n }\n </li>\n }\n }\n </ul>\n }\n</div>\n",
1020
+ styles: ["@charset \"UTF-8\";:host{display:block;width:100%}:host .q-icon{font-style:normal;font-size:12px}:host .q-remove-icon:before{content:\"\\274c\"}:host .q-arrow-icon-button{float:left;margin:4px 6px 4px 0;transform:rotate(90deg);transition:linear .25s transform;cursor:pointer}:host .q-arrow-icon-button.q-collapsed{transform:rotate(0)}:host .q-arrow-icon:before{content:\"\\25b6\"}:host .q-add-icon{color:#555}:host .q-add-icon:before{content:\"\\2795\"}:host .q-remove-button{color:#b3415d;width:31px}:host .q-switch-group,:host .q-button-group{font-family:Lucida Grande,Tahoma,Verdana,sans-serif;overflow:hidden}:host .q-right-align{float:right}:host .q-button{margin-left:8px;padding:0 8px;background-color:#fff}:host .q-button:disabled{display:none}:host .q-control-size{display:inline-block;vertical-align:top;padding-right:10px}:host .q-input-control,:host .q-operator-control,:host .q-field-control,:host .q-entity-control{display:inline-block;padding:5px 8px;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;box-sizing:border-box;width:auto;min-width:180px}:host .q-input-control:disabled,:host .q-operator-control:disabled,:host .q-field-control:disabled,:host .q-entity-control:disabled{border-color:transparent}:host .q-operator-control,:host .q-field-control,:host .q-entity-control,:host .q-input-control:not([type=checkbox]){min-height:32px;-webkit-appearance:none}:host .q-switch-label,:host .q-button{float:left;margin-bottom:0;font-size:14px;line-height:30px;font-weight:400;text-align:center;text-shadow:none;border:1px solid rgba(0,0,0,.2);box-sizing:border-box}:host .q-switch-label:hover,:host .q-button:hover{cursor:pointer;background-color:#f0f0f0}:host .q-switch-label{background-color:#e4e4e4;padding:0 8px}:host .q-switch-radio{position:absolute;clip:rect(0,0,0,0);height:1px;width:1px;border:0;overflow:hidden}:host .q-switch-radio:checked+.q-switch-label{border:1px solid rgb(97,158,215);background:#fff;color:#3176b3}:host .q-switch-radio:disabled+.q-switch-label{display:none}:host .q-switch-radio:checked:disabled+.q-switch-label{display:initial;color:initial;cursor:default;border-color:transparent}:host .q-invalid-ruleset{border:1px solid rgba(179,65,93,.5)!important;background:#b3415d1a!important}:host .q-empty-warning{color:#8d252e;text-align:center}:host .q-ruleset{border:1px solid #ccc}:host .q-rule{border:1px solid #ccc;background:#fff}:host .q-transition{-webkit-transition:all .1s ease-in-out;-moz-transition:all .1s ease-in-out;-ms-transition:all .1s ease-in-out;-o-transition:all .1s ease-in-out;transition:all .1s ease-in-out}:host .q-tree-container{width:100%;overflow:hidden;transition:ease-in .25s max-height}:host .q-tree-container.q-collapsed{max-height:0!important}:host .q-tree{list-style:none;margin:4px 0 2px}:host .q-row{padding:6px 8px;margin-top:6px}:host .q-connector{position:relative}:host .q-connector:before{top:-5px;border-width:0 0 2px 2px}:host .q-connector:after{border-width:0 0 0 2px;top:50%}:host .q-connector:before,:host .q-connector:after{content:\"\";left:-12px;border-color:#ccc;border-style:solid;width:9px;height:calc(50% + 6px);position:absolute}:host .q-connector:last-child:after{content:none}:host .q-inline-block-display{display:inline-block;vertical-align:top}\n"],
1021
+ dependencies: [
1022
+ {
1023
+ kind: "directive",
1024
+ type: i1.NgClass,
1025
+ selector: "[ngClass]",
1026
+ inputs: ["class", "ngClass"]
1027
+ },
1028
+ {
1029
+ kind: "directive",
1030
+ type: i1.NgTemplateOutlet,
1031
+ selector: "[ngTemplateOutlet]",
1032
+ inputs: [
1033
+ "ngTemplateOutletContext",
1034
+ "ngTemplateOutlet",
1035
+ "ngTemplateOutletInjector"
1036
+ ]
1037
+ },
1038
+ {
1039
+ kind: "directive",
1040
+ type: i2.NgSelectOption,
1041
+ selector: "option",
1042
+ inputs: ["ngValue", "value"]
1043
+ },
1044
+ {
1045
+ kind: "directive",
1046
+ type: i2.ɵNgSelectMultipleOption,
1047
+ selector: "option",
1048
+ inputs: ["ngValue", "value"]
1049
+ },
1050
+ {
1051
+ kind: "directive",
1052
+ type: i2.DefaultValueAccessor,
1053
+ selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
1054
+ },
1055
+ {
1056
+ kind: "directive",
1057
+ type: i2.NumberValueAccessor,
1058
+ selector: "input[type=number]:not([ngNoCva])[formControlName],input[type=number]:not([ngNoCva])[formControl],input[type=number]:not([ngNoCva])[ngModel]"
1059
+ },
1060
+ {
1061
+ kind: "directive",
1062
+ type: i2.CheckboxControlValueAccessor,
1063
+ selector: "input[type=checkbox]:not([ngNoCva])[formControlName],input[type=checkbox]:not([ngNoCva])[formControl],input[type=checkbox]:not([ngNoCva])[ngModel]"
1064
+ },
1065
+ {
1066
+ kind: "directive",
1067
+ type: i2.SelectControlValueAccessor,
1068
+ selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]",
1069
+ inputs: ["compareWith"]
1070
+ },
1071
+ {
1072
+ kind: "directive",
1073
+ type: i2.SelectMultipleControlValueAccessor,
1074
+ selector: "select[multiple]:not([ngNoCva])[formControlName],select[multiple]:not([ngNoCva])[formControl],select[multiple]:not([ngNoCva])[ngModel]",
1075
+ inputs: ["compareWith"]
1076
+ },
1077
+ {
1078
+ kind: "directive",
1079
+ type: i2.RadioControlValueAccessor,
1080
+ selector: "input[type=radio]:not([ngNoCva])[formControlName],input[type=radio]:not([ngNoCva])[formControl],input[type=radio]:not([ngNoCva])[ngModel]",
1081
+ inputs: [
1082
+ "name",
1083
+ "formControlName",
1084
+ "value"
1085
+ ]
1086
+ },
1087
+ {
1088
+ kind: "directive",
1089
+ type: i2.NgControlStatus,
1090
+ selector: "[formControlName],[ngModel],[formControl]"
1091
+ },
1092
+ {
1093
+ kind: "directive",
1094
+ type: i2.NgModel,
1095
+ selector: "[ngModel]:not([formControlName]):not([formControl])",
1096
+ inputs: [
1097
+ "name",
1098
+ "disabled",
1099
+ "ngModel",
1100
+ "ngModelOptions"
1101
+ ],
1102
+ outputs: ["ngModelChange"],
1103
+ exportAs: ["ngModel"]
1104
+ },
1105
+ {
1106
+ kind: "component",
1107
+ type: QueryBuilderComponent,
1108
+ selector: "query-builder",
1109
+ inputs: [
1110
+ "disabled",
1111
+ "data",
1112
+ "allowRuleset",
1113
+ "allowCollapse",
1114
+ "emptyMessage",
1115
+ "classNames",
1116
+ "operatorMap",
1117
+ "parentValue",
1118
+ "config",
1119
+ "parentArrowIconTemplate",
1120
+ "parentInputTemplates",
1121
+ "parentOperatorTemplate",
1122
+ "parentFieldTemplate",
1123
+ "parentEntityTemplate",
1124
+ "parentSwitchGroupTemplate",
1125
+ "parentButtonGroupTemplate",
1126
+ "parentRemoveButtonTemplate",
1127
+ "parentEmptyWarningTemplate",
1128
+ "parentChangeCallback",
1129
+ "parentTouchedCallback",
1130
+ "persistValueOnFieldChange",
1131
+ "value"
1132
+ ]
1133
+ }
1134
+ ],
1135
+ changeDetection: i0.ChangeDetectionStrategy.Eager
1136
+ });
1137
+ }
1138
+ };
1139
+ i0.ɵɵngDeclareClassMetadata({
1140
+ minVersion: "12.0.0",
1141
+ version: "22.3.0",
1142
+ ngImport: i0,
1143
+ type: QueryBuilderComponent,
1144
+ decorators: [{
1145
+ type: Component,
1146
+ args: [{
1147
+ selector: "query-builder",
1148
+ providers: [CONTROL_VALUE_ACCESSOR, VALIDATOR],
1149
+ changeDetection: ChangeDetectionStrategy.Eager,
1150
+ standalone: false,
1151
+ template: "<div [ngClass]=\"getClassNames('switchRow')\">\n @if (allowCollapse) {\n <a\n (click)=\"toggleCollapse()\"\n [ngClass]=\"getClassNames('arrowIconButton', data.collapsed ? 'collapsed' : '')\"\n >\n @if (getArrowIconTemplate(); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: getArrowIconContext()\"></ng-container>\n } @else {\n <i [ngClass]=\"getClassNames('arrowIcon')\"></i>\n }\n </a>\n }\n\n @if (getButtonGroupTemplate(); as template) {\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <ng-container *ngTemplateOutlet=\"template; context: getButtonGroupContext()\"></ng-container>\n </div>\n } @else {\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <button\n type=\"button\"\n (click)=\"addRule()\"\n [ngClass]=\"getClassNames('button')\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('addIcon')\"></i> Rule\n </button>\n @if (allowRuleset) {\n <button\n type=\"button\"\n (click)=\"addRuleSet()\"\n [ngClass]=\"getClassNames('button')\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('addIcon')\"></i> Ruleset\n </button>\n }\n @if (!!parentValue && allowRuleset) {\n <button\n type=\"button\"\n (click)=\"removeRuleSet()\"\n [ngClass]=\"getClassNames('button', 'removeButton')\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('removeIcon')\"></i>\n </button>\n }\n </div>\n }\n\n @if (getSwitchGroupTemplate(); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: getSwitchGroupContext()\"></ng-container>\n } @else {\n @if (data) {\n <div [ngClass]=\"getClassNames('switchGroup', 'transition')\">\n <div [ngClass]=\"getClassNames('switchControl')\">\n <input\n type=\"radio\"\n [ngClass]=\"getClassNames('switchRadio')\"\n [(ngModel)]=\"data.condition\"\n [disabled]=\"disabled\"\n value=\"and\"\n #andOption\n />\n <label (click)=\"changeCondition(andOption.value)\" [ngClass]=\"getClassNames('switchLabel')\"\n >AND</label\n >\n </div>\n <div [ngClass]=\"getClassNames('switchControl')\">\n <input\n type=\"radio\"\n [ngClass]=\"getClassNames('switchRadio')\"\n [(ngModel)]=\"data.condition\"\n [disabled]=\"disabled\"\n value=\"or\"\n #orOption\n />\n <label (click)=\"changeCondition(orOption.value)\" [ngClass]=\"getClassNames('switchLabel')\"\n >OR</label\n >\n </div>\n </div>\n }\n }\n</div>\n\n<div\n #treeContainer\n (transitionend)=\"transitionEnd($event)\"\n [ngClass]=\"getClassNames('treeContainer', data.collapsed ? 'collapsed' : '')\"\n>\n @if (data && data.rules) {\n <ul [ngClass]=\"getClassNames('tree')\">\n @for (rule of data.rules; track rule; let i = $index) {\n @if (\n {\n ruleset: !!rule.rules,\n invalid: !config.allowEmptyRulesets && rule.rules && rule.rules.length === 0\n };\n as local\n ) {\n <li [ngClass]=\"getQueryItemClassName(local)\">\n @if (!local.ruleset) {\n @if (getRemoveButtonTemplate(); as template) {\n <div [ngClass]=\"getClassNames('buttonGroup', 'rightAlign')\">\n <ng-container\n *ngTemplateOutlet=\"template; context: getRemoveButtonContext(rule)\"\n ></ng-container>\n </div>\n } @else {\n <div [ngClass]=\"getClassNames('removeButtonSize', 'rightAlign')\">\n <button\n type=\"button\"\n [ngClass]=\"getClassNames('button', 'removeButton')\"\n (click)=\"removeRule(rule, data)\"\n [disabled]=\"disabled\"\n >\n <i [ngClass]=\"getClassNames('removeIcon')\"></i>\n </button>\n </div>\n }\n @if (entities?.length) {\n <div class=\"q-inline-block-display\">\n @if (getEntityTemplate(); as template) {\n <ng-container\n *ngTemplateOutlet=\"template; context: getEntityContext(rule)\"\n ></ng-container>\n } @else {\n <div [ngClass]=\"getClassNames('entityControlSize')\">\n <select\n [ngClass]=\"getClassNames('entityControl')\"\n [(ngModel)]=\"rule.entity\"\n (ngModelChange)=\"changeEntity($event, rule, i, data)\"\n [disabled]=\"disabled\"\n >\n @for (entity of entities; track entity) {\n <option [ngValue]=\"entity.value\">\n {{ entity.name }}\n </option>\n }\n </select>\n </div>\n }\n </div>\n }\n @if (getFieldTemplate(); as template) {\n <ng-container\n *ngTemplateOutlet=\"template; context: getFieldContext(rule)\"\n ></ng-container>\n } @else {\n <div [ngClass]=\"getClassNames('fieldControlSize')\">\n <select\n [ngClass]=\"getClassNames('fieldControl')\"\n [(ngModel)]=\"rule.field\"\n (ngModelChange)=\"changeField($event, rule)\"\n [disabled]=\"disabled\"\n >\n @for (field of getFields(rule.entity); track field) {\n <option [ngValue]=\"field.value\">\n {{ field.name }}\n </option>\n }\n </select>\n </div>\n }\n @if (getOperatorTemplate(); as template) {\n <ng-container\n *ngTemplateOutlet=\"template; context: getOperatorContext(rule)\"\n ></ng-container>\n } @else {\n <div [ngClass]=\"getClassNames('operatorControlSize')\">\n <select\n [ngClass]=\"getClassNames('operatorControl')\"\n [(ngModel)]=\"rule.operator\"\n (ngModelChange)=\"changeOperator(rule)\"\n [disabled]=\"disabled\"\n >\n @for (operator of getOperators(rule.field); track operator) {\n <option [ngValue]=\"operator\">\n {{ operator }}\n </option>\n }\n </select>\n </div>\n }\n @if (findTemplateForRule(rule); as template) {\n <ng-container\n *ngTemplateOutlet=\"template; context: getInputContext(rule)\"\n ></ng-container>\n } @else {\n <div [ngClass]=\"getClassNames('inputControlSize')\">\n @switch (getInputType(rule.field, rule.operator)) {\n @case (\"string\") {\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n type=\"text\"\n />\n }\n @case (\"number\") {\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n type=\"number\"\n />\n }\n @case (\"date\") {\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n type=\"date\"\n />\n }\n @case (\"time\") {\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n type=\"time\"\n />\n }\n @case (\"category\") {\n <select\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n >\n @for (opt of getOptions(rule.field); track opt) {\n <option [ngValue]=\"opt.value\">\n {{ opt.name }}\n </option>\n }\n </select>\n }\n @case (\"multiselect\") {\n <select\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n multiple\n >\n @for (opt of getOptions(rule.field); track opt) {\n <option [ngValue]=\"opt.value\">\n {{ opt.name }}\n </option>\n }\n </select>\n }\n @case (\"boolean\") {\n <input\n [ngClass]=\"getClassNames('inputControl')\"\n [(ngModel)]=\"rule.value\"\n (ngModelChange)=\"changeInput()\"\n [disabled]=\"disabled\"\n type=\"checkbox\"\n />\n }\n }\n </div>\n }\n }\n @if (local.ruleset) {\n <query-builder\n [data]=\"rule\"\n [disabled]=\"disabled\"\n [parentTouchedCallback]=\"parentTouchedCallback || onTouchedCallback\"\n [parentChangeCallback]=\"parentChangeCallback || onChangeCallback\"\n [parentInputTemplates]=\"parentInputTemplates || inputTemplates\"\n [parentOperatorTemplate]=\"parentOperatorTemplate || operatorTemplate\"\n [parentFieldTemplate]=\"parentFieldTemplate || fieldTemplate\"\n [parentEntityTemplate]=\"parentEntityTemplate || entityTemplate\"\n [parentSwitchGroupTemplate]=\"parentSwitchGroupTemplate || switchGroupTemplate\"\n [parentButtonGroupTemplate]=\"parentButtonGroupTemplate || buttonGroupTemplate\"\n [parentRemoveButtonTemplate]=\"parentRemoveButtonTemplate || removeButtonTemplate\"\n [parentEmptyWarningTemplate]=\"parentEmptyWarningTemplate || emptyWarningTemplate\"\n [parentArrowIconTemplate]=\"parentArrowIconTemplate || arrowIconTemplate\"\n [parentValue]=\"data\"\n [classNames]=\"classNames\"\n [config]=\"config\"\n [allowRuleset]=\"allowRuleset\"\n [allowCollapse]=\"allowCollapse\"\n [emptyMessage]=\"emptyMessage\"\n [operatorMap]=\"operatorMap\"\n >\n </query-builder>\n }\n @if (getEmptyWarningTemplate(); as template) {\n @if (local.invalid) {\n <ng-container\n *ngTemplateOutlet=\"template; context: getEmptyWarningContext()\"\n ></ng-container>\n }\n } @else {\n @if (local.invalid) {\n <p [ngClass]=\"getClassNames('emptyWarning')\">\n {{ emptyMessage }}\n </p>\n }\n }\n </li>\n }\n }\n </ul>\n }\n</div>\n",
1152
+ styles: ["@charset \"UTF-8\";:host{display:block;width:100%}:host .q-icon{font-style:normal;font-size:12px}:host .q-remove-icon:before{content:\"\\274c\"}:host .q-arrow-icon-button{float:left;margin:4px 6px 4px 0;transform:rotate(90deg);transition:linear .25s transform;cursor:pointer}:host .q-arrow-icon-button.q-collapsed{transform:rotate(0)}:host .q-arrow-icon:before{content:\"\\25b6\"}:host .q-add-icon{color:#555}:host .q-add-icon:before{content:\"\\2795\"}:host .q-remove-button{color:#b3415d;width:31px}:host .q-switch-group,:host .q-button-group{font-family:Lucida Grande,Tahoma,Verdana,sans-serif;overflow:hidden}:host .q-right-align{float:right}:host .q-button{margin-left:8px;padding:0 8px;background-color:#fff}:host .q-button:disabled{display:none}:host .q-control-size{display:inline-block;vertical-align:top;padding-right:10px}:host .q-input-control,:host .q-operator-control,:host .q-field-control,:host .q-entity-control{display:inline-block;padding:5px 8px;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;box-sizing:border-box;width:auto;min-width:180px}:host .q-input-control:disabled,:host .q-operator-control:disabled,:host .q-field-control:disabled,:host .q-entity-control:disabled{border-color:transparent}:host .q-operator-control,:host .q-field-control,:host .q-entity-control,:host .q-input-control:not([type=checkbox]){min-height:32px;-webkit-appearance:none}:host .q-switch-label,:host .q-button{float:left;margin-bottom:0;font-size:14px;line-height:30px;font-weight:400;text-align:center;text-shadow:none;border:1px solid rgba(0,0,0,.2);box-sizing:border-box}:host .q-switch-label:hover,:host .q-button:hover{cursor:pointer;background-color:#f0f0f0}:host .q-switch-label{background-color:#e4e4e4;padding:0 8px}:host .q-switch-radio{position:absolute;clip:rect(0,0,0,0);height:1px;width:1px;border:0;overflow:hidden}:host .q-switch-radio:checked+.q-switch-label{border:1px solid rgb(97,158,215);background:#fff;color:#3176b3}:host .q-switch-radio:disabled+.q-switch-label{display:none}:host .q-switch-radio:checked:disabled+.q-switch-label{display:initial;color:initial;cursor:default;border-color:transparent}:host .q-invalid-ruleset{border:1px solid rgba(179,65,93,.5)!important;background:#b3415d1a!important}:host .q-empty-warning{color:#8d252e;text-align:center}:host .q-ruleset{border:1px solid #ccc}:host .q-rule{border:1px solid #ccc;background:#fff}:host .q-transition{-webkit-transition:all .1s ease-in-out;-moz-transition:all .1s ease-in-out;-ms-transition:all .1s ease-in-out;-o-transition:all .1s ease-in-out;transition:all .1s ease-in-out}:host .q-tree-container{width:100%;overflow:hidden;transition:ease-in .25s max-height}:host .q-tree-container.q-collapsed{max-height:0!important}:host .q-tree{list-style:none;margin:4px 0 2px}:host .q-row{padding:6px 8px;margin-top:6px}:host .q-connector{position:relative}:host .q-connector:before{top:-5px;border-width:0 0 2px 2px}:host .q-connector:after{border-width:0 0 0 2px;top:50%}:host .q-connector:before,:host .q-connector:after{content:\"\";left:-12px;border-color:#ccc;border-style:solid;width:9px;height:calc(50% + 6px);position:absolute}:host .q-connector:last-child:after{content:none}:host .q-inline-block-display{display:inline-block;vertical-align:top}\n"]
1153
+ }]
1154
+ }],
1155
+ ctorParameters: () => [{ type: i0.ChangeDetectorRef }],
1156
+ propDecorators: {
1157
+ disabled: [{ type: Input }],
1158
+ data: [{ type: Input }],
1159
+ condition: [{
1160
+ type: HostBinding,
1161
+ args: ["attr.query-builder-condition"]
1162
+ }],
1163
+ allowRuleset: [{ type: Input }],
1164
+ allowCollapse: [{ type: Input }],
1165
+ emptyMessage: [{ type: Input }],
1166
+ classNames: [{ type: Input }],
1167
+ operatorMap: [{ type: Input }],
1168
+ parentValue: [{ type: Input }],
1169
+ config: [{ type: Input }],
1170
+ parentArrowIconTemplate: [{ type: Input }],
1171
+ parentInputTemplates: [{ type: Input }],
1172
+ parentOperatorTemplate: [{ type: Input }],
1173
+ parentFieldTemplate: [{ type: Input }],
1174
+ parentEntityTemplate: [{ type: Input }],
1175
+ parentSwitchGroupTemplate: [{ type: Input }],
1176
+ parentButtonGroupTemplate: [{ type: Input }],
1177
+ parentRemoveButtonTemplate: [{ type: Input }],
1178
+ parentEmptyWarningTemplate: [{ type: Input }],
1179
+ parentChangeCallback: [{ type: Input }],
1180
+ parentTouchedCallback: [{ type: Input }],
1181
+ persistValueOnFieldChange: [{ type: Input }],
1182
+ treeContainer: [{
1183
+ type: ViewChild,
1184
+ args: ["treeContainer", { static: true }]
1185
+ }],
1186
+ buttonGroupTemplate: [{
1187
+ type: ContentChild,
1188
+ args: [QueryButtonGroupDirective]
1189
+ }],
1190
+ switchGroupTemplate: [{
1191
+ type: ContentChild,
1192
+ args: [QuerySwitchGroupDirective]
1193
+ }],
1194
+ fieldTemplate: [{
1195
+ type: ContentChild,
1196
+ args: [QueryFieldDirective]
1197
+ }],
1198
+ entityTemplate: [{
1199
+ type: ContentChild,
1200
+ args: [QueryEntityDirective]
1201
+ }],
1202
+ operatorTemplate: [{
1203
+ type: ContentChild,
1204
+ args: [QueryOperatorDirective]
1205
+ }],
1206
+ removeButtonTemplate: [{
1207
+ type: ContentChild,
1208
+ args: [QueryRemoveButtonDirective]
1209
+ }],
1210
+ emptyWarningTemplate: [{
1211
+ type: ContentChild,
1212
+ args: [QueryEmptyWarningDirective]
1213
+ }],
1214
+ inputTemplates: [{
1215
+ type: ContentChildren,
1216
+ args: [QueryInputDirective, { descendants: true }]
1217
+ }],
1218
+ arrowIconTemplate: [{
1219
+ type: ContentChild,
1220
+ args: [QueryArrowIconDirective]
1221
+ }],
1222
+ value: [{ type: Input }]
1223
+ }
1224
+ });
1225
+ var NgxAngularQueryBuilderModule = class NgxAngularQueryBuilderModule {
1226
+ static {
1227
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1228
+ minVersion: "12.0.0",
1229
+ version: "22.3.0",
1230
+ ngImport: i0,
1231
+ type: NgxAngularQueryBuilderModule,
1232
+ deps: [],
1233
+ target: i0.ɵɵFactoryTarget.NgModule
1234
+ });
1235
+ }
1236
+ static {
1237
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
1238
+ minVersion: "14.0.0",
1239
+ version: "22.3.0",
1240
+ ngImport: i0,
1241
+ type: NgxAngularQueryBuilderModule,
1242
+ declarations: [
1243
+ QueryBuilderComponent,
1244
+ QueryInputDirective,
1245
+ QueryOperatorDirective,
1246
+ QueryFieldDirective,
1247
+ QueryEntityDirective,
1248
+ QueryButtonGroupDirective,
1249
+ QuerySwitchGroupDirective,
1250
+ QueryRemoveButtonDirective,
1251
+ QueryEmptyWarningDirective,
1252
+ QueryArrowIconDirective
1253
+ ],
1254
+ imports: [CommonModule, FormsModule],
1255
+ exports: [
1256
+ QueryBuilderComponent,
1257
+ QueryInputDirective,
1258
+ QueryOperatorDirective,
1259
+ QueryFieldDirective,
1260
+ QueryEntityDirective,
1261
+ QueryButtonGroupDirective,
1262
+ QuerySwitchGroupDirective,
1263
+ QueryRemoveButtonDirective,
1264
+ QueryEmptyWarningDirective,
1265
+ QueryArrowIconDirective
1266
+ ]
1267
+ });
1268
+ }
1269
+ static {
1270
+ this.ɵinj = i0.ɵɵngDeclareInjector({
1271
+ minVersion: "12.0.0",
1272
+ version: "22.3.0",
1273
+ ngImport: i0,
1274
+ type: NgxAngularQueryBuilderModule,
1275
+ imports: [CommonModule, FormsModule]
1276
+ });
1277
+ }
1278
+ };
1279
+ i0.ɵɵngDeclareClassMetadata({
1280
+ minVersion: "12.0.0",
1281
+ version: "22.3.0",
1282
+ ngImport: i0,
1283
+ type: NgxAngularQueryBuilderModule,
1284
+ decorators: [{
1285
+ type: NgModule,
1286
+ args: [{
1287
+ imports: [CommonModule, FormsModule],
1288
+ declarations: [
1289
+ QueryBuilderComponent,
1290
+ QueryInputDirective,
1291
+ QueryOperatorDirective,
1292
+ QueryFieldDirective,
1293
+ QueryEntityDirective,
1294
+ QueryButtonGroupDirective,
1295
+ QuerySwitchGroupDirective,
1296
+ QueryRemoveButtonDirective,
1297
+ QueryEmptyWarningDirective,
1298
+ QueryArrowIconDirective
1299
+ ],
1300
+ exports: [
1301
+ QueryBuilderComponent,
1302
+ QueryInputDirective,
1303
+ QueryOperatorDirective,
1304
+ QueryFieldDirective,
1305
+ QueryEntityDirective,
1306
+ QueryButtonGroupDirective,
1307
+ QuerySwitchGroupDirective,
1308
+ QueryRemoveButtonDirective,
1309
+ QueryEmptyWarningDirective,
1310
+ QueryArrowIconDirective
1311
+ ]
1312
+ }]
1313
+ }]
1314
+ });
963
1315
  export { CONTROL_VALUE_ACCESSOR, NgxAngularQueryBuilderModule, QueryArrowIconDirective, QueryBuilderComponent, QueryButtonGroupDirective, QueryEmptyWarningDirective, QueryEntityDirective, QueryFieldDirective, QueryInputDirective, QueryOperatorDirective, QueryRemoveButtonDirective, QuerySwitchGroupDirective, VALIDATOR };
964
- //# sourceMappingURL=ngx-angular-query-builder.mjs.map
1316
+
1317
+ //# sourceMappingURL=ngx-angular-query-builder.mjs.map