Skip to content

Commit 888f862

Browse files
committed
bugfix
1 parent 0430fa5 commit 888f862

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-angular-query-builder",
3-
"version": "15.0.0",
3+
"version": "15.0.1",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",

projects/ngx-angular-query-builder/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ Credit: @ravijoshi007
1717
- Angular 14 Upgrade
1818
### 15.0.0
1919
- Angular 15 upgrade
20+
### 15.0.1
21+
- Angular 15 seems to have a subtle change which causes the templates to not be loaded into the query list when it first looks for them. Worked around by defaulting if these are undefined: this.parentInputTemplates || this.inputTemplates

projects/ngx-angular-query-builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-angular-query-builder",
3-
"version": "15.0.0",
3+
"version": "15.0.1",
44
"description": "Port of angular2-query-builder from github.com/designermanjeets/Angular-QueryBuilder in order to support angular 12+",
55
"license": "MIT",
66
"peerDependencies": {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class QueryBuilderComponent implements OnChanges, ControlValueAccessor, V
144144
@Input() parentTouchedCallback!: () => void;
145145
@Input() persistValueOnFieldChange = false;
146146

147-
@ViewChild('treeContainer', {static: true}) treeContainer!: ElementRef;
147+
@ViewChild('treeContainer', { static: true }) treeContainer!: ElementRef;
148148

149149
@ContentChild(QueryButtonGroupDirective) buttonGroupTemplate!: QueryButtonGroupDirective;
150150
@ContentChild(QuerySwitchGroupDirective) switchGroupTemplate!: QuerySwitchGroupDirective;
@@ -153,7 +153,7 @@ export class QueryBuilderComponent implements OnChanges, ControlValueAccessor, V
153153
@ContentChild(QueryOperatorDirective) operatorTemplate!: QueryOperatorDirective;
154154
@ContentChild(QueryRemoveButtonDirective) removeButtonTemplate!: QueryRemoveButtonDirective;
155155
@ContentChild(QueryEmptyWarningDirective) emptyWarningTemplate!: QueryEmptyWarningDirective;
156-
@ContentChildren(QueryInputDirective, {descendants: true}) inputTemplates!: QueryList<QueryInputDirective>;
156+
@ContentChildren(QueryInputDirective, { descendants: true }) inputTemplates!: QueryList<QueryInputDirective>;
157157
@ContentChild(QueryArrowIconDirective) arrowIconTemplate!: QueryArrowIconDirective;
158158

159159
private defaultTemplateTypes: string[] = [
@@ -192,7 +192,7 @@ export class QueryBuilderComponent implements OnChanges, ControlValueAccessor, V
192192
});
193193
if (config.entities) {
194194
this.entities = Object.keys(config.entities).map((value) => {
195-
const entity = config.entities ? config.entities[value]: [] as any;
195+
const entity = config.entities ? config.entities[value] : [] as any;
196196
entity.value = entity.value || value;
197197
return entity;
198198
});
@@ -274,7 +274,7 @@ export class QueryBuilderComponent implements OnChanges, ControlValueAccessor, V
274274
}
275275

276276
findQueryInput(type: string): QueryInputDirective {
277-
const templates = this.parentInputTemplates || this.inputTemplates;
277+
const templates = this.parentInputTemplates || this.inputTemplates || [];
278278
return templates.find((item) => item.queryInputType === type) as QueryInputDirective;
279279
}
280280

@@ -355,7 +355,7 @@ export class QueryBuilderComponent implements OnChanges, ControlValueAccessor, V
355355
const clsLookup = this.classNames ? this.classNames : this.defaultClassNames as any;
356356
const defaultClassNames = this.defaultClassNames as any;
357357
const classNames = args.map((id: any) => clsLookup[id] || defaultClassNames[id]).filter((c: any) => !!c);
358-
return classNames.length ? classNames.join(' ') : [];
358+
return classNames.length ? classNames.join(' ') : [];
359359
}
360360

361361
getDefaultField(entity: Entity): Field | null {

0 commit comments

Comments
 (0)