UNPKG

ng2-encrm-components

Version:
193 lines (188 loc) 7.67 kB
<div class="col-xs-12"> <h1 id="forms">Forms</h1> <br> <form name="previewForm"> <en-input type="text" [(ngModel)]="form.input" placeholder="input" name="input"></en-input> <en-input type="email" [(ngModel)]="form.error" [placeholder]="'has error'" name="error" class="has-danger"></en-input> <en-input type="text" [(ngModel)]="form.disabled" name="disabled" [placeholder]="'input disabled'" disabled></en-input> <en-input type="text" name="search" [(ngModel)]="form.search" placeholder="search" (btnClick)="inputSearchClick($event)" addonRight> <i class="material-icons">search</i> </en-input> <!--textarea to standardowy element z klasami bootstrap--> <div class="en-input-group"> <textarea id="form.input.textarea" class="form-control en-form-control" name="textarea" cols="30" rows="10" [(ngModel)]="form.textarea" required></textarea> <label for="form.input.textarea">textarea</label> </div> <br> <div class="en-input-group"> <select name="name" class="en-form-control custom-select w-100"> <option [value]="'1'"> 1</option> <option [value]="'2'"> 2</option> </select> <label>default select</label> </div> <br> <!--złożony select box--> <en-select [options]="selectOptions" label="compound select" placeholder="placeholder"> </en-select> <tabset> <tab heading="HTML"> <pre><code highlight class="html"> &lt;en-input type=&quot;text&quot; [(ngModel)]=&quot;form.input&quot; placeholder=&quot;input&quot; name=&quot;input&quot;&gt;&lt;/en-input&gt; &lt;en-input type=&quot;email&quot; [(ngModel)]=&quot;form.error&quot; [placeholder]=&quot;&#039;has error&#039;&quot; name=&quot;error&quot; class=&quot;has-danger&quot;&gt;&lt;/en-input&gt; &lt;en-input type=&quot;text&quot; [(ngModel)]=&quot;form.disabled&quot; name=&quot;disabled&quot; [placeholder]=&quot;&#039;input disabled&#039;&quot; disabled&gt;&lt;/en-input&gt; &lt;en-input type=&quot;text&quot; name=&quot;search&quot; [(ngModel)]=&quot;form.search&quot; placeholder=&quot;search&quot; (btnClick)=&quot;inputSearchClick($event)&quot; addonRight&gt; &lt;i class=&quot;material-icons&quot;&gt;search&lt;/i&gt; &lt;/en-input&gt; &lt;!--textarea to standardowy element z klasami bootstrap--&gt; &lt;div class=&quot;en-input-group&quot;&gt; &lt;textarea id=&quot;form.input.textarea&quot; class=&quot;form-control en-form-control&quot; name=&quot;textarea&quot; cols=&quot;30&quot; rows=&quot;10&quot; [(ngModel)]=&quot;form.textarea&quot; required&gt;&lt;/textarea&gt; &lt;label for=&quot;form.input.textarea&quot;&gt;textarea&lt;/label&gt; &lt;/div&gt; &lt;!--standardowy select box--&gt; &lt;div class=&quot;en-input-group&quot;&gt; &lt;select class=&quot;form-control en-form-control custom-select&quot; id=&quot;select.box&quot;&gt; &lt;option selected&gt;Open this select menu&lt;/option&gt; &lt;option value=&quot;1&quot;&gt;One&lt;/option&gt; &lt;option value=&quot;2&quot;&gt;Two&lt;/option&gt; &lt;option value=&quot;3&quot;&gt;Three&lt;/option&gt; &lt;/select&gt; &lt;label for=&quot;select.box&quot;&gt;select box std&lt;/label&gt; &lt;/div&gt; &lt;br&gt; &lt;div class=&quot;en-input-group&quot;&gt; &lt;select name=&quot;name&quot; class=&quot;en-form-control custom-select w-100&quot;&gt; &lt;option [value]=&quot;'1'&quot;&gt; 1&lt;/option&gt; &lt;option [value]=&quot;'2'&quot;&gt; 2&lt;/option&gt; &lt;/select&gt; &lt;label&gt;default select&lt;/label&gt; &lt;/div&gt; &lt;br&gt; &lt;!--z&#x142;o&#x17c;ony select box--&gt; &lt;en-select [options]=&quot;selectOptions&quot; label=&quot;compound select&quot; placeholder=&quot;placeholder&quot;&gt; &lt;/en-select&gt; </code></pre> </tab> <tab heading="TypeScript"> <pre><code highlight class="typescript"> @Component(...) export class FormsPreviewComponent implements OnInit &#123; constructor() &#123;&#125; ngOnInit() &#123;&#125; /*--------------------------------------------------------- * FORMS *--------------------------------------------------------*/ public form = &#123; input: &#039;asd&#039;, search: &#039;&#039;, error: &#039;err&#039;, textarea: &#039;&#039;, disabled: &#039;asdasd&#039;, &#125;; inputSearchClick(e: Event)&#123; // search box handler &#125; /*---------------------------------------------------------- * SELECTS *---------------------------------------------------------*/ public selectOptions = [ &#123; label: &#039;nazwa&#039;, value: &#039;name&#039; &#125;, &#123; label: &#039;ulica&#039;, value: &#039;street&#039;, suboptions: [ &#123; label: &#039;od A do Z&#039;, value: &#039;asc&#039; &#125;, &#123; label: &#039;od Z do A&#039;, value: &#039;desc&#039; &#125; ] &#125; ]; &#125; </code></pre> </tab> </tabset> <br> <form> <en-checkbox label="Check this custom checkbox"> <input type="checkbox" class="custom-control-input" name="checkbox" [(ngModel)]="checkboxModel"> </en-checkbox> <br><br> <label class="custom-control custom-radio"> <input id="radio1" name="radio" type="radio" class="custom-control-input"> <span class="custom-control-indicator"></span> <span class="custom-control-description">Toggle this custom radio</span> </label> <label class="custom-control custom-radio"> <input id="radio2" name="radio" type="radio" class="custom-control-input"> <span class="custom-control-indicator"></span> <span class="custom-control-description">Or toggle this other custom radio</span> </label></form> <br><br> <tabset> <tab heading="HTML"> <pre><code highlight class="html"> &lt;en-checkbox label=&quot;Check this custom checkbox&quot;&gt; &lt;!--a normal input element with goes here, en-checkbox only wraps it in bs4 custom checkbox classes--&gt; &lt;input type=&quot;checkbox&quot; class=&quot;custom-control-input&quot; name=&quot;checkbox&quot; [(ngModel)]=&quot;checkboxModel&quot;&gt; &lt;/en-checkbox&gt; &lt;br&gt;&lt;br&gt; &lt;label class=&quot;custom-control custom-radio&quot;&gt; &lt;input id=&quot;radio1&quot; name=&quot;radio&quot; type=&quot;radio&quot; class=&quot;custom-control-input&quot;&gt; &lt;span class=&quot;custom-control-indicator&quot;&gt;&lt;/span&gt; &lt;span class=&quot;custom-control-description&quot;&gt;Toggle this custom radio&lt;/span&gt; &lt;/label&gt; &lt;label class=&quot;custom-control custom-radio&quot;&gt; &lt;input id=&quot;radio2&quot; name=&quot;radio&quot; type=&quot;radio&quot; class=&quot;custom-control-input&quot;&gt; &lt;span class=&quot;custom-control-indicator&quot;&gt;&lt;/span&gt; &lt;span class=&quot;custom-control-description&quot;&gt;Or toggle this other custom radio&lt;/span&gt; &lt;/label&gt; </code></pre> </tab> <tab heading="TypeScript"> <pre highlight-js="code"><code class="typescript">none</code></pre> </tab> </tabset> </form> </div>