|
2 | 2 | import { Component } from '@angular/core';
|
3 | 3 | import { DEMOS } from './demos';
|
4 | 4 | // webpack html imports
|
| 5 | +let oldTitleDoc = require('html-loader!markdown-loader!./docs/titleOld.md'); |
5 | 6 | let titleDoc = require('html-loader!markdown-loader!./docs/title.md');
|
6 | 7 |
|
7 | 8 | @Component({
|
8 | 9 | selector: 'datepicker-section',
|
9 |
| - template: ` |
| 10 | + template: ` |
10 | 11 | <demo-section [name]="name" [src]="src">
|
11 |
| - <p>Datepicker is a highly configurable component that adds datepicker functionality to your pages. You can |
12 |
| - customize the date format and language, restrict the selectable date ranges.</p> |
13 |
| -
|
14 |
| - <h2>Contents</h2> |
15 |
| - <ul> |
16 |
| - <li><a routerLink="." fragment="usage">Usage</a></li> |
17 |
| - <li><a routerLink="." fragment="examples">Examples</a> |
18 |
| - <ul> |
19 |
| - <!--<li><a routerLink="." fragment="link-color">Link color</a></li>--> |
20 |
| - </ul> |
21 |
| - </li> |
22 |
| - <li><a routerLink="." fragment="api-reference">API Reference</a> |
| 12 | + <tabset> |
| 13 | + <tab heading="Overview"> |
| 14 | + <p>Datepicker is a highly configurable component that adds datepicker functionality to your pages. You can |
| 15 | + customize the date format and language, restrict the selectable date ranges.</p> |
| 16 | + <h2>Contents</h2> |
23 | 17 | <ul>
|
24 |
| - <li><a routerLink="." fragment="datepicker-component">DatePickerComponent</a></li> |
| 18 | + <li><a routerLink="." fragment="usage">Usage</a></li> |
| 19 | + <li><a routerLink="." fragment="examples">Examples</a> |
| 20 | + <ul> |
| 21 | + <li><a routerLink="." fragment="basic">Basic</a></li> |
| 22 | + <li><a routerLink="." fragment="themes">Themes</a></li> |
| 23 | + <li><a routerLink="." fragment="locales">Locales</a></li> |
| 24 | + <li><a routerLink="." fragment="min-max">Min-max</a></li> |
| 25 | + <li><a routerLink="." fragment="disabled">Disabled</a></li> |
| 26 | + <li><a routerLink="." fragment="forms">Forms</a></li> |
| 27 | + <li><a routerLink="." fragment="reactive">Reactive forms</a></li> |
| 28 | + </ul> |
| 29 | + </li> |
| 30 | + <li><a routerLink="." fragment="api-reference">API Reference</a> |
| 31 | + <ul> |
| 32 | + <li><a routerLink="." fragment="bs-datepicker-component">BsDatepickerComponent</a></li> |
| 33 | + <li><a routerLink="." fragment="bs-daterangepicker-component">BsDaterangepickerComponent</a></li> |
| 34 | + </ul> |
| 35 | + </li> |
25 | 36 | </ul>
|
26 |
| - </li> |
27 |
| - </ul> |
28 | 37 |
|
29 |
| - <h2 routerLink="." fragment="usage" id="usage">Usage</h2> |
| 38 | + <h2 routerLink="." fragment="usage" id="usage">Usage</h2> |
| 39 | +
|
| 40 | + <p [innerHtml]="titleDoc"></p> |
| 41 | +
|
| 42 | + <h2 routerLink="." fragment="examples" id="examples">Examples</h2> |
| 43 | + <h3 routerLink="." fragment="basic" id="basic">Basic</h3> |
| 44 | + <ng-sample-box [ts]="demos.pop.component" [html]="demos.pop.html"> |
| 45 | + <p><code>BsDatepickerModule</code> is activily developed but you can use it already</p> |
| 46 | + <p>Notebale change is additional css for it <code> "/datepicker/bs-datepicker.css"</code> <br></p> |
| 47 | + <p>There are two ways of adding css:</p> |
| 48 | + <ul> |
| 49 | + <li>Load it from CDN. Add <code><link rel="stylesheet" href="https://unpkg.com/ngx-bootstrap/datepicker/bs-datepicker.css"></code> to your <code>index.html</code></li> |
| 50 | + <li>Load it from <code>node_modules/ngx-bootstrap/datepicker/bs-datepicker.css</code> via package bundler like Angular CLI, if you're using one.</li> |
| 51 | + </ul> |
| 52 | + <p>In nearest time will be added:</p> |
| 53 | + <ul> |
| 54 | + <li><s>1. Month and year selection</s></li> |
| 55 | + <li><s>2. Min/max dates restrcitions</s></li> |
| 56 | + <li><s>3. Color theming</s></li> |
| 57 | + <li>4. Options to replace any part of template</li> |
| 58 | + <li><s>5. Configuration</s></li> |
| 59 | + <li><s>6. Integration with forms, only for input fields</s></li> |
| 60 | + <li>etc.</li> |
| 61 | + </ul> |
| 62 | + <demo-date-picker-popup></demo-date-picker-popup> |
| 63 | + </ng-sample-box> |
| 64 | +
|
| 65 | + <h3 routerLink="." fragment="themes" id="themes">Themes</h3> |
| 66 | + <ng-sample-box [ts]="demos.colorTheming.component" [html]="demos.colorTheming.html"> |
| 67 | + <p>Datepicker comes with some default color schemes. |
| 68 | + You can change it by manipulating <code>containerClass</code> property in <code>bsConfig</code> object</p> |
| 69 | + <p>There are 6 color schemes: <code>theme-default</code>, <code>theme-green</code>, <code>theme-blue</code>, |
| 70 | + <code>theme-dark-blue</code>, <code>theme-red</code>, <code>theme-orange</code></p> |
| 71 | + <demo-datepicker-color-theming></demo-datepicker-color-theming> |
| 72 | + </ng-sample-box> |
30 | 73 |
|
31 |
| - <p [innerHtml]="titleDoc"></p> |
| 74 | + <h3 routerLink="." fragment="locales" id="locales">Locales</h3> |
32 | 75 |
|
33 |
| - <h2 routerLink="." fragment="examples" id="examples">Examples</h2> |
| 76 | + <ng-sample-box [ts]="demos.changeLocale.component" [html]="demos.changeLocale.html"> |
| 77 | + <p>Datepicker can use different locales. <br>It's possible to change a locale by changing <code>locale</code> |
| 78 | + property in <code>bsConfig</code> object, list of available locales is in dropdown below.</p> |
| 79 | + <p>To use a different locale, you have to import it from <code>ngx-bootstrap/bs-moment</code> and define it |
| 80 | + in your <code>@NgModule</code> using function <code>defineLocale</code></p> |
| 81 | + <p>Example: </p> |
| 82 | + <code>import {{ '{' }} defineLocale {{ '}' }} from 'ngx-bootstrap/bs-moment';</code><br> |
| 83 | + <code>import {{ '{' }} de {{ '}' }} from 'ngx-bootstrap/locale';</code><br> |
| 84 | + <code>defineLocale('de', de));</code> |
| 85 | + <br><br> |
| 86 | + <demo-datepicker-change-locale></demo-datepicker-change-locale> |
| 87 | + </ng-sample-box> |
34 | 88 |
|
35 |
| - <ng-sample-box [ts]="demos.pop.component" [html]="demos.pop.html"> |
36 |
| - <p><code>BsDatepickerModule</code> is activily developed but you can use it already</p> |
37 |
| - <p>Notebale change is additional css for it <code> "/datepicker/bs-datepicker.css"</code></p> |
38 |
| - <p>In nearest time will be added:</p> |
39 |
| - <ul> |
40 |
| - <li><s>1. Month and year selection</s></li> |
41 |
| - <li><s>2. Min/max dates restrcitions</s></li> |
42 |
| - <li><s>3. Color theming</s></li> |
43 |
| - <li>4. Options to replace any part of template</li> |
44 |
| - <li><s>5. Configuration</s></li> |
45 |
| - <li>6. Integration with forms, only for input fields</li> |
46 |
| - <li>etc.</li> |
47 |
| - </ul> |
48 |
| - <demo-date-picker-popup></demo-date-picker-popup> |
49 |
| - </ng-sample-box> |
| 89 | + <h3 routerLink="." fragment="min-max" id="min-max">Min-max</h3> |
| 90 | + <ng-sample-box [ts]="demos.minMax.component" [html]="demos.minMax.html"> |
| 91 | + <p>You can set min and max date of datepicker/daterangepicker using <code>minDate</code> and <code>maxDate</code> properties</p> |
| 92 | + <p>In the following example <code>minDate</code> is set to yesterday and <code>maxDate</code> to the current day in the next week</p> |
| 93 | + <demo-datepicker-min-max></demo-datepicker-min-max> |
| 94 | + </ng-sample-box> |
50 | 95 |
|
51 |
| - <ng-sample-box [ts]="demos.colorTheming.component" [html]="demos.colorTheming.html"> |
52 |
| - <demo-datepicker-color-theming></demo-datepicker-color-theming> |
53 |
| - </ng-sample-box> |
54 |
| - |
55 |
| - <ng-sample-box [ts]="demos.changeLocale.component" [html]="demos.changeLocale.html"> |
56 |
| - <demo-datepicker-change-locale></demo-datepicker-change-locale> |
57 |
| - </ng-sample-box> |
| 96 | + <h3 routerLink="." fragment="disabled" id="disabled">Disabled (scratch, WIP)</h3> |
| 97 | + <ng-sample-box [ts]="demos.disabled.component" [html]="demos.disabled.html"> |
| 98 | + <p>If you want to disable datepicker set is <code>isDisabled</code> property to true</p> |
| 99 | + <demo-datepicker-disabled></demo-datepicker-disabled> |
| 100 | + </ng-sample-box> |
| 101 | +
|
| 102 | + <h3 routerLink="." fragment="forms" id="forms">Forms</h3> |
| 103 | + <ng-sample-box [ts]="demos.forms.component" [html]="demos.forms.html"> |
| 104 | + <p>Datepicker and daterangepicker can be used in forms. Keep in mind that value of <code>ngModel</code> |
| 105 | + is <code>Date</code> object (array of 2 object for daterangepicker)</p> |
| 106 | + <demo-datepicker-forms></demo-datepicker-forms> |
| 107 | + </ng-sample-box> |
| 108 | +
|
| 109 | + <h3 routerLink="." fragment="reactive" id="reactive">Reactive forms</h3> |
| 110 | + <ng-sample-box [ts]="demos.reactive.component" [html]="demos.reactive.html"> |
| 111 | + <demo-datepicker-reactive-forms></demo-datepicker-reactive-forms> |
| 112 | + </ng-sample-box> |
| 113 | +
|
| 114 | + <h2 routerLink="." fragment="api-reference" id="api-reference">API Reference</h2> |
| 115 | + <ng-api-doc id="bs-datepicker-component" directive="BsDatepickerComponent"></ng-api-doc> |
| 116 | + <ng-api-doc id="bs-daterangepicker-component" directive="BsDaterangepickerComponent"></ng-api-doc> |
| 117 | + </tab> |
| 118 | + <tab heading="Old"> |
| 119 | + <p>This is a legacy version of datepicker without support of daterangepicker, locales, themes, etc.</p> |
| 120 | + <h2>Contents</h2> |
| 121 | + <ul> |
| 122 | + <li><a routerLink="." fragment="usageOld">Usage</a></li> |
| 123 | + <li><a routerLink="." fragment="examplesOld">Example</a> </li> |
| 124 | + <li><a routerLink="." fragment="api-referenceOld">API Reference</a> |
| 125 | + <ul> |
| 126 | + <li><a routerLink="." fragment="datepicker-component">DatePickerComponent</a></li> |
| 127 | + </ul> |
| 128 | + </li> |
| 129 | + </ul> |
| 130 | + |
| 131 | + <h2 routerLink="." fragment="usageOld" id="usageOld">Usage</h2> |
58 | 132 |
|
59 |
| - <ng-sample-box [ts]="demos.old.component" [html]="demos.old.html"> |
60 |
| - <datepicker-demo></datepicker-demo> |
61 |
| - </ng-sample-box> |
| 133 | + <p [innerHtml]="oldTitleDoc"></p> |
| 134 | + |
| 135 | + <h2 routerLink="." fragment="examplesOld" id="examplesOld">Example</h2> |
| 136 | + <ng-sample-box [ts]="demos.old.component" [html]="demos.old.html"> |
| 137 | + <datepicker-demo></datepicker-demo> |
| 138 | + </ng-sample-box> |
62 | 139 |
|
63 |
| - <h2 routerLink="." fragment="api-reference" id="api-reference">API Reference</h2> |
64 |
| - <ng-api-doc id="datepicker-component" directive="DatePickerComponent"></ng-api-doc> |
| 140 | + <h2 routerLink="." fragment="api-referenceOld" id="api-referenceOld">API Reference</h2> |
| 141 | + <ng-api-doc id="datepicker-component" directive="DatePickerComponent"></ng-api-doc> |
| 142 | + </tab> |
| 143 | + </tabset> |
65 | 144 | </demo-section>`
|
66 | 145 | })
|
67 | 146 | export class DatepickerSectionComponent {
|
68 | 147 | public name: string = 'Datepicker';
|
69 | 148 | public src: string = 'https://github.com/valor-software/ngx-bootstrap/tree/development/src/datepicker';
|
70 | 149 | public demos: any = DEMOS;
|
| 150 | + public oldTitleDoc: string = oldTitleDoc; |
71 | 151 | public titleDoc: string = titleDoc;
|
72 | 152 | }
|
0 commit comments