Skip to content

Commit 00122a6

Browse files
authored
Merge pull request raysuelzer#6 from michealharrington/bugfix/for_raysuelzer
Fix RuleSet not pointing to the correct condition value.
2 parents 64b506c + 417a3a4 commit 00122a6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

projects/ngx-angular-query-builder/src/lib/query-builder/query-builder.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class QueryBuilderComponent implements OnChanges, ControlValueAccessor, V
113113
boolean: ['=']
114114
};
115115
@Input() disabled = false;
116-
@Input() data: RuleSet = { condition: 'add', rules: [] };
116+
@Input() data: RuleSet = { condition: 'and', rules: [] };
117117

118118

119119
@HostBinding('attr.query-builder-condition') get condintion() {
@@ -129,7 +129,7 @@ export class QueryBuilderComponent implements OnChanges, ControlValueAccessor, V
129129
@Input() emptyMessage = 'A ruleset cannot be empty. Please add a rule or remove it all together.';
130130
@Input() classNames: QueryBuilderClassNames = {};
131131
@Input() operatorMap: { [key: string]: string[] } = {};
132-
@Input() parentValue: RuleSet = { condition: 'add', rules: [] };
132+
@Input() parentValue: RuleSet = { condition: 'and', rules: [] };
133133
@Input() config: QueryBuilderConfig = { fields: {} };
134134
@Input() parentArrowIconTemplate!: QueryArrowIconDirective;
135135
@Input() parentInputTemplates!: QueryList<QueryInputDirective>;
@@ -234,7 +234,7 @@ export class QueryBuilderComponent implements OnChanges, ControlValueAccessor, V
234234
}
235235
set value(value: RuleSet) {
236236
// When component is initialized without a formControl, null is passed to value
237-
this.data = value || { condition: 'add', rules: [] };
237+
this.data = value || { condition: 'and', rules: [] };
238238
this.handleDataChange();
239239
}
240240

@@ -444,7 +444,7 @@ export class QueryBuilderComponent implements OnChanges, ControlValueAccessor, V
444444
if (this.config.addRuleSet) {
445445
this.config.addRuleSet(parent);
446446
} else {
447-
parent.rules = parent.rules.concat([{ condition: 'add', rules: [] }]);
447+
parent.rules = parent.rules.concat([{ condition: 'and', rules: [] }]);
448448
}
449449

450450
this.handleTouched();

0 commit comments

Comments
 (0)