1+ < h2 > Vanilla</ h2 >
2+ < br >
3+ < query-builder [formControl] ='queryCtrl ' [config] ='currentConfig ' [allowRuleset] ='allowRuleset '
4+ [allowCollapse] ='allowCollapse ' [persistValueOnFieldChange] ='persistValueOnFieldChange '>
5+ < ng-container *queryInput ="let rule; type: 'textarea'; let getDisabledState=getDisabledState ">
6+ < textarea class ="text-input text-area " [(ngModel)] ="rule.value " [disabled] =getDisabledState()
7+ placeholder ="Custom Textarea "> </ textarea >
8+ </ ng-container >
9+ </ query-builder >
10+ < br >
11+ < div >
12+ < div class ="row ">
13+ < p class ="col-6 "> Control Valid (Vanilla): {{ queryCtrl.valid }}</ p >
14+ < div class ="col-6 ">
15+ < label > < input type ="checkbox " (change) =switchModes($event) > Entity Mode</ label >
16+ </ div >
17+ </ div >
18+ < div class ="row ">
19+ < p class ="col-6 "> Control Touched (Vanilla): {{ queryCtrl.touched }}</ p >
20+ < div class ="col-6 ">
21+ < label > < input type ="checkbox " (change) =changeDisabled($event) > Disabled</ label >
22+ </ div >
23+ </ div >
24+ < div class ="row ">
25+ < div class ="col-6 ">
26+ < label > < input type ="checkbox " [(ngModel)] ='allowRuleset '> Allow Ruleset</ label >
27+ </ div >
28+ < div class ="col-6 ">
29+ < label > < input type ="checkbox " [(ngModel)] ='allowCollapse '> Allow Collapse</ label >
30+ </ div >
31+ < div class ="col-6 ">
32+ < label > < input type ="checkbox " [(ngModel)] ='persistValueOnFieldChange '> Persist Values on Field Change</ label >
33+ </ div >
34+ </ div >
35+ < textarea class ="output "> {{query | json}}</ textarea >
36+ </ div >
37+ < br >
38+ < h2 > Custom Material</ h2 >
39+ < br >
40+ < mat-card appearance ="outlined " [style.padding.px] ="'10' ">
41+ < query-builder [(ngModel)] ='query ' [config] ='currentConfig ' [allowRuleset] ='allowRuleset '
42+ [allowCollapse] ='allowCollapse ' [persistValueOnFieldChange] ='persistValueOnFieldChange '>
43+ < ng-container
44+ *queryButtonGroup ="let ruleset; let addRule=addRule; let addRuleSet=addRuleSet; let removeRuleSet=removeRuleSet ">
45+ < button type ="button " mat-icon-button color ="primary " (click) ="addRule() ">
46+ < mat-icon > add</ mat-icon > </ button >
47+ < button type ="button " mat-icon-button color ="primary " *ngIf ="addRuleSet " (click) ="addRuleSet() ">
48+ < mat-icon > add_circle_outline</ mat-icon > </ button >
49+ < button type ="button " mat-icon-button color ="accent " *ngIf ="removeRuleSet " (click) ="removeRuleSet() ">
50+ < mat-icon > remove_circle_outline</ mat-icon > </ button >
51+ </ ng-container >
52+ < ng-container *queryArrowIcon >
53+ < mat-icon ngClass ="mat-arrow-icon "> chevron_right</ mat-icon >
54+ </ ng-container >
55+ < ng-container *queryRemoveButton ="let rule; let removeRule=removeRule ">
56+ < button type ="button " mat-icon-button color ="accent " (click) ="removeRule(rule) ">
57+ < mat-icon > remove</ mat-icon >
58+ </ button >
59+ </ ng-container >
60+ < ng-container *querySwitchGroup ="let ruleset; let onChange=onChange ">
61+ < mat-radio-group *ngIf ="ruleset " [(ngModel)] ="ruleset.condition " (ngModelChange) ="onChange($event) ">
62+ < mat-radio-button [style.padding.px] ="10 " value ="and "> And</ mat-radio-button >
63+ < mat-radio-button [style.padding.px] ="10 " value ="or "> Or</ mat-radio-button >
64+ </ mat-radio-group >
65+ </ ng-container >
66+ < ng-container *queryEntity ="let rule; let entities=entities; let onChange=onChange ">
67+ < mat-form-field [appearance] ="appearance " subscriptSizing ="dynamic ">
68+ < mat-select [(ngModel)] ="rule.entity " (ngModelChange) ="onChange($event, rule) " [hideSingleSelectionIndicator] ="true ">
69+ < mat-option *ngFor ="let entity of entities " [value] ="entity.value ">
70+ {{entity.name}}
71+ </ mat-option >
72+ </ mat-select >
73+ </ mat-form-field >
74+ </ ng-container >
75+ < ng-container *queryField ="let rule; let fields=fields; let onChange=onChange; let getFields = getFields ">
76+ < mat-form-field [appearance] ="appearance " subscriptSizing ="dynamic ">
77+ < mat-select [(ngModel)] ="rule.field " (ngModelChange) ="onChange($event, rule) " [hideSingleSelectionIndicator] ="true ">
78+ < mat-option *ngFor ="let field of getFields(rule.entity) " [value] ="field.value ">
79+ {{ field.name }}
80+ </ mat-option >
81+ </ mat-select >
82+ </ mat-form-field >
83+ </ ng-container >
84+ < ng-container *queryOperator ="let rule; let operators=operators; let onChange=onChange ">
85+ < mat-form-field [style.width.px] ="150 " [appearance] ="appearance " subscriptSizing ="dynamic ">
86+ < mat-select [(ngModel)] ="rule.operator " (ngModelChange) ="onChange(rule) " [hideSingleSelectionIndicator] ="true ">
87+ < mat-option *ngFor ="let value of operators " [value] ="value ">
88+ {{ value }}
89+ </ mat-option >
90+ </ mat-select >
91+ </ mat-form-field >
92+ </ ng-container >
93+ < ng-container *queryInput ="let rule; type: 'boolean'; let onChange=onChange ">
94+ < mat-checkbox [(ngModel)] ="rule.value " (ngModelChange) ="onChange() "> </ mat-checkbox >
95+ </ ng-container >
96+ < ng-container *queryInput ="let rule; let field=field; let options=options; type: 'category'; let onChange=onChange ">
97+ < mat-form-field [appearance] ="appearance " subscriptSizing ="dynamic ">
98+ < mat-select [(ngModel)] ="rule.value " (ngModelChange) ="onChange() " [hideSingleSelectionIndicator] ="true ">
99+ < mat-option *ngFor ="let opt of options " [value] ="opt.value ">
100+ {{ opt.name }}
101+ </ mat-option >
102+ </ mat-select >
103+ </ mat-form-field >
104+ </ ng-container >
105+ < ng-container *queryInput ="let rule; type: 'date'; let onChange=onChange ">
106+ < mat-form-field [appearance] ="appearance " subscriptSizing ="dynamic ">
107+ < input matInput [matDatepicker] ="picker " [(ngModel)] ="rule.value " (ngModelChange) ="onChange() ">
108+ < mat-datepicker-toggle matSuffix [for] ="picker "> </ mat-datepicker-toggle >
109+ < mat-datepicker #picker > </ mat-datepicker >
110+ </ mat-form-field >
111+ </ ng-container >
112+ < ng-container *queryInput ="let rule; let options=options; type: 'multiselect'; let onChange=onChange ">
113+ < mat-form-field [style.width.px] ="300 " [appearance] ="appearance " subscriptSizing ="dynamic ">
114+ < mat-select [(ngModel)] ="rule.value " multiple (ngModelChange) ="onChange() " [hideSingleSelectionIndicator] ="true ">
115+ < mat-option *ngFor ="let opt of options " [value] ="opt.value ">
116+ {{ opt.name }}
117+ </ mat-option >
118+ </ mat-select >
119+ </ mat-form-field >
120+ </ ng-container >
121+ < ng-container *queryInput ="let rule; let field=field; type: 'number'; let onChange=onChange ">
122+ < mat-form-field [style.width.px] ="100 " [appearance] ="appearance " subscriptSizing ="dynamic ">
123+ < input matInput [(ngModel)] ="rule.value " type ="number " (ngModelChange) ="onChange() ">
124+ </ mat-form-field >
125+ </ ng-container >
126+ < ng-container *queryInput ="let rule; let field=field; type: 'string'; let onChange=onChange ">
127+ < mat-form-field [appearance] ="appearance " subscriptSizing ="dynamic ">
128+ < input matInput [(ngModel)] ="rule.value " (ngModelChange) ="onChange() ">
129+ </ mat-form-field >
130+ </ ng-container >
131+ < ng-container *queryInput ="let rule; let field=field; type: 'textarea'; let onChange=onChange ">
132+ < mat-form-field [appearance] ="appearance " subscriptSizing ="dynamic ">
133+ < textarea matInput [(ngModel)] ="rule.value " (ngModelChange) ="onChange() ">
134+ </ textarea >
135+ </ mat-form-field >
136+ </ ng-container >
137+ </ query-builder >
138+ </ mat-card >
139+ < br >
140+ < h2 > Bootstrap</ h2 >
141+ < br >
142+ < query-builder [(ngModel)] ='query ' [classNames] ='bootstrapClassNames ' [config] ='currentConfig '
143+ [allowRuleset] ='allowRuleset ' [allowCollapse] ='allowCollapse ' [persistValueOnFieldChange] ='persistValueOnFieldChange '>
144+ < div class ="col-auto " *queryInput ="let rule; type: 'textarea' ">
145+ < textarea class ="form-control " [(ngModel)] ="rule.value " placeholder ="Custom Textarea "> </ textarea >
146+ </ div >
147+ </ query-builder >
0 commit comments