Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16,442 changes: 8,566 additions & 7,876 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^14.2.8",
"@angular/common": "^14.2.8",
"@angular/compiler": "^14.2.8",
"@angular/cdk": "^14.2.6",
"@angular/material": "^14.2.6",
"@angular/core": "^14.2.8",
"@angular/forms": "^14.2.8",
"@angular/platform-browser": "^14.2.8",
"@angular/platform-browser-dynamic": "^14.2.8",
"@angular/router": "^14.2.8",
"@angular/animations": "^15.2.0",
"@angular/common": "^15.2.0",
"@angular/compiler": "^15.2.0",
"@angular/cdk": "^15.2.0",
"@angular/material": "^15.2.0",
"@angular/core": "^15.2.0",
"@angular/forms": "^15.2.0",
"@angular/platform-browser": "^15.2.0",
"@angular/platform-browser-dynamic": "^15.2.0",
"@angular/router": "^15.2.0",
"rxjs": "~6.6.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.2.7",
"@angular/cli": "^14.2.7",
"@angular/compiler-cli": "^14.2.8",
"@angular-devkit/build-angular": "^15.2.0",
"@angular/cli": "^15.2.0",
"@angular/compiler-cli": "^15.2.0",
"@types/jasmine": "~3.8.0",
"@types/node": "^12.11.1",
"jasmine-core": "~3.8.0",
Expand All @@ -37,7 +37,7 @@
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"ng-packagr": "^14.2.2",
"typescript": "~4.6.4"
"ng-packagr": "^15.2.2",
"typescript": "~4.9.5"
}
}
17 changes: 0 additions & 17 deletions projects/demo/.browserslistrc

This file was deleted.

147 changes: 147 additions & 0 deletions projects/demo/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<h2>Vanilla</h2>
<br>
<query-builder [formControl]='queryCtrl' [config]='currentConfig' [allowRuleset]='allowRuleset'
[allowCollapse]='allowCollapse' [persistValueOnFieldChange]='persistValueOnFieldChange'>
<ng-container *queryInput="let rule; type: 'textarea'; let getDisabledState=getDisabledState">
<textarea class="text-input text-area" [(ngModel)]="rule.value" [disabled]=getDisabledState()
placeholder="Custom Textarea"></textarea>
</ng-container>
</query-builder>
<br>
<div>
<div class="row">
<p class="col-6">Control Valid (Vanilla): {{ queryCtrl.valid }}</p>
<div class="col-6">
<label><input type="checkbox" (change)=switchModes($event)>Entity Mode</label>
</div>
</div>
<div class="row">
<p class="col-6">Control Touched (Vanilla): {{ queryCtrl.touched }}</p>
<div class="col-6">
<label><input type="checkbox" (change)=changeDisabled($event)>Disabled</label>
</div>
</div>
<div class="row">
<div class="col-6">
<label><input type="checkbox" [(ngModel)]='allowRuleset'>Allow Ruleset</label>
</div>
<div class="col-6">
<label><input type="checkbox" [(ngModel)]='allowCollapse'>Allow Collapse</label>
</div>
<div class="col-6">
<label><input type="checkbox" [(ngModel)]='persistValueOnFieldChange'>Persist Values on Field Change</label>
</div>
</div>
<textarea class="output">{{query | json}}</textarea>
</div>
<br>
<h2>Custom Material</h2>
<br>
<mat-card appearance="outlined" [style.padding.px]="'10'">
<query-builder [(ngModel)]='query' [config]='currentConfig' [allowRuleset]='allowRuleset'
[allowCollapse]='allowCollapse' [persistValueOnFieldChange]='persistValueOnFieldChange'>
<ng-container
*queryButtonGroup="let ruleset; let addRule=addRule; let addRuleSet=addRuleSet; let removeRuleSet=removeRuleSet">
<button type="button" mat-icon-button color="primary" (click)="addRule()">
<mat-icon>add</mat-icon></button>
<button type="button" mat-icon-button color="primary" *ngIf="addRuleSet" (click)="addRuleSet()">
<mat-icon>add_circle_outline</mat-icon></button>
<button type="button" mat-icon-button color="accent" *ngIf="removeRuleSet" (click)="removeRuleSet()">
<mat-icon>remove_circle_outline</mat-icon></button>
</ng-container>
<ng-container *queryArrowIcon>
<mat-icon ngClass="mat-arrow-icon">chevron_right</mat-icon>
</ng-container>
<ng-container *queryRemoveButton="let rule; let removeRule=removeRule">
<button type="button" mat-icon-button color="accent" (click)="removeRule(rule)">
<mat-icon>remove</mat-icon>
</button>
</ng-container>
<ng-container *querySwitchGroup="let ruleset; let onChange=onChange">
<mat-radio-group *ngIf="ruleset" [(ngModel)]="ruleset.condition" (ngModelChange)="onChange($event)">
<mat-radio-button [style.padding.px]="10" value="and">And</mat-radio-button>
<mat-radio-button [style.padding.px]="10" value="or">Or</mat-radio-button>
</mat-radio-group>
</ng-container>
<ng-container *queryEntity="let rule; let entities=entities; let onChange=onChange">
<mat-form-field [appearance]="appearance" subscriptSizing="dynamic">
<mat-select [(ngModel)]="rule.entity" (ngModelChange)="onChange($event, rule)" [hideSingleSelectionIndicator]="true">
<mat-option *ngFor="let entity of entities" [value]="entity.value">
{{entity.name}}
</mat-option>
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *queryField="let rule; let fields=fields; let onChange=onChange; let getFields = getFields">
<mat-form-field [appearance]="appearance" subscriptSizing="dynamic">
<mat-select [(ngModel)]="rule.field" (ngModelChange)="onChange($event, rule)" [hideSingleSelectionIndicator]="true">
<mat-option *ngFor="let field of getFields(rule.entity)" [value]="field.value">
{{ field.name }}
</mat-option>
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *queryOperator="let rule; let operators=operators; let onChange=onChange">
<mat-form-field [style.width.px]="150" [appearance]="appearance" subscriptSizing="dynamic">
<mat-select [(ngModel)]="rule.operator" (ngModelChange)="onChange(rule)" [hideSingleSelectionIndicator]="true">
<mat-option *ngFor="let value of operators" [value]="value">
{{ value }}
</mat-option>
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *queryInput="let rule; type: 'boolean'; let onChange=onChange">
<mat-checkbox [(ngModel)]="rule.value" (ngModelChange)="onChange()"></mat-checkbox>
</ng-container>
<ng-container *queryInput="let rule; let field=field; let options=options; type: 'category'; let onChange=onChange">
<mat-form-field [appearance]="appearance" subscriptSizing="dynamic">
<mat-select [(ngModel)]="rule.value" (ngModelChange)="onChange()" [hideSingleSelectionIndicator]="true">
<mat-option *ngFor="let opt of options" [value]="opt.value">
{{ opt.name }}
</mat-option>
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *queryInput="let rule; type: 'date'; let onChange=onChange">
<mat-form-field [appearance]="appearance" subscriptSizing="dynamic">
<input matInput [matDatepicker]="picker" [(ngModel)]="rule.value" (ngModelChange)="onChange()">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
</ng-container>
<ng-container *queryInput="let rule; let options=options; type: 'multiselect'; let onChange=onChange">
<mat-form-field [style.width.px]="300" [appearance]="appearance" subscriptSizing="dynamic">
<mat-select [(ngModel)]="rule.value" multiple (ngModelChange)="onChange()" [hideSingleSelectionIndicator]="true">
<mat-option *ngFor="let opt of options" [value]="opt.value">
{{ opt.name }}
</mat-option>
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *queryInput="let rule; let field=field; type: 'number'; let onChange=onChange">
<mat-form-field [style.width.px]="100" [appearance]="appearance" subscriptSizing="dynamic">
<input matInput [(ngModel)]="rule.value" type="number" (ngModelChange)="onChange()">
</mat-form-field>
</ng-container>
<ng-container *queryInput="let rule; let field=field; type: 'string'; let onChange=onChange">
<mat-form-field [appearance]="appearance" subscriptSizing="dynamic">
<input matInput [(ngModel)]="rule.value" (ngModelChange)="onChange()">
</mat-form-field>
</ng-container>
<ng-container *queryInput="let rule; let field=field; type: 'textarea'; let onChange=onChange">
<mat-form-field [appearance]="appearance" subscriptSizing="dynamic">
<textarea matInput [(ngModel)]="rule.value" (ngModelChange)="onChange()">
</textarea>
</mat-form-field>
</ng-container>
</query-builder>
</mat-card>
<br>
<h2>Bootstrap</h2>
<br>
<query-builder [(ngModel)]='query' [classNames]='bootstrapClassNames' [config]='currentConfig'
[allowRuleset]='allowRuleset' [allowCollapse]='allowCollapse' [persistValueOnFieldChange]='persistValueOnFieldChange'>
<div class="col-auto" *queryInput="let rule; type: 'textarea'">
<textarea class="form-control" [(ngModel)]="rule.value" placeholder="Custom Textarea"></textarea>
</div>
</query-builder>
32 changes: 32 additions & 0 deletions projects/demo/src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
::ng-deep html {
font: 14px sans-serif;
margin: 30px;
}
.mat-mdc-icon-button {
outline: none;
}
.mat-arrow-icon {
outline: none;
line-height: 32px;
}
.mat-mdc-form-field {
padding-left: 5px;
padding-right: 5px;
}
.text-input {
padding: 4px 8px;
border-radius: 4px;
border: 1px solid #ccc;
}
.text-area {
width: 300px;
height: 100px;
}
.output {
width: 100%;
height: 300px;
}

.mat-mdc-radio-button label {
margin: 0;
}
Loading