ngx-angular-query-builder 17.0.0 → 18.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.
Files changed (35) hide show
  1. package/{esm2020 → esm2022}/lib/ngx-angular-query-builder.module.mjs +68 -68
  2. package/{esm2020 → esm2022}/lib/query-builder/query-arrow-icon.directive.mjs +14 -14
  3. package/esm2022/lib/query-builder/query-builder.component.mjs +758 -0
  4. package/{esm2020 → esm2022}/lib/query-builder/query-builder.interfaces.mjs +1 -1
  5. package/{esm2020 → esm2022}/lib/query-builder/query-button-group.directive.mjs +14 -14
  6. package/{esm2020 → esm2022}/lib/query-builder/query-empty-warning.directive.mjs +14 -14
  7. package/{esm2020 → esm2022}/lib/query-builder/query-entity.directive.mjs +14 -14
  8. package/{esm2020 → esm2022}/lib/query-builder/query-field.directive.mjs +14 -14
  9. package/esm2022/lib/query-builder/query-input.directive.mjs +28 -0
  10. package/{esm2020 → esm2022}/lib/query-builder/query-operator.directive.mjs +14 -14
  11. package/{esm2020 → esm2022}/lib/query-builder/query-remove-button.directive.mjs +14 -14
  12. package/{esm2020 → esm2022}/lib/query-builder/query-switch-group.directive.mjs +14 -14
  13. package/{esm2020 → esm2022}/ngx-angular-query-builder.mjs +4 -4
  14. package/{esm2020 → esm2022}/public-api.mjs +15 -15
  15. package/{fesm2020 → fesm2022}/ngx-angular-query-builder.mjs +910 -910
  16. package/{fesm2020 → fesm2022}/ngx-angular-query-builder.mjs.map +1 -1
  17. package/index.d.ts +5 -5
  18. package/lib/ngx-angular-query-builder.module.d.ts +18 -18
  19. package/lib/query-builder/query-arrow-icon.directive.d.ts +8 -8
  20. package/lib/query-builder/query-builder.component.d.ts +129 -129
  21. package/lib/query-builder/query-builder.interfaces.d.ts +143 -143
  22. package/lib/query-builder/query-button-group.directive.d.ts +8 -8
  23. package/lib/query-builder/query-empty-warning.directive.d.ts +8 -8
  24. package/lib/query-builder/query-entity.directive.d.ts +8 -8
  25. package/lib/query-builder/query-field.directive.d.ts +8 -8
  26. package/lib/query-builder/query-input.directive.d.ts +12 -12
  27. package/lib/query-builder/query-operator.directive.d.ts +8 -8
  28. package/lib/query-builder/query-remove-button.directive.d.ts +8 -8
  29. package/lib/query-builder/query-switch-group.directive.d.ts +8 -8
  30. package/package.json +7 -13
  31. package/public-api.d.ts +12 -12
  32. package/esm2020/lib/query-builder/query-builder.component.mjs +0 -758
  33. package/esm2020/lib/query-builder/query-input.directive.mjs +0 -28
  34. package/fesm2015/ngx-angular-query-builder.mjs +0 -939
  35. package/fesm2015/ngx-angular-query-builder.mjs.map +0 -1
@@ -5,932 +5,932 @@ import { Directive, Input, forwardRef, Component, HostBinding, ViewChild, Conten
5
5
  import * as i1 from '@angular/common';
6
6
  import { CommonModule } from '@angular/common';
7
7
 
8
- class QueryOperatorDirective {
9
- constructor(template) {
10
- this.template = template;
11
- }
12
- }
13
- QueryOperatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryOperatorDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
14
- QueryOperatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: QueryOperatorDirective, selector: "[queryOperator]", ngImport: i0 });
15
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryOperatorDirective, decorators: [{
16
- type: Directive,
17
- args: [{ selector: "[queryOperator]" }]
18
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
8
+ class QueryOperatorDirective {
9
+ constructor(template) {
10
+ this.template = template;
11
+ }
12
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryOperatorDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
13
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.3", type: QueryOperatorDirective, selector: "[queryOperator]", ngImport: i0 }); }
14
+ }
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryOperatorDirective, decorators: [{
16
+ type: Directive,
17
+ args: [{ selector: "[queryOperator]" }]
18
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
19
19
 
20
- class QueryFieldDirective {
21
- constructor(template) {
22
- this.template = template;
23
- }
24
- }
25
- QueryFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryFieldDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
26
- QueryFieldDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: QueryFieldDirective, selector: "[queryField]", ngImport: i0 });
27
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryFieldDirective, decorators: [{
28
- type: Directive,
29
- args: [{ selector: "[queryField]" }]
30
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
20
+ class QueryFieldDirective {
21
+ constructor(template) {
22
+ this.template = template;
23
+ }
24
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryFieldDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
25
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.3", type: QueryFieldDirective, selector: "[queryField]", ngImport: i0 }); }
26
+ }
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryFieldDirective, decorators: [{
28
+ type: Directive,
29
+ args: [{ selector: "[queryField]" }]
30
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
31
31
 
32
- class QueryEntityDirective {
33
- constructor(template) {
34
- this.template = template;
35
- }
36
- }
37
- QueryEntityDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryEntityDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
38
- QueryEntityDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: QueryEntityDirective, selector: "[queryEntity]", ngImport: i0 });
39
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryEntityDirective, decorators: [{
40
- type: Directive,
41
- args: [{ selector: "[queryEntity]" }]
42
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
32
+ class QueryEntityDirective {
33
+ constructor(template) {
34
+ this.template = template;
35
+ }
36
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryEntityDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
37
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.3", type: QueryEntityDirective, selector: "[queryEntity]", ngImport: i0 }); }
38
+ }
39
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryEntityDirective, decorators: [{
40
+ type: Directive,
41
+ args: [{ selector: "[queryEntity]" }]
42
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
43
43
 
44
- class QuerySwitchGroupDirective {
45
- constructor(template) {
46
- this.template = template;
47
- }
48
- }
49
- QuerySwitchGroupDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QuerySwitchGroupDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
50
- QuerySwitchGroupDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: QuerySwitchGroupDirective, selector: "[querySwitchGroup]", ngImport: i0 });
51
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QuerySwitchGroupDirective, decorators: [{
52
- type: Directive,
53
- args: [{ selector: "[querySwitchGroup]" }]
54
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
44
+ class QuerySwitchGroupDirective {
45
+ constructor(template) {
46
+ this.template = template;
47
+ }
48
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QuerySwitchGroupDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
49
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.3", type: QuerySwitchGroupDirective, selector: "[querySwitchGroup]", ngImport: i0 }); }
50
+ }
51
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QuerySwitchGroupDirective, decorators: [{
52
+ type: Directive,
53
+ args: [{ selector: "[querySwitchGroup]" }]
54
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
55
55
 
56
- class QueryButtonGroupDirective {
57
- constructor(template) {
58
- this.template = template;
59
- }
60
- }
61
- QueryButtonGroupDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryButtonGroupDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
62
- QueryButtonGroupDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: QueryButtonGroupDirective, selector: "[queryButtonGroup]", ngImport: i0 });
63
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryButtonGroupDirective, decorators: [{
64
- type: Directive,
65
- args: [{ selector: "[queryButtonGroup]" }]
66
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
56
+ class QueryButtonGroupDirective {
57
+ constructor(template) {
58
+ this.template = template;
59
+ }
60
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryButtonGroupDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
61
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.3", type: QueryButtonGroupDirective, selector: "[queryButtonGroup]", ngImport: i0 }); }
62
+ }
63
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryButtonGroupDirective, decorators: [{
64
+ type: Directive,
65
+ args: [{ selector: "[queryButtonGroup]" }]
66
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
67
67
 
68
- class QueryInputDirective {
69
- /** Unique name for query input type. */
70
- get queryInputType() {
71
- return this._type;
72
- }
73
- set queryInputType(value) {
74
- // If the directive is set without a type (updated programatically), then this setter will
75
- // trigger with an empty string and should not overwrite the programatically set value.
76
- if (!value) {
77
- return;
78
- }
79
- this._type = value;
80
- }
81
- constructor(template) {
82
- this.template = template;
83
- }
84
- }
85
- QueryInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryInputDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
86
- QueryInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: QueryInputDirective, selector: "[queryInput]", inputs: { queryInputType: "queryInputType" }, ngImport: i0 });
87
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryInputDirective, decorators: [{
88
- type: Directive,
89
- args: [{ selector: "[queryInput]" }]
90
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { queryInputType: [{
91
- type: Input
68
+ class QueryInputDirective {
69
+ /** Unique name for query input type. */
70
+ get queryInputType() {
71
+ return this._type;
72
+ }
73
+ set queryInputType(value) {
74
+ // If the directive is set without a type (updated programatically), then this setter will
75
+ // trigger with an empty string and should not overwrite the programatically set value.
76
+ if (!value) {
77
+ return;
78
+ }
79
+ this._type = value;
80
+ }
81
+ constructor(template) {
82
+ this.template = template;
83
+ }
84
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryInputDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
85
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.3", type: QueryInputDirective, selector: "[queryInput]", inputs: { queryInputType: "queryInputType" }, ngImport: i0 }); }
86
+ }
87
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryInputDirective, decorators: [{
88
+ type: Directive,
89
+ args: [{ selector: "[queryInput]" }]
90
+ }], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { queryInputType: [{
91
+ type: Input
92
92
  }] } });
93
93
 
94
- class QueryRemoveButtonDirective {
95
- constructor(template) {
96
- this.template = template;
97
- }
98
- }
99
- QueryRemoveButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryRemoveButtonDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
100
- QueryRemoveButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: QueryRemoveButtonDirective, selector: "[queryRemoveButton]", ngImport: i0 });
101
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryRemoveButtonDirective, decorators: [{
102
- type: Directive,
103
- args: [{ selector: "[queryRemoveButton]" }]
104
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
94
+ class QueryRemoveButtonDirective {
95
+ constructor(template) {
96
+ this.template = template;
97
+ }
98
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryRemoveButtonDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
99
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.3", type: QueryRemoveButtonDirective, selector: "[queryRemoveButton]", ngImport: i0 }); }
100
+ }
101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryRemoveButtonDirective, decorators: [{
102
+ type: Directive,
103
+ args: [{ selector: "[queryRemoveButton]" }]
104
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
105
105
 
106
- class QueryEmptyWarningDirective {
107
- constructor(template) {
108
- this.template = template;
109
- }
110
- }
111
- QueryEmptyWarningDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryEmptyWarningDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
112
- QueryEmptyWarningDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: QueryEmptyWarningDirective, selector: "[queryEmptyWarning]", ngImport: i0 });
113
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryEmptyWarningDirective, decorators: [{
114
- type: Directive,
115
- args: [{ selector: "[queryEmptyWarning]" }]
116
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
106
+ class QueryEmptyWarningDirective {
107
+ constructor(template) {
108
+ this.template = template;
109
+ }
110
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryEmptyWarningDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
111
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.3", type: QueryEmptyWarningDirective, selector: "[queryEmptyWarning]", ngImport: i0 }); }
112
+ }
113
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryEmptyWarningDirective, decorators: [{
114
+ type: Directive,
115
+ args: [{ selector: "[queryEmptyWarning]" }]
116
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
117
117
 
118
- class QueryArrowIconDirective {
119
- constructor(template) {
120
- this.template = template;
121
- }
122
- }
123
- QueryArrowIconDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryArrowIconDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
124
- QueryArrowIconDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: QueryArrowIconDirective, selector: "[queryArrowIcon]", ngImport: i0 });
125
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryArrowIconDirective, decorators: [{
126
- type: Directive,
127
- args: [{ selector: "[queryArrowIcon]" }]
128
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
118
+ class QueryArrowIconDirective {
119
+ constructor(template) {
120
+ this.template = template;
121
+ }
122
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryArrowIconDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
123
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.3", type: QueryArrowIconDirective, selector: "[queryArrowIcon]", ngImport: i0 }); }
124
+ }
125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryArrowIconDirective, decorators: [{
126
+ type: Directive,
127
+ args: [{ selector: "[queryArrowIcon]" }]
128
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
129
129
 
130
- const CONTROL_VALUE_ACCESSOR = {
131
- provide: NG_VALUE_ACCESSOR,
132
- useExisting: forwardRef(() => QueryBuilderComponent),
133
- multi: true
134
- };
135
- const VALIDATOR = {
136
- provide: NG_VALIDATORS,
137
- useExisting: forwardRef(() => QueryBuilderComponent),
138
- multi: true
139
- };
140
- class QueryBuilderComponent {
141
- get condition() {
142
- return this.data?.condition;
143
- }
144
- constructor(changeDetectorRef) {
145
- this.changeDetectorRef = changeDetectorRef;
146
- this.defaultClassNames = {
147
- arrowIconButton: "q-arrow-icon-button",
148
- arrowIcon: "q-icon q-arrow-icon",
149
- removeIcon: "q-icon q-remove-icon",
150
- addIcon: "q-icon q-add-icon",
151
- button: "q-button",
152
- buttonGroup: "q-button-group",
153
- removeButton: "q-remove-button",
154
- switchGroup: "q-switch-group",
155
- switchLabel: "q-switch-label",
156
- switchRadio: "q-switch-radio",
157
- rightAlign: "q-right-align",
158
- transition: "q-transition",
159
- collapsed: "q-collapsed",
160
- treeContainer: "q-tree-container",
161
- tree: "q-tree",
162
- row: "q-row",
163
- connector: "q-connector",
164
- rule: "q-rule",
165
- ruleSet: "q-ruleset",
166
- invalidRuleSet: "q-invalid-ruleset",
167
- emptyWarning: "q-empty-warning",
168
- fieldControl: "q-field-control",
169
- fieldControlSize: "q-control-size",
170
- entityControl: "q-entity-control",
171
- entityControlSize: "q-control-size",
172
- operatorControl: "q-operator-control",
173
- operatorControlSize: "q-control-size",
174
- inputControl: "q-input-control",
175
- inputControlSize: "q-control-size"
176
- };
177
- this.defaultOperatorMap = {
178
- string: ["=", "!=", "contains", "like"],
179
- number: ["=", "!=", ">", ">=", "<", "<="],
180
- time: ["=", "!=", ">", ">=", "<", "<="],
181
- date: ["=", "!=", ">", ">=", "<", "<="],
182
- category: ["=", "!=", "in", "not in"],
183
- boolean: ["="]
184
- };
185
- this.disabled = false;
186
- this.data = { condition: "and", rules: [] };
187
- this.allowRuleset = true;
188
- this.allowCollapse = false;
189
- this.emptyMessage = "A ruleset cannot be empty. Please add a rule or remove it all together.";
190
- this.classNames = {};
191
- this.operatorMap = {};
192
- this.config = { fields: {} };
193
- this.persistValueOnFieldChange = false;
194
- this.defaultTemplateTypes = [
195
- "string",
196
- "number",
197
- "time",
198
- "date",
199
- "category",
200
- "boolean",
201
- "multiselect"
202
- ];
203
- this.defaultPersistValueTypes = ["string", "number", "time", "date", "boolean"];
204
- this.defaultEmptyList = [];
205
- this.operatorsCache = {};
206
- this.inputContextCache = new Map();
207
- this.operatorContextCache = new Map();
208
- this.fieldContextCache = new Map();
209
- this.entityContextCache = new Map();
210
- this.removeButtonContextCache = new Map();
211
- // ----------END----------
212
- this.getDisabledState = () => {
213
- return this.disabled;
214
- };
215
- this.fields = [];
216
- this.filterFields = [];
217
- this.entities = [];
218
- }
219
- // ----------OnChanges Implementation----------
220
- ngOnChanges(changes) {
221
- const config = this.config;
222
- const type = typeof config;
223
- if (type === "object") {
224
- this.fields = Object.keys(config.fields).map((value) => {
225
- const field = config.fields[value];
226
- field.value = field.value || value;
227
- return field;
228
- });
229
- if (config.entities) {
230
- this.entities = Object.keys(config.entities).map((value) => {
231
- const entity = config.entities ? config.entities[value] : [];
232
- entity.value = entity.value || value;
233
- return entity;
234
- });
235
- }
236
- else {
237
- this.entities = [];
238
- }
239
- this.operatorsCache = {};
240
- }
241
- else {
242
- throw new Error(`Expected 'config' must be a valid object, got ${type} instead.`);
243
- }
244
- }
245
- // ----------Validator Implementation----------
246
- validate(control) {
247
- const errors = {};
248
- const ruleErrorStore = [];
249
- let hasErrors = false;
250
- if (!this.config.allowEmptyRulesets && this.checkEmptyRuleInRuleset(this.data)) {
251
- errors.empty = "Empty rulesets are not allowed.";
252
- hasErrors = true;
253
- }
254
- this.validateRulesInRuleset(this.data, ruleErrorStore);
255
- if (ruleErrorStore.length) {
256
- errors.rules = ruleErrorStore;
257
- hasErrors = true;
258
- }
259
- return hasErrors ? errors : null;
260
- }
261
- // ----------ControlValueAccessor Implementation----------
262
- get value() {
263
- return this.data;
264
- }
265
- set value(value) {
266
- // When component is initialized without a formControl, null is passed to value
267
- this.data = value || { condition: "and", rules: [] };
268
- this.handleDataChange();
269
- }
270
- writeValue(obj) {
271
- this.value = obj;
272
- }
273
- registerOnChange(fn) {
274
- this.onChangeCallback = () => fn(this.data);
275
- }
276
- registerOnTouched(fn) {
277
- this.onTouchedCallback = () => fn(this.data);
278
- }
279
- setDisabledState(isDisabled) {
280
- this.disabled = isDisabled;
281
- this.changeDetectorRef.detectChanges();
282
- }
283
- findTemplateForRule(rule) {
284
- const type = this.getInputType(rule.field, rule.operator);
285
- if (type) {
286
- const queryInput = this.findQueryInput(type);
287
- if (queryInput) {
288
- return queryInput.template;
289
- }
290
- else {
291
- if (this.defaultTemplateTypes.indexOf(type) === -1) {
292
- console.warn(`Could not find template for field with type: ${type}`);
293
- }
294
- return null;
295
- }
296
- }
297
- }
298
- findQueryInput(type) {
299
- const templates = this.parentInputTemplates || this.inputTemplates || [];
300
- return templates.find((item) => item.queryInputType === type);
301
- }
302
- getOperators(field) {
303
- if (this.operatorsCache[field]) {
304
- return this.operatorsCache[field];
305
- }
306
- let operators = this.defaultEmptyList;
307
- const fieldObject = this.config.fields[field];
308
- if (this.config.getOperators) {
309
- return this.config.getOperators(field, fieldObject);
310
- }
311
- const type = fieldObject.type;
312
- if (fieldObject && fieldObject.operators) {
313
- operators = fieldObject.operators;
314
- }
315
- else if (type) {
316
- operators =
317
- (this.operatorMap && this.operatorMap[type]) ||
318
- this.defaultOperatorMap[type] ||
319
- this.defaultEmptyList;
320
- if (operators.length === 0) {
321
- console.warn(`No operators found for field '${field}' with type ${fieldObject.type}. ` +
322
- `Please define an 'operators' property on the field or use the 'operatorMap' binding to fix this.`);
323
- }
324
- if (fieldObject.nullable) {
325
- operators = operators.concat(["is null", "is not null"]);
326
- }
327
- }
328
- else {
329
- console.warn(`No 'type' property found on field: '${field}'`);
330
- }
331
- // Cache reference to array object, so it won't be computed next time and trigger a rerender.
332
- this.operatorsCache[field] = operators;
333
- return operators;
334
- }
335
- getFields(entity) {
336
- if (this.entities?.length && entity) {
337
- return this.fields.filter((field) => {
338
- return field && field.entity === entity;
339
- });
340
- }
341
- else {
342
- return this.fields;
343
- }
344
- }
345
- getInputType(field, operator) {
346
- if (this.config.getInputType) {
347
- return this.config.getInputType(field, operator);
348
- }
349
- if (!this.config.fields[field]) {
350
- throw new Error(`No configuration for field '${field}' could be found! Please add it to config.fields.`);
351
- }
352
- const type = this.config.fields[field].type;
353
- switch (operator) {
354
- case "is null":
355
- case "is not null":
356
- return null; // No displayed component
357
- case "in":
358
- case "not in":
359
- return type === "category" || type === "boolean" ? "multiselect" : type;
360
- default:
361
- return type;
362
- }
363
- }
364
- getOptions(field) {
365
- if (this.config.getOptions) {
366
- return this.config.getOptions(field);
367
- }
368
- return this.config.fields[field].options || this.defaultEmptyList;
369
- }
370
- getClassNames(...args) {
371
- const clsLookup = this.classNames ? this.classNames : this.defaultClassNames;
372
- const defaultClassNames = this.defaultClassNames;
373
- const classNames = args
374
- .map((id) => clsLookup[id] || defaultClassNames[id])
375
- .filter((c) => !!c);
376
- return classNames.length ? classNames.join(" ") : [];
377
- }
378
- getDefaultField(entity) {
379
- if (!entity) {
380
- return null;
381
- }
382
- else if (entity.defaultField !== undefined) {
383
- return this.getDefaultValue(entity.defaultField);
384
- }
385
- else {
386
- const entityFields = this.fields.filter((field) => {
387
- return field && field.entity === entity.value;
388
- });
389
- if (entityFields && entityFields.length) {
390
- return entityFields[0];
391
- }
392
- else {
393
- console.warn(`No fields found for entity '${entity.name}'. ` +
394
- `A 'defaultOperator' is also not specified on the field config. Operator value will default to null.`);
395
- return null;
396
- }
397
- }
398
- }
399
- getDefaultOperator(field) {
400
- if (field && field.defaultOperator !== undefined) {
401
- return this.getDefaultValue(field.defaultOperator);
402
- }
403
- else {
404
- const operators = this.getOperators(field.value);
405
- if (operators && operators.length) {
406
- return operators[0];
407
- }
408
- else {
409
- console.warn(`No operators found for field '${field.value}'. ` +
410
- `A 'defaultOperator' is also not specified on the field config. Operator value will default to null.`);
411
- return null;
412
- }
413
- }
414
- }
415
- addRule(parent) {
416
- if (this.disabled) {
417
- return;
418
- }
419
- parent = parent || this.data;
420
- if (this.config.addRule) {
421
- this.config.addRule(parent);
422
- }
423
- else {
424
- const field = this.fields[0];
425
- parent.rules = parent.rules.concat([
426
- {
427
- field: field.value,
428
- operator: this.getDefaultOperator(field),
429
- value: this.getDefaultValue(field.defaultValue),
430
- entity: field.entity
431
- }
432
- ]);
433
- }
434
- this.handleTouched();
435
- this.handleDataChange();
436
- }
437
- removeRule(rule, parent) {
438
- if (this.disabled) {
439
- return;
440
- }
441
- parent = parent || this.data;
442
- if (this.config.removeRule) {
443
- this.config.removeRule(rule, parent);
444
- }
445
- else {
446
- parent.rules = parent.rules.filter((r) => r !== rule);
447
- }
448
- this.inputContextCache.delete(rule);
449
- this.operatorContextCache.delete(rule);
450
- this.fieldContextCache.delete(rule);
451
- this.entityContextCache.delete(rule);
452
- this.removeButtonContextCache.delete(rule);
453
- this.handleTouched();
454
- this.handleDataChange();
455
- }
456
- addRuleSet(parent) {
457
- if (this.disabled) {
458
- return;
459
- }
460
- parent = parent || this.data;
461
- if (this.config.addRuleSet) {
462
- this.config.addRuleSet(parent);
463
- }
464
- else {
465
- parent.rules = parent.rules.concat([{ condition: "and", rules: [] }]);
466
- }
467
- this.handleTouched();
468
- this.handleDataChange();
469
- }
470
- removeRuleSet(ruleset, parent) {
471
- if (this.disabled) {
472
- return;
473
- }
474
- ruleset = ruleset || this.data;
475
- parent = parent || this.parentValue;
476
- if (this.config.removeRuleSet) {
477
- this.config.removeRuleSet(ruleset, parent);
478
- }
479
- else if (parent) {
480
- parent.rules = parent.rules.filter((r) => r !== ruleset);
481
- }
482
- this.handleTouched();
483
- this.handleDataChange();
484
- }
485
- transitionEnd(e) {
486
- this.treeContainer.nativeElement.style.maxHeight = null;
487
- }
488
- toggleCollapse() {
489
- this.computedTreeContainerHeight();
490
- setTimeout(() => {
491
- this.data.collapsed = !this.data.collapsed;
492
- }, 100);
493
- }
494
- computedTreeContainerHeight() {
495
- const nativeElement = this.treeContainer.nativeElement;
496
- if (nativeElement && nativeElement.firstElementChild) {
497
- nativeElement.style.maxHeight = nativeElement.firstElementChild.clientHeight + 8 + "px";
498
- }
499
- }
500
- changeCondition(value) {
501
- if (this.disabled) {
502
- return;
503
- }
504
- this.data.condition = value;
505
- this.handleTouched();
506
- this.handleDataChange();
507
- }
508
- changeOperator(rule) {
509
- if (this.disabled) {
510
- return;
511
- }
512
- if (this.config.coerceValueForOperator) {
513
- rule.value = this.config.coerceValueForOperator(rule.operator, rule.value, rule);
514
- }
515
- else {
516
- rule.value = this.coerceValueForOperator(rule.operator, rule.value, rule);
517
- }
518
- this.handleTouched();
519
- this.handleDataChange();
520
- }
521
- coerceValueForOperator(operator, value, rule) {
522
- const inputType = this.getInputType(rule.field, operator);
523
- if (inputType === "multiselect" && !Array.isArray(value)) {
524
- return [value];
525
- }
526
- return value;
527
- }
528
- changeInput() {
529
- if (this.disabled) {
530
- return;
531
- }
532
- this.handleTouched();
533
- this.handleDataChange();
534
- }
535
- changeField(fieldValue, rule) {
536
- if (this.disabled) {
537
- return;
538
- }
539
- const inputContext = this.inputContextCache.get(rule);
540
- const currentField = inputContext && inputContext.field;
541
- const nextField = this.config.fields[fieldValue];
542
- const nextValue = this.calculateFieldChangeValue(currentField, nextField, rule.value);
543
- if (nextValue !== undefined) {
544
- rule.value = nextValue;
545
- }
546
- else {
547
- delete rule.value;
548
- }
549
- rule.operator = this.getDefaultOperator(nextField);
550
- // Create new context objects so templates will automatically update
551
- this.inputContextCache.delete(rule);
552
- this.operatorContextCache.delete(rule);
553
- this.fieldContextCache.delete(rule);
554
- this.entityContextCache.delete(rule);
555
- this.getInputContext(rule);
556
- this.getFieldContext(rule);
557
- this.getOperatorContext(rule);
558
- this.getEntityContext(rule);
559
- this.handleTouched();
560
- this.handleDataChange();
561
- }
562
- changeEntity(entityValue, rule, index, data) {
563
- if (this.disabled) {
564
- return;
565
- }
566
- let i = index;
567
- let rs = data;
568
- const entity = this.entities.find((e) => e.value === entityValue);
569
- const defaultField = this.getDefaultField(entity);
570
- if (!rs) {
571
- rs = this.data;
572
- i = rs.rules.findIndex((x) => x === rule);
573
- }
574
- rule.field = defaultField.value;
575
- rs.rules[i] = rule;
576
- if (defaultField) {
577
- this.changeField(defaultField.value, rule);
578
- }
579
- else {
580
- this.handleTouched();
581
- this.handleDataChange();
582
- }
583
- }
584
- getDefaultValue(defaultValue) {
585
- switch (typeof defaultValue) {
586
- case "function":
587
- return defaultValue();
588
- default:
589
- return defaultValue;
590
- }
591
- }
592
- getOperatorTemplate() {
593
- const t = this.parentOperatorTemplate || this.operatorTemplate;
594
- return t ? t.template : null;
595
- }
596
- getFieldTemplate() {
597
- const t = this.parentFieldTemplate || this.fieldTemplate;
598
- return t ? t.template : null;
599
- }
600
- getEntityTemplate() {
601
- const t = this.parentEntityTemplate || this.entityTemplate;
602
- return t ? t.template : null;
603
- }
604
- getArrowIconTemplate() {
605
- const t = this.parentArrowIconTemplate || this.arrowIconTemplate;
606
- return t ? t.template : null;
607
- }
608
- getButtonGroupTemplate() {
609
- const t = this.parentButtonGroupTemplate || this.buttonGroupTemplate;
610
- return t ? t.template : null;
611
- }
612
- getSwitchGroupTemplate() {
613
- const t = this.parentSwitchGroupTemplate || this.switchGroupTemplate;
614
- return t ? t.template : null;
615
- }
616
- getRemoveButtonTemplate() {
617
- const t = this.parentRemoveButtonTemplate || this.removeButtonTemplate;
618
- return t ? t.template : null;
619
- }
620
- getEmptyWarningTemplate() {
621
- const t = this.parentEmptyWarningTemplate || this.emptyWarningTemplate;
622
- return t ? t.template : null;
623
- }
624
- getQueryItemClassName(local) {
625
- let cls = this.getClassNames("row", "connector", "transition");
626
- cls += " " + this.getClassNames(local.ruleset ? "ruleSet" : "rule");
627
- if (local.invalid) {
628
- cls += " " + this.getClassNames("invalidRuleSet");
629
- }
630
- return cls;
631
- }
632
- getButtonGroupContext() {
633
- if (!this.buttonGroupContext) {
634
- this.buttonGroupContext = {
635
- addRule: this.addRule.bind(this),
636
- addRuleSet: this.allowRuleset && this.addRuleSet.bind(this),
637
- removeRuleSet: this.allowRuleset && this.parentValue && this.removeRuleSet.bind(this),
638
- getDisabledState: this.getDisabledState,
639
- $implicit: this.data
640
- };
641
- }
642
- return this.buttonGroupContext;
643
- }
644
- getRemoveButtonContext(rule) {
645
- if (!this.removeButtonContextCache.has(rule)) {
646
- this.removeButtonContextCache.set(rule, {
647
- removeRule: this.removeRule.bind(this),
648
- getDisabledState: this.getDisabledState,
649
- $implicit: rule
650
- });
651
- }
652
- return this.removeButtonContextCache.get(rule);
653
- }
654
- getFieldContext(rule) {
655
- if (!this.fieldContextCache.has(rule)) {
656
- this.fieldContextCache.set(rule, {
657
- onChange: this.changeField.bind(this),
658
- getFields: this.getFields.bind(this),
659
- getDisabledState: this.getDisabledState,
660
- fields: this.fields,
661
- $implicit: rule
662
- });
663
- }
664
- return this.fieldContextCache.get(rule);
665
- }
666
- getEntityContext(rule) {
667
- if (!this.entityContextCache.has(rule)) {
668
- this.entityContextCache.set(rule, {
669
- onChange: this.changeEntity.bind(this),
670
- getDisabledState: this.getDisabledState,
671
- entities: this.entities,
672
- $implicit: rule
673
- });
674
- }
675
- return this.entityContextCache.get(rule);
676
- }
677
- getSwitchGroupContext() {
678
- return {
679
- onChange: this.changeCondition.bind(this),
680
- getDisabledState: this.getDisabledState,
681
- $implicit: this.data
682
- };
683
- }
684
- getArrowIconContext() {
685
- return {
686
- getDisabledState: this.getDisabledState,
687
- $implicit: this.data
688
- };
689
- }
690
- getEmptyWarningContext() {
691
- return {
692
- getDisabledState: this.getDisabledState,
693
- message: this.emptyMessage,
694
- $implicit: this.data
695
- };
696
- }
697
- getOperatorContext(rule) {
698
- if (!this.operatorContextCache.has(rule)) {
699
- this.operatorContextCache.set(rule, {
700
- onChange: this.changeOperator.bind(this),
701
- getDisabledState: this.getDisabledState,
702
- operators: this.getOperators(rule.field),
703
- $implicit: rule
704
- });
705
- }
706
- return this.operatorContextCache.get(rule);
707
- }
708
- getInputContext(rule) {
709
- if (!this.inputContextCache.has(rule)) {
710
- this.inputContextCache.set(rule, {
711
- onChange: this.changeInput.bind(this),
712
- getDisabledState: this.getDisabledState,
713
- options: this.getOptions(rule.field),
714
- field: this.config.fields[rule.field],
715
- $implicit: rule
716
- });
717
- }
718
- return this.inputContextCache.get(rule);
719
- }
720
- calculateFieldChangeValue(currentField, nextField, currentValue) {
721
- if (this.config.calculateFieldChangeValue != null) {
722
- return this.config.calculateFieldChangeValue(currentField, nextField, currentValue);
723
- }
724
- const canKeepValue = () => {
725
- if (currentField == null || nextField == null) {
726
- return false;
727
- }
728
- return (currentField.type === nextField.type &&
729
- this.defaultPersistValueTypes.indexOf(currentField.type) !== -1);
730
- };
731
- if (this.persistValueOnFieldChange && canKeepValue()) {
732
- return currentValue;
733
- }
734
- if (nextField && nextField.defaultValue !== undefined) {
735
- return this.getDefaultValue(nextField.defaultValue);
736
- }
737
- return undefined;
738
- }
739
- checkEmptyRuleInRuleset(ruleset) {
740
- if (!ruleset || !ruleset.rules || ruleset.rules.length === 0) {
741
- return true;
742
- }
743
- else {
744
- return ruleset.rules.some((item) => {
745
- if (item.rules) {
746
- return this.checkEmptyRuleInRuleset(item);
747
- }
748
- else {
749
- return false;
750
- }
751
- });
752
- }
753
- }
754
- validateRulesInRuleset(ruleset, errorStore) {
755
- if (ruleset && ruleset.rules && ruleset.rules.length > 0) {
756
- ruleset.rules.forEach((item) => {
757
- if (item.rules) {
758
- return this.validateRulesInRuleset(item, errorStore);
759
- }
760
- else if (item.field) {
761
- const field = this.config.fields[item.field];
762
- if (field && field.validator) {
763
- const error = field.validator(item, ruleset);
764
- if (error != null) {
765
- errorStore.push(error);
766
- }
767
- }
768
- }
769
- });
770
- }
771
- }
772
- handleDataChange() {
773
- this.changeDetectorRef.markForCheck();
774
- if (this.onChangeCallback) {
775
- this.onChangeCallback();
776
- }
777
- if (this.parentChangeCallback) {
778
- this.parentChangeCallback();
779
- }
780
- }
781
- handleTouched() {
782
- if (this.onTouchedCallback) {
783
- this.onTouchedCallback();
784
- }
785
- if (this.parentTouchedCallback) {
786
- this.parentTouchedCallback();
787
- }
788
- }
789
- }
790
- QueryBuilderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryBuilderComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
791
- QueryBuilderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.0", type: QueryBuilderComponent, 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:white;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:rgba(179,65,93,.1)!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:white}:host .q-transition{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"] }] });
792
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: QueryBuilderComponent, decorators: [{
793
- type: Component,
794
- args: [{ selector: "query-builder", providers: [CONTROL_VALUE_ACCESSOR, VALIDATOR], 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:white;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:rgba(179,65,93,.1)!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:white}:host .q-transition{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"] }]
795
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { disabled: [{
796
- type: Input
797
- }], data: [{
798
- type: Input
799
- }], condition: [{
800
- type: HostBinding,
801
- args: ["attr.query-builder-condition"]
802
- }], allowRuleset: [{
803
- type: Input
804
- }], allowCollapse: [{
805
- type: Input
806
- }], emptyMessage: [{
807
- type: Input
808
- }], classNames: [{
809
- type: Input
810
- }], operatorMap: [{
811
- type: Input
812
- }], parentValue: [{
813
- type: Input
814
- }], config: [{
815
- type: Input
816
- }], parentArrowIconTemplate: [{
817
- type: Input
818
- }], parentInputTemplates: [{
819
- type: Input
820
- }], parentOperatorTemplate: [{
821
- type: Input
822
- }], parentFieldTemplate: [{
823
- type: Input
824
- }], parentEntityTemplate: [{
825
- type: Input
826
- }], parentSwitchGroupTemplate: [{
827
- type: Input
828
- }], parentButtonGroupTemplate: [{
829
- type: Input
830
- }], parentRemoveButtonTemplate: [{
831
- type: Input
832
- }], parentEmptyWarningTemplate: [{
833
- type: Input
834
- }], parentChangeCallback: [{
835
- type: Input
836
- }], parentTouchedCallback: [{
837
- type: Input
838
- }], persistValueOnFieldChange: [{
839
- type: Input
840
- }], treeContainer: [{
841
- type: ViewChild,
842
- args: ["treeContainer", { static: true }]
843
- }], buttonGroupTemplate: [{
844
- type: ContentChild,
845
- args: [QueryButtonGroupDirective]
846
- }], switchGroupTemplate: [{
847
- type: ContentChild,
848
- args: [QuerySwitchGroupDirective]
849
- }], fieldTemplate: [{
850
- type: ContentChild,
851
- args: [QueryFieldDirective]
852
- }], entityTemplate: [{
853
- type: ContentChild,
854
- args: [QueryEntityDirective]
855
- }], operatorTemplate: [{
856
- type: ContentChild,
857
- args: [QueryOperatorDirective]
858
- }], removeButtonTemplate: [{
859
- type: ContentChild,
860
- args: [QueryRemoveButtonDirective]
861
- }], emptyWarningTemplate: [{
862
- type: ContentChild,
863
- args: [QueryEmptyWarningDirective]
864
- }], inputTemplates: [{
865
- type: ContentChildren,
866
- args: [QueryInputDirective, { descendants: true }]
867
- }], arrowIconTemplate: [{
868
- type: ContentChild,
869
- args: [QueryArrowIconDirective]
870
- }], value: [{
871
- type: Input
130
+ const CONTROL_VALUE_ACCESSOR = {
131
+ provide: NG_VALUE_ACCESSOR,
132
+ useExisting: forwardRef(() => QueryBuilderComponent),
133
+ multi: true
134
+ };
135
+ const VALIDATOR = {
136
+ provide: NG_VALIDATORS,
137
+ useExisting: forwardRef(() => QueryBuilderComponent),
138
+ multi: true
139
+ };
140
+ class QueryBuilderComponent {
141
+ get condition() {
142
+ return this.data?.condition;
143
+ }
144
+ constructor(changeDetectorRef) {
145
+ this.changeDetectorRef = changeDetectorRef;
146
+ this.defaultClassNames = {
147
+ arrowIconButton: "q-arrow-icon-button",
148
+ arrowIcon: "q-icon q-arrow-icon",
149
+ removeIcon: "q-icon q-remove-icon",
150
+ addIcon: "q-icon q-add-icon",
151
+ button: "q-button",
152
+ buttonGroup: "q-button-group",
153
+ removeButton: "q-remove-button",
154
+ switchGroup: "q-switch-group",
155
+ switchLabel: "q-switch-label",
156
+ switchRadio: "q-switch-radio",
157
+ rightAlign: "q-right-align",
158
+ transition: "q-transition",
159
+ collapsed: "q-collapsed",
160
+ treeContainer: "q-tree-container",
161
+ tree: "q-tree",
162
+ row: "q-row",
163
+ connector: "q-connector",
164
+ rule: "q-rule",
165
+ ruleSet: "q-ruleset",
166
+ invalidRuleSet: "q-invalid-ruleset",
167
+ emptyWarning: "q-empty-warning",
168
+ fieldControl: "q-field-control",
169
+ fieldControlSize: "q-control-size",
170
+ entityControl: "q-entity-control",
171
+ entityControlSize: "q-control-size",
172
+ operatorControl: "q-operator-control",
173
+ operatorControlSize: "q-control-size",
174
+ inputControl: "q-input-control",
175
+ inputControlSize: "q-control-size"
176
+ };
177
+ this.defaultOperatorMap = {
178
+ string: ["=", "!=", "contains", "like"],
179
+ number: ["=", "!=", ">", ">=", "<", "<="],
180
+ time: ["=", "!=", ">", ">=", "<", "<="],
181
+ date: ["=", "!=", ">", ">=", "<", "<="],
182
+ category: ["=", "!=", "in", "not in"],
183
+ boolean: ["="]
184
+ };
185
+ this.disabled = false;
186
+ this.data = { condition: "and", rules: [] };
187
+ this.allowRuleset = true;
188
+ this.allowCollapse = false;
189
+ this.emptyMessage = "A ruleset cannot be empty. Please add a rule or remove it all together.";
190
+ this.classNames = {};
191
+ this.operatorMap = {};
192
+ this.config = { fields: {} };
193
+ this.persistValueOnFieldChange = false;
194
+ this.defaultTemplateTypes = [
195
+ "string",
196
+ "number",
197
+ "time",
198
+ "date",
199
+ "category",
200
+ "boolean",
201
+ "multiselect"
202
+ ];
203
+ this.defaultPersistValueTypes = ["string", "number", "time", "date", "boolean"];
204
+ this.defaultEmptyList = [];
205
+ this.operatorsCache = {};
206
+ this.inputContextCache = new Map();
207
+ this.operatorContextCache = new Map();
208
+ this.fieldContextCache = new Map();
209
+ this.entityContextCache = new Map();
210
+ this.removeButtonContextCache = new Map();
211
+ // ----------END----------
212
+ this.getDisabledState = () => {
213
+ return this.disabled;
214
+ };
215
+ this.fields = [];
216
+ this.filterFields = [];
217
+ this.entities = [];
218
+ }
219
+ // ----------OnChanges Implementation----------
220
+ ngOnChanges(changes) {
221
+ const config = this.config;
222
+ const type = typeof config;
223
+ if (type === "object") {
224
+ this.fields = Object.keys(config.fields).map((value) => {
225
+ const field = config.fields[value];
226
+ field.value = field.value || value;
227
+ return field;
228
+ });
229
+ if (config.entities) {
230
+ this.entities = Object.keys(config.entities).map((value) => {
231
+ const entity = config.entities ? config.entities[value] : [];
232
+ entity.value = entity.value || value;
233
+ return entity;
234
+ });
235
+ }
236
+ else {
237
+ this.entities = [];
238
+ }
239
+ this.operatorsCache = {};
240
+ }
241
+ else {
242
+ throw new Error(`Expected 'config' must be a valid object, got ${type} instead.`);
243
+ }
244
+ }
245
+ // ----------Validator Implementation----------
246
+ validate(control) {
247
+ const errors = {};
248
+ const ruleErrorStore = [];
249
+ let hasErrors = false;
250
+ if (!this.config.allowEmptyRulesets && this.checkEmptyRuleInRuleset(this.data)) {
251
+ errors.empty = "Empty rulesets are not allowed.";
252
+ hasErrors = true;
253
+ }
254
+ this.validateRulesInRuleset(this.data, ruleErrorStore);
255
+ if (ruleErrorStore.length) {
256
+ errors.rules = ruleErrorStore;
257
+ hasErrors = true;
258
+ }
259
+ return hasErrors ? errors : null;
260
+ }
261
+ // ----------ControlValueAccessor Implementation----------
262
+ get value() {
263
+ return this.data;
264
+ }
265
+ set value(value) {
266
+ // When component is initialized without a formControl, null is passed to value
267
+ this.data = value || { condition: "and", rules: [] };
268
+ this.handleDataChange();
269
+ }
270
+ writeValue(obj) {
271
+ this.value = obj;
272
+ }
273
+ registerOnChange(fn) {
274
+ this.onChangeCallback = () => fn(this.data);
275
+ }
276
+ registerOnTouched(fn) {
277
+ this.onTouchedCallback = () => fn(this.data);
278
+ }
279
+ setDisabledState(isDisabled) {
280
+ this.disabled = isDisabled;
281
+ this.changeDetectorRef.detectChanges();
282
+ }
283
+ findTemplateForRule(rule) {
284
+ const type = this.getInputType(rule.field, rule.operator);
285
+ if (type) {
286
+ const queryInput = this.findQueryInput(type);
287
+ if (queryInput) {
288
+ return queryInput.template;
289
+ }
290
+ else {
291
+ if (this.defaultTemplateTypes.indexOf(type) === -1) {
292
+ console.warn(`Could not find template for field with type: ${type}`);
293
+ }
294
+ return null;
295
+ }
296
+ }
297
+ }
298
+ findQueryInput(type) {
299
+ const templates = this.parentInputTemplates || this.inputTemplates || [];
300
+ return templates.find((item) => item.queryInputType === type);
301
+ }
302
+ getOperators(field) {
303
+ if (this.operatorsCache[field]) {
304
+ return this.operatorsCache[field];
305
+ }
306
+ let operators = this.defaultEmptyList;
307
+ const fieldObject = this.config.fields[field];
308
+ if (this.config.getOperators) {
309
+ return this.config.getOperators(field, fieldObject);
310
+ }
311
+ const type = fieldObject.type;
312
+ if (fieldObject && fieldObject.operators) {
313
+ operators = fieldObject.operators;
314
+ }
315
+ else if (type) {
316
+ operators =
317
+ (this.operatorMap && this.operatorMap[type]) ||
318
+ this.defaultOperatorMap[type] ||
319
+ this.defaultEmptyList;
320
+ if (operators.length === 0) {
321
+ console.warn(`No operators found for field '${field}' with type ${fieldObject.type}. ` +
322
+ `Please define an 'operators' property on the field or use the 'operatorMap' binding to fix this.`);
323
+ }
324
+ if (fieldObject.nullable) {
325
+ operators = operators.concat(["is null", "is not null"]);
326
+ }
327
+ }
328
+ else {
329
+ console.warn(`No 'type' property found on field: '${field}'`);
330
+ }
331
+ // Cache reference to array object, so it won't be computed next time and trigger a rerender.
332
+ this.operatorsCache[field] = operators;
333
+ return operators;
334
+ }
335
+ getFields(entity) {
336
+ if (this.entities?.length && entity) {
337
+ return this.fields.filter((field) => {
338
+ return field && field.entity === entity;
339
+ });
340
+ }
341
+ else {
342
+ return this.fields;
343
+ }
344
+ }
345
+ getInputType(field, operator) {
346
+ if (this.config.getInputType) {
347
+ return this.config.getInputType(field, operator);
348
+ }
349
+ if (!this.config.fields[field]) {
350
+ throw new Error(`No configuration for field '${field}' could be found! Please add it to config.fields.`);
351
+ }
352
+ const type = this.config.fields[field].type;
353
+ switch (operator) {
354
+ case "is null":
355
+ case "is not null":
356
+ return null; // No displayed component
357
+ case "in":
358
+ case "not in":
359
+ return type === "category" || type === "boolean" ? "multiselect" : type;
360
+ default:
361
+ return type;
362
+ }
363
+ }
364
+ getOptions(field) {
365
+ if (this.config.getOptions) {
366
+ return this.config.getOptions(field);
367
+ }
368
+ return this.config.fields[field].options || this.defaultEmptyList;
369
+ }
370
+ getClassNames(...args) {
371
+ const clsLookup = this.classNames ? this.classNames : this.defaultClassNames;
372
+ const defaultClassNames = this.defaultClassNames;
373
+ const classNames = args
374
+ .map((id) => clsLookup[id] || defaultClassNames[id])
375
+ .filter((c) => !!c);
376
+ return classNames.length ? classNames.join(" ") : [];
377
+ }
378
+ getDefaultField(entity) {
379
+ if (!entity) {
380
+ return null;
381
+ }
382
+ else if (entity.defaultField !== undefined) {
383
+ return this.getDefaultValue(entity.defaultField);
384
+ }
385
+ else {
386
+ const entityFields = this.fields.filter((field) => {
387
+ return field && field.entity === entity.value;
388
+ });
389
+ if (entityFields && entityFields.length) {
390
+ return entityFields[0];
391
+ }
392
+ else {
393
+ console.warn(`No fields found for entity '${entity.name}'. ` +
394
+ `A 'defaultOperator' is also not specified on the field config. Operator value will default to null.`);
395
+ return null;
396
+ }
397
+ }
398
+ }
399
+ getDefaultOperator(field) {
400
+ if (field && field.defaultOperator !== undefined) {
401
+ return this.getDefaultValue(field.defaultOperator);
402
+ }
403
+ else {
404
+ const operators = this.getOperators(field.value);
405
+ if (operators && operators.length) {
406
+ return operators[0];
407
+ }
408
+ else {
409
+ console.warn(`No operators found for field '${field.value}'. ` +
410
+ `A 'defaultOperator' is also not specified on the field config. Operator value will default to null.`);
411
+ return null;
412
+ }
413
+ }
414
+ }
415
+ addRule(parent) {
416
+ if (this.disabled) {
417
+ return;
418
+ }
419
+ parent = parent || this.data;
420
+ if (this.config.addRule) {
421
+ this.config.addRule(parent);
422
+ }
423
+ else {
424
+ const field = this.fields[0];
425
+ parent.rules = parent.rules.concat([
426
+ {
427
+ field: field.value,
428
+ operator: this.getDefaultOperator(field),
429
+ value: this.getDefaultValue(field.defaultValue),
430
+ entity: field.entity
431
+ }
432
+ ]);
433
+ }
434
+ this.handleTouched();
435
+ this.handleDataChange();
436
+ }
437
+ removeRule(rule, parent) {
438
+ if (this.disabled) {
439
+ return;
440
+ }
441
+ parent = parent || this.data;
442
+ if (this.config.removeRule) {
443
+ this.config.removeRule(rule, parent);
444
+ }
445
+ else {
446
+ parent.rules = parent.rules.filter((r) => r !== rule);
447
+ }
448
+ this.inputContextCache.delete(rule);
449
+ this.operatorContextCache.delete(rule);
450
+ this.fieldContextCache.delete(rule);
451
+ this.entityContextCache.delete(rule);
452
+ this.removeButtonContextCache.delete(rule);
453
+ this.handleTouched();
454
+ this.handleDataChange();
455
+ }
456
+ addRuleSet(parent) {
457
+ if (this.disabled) {
458
+ return;
459
+ }
460
+ parent = parent || this.data;
461
+ if (this.config.addRuleSet) {
462
+ this.config.addRuleSet(parent);
463
+ }
464
+ else {
465
+ parent.rules = parent.rules.concat([{ condition: "and", rules: [] }]);
466
+ }
467
+ this.handleTouched();
468
+ this.handleDataChange();
469
+ }
470
+ removeRuleSet(ruleset, parent) {
471
+ if (this.disabled) {
472
+ return;
473
+ }
474
+ ruleset = ruleset || this.data;
475
+ parent = parent || this.parentValue;
476
+ if (this.config.removeRuleSet) {
477
+ this.config.removeRuleSet(ruleset, parent);
478
+ }
479
+ else if (parent) {
480
+ parent.rules = parent.rules.filter((r) => r !== ruleset);
481
+ }
482
+ this.handleTouched();
483
+ this.handleDataChange();
484
+ }
485
+ transitionEnd(e) {
486
+ this.treeContainer.nativeElement.style.maxHeight = null;
487
+ }
488
+ toggleCollapse() {
489
+ this.computedTreeContainerHeight();
490
+ setTimeout(() => {
491
+ this.data.collapsed = !this.data.collapsed;
492
+ }, 100);
493
+ }
494
+ computedTreeContainerHeight() {
495
+ const nativeElement = this.treeContainer.nativeElement;
496
+ if (nativeElement && nativeElement.firstElementChild) {
497
+ nativeElement.style.maxHeight = nativeElement.firstElementChild.clientHeight + 8 + "px";
498
+ }
499
+ }
500
+ changeCondition(value) {
501
+ if (this.disabled) {
502
+ return;
503
+ }
504
+ this.data.condition = value;
505
+ this.handleTouched();
506
+ this.handleDataChange();
507
+ }
508
+ changeOperator(rule) {
509
+ if (this.disabled) {
510
+ return;
511
+ }
512
+ if (this.config.coerceValueForOperator) {
513
+ rule.value = this.config.coerceValueForOperator(rule.operator, rule.value, rule);
514
+ }
515
+ else {
516
+ rule.value = this.coerceValueForOperator(rule.operator, rule.value, rule);
517
+ }
518
+ this.handleTouched();
519
+ this.handleDataChange();
520
+ }
521
+ coerceValueForOperator(operator, value, rule) {
522
+ const inputType = this.getInputType(rule.field, operator);
523
+ if (inputType === "multiselect" && !Array.isArray(value)) {
524
+ return [value];
525
+ }
526
+ return value;
527
+ }
528
+ changeInput() {
529
+ if (this.disabled) {
530
+ return;
531
+ }
532
+ this.handleTouched();
533
+ this.handleDataChange();
534
+ }
535
+ changeField(fieldValue, rule) {
536
+ if (this.disabled) {
537
+ return;
538
+ }
539
+ const inputContext = this.inputContextCache.get(rule);
540
+ const currentField = inputContext && inputContext.field;
541
+ const nextField = this.config.fields[fieldValue];
542
+ const nextValue = this.calculateFieldChangeValue(currentField, nextField, rule.value);
543
+ if (nextValue !== undefined) {
544
+ rule.value = nextValue;
545
+ }
546
+ else {
547
+ delete rule.value;
548
+ }
549
+ rule.operator = this.getDefaultOperator(nextField);
550
+ // Create new context objects so templates will automatically update
551
+ this.inputContextCache.delete(rule);
552
+ this.operatorContextCache.delete(rule);
553
+ this.fieldContextCache.delete(rule);
554
+ this.entityContextCache.delete(rule);
555
+ this.getInputContext(rule);
556
+ this.getFieldContext(rule);
557
+ this.getOperatorContext(rule);
558
+ this.getEntityContext(rule);
559
+ this.handleTouched();
560
+ this.handleDataChange();
561
+ }
562
+ changeEntity(entityValue, rule, index, data) {
563
+ if (this.disabled) {
564
+ return;
565
+ }
566
+ let i = index;
567
+ let rs = data;
568
+ const entity = this.entities.find((e) => e.value === entityValue);
569
+ const defaultField = this.getDefaultField(entity);
570
+ if (!rs) {
571
+ rs = this.data;
572
+ i = rs.rules.findIndex((x) => x === rule);
573
+ }
574
+ rule.field = defaultField.value;
575
+ rs.rules[i] = rule;
576
+ if (defaultField) {
577
+ this.changeField(defaultField.value, rule);
578
+ }
579
+ else {
580
+ this.handleTouched();
581
+ this.handleDataChange();
582
+ }
583
+ }
584
+ getDefaultValue(defaultValue) {
585
+ switch (typeof defaultValue) {
586
+ case "function":
587
+ return defaultValue();
588
+ default:
589
+ return defaultValue;
590
+ }
591
+ }
592
+ getOperatorTemplate() {
593
+ const t = this.parentOperatorTemplate || this.operatorTemplate;
594
+ return t ? t.template : null;
595
+ }
596
+ getFieldTemplate() {
597
+ const t = this.parentFieldTemplate || this.fieldTemplate;
598
+ return t ? t.template : null;
599
+ }
600
+ getEntityTemplate() {
601
+ const t = this.parentEntityTemplate || this.entityTemplate;
602
+ return t ? t.template : null;
603
+ }
604
+ getArrowIconTemplate() {
605
+ const t = this.parentArrowIconTemplate || this.arrowIconTemplate;
606
+ return t ? t.template : null;
607
+ }
608
+ getButtonGroupTemplate() {
609
+ const t = this.parentButtonGroupTemplate || this.buttonGroupTemplate;
610
+ return t ? t.template : null;
611
+ }
612
+ getSwitchGroupTemplate() {
613
+ const t = this.parentSwitchGroupTemplate || this.switchGroupTemplate;
614
+ return t ? t.template : null;
615
+ }
616
+ getRemoveButtonTemplate() {
617
+ const t = this.parentRemoveButtonTemplate || this.removeButtonTemplate;
618
+ return t ? t.template : null;
619
+ }
620
+ getEmptyWarningTemplate() {
621
+ const t = this.parentEmptyWarningTemplate || this.emptyWarningTemplate;
622
+ return t ? t.template : null;
623
+ }
624
+ getQueryItemClassName(local) {
625
+ let cls = this.getClassNames("row", "connector", "transition");
626
+ cls += " " + this.getClassNames(local.ruleset ? "ruleSet" : "rule");
627
+ if (local.invalid) {
628
+ cls += " " + this.getClassNames("invalidRuleSet");
629
+ }
630
+ return cls;
631
+ }
632
+ getButtonGroupContext() {
633
+ if (!this.buttonGroupContext) {
634
+ this.buttonGroupContext = {
635
+ addRule: this.addRule.bind(this),
636
+ addRuleSet: this.allowRuleset && this.addRuleSet.bind(this),
637
+ removeRuleSet: this.allowRuleset && this.parentValue && this.removeRuleSet.bind(this),
638
+ getDisabledState: this.getDisabledState,
639
+ $implicit: this.data
640
+ };
641
+ }
642
+ return this.buttonGroupContext;
643
+ }
644
+ getRemoveButtonContext(rule) {
645
+ if (!this.removeButtonContextCache.has(rule)) {
646
+ this.removeButtonContextCache.set(rule, {
647
+ removeRule: this.removeRule.bind(this),
648
+ getDisabledState: this.getDisabledState,
649
+ $implicit: rule
650
+ });
651
+ }
652
+ return this.removeButtonContextCache.get(rule);
653
+ }
654
+ getFieldContext(rule) {
655
+ if (!this.fieldContextCache.has(rule)) {
656
+ this.fieldContextCache.set(rule, {
657
+ onChange: this.changeField.bind(this),
658
+ getFields: this.getFields.bind(this),
659
+ getDisabledState: this.getDisabledState,
660
+ fields: this.fields,
661
+ $implicit: rule
662
+ });
663
+ }
664
+ return this.fieldContextCache.get(rule);
665
+ }
666
+ getEntityContext(rule) {
667
+ if (!this.entityContextCache.has(rule)) {
668
+ this.entityContextCache.set(rule, {
669
+ onChange: this.changeEntity.bind(this),
670
+ getDisabledState: this.getDisabledState,
671
+ entities: this.entities,
672
+ $implicit: rule
673
+ });
674
+ }
675
+ return this.entityContextCache.get(rule);
676
+ }
677
+ getSwitchGroupContext() {
678
+ return {
679
+ onChange: this.changeCondition.bind(this),
680
+ getDisabledState: this.getDisabledState,
681
+ $implicit: this.data
682
+ };
683
+ }
684
+ getArrowIconContext() {
685
+ return {
686
+ getDisabledState: this.getDisabledState,
687
+ $implicit: this.data
688
+ };
689
+ }
690
+ getEmptyWarningContext() {
691
+ return {
692
+ getDisabledState: this.getDisabledState,
693
+ message: this.emptyMessage,
694
+ $implicit: this.data
695
+ };
696
+ }
697
+ getOperatorContext(rule) {
698
+ if (!this.operatorContextCache.has(rule)) {
699
+ this.operatorContextCache.set(rule, {
700
+ onChange: this.changeOperator.bind(this),
701
+ getDisabledState: this.getDisabledState,
702
+ operators: this.getOperators(rule.field),
703
+ $implicit: rule
704
+ });
705
+ }
706
+ return this.operatorContextCache.get(rule);
707
+ }
708
+ getInputContext(rule) {
709
+ if (!this.inputContextCache.has(rule)) {
710
+ this.inputContextCache.set(rule, {
711
+ onChange: this.changeInput.bind(this),
712
+ getDisabledState: this.getDisabledState,
713
+ options: this.getOptions(rule.field),
714
+ field: this.config.fields[rule.field],
715
+ $implicit: rule
716
+ });
717
+ }
718
+ return this.inputContextCache.get(rule);
719
+ }
720
+ calculateFieldChangeValue(currentField, nextField, currentValue) {
721
+ if (this.config.calculateFieldChangeValue != null) {
722
+ return this.config.calculateFieldChangeValue(currentField, nextField, currentValue);
723
+ }
724
+ const canKeepValue = () => {
725
+ if (currentField == null || nextField == null) {
726
+ return false;
727
+ }
728
+ return (currentField.type === nextField.type &&
729
+ this.defaultPersistValueTypes.indexOf(currentField.type) !== -1);
730
+ };
731
+ if (this.persistValueOnFieldChange && canKeepValue()) {
732
+ return currentValue;
733
+ }
734
+ if (nextField && nextField.defaultValue !== undefined) {
735
+ return this.getDefaultValue(nextField.defaultValue);
736
+ }
737
+ return undefined;
738
+ }
739
+ checkEmptyRuleInRuleset(ruleset) {
740
+ if (!ruleset || !ruleset.rules || ruleset.rules.length === 0) {
741
+ return true;
742
+ }
743
+ else {
744
+ return ruleset.rules.some((item) => {
745
+ if (item.rules) {
746
+ return this.checkEmptyRuleInRuleset(item);
747
+ }
748
+ else {
749
+ return false;
750
+ }
751
+ });
752
+ }
753
+ }
754
+ validateRulesInRuleset(ruleset, errorStore) {
755
+ if (ruleset && ruleset.rules && ruleset.rules.length > 0) {
756
+ ruleset.rules.forEach((item) => {
757
+ if (item.rules) {
758
+ return this.validateRulesInRuleset(item, errorStore);
759
+ }
760
+ else if (item.field) {
761
+ const field = this.config.fields[item.field];
762
+ if (field && field.validator) {
763
+ const error = field.validator(item, ruleset);
764
+ if (error != null) {
765
+ errorStore.push(error);
766
+ }
767
+ }
768
+ }
769
+ });
770
+ }
771
+ }
772
+ handleDataChange() {
773
+ this.changeDetectorRef.markForCheck();
774
+ if (this.onChangeCallback) {
775
+ this.onChangeCallback();
776
+ }
777
+ if (this.parentChangeCallback) {
778
+ this.parentChangeCallback();
779
+ }
780
+ }
781
+ handleTouched() {
782
+ if (this.onTouchedCallback) {
783
+ this.onTouchedCallback();
784
+ }
785
+ if (this.parentTouchedCallback) {
786
+ this.parentTouchedCallback();
787
+ }
788
+ }
789
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryBuilderComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
790
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.3", type: QueryBuilderComponent, 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"] }] }); }
791
+ }
792
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: QueryBuilderComponent, decorators: [{
793
+ type: Component,
794
+ args: [{ selector: "query-builder", providers: [CONTROL_VALUE_ACCESSOR, VALIDATOR], 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"] }]
795
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { disabled: [{
796
+ type: Input
797
+ }], data: [{
798
+ type: Input
799
+ }], condition: [{
800
+ type: HostBinding,
801
+ args: ["attr.query-builder-condition"]
802
+ }], allowRuleset: [{
803
+ type: Input
804
+ }], allowCollapse: [{
805
+ type: Input
806
+ }], emptyMessage: [{
807
+ type: Input
808
+ }], classNames: [{
809
+ type: Input
810
+ }], operatorMap: [{
811
+ type: Input
812
+ }], parentValue: [{
813
+ type: Input
814
+ }], config: [{
815
+ type: Input
816
+ }], parentArrowIconTemplate: [{
817
+ type: Input
818
+ }], parentInputTemplates: [{
819
+ type: Input
820
+ }], parentOperatorTemplate: [{
821
+ type: Input
822
+ }], parentFieldTemplate: [{
823
+ type: Input
824
+ }], parentEntityTemplate: [{
825
+ type: Input
826
+ }], parentSwitchGroupTemplate: [{
827
+ type: Input
828
+ }], parentButtonGroupTemplate: [{
829
+ type: Input
830
+ }], parentRemoveButtonTemplate: [{
831
+ type: Input
832
+ }], parentEmptyWarningTemplate: [{
833
+ type: Input
834
+ }], parentChangeCallback: [{
835
+ type: Input
836
+ }], parentTouchedCallback: [{
837
+ type: Input
838
+ }], persistValueOnFieldChange: [{
839
+ type: Input
840
+ }], treeContainer: [{
841
+ type: ViewChild,
842
+ args: ["treeContainer", { static: true }]
843
+ }], buttonGroupTemplate: [{
844
+ type: ContentChild,
845
+ args: [QueryButtonGroupDirective]
846
+ }], switchGroupTemplate: [{
847
+ type: ContentChild,
848
+ args: [QuerySwitchGroupDirective]
849
+ }], fieldTemplate: [{
850
+ type: ContentChild,
851
+ args: [QueryFieldDirective]
852
+ }], entityTemplate: [{
853
+ type: ContentChild,
854
+ args: [QueryEntityDirective]
855
+ }], operatorTemplate: [{
856
+ type: ContentChild,
857
+ args: [QueryOperatorDirective]
858
+ }], removeButtonTemplate: [{
859
+ type: ContentChild,
860
+ args: [QueryRemoveButtonDirective]
861
+ }], emptyWarningTemplate: [{
862
+ type: ContentChild,
863
+ args: [QueryEmptyWarningDirective]
864
+ }], inputTemplates: [{
865
+ type: ContentChildren,
866
+ args: [QueryInputDirective, { descendants: true }]
867
+ }], arrowIconTemplate: [{
868
+ type: ContentChild,
869
+ args: [QueryArrowIconDirective]
870
+ }], value: [{
871
+ type: Input
872
872
  }] } });
873
873
 
874
- class NgxAngularQueryBuilderModule {
875
- }
876
- NgxAngularQueryBuilderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: NgxAngularQueryBuilderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
877
- NgxAngularQueryBuilderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.0", ngImport: i0, type: NgxAngularQueryBuilderModule, declarations: [QueryBuilderComponent,
878
- QueryInputDirective,
879
- QueryOperatorDirective,
880
- QueryFieldDirective,
881
- QueryEntityDirective,
882
- QueryButtonGroupDirective,
883
- QuerySwitchGroupDirective,
884
- QueryRemoveButtonDirective,
885
- QueryEmptyWarningDirective,
886
- QueryArrowIconDirective], imports: [CommonModule, FormsModule], exports: [QueryBuilderComponent,
887
- QueryInputDirective,
888
- QueryOperatorDirective,
889
- QueryFieldDirective,
890
- QueryEntityDirective,
891
- QueryButtonGroupDirective,
892
- QuerySwitchGroupDirective,
893
- QueryRemoveButtonDirective,
894
- QueryEmptyWarningDirective,
895
- QueryArrowIconDirective] });
896
- NgxAngularQueryBuilderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: NgxAngularQueryBuilderModule, imports: [CommonModule, FormsModule] });
897
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: NgxAngularQueryBuilderModule, decorators: [{
898
- type: NgModule,
899
- args: [{
900
- imports: [CommonModule, FormsModule],
901
- declarations: [
902
- QueryBuilderComponent,
903
- QueryInputDirective,
904
- QueryOperatorDirective,
905
- QueryFieldDirective,
906
- QueryEntityDirective,
907
- QueryButtonGroupDirective,
908
- QuerySwitchGroupDirective,
909
- QueryRemoveButtonDirective,
910
- QueryEmptyWarningDirective,
911
- QueryArrowIconDirective
912
- ],
913
- exports: [
914
- QueryBuilderComponent,
915
- QueryInputDirective,
916
- QueryOperatorDirective,
917
- QueryFieldDirective,
918
- QueryEntityDirective,
919
- QueryButtonGroupDirective,
920
- QuerySwitchGroupDirective,
921
- QueryRemoveButtonDirective,
922
- QueryEmptyWarningDirective,
923
- QueryArrowIconDirective
924
- ]
925
- }]
874
+ class NgxAngularQueryBuilderModule {
875
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgxAngularQueryBuilderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
876
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.3", ngImport: i0, type: NgxAngularQueryBuilderModule, declarations: [QueryBuilderComponent,
877
+ QueryInputDirective,
878
+ QueryOperatorDirective,
879
+ QueryFieldDirective,
880
+ QueryEntityDirective,
881
+ QueryButtonGroupDirective,
882
+ QuerySwitchGroupDirective,
883
+ QueryRemoveButtonDirective,
884
+ QueryEmptyWarningDirective,
885
+ QueryArrowIconDirective], imports: [CommonModule, FormsModule], exports: [QueryBuilderComponent,
886
+ QueryInputDirective,
887
+ QueryOperatorDirective,
888
+ QueryFieldDirective,
889
+ QueryEntityDirective,
890
+ QueryButtonGroupDirective,
891
+ QuerySwitchGroupDirective,
892
+ QueryRemoveButtonDirective,
893
+ QueryEmptyWarningDirective,
894
+ QueryArrowIconDirective] }); }
895
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgxAngularQueryBuilderModule, imports: [CommonModule, FormsModule] }); }
896
+ }
897
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: NgxAngularQueryBuilderModule, decorators: [{
898
+ type: NgModule,
899
+ args: [{
900
+ imports: [CommonModule, FormsModule],
901
+ declarations: [
902
+ QueryBuilderComponent,
903
+ QueryInputDirective,
904
+ QueryOperatorDirective,
905
+ QueryFieldDirective,
906
+ QueryEntityDirective,
907
+ QueryButtonGroupDirective,
908
+ QuerySwitchGroupDirective,
909
+ QueryRemoveButtonDirective,
910
+ QueryEmptyWarningDirective,
911
+ QueryArrowIconDirective
912
+ ],
913
+ exports: [
914
+ QueryBuilderComponent,
915
+ QueryInputDirective,
916
+ QueryOperatorDirective,
917
+ QueryFieldDirective,
918
+ QueryEntityDirective,
919
+ QueryButtonGroupDirective,
920
+ QuerySwitchGroupDirective,
921
+ QueryRemoveButtonDirective,
922
+ QueryEmptyWarningDirective,
923
+ QueryArrowIconDirective
924
+ ]
925
+ }]
926
926
  }] });
927
927
 
928
- /*
929
- * Public API Surface of ngx-angular-query-builder
928
+ /*
929
+ * Public API Surface of ngx-angular-query-builder
930
930
  */
931
931
 
932
- /**
933
- * Generated bundle index. Do not edit.
932
+ /**
933
+ * Generated bundle index. Do not edit.
934
934
  */
935
935
 
936
936
  export { CONTROL_VALUE_ACCESSOR, NgxAngularQueryBuilderModule, QueryArrowIconDirective, QueryBuilderComponent, QueryButtonGroupDirective, QueryEmptyWarningDirective, QueryEntityDirective, QueryFieldDirective, QueryInputDirective, QueryOperatorDirective, QueryRemoveButtonDirective, QuerySwitchGroupDirective, VALIDATOR };