Skip to content

Commit 3ae4fae

Browse files
author
pipeline
committed
Ej2 4650 date range picker samples
1 parent cb8d263 commit 3ae4fae

19 files changed

+318
-0
lines changed

src/common/samplelist.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { comboboxAppRoutes } from '../combobox/combobox.module';
99
import { autoCompleteAppRoutes } from '../autocomplete/autocomplete.module';
1010
import { calendarAppRoutes } from '../calendar/calendar.module';
1111
import { datePickerAppRoutes } from '../datepicker/datepicker.module';
12+
import { dateRangePickerAppRoutes } from '../daterangepicker/daterangepicker.module';
1213
import { chartAppRoutes } from '../chart/chart.module';
1314
import { dialogAppRoutes } from '../dialog/dialog.module';
1415
import { circulargaugeAppRoutes } from '../circulargauge/circulargauge.module';
@@ -42,6 +43,9 @@ export let samplesList: any = [
4243
{
4344
'name': 'DatePicker', 'category': 'Editors', 'order': '03', 'path': 'datepicker', 'samples': datePickerAppRoutes, type: "new"
4445
},
46+
{
47+
'name': 'DateRangePicker', 'category': 'Editors', 'order': '03', 'path': 'daterangepicker', 'samples': dateRangePickerAppRoutes, type: "new"
48+
},
4549
{
4650
'name': 'DropDownList', 'category': 'Editors', 'order': '03', 'path': 'dropdownlist', 'samples': dropdownlistAppRoutes
4751
},

src/common/sb.router.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ComboBoxSampleModule } from '../combobox/combobox.module';
66
import { AutoCompleteSampleModule } from '../autocomplete/autocomplete.module';
77
import { CalendarSampleModule } from '../calendar/calendar.module';
88
import { DatePickerSampleModule } from '../datepicker/datepicker.module';
9+
import { DateRangePickerSampleModule } from '../daterangepicker/daterangepicker.module';
910
import { TimePickerSampleModule } from '../timepicker/timepicker.module';
1011
import { ButtonModule } from '../button/button.module';
1112
import { ListViewSampleModule } from '../listview/listview.module';
@@ -32,6 +33,7 @@ const appRoutes: any = [
3233
{ path: 'autocomplete', loadChildren: AutoCompleteSampleModule },
3334
{ path: 'calendar', loadChildren: CalendarSampleModule },
3435
{ path: 'datepicker', loadChildren: DatePickerSampleModule },
36+
{ path: 'daterangepicker', loadChildren: DateRangePickerSampleModule },
3537
{ path: 'timepicker', loadChildren: TimePickerSampleModule },
3638
{ path: 'numerictextbox', loadChildren: NumericModule },
3739
{ path: 'listview', loadChildren: ListViewSampleModule },
@@ -56,6 +58,7 @@ const appRoutes: any = [
5658
DropDownListSampleModule,
5759
CalendarSampleModule,
5860
DatePickerSampleModule,
61+
DateRangePickerSampleModule,
5962
TimePickerSampleModule,
6063
NumericModule,
6164
ListViewSampleModule,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#control_wrapper {
2+
max-width: 246px;
3+
margin: 30px auto;
4+
padding-top: 50px;
5+
}
6+
7+
.control-section {
8+
margin: 25px auto;
9+
}
10+
11+
#control_wrapper #container {
12+
min-height: 300px;
13+
}
14+
15+
.form-group .content-wrapper {
16+
float: left;
17+
padding: 0 10px;
18+
}
19+
20+
.property-panel-content {
21+
padding: 0 10px 10px 0;
22+
}
23+
24+
.content {
25+
width: 43%;
26+
margin: 0 auto;
27+
min-width: 185px;
28+
padding: 20px 0px;
29+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { NgModule, ModuleWithProviders, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2+
import { RouterModule } from '@angular/router';
3+
4+
import { DateRangePickerModule } from '@syncfusion/ej2-ng-calendars';
5+
6+
import { DefaultDateRangePickerComponent } from './default.component';
7+
import { GlobalizationComponent } from './globalization.component';
8+
import { MinMaxComponent } from './minMax.component';
9+
import { MinMaxDaysComponent } from './minMaxDays.component';
10+
import { PresetsComponent } from './presets.component';
11+
12+
13+
export const dateRangePickerAppRoutes: Object[] = [
14+
{ path: ':theme/daterangepicker/default', component: DefaultDateRangePickerComponent, name: 'Default Functionalities', category: 'DateRangePicker' },
15+
{ path: ':theme/daterangepicker/minMax', component: MinMaxComponent, name: 'Date Range', category: 'DateRangePicker' },
16+
{ path: ':theme/daterangepicker/minMaxDays', component: MinMaxDaysComponent, name: 'Restrict Range', category: 'DateRangePicker' },
17+
{ path: ':theme/daterangepicker/globalization', component: GlobalizationComponent, name: 'Globalization', category: 'DateRangePicker' },
18+
{ path: ':theme/daterangepicker/presets', component: PresetsComponent, name: 'Preset Ranges', category: 'DateRangePicker' },
19+
];
20+
21+
export const DateRangePickerRouter: ModuleWithProviders = RouterModule.forChild(dateRangePickerAppRoutes);
22+
23+
@NgModule({
24+
imports: [DateRangePickerRouter, DateRangePickerModule],
25+
declarations: [
26+
DefaultDateRangePickerComponent,
27+
GlobalizationComponent,
28+
MinMaxComponent,
29+
MinMaxDaysComponent,
30+
PresetsComponent
31+
32+
],
33+
schemas: [CUSTOM_ELEMENTS_SCHEMA]
34+
})
35+
export class DateRangePickerSampleModule {
36+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"app.module":"import { DefaultDateRangePickerComponent } from './default.component';\nimport { HttpModule, JsonpModule } from '@angular/http';\nimport { BrowserModule } from '@angular/platform-browser';\nimport 'rxjs/add/operator/map';\nimport { NgModule, ModuleWithProviders, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';\n\n\nimport { DateRangePickerModule } from '@syncfusion/ej2-ng-calendars';\n\n\n\n\n\n\n\n\n\n\n\n\n@NgModule({\n imports: [DateRangePickerModule, HttpModule, JsonpModule, BrowserModule],\ndeclarations: [DefaultDateRangePickerComponent],\nbootstrap: [DefaultDateRangePickerComponent]\n})\nexport class AppModule { }","default.component":"import { Component, ViewEncapsulation, Inject } from '@angular/core';\n@Component({\n selector: 'control-content',\n styleUrls: ['daterangepicker-style.css'],\n templateUrl: 'default.html',\n encapsulation: ViewEncapsulation.None\n})\nexport class DefaultDateRangePickerComponent {\n\n public date: Object = new Date()\n\n \n\n}","default.html":"<div class=\"control-section\">\n <div id=\"control_wrapper\">\n <ej-daterangepicker placeholder='Select a range'></ej-daterangepicker>\n </div>\n</div>","daterangepicker-style.css":"#control_wrapper {\n max-width: 246px;\n margin: 30px auto;\n padding-top: 50px;\n}\n\n.control-section {\n margin: 25px auto;\n}\n\n#control_wrapper #container {\n min-height: 300px;\n}\n\n.form-group .content-wrapper {\n float: left;\n padding: 0 10px;\n}\n\n.property-panel-content {\n padding: 0 10px 10px 0;\n}\n\n.content {\n width: 43%;\n margin: 0 auto;\n min-width: 185px;\n padding: 20px 0px;\n}\n","index.html":"<!DOCTYPE html>\n<html>\n \n <head>\n <meta name=\"author\" content=\"Syncfusion\" />\n <link href=\"http://npmci.syncfusion.com/packages/production/material.css\" rel=\"stylesheet\" />\n <script src=\"https://unpkg.com/core-js/client/shim.min.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.6.25/zone.min.js\"></script>\n <script src=\"https://unpkg.com/[email protected]\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js\"></script>\n <script src=\"systemjs.config.js\"></script>\n </head>\n \n <body>\n <control-content>\n <div id='loader'>Loading...</div>\n </control-content>\n </body>\n \n </html>\n ","systemjs.config.js":"System.config({\n transpiler: \"typescript\",\n typescriptOptions: {\n compilerOptions: {\n target: \"umd\",\n module: \"commonjs\",\n moduleResolution: \"node\",\n emitDecoratorMetadata: true,\n experimentalDecorators: true\n }\n },\n paths: {\n \"syncfusion:\": \"http://npmci.syncfusion.com/packages/production/\",\n \"angular:\": \"https://unpkg.com/@angular/\"\n },\n map: {\n main: 'main.ts',\n typescript: \"https://unpkg.com/[email protected]/lib/typescript.js\",\n \"plugin-json\":\"https://cdnjs.cloudflare.com/ajax/libs/systemjs-plugin-json/0.3.0/json.min.js\",\n \"@syncfusion/ej2-base\": \"syncfusion:ej2-base/dist/ej2-base.umd.min.js\",\n \"@syncfusion/ej2-buttons\": \"syncfusion:ej2-buttons/dist/ej2-buttons.umd.min.js\",\n \"@syncfusion/ej2-calendars\": \"syncfusion:ej2-calendars/dist/ej2-calendars.umd.min.js\",\n \"@syncfusion/ej2-charts\": \"syncfusion:ej2-charts/dist/ej2-charts.umd.min.js\",\n \"@syncfusion/ej2-circulargauge\": \"syncfusion:ej2-circulargauge/dist/ej2-circulargauge.umd.min.js\",\n \"@syncfusion/ej2-data\": \"syncfusion:ej2-data/dist/ej2-data.umd.min.js\",\n \"@syncfusion/ej2-dropdowns\": \"syncfusion:ej2-dropdowns/dist/ej2-dropdowns.umd.min.js\",\n \"@syncfusion/ej2-grids\": \"syncfusion:ej2-grids/dist/ej2-grids.umd.min.js\",\n \"@syncfusion/ej2-inputs\": \"syncfusion:ej2-inputs/dist/ej2-inputs.umd.min.js\",\n \"@syncfusion/ej2-lists\": \"syncfusion:ej2-lists/dist/ej2-lists.umd.min.js\",\n \"@syncfusion/ej2-navigations\": \"syncfusion:ej2-navigations/dist/ej2-navigations.umd.min.js\",\n \"@syncfusion/ej2-popups\": \"syncfusion:ej2-popups/dist/ej2-popups.umd.min.js\",\n \"@syncfusion/ej2-lineargauge\": \"syncfusion:ej2-lineargauge/dist/ej2-lineargauge.umd.min.js\",\n\n \"@syncfusion/ej2-ng-base\": \"syncfusion:ej2-ng-base/dist/ej2-ng-base.umd.min.js\",\n \"@syncfusion/ej2-ng-buttons\": \"syncfusion:ej2-ng-buttons/dist/ej2-ng-buttons.umd.min.js\",\n \"@syncfusion/ej2-ng-calendars\": \"syncfusion:ej2-ng-calendars/dist/ej2-ng-calendars.umd.min.js\",\n \"@syncfusion/ej2-ng-charts\": \"syncfusion:ej2-ng-charts/dist/ej2-ng-charts.umd.min.js\",\n \"@syncfusion/ej2-ng-circulargauge\": \"syncfusion:ej2-ng-circulargauge/dist/ej2-ng-circulargauge.umd.min.js\",\n \"@syncfusion/ej2-ng-data\": \"syncfusion:ej2-ng-data/dist/ej2-ng-data.umd.min.js\",\n \"@syncfusion/ej2-ng-dropdowns\": \"syncfusion:ej2-ng-dropdowns/dist/ej2-ng-dropdowns.umd.min.js\",\n \"@syncfusion/ej2-ng-grids\": \"syncfusion:ej2-ng-grids/dist/ej2-ng-grids.umd.min.js\",\n \"@syncfusion/ej2-ng-inputs\": \"syncfusion:ej2-ng-inputs/dist/ej2-ng-inputs.umd.min.js\",\n \"@syncfusion/ej2-ng-lists\": \"syncfusion:ej2-ng-lists/dist/ej2-ng-lists.umd.min.js\",\n \"@syncfusion/ej2-ng-navigations\": \"syncfusion:ej2-ng-navigations/dist/ej2-ng-navigations.umd.min.js\",\n \"@syncfusion/ej2-ng-popups\": \"syncfusion:ej2-ng-popups/dist/ej2-ng-popups.umd.min.js\",\n \"@syncfusion/ej2-ng-lineargauge\": \"syncfusion:ej2-ng-lineargauge/dist/ej2-ng-lineargauge.umd.min.js\",\n\n '@angular/core': 'angular:core/bundles/core.umd.js',\n '@angular/common': 'angular:common/bundles/common.umd.js',\n '@angular/compiler': 'angular:compiler/bundles/compiler.umd.js',\n '@angular/http': 'angular:http/bundles/http.umd.js',\n '@angular/forms': 'angular:forms/bundles/forms.umd.js',\n '@angular/router': 'angular:router/bundles/router.umd.js',\n '@angular/platform-browser': 'angular:platform-browser/bundles/platform-browser.umd.js',\n '@angular/platform-browser-dynamic': 'angular:platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',\n '@angular/material': 'angular:material/bundles/material.umd.js',\n 'rxjs': 'https://unpkg.com/rxjs'\n },\n meta: { \n '*.json': { loader: 'plugin-json' }\n }\n});\n\nSystem.import('main.ts').catch(console.error.bind(console));\n","main.ts":"import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\nimport { enableProdMode } from '@angular/core';\nimport { AppModule } from './app.module';\nimport { enableRipple } from '@syncfusion/ej2-base';\n\nenableRipple(true);\n\nenableProdMode();\nplatformBrowserDynamic().bootstrapModule(AppModule);"}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Component, ViewEncapsulation, Inject } from '@angular/core';
2+
@Component({
3+
selector: 'control-content',
4+
styleUrls: ['daterangepicker-style.css'],
5+
templateUrl: 'default.html',
6+
encapsulation: ViewEncapsulation.None
7+
})
8+
export class DefaultDateRangePickerComponent {
9+
10+
public date: Object = new Date()
11+
12+
constructor( @Inject('sourceFiles') private sourceFiles: any) {
13+
sourceFiles.files = ['daterangepicker-style.css'];
14+
}
15+
16+
}

src/daterangepicker/default.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<div class="control-section">
2+
<div id="control_wrapper">
3+
<ej-daterangepicker placeholder='Select a range'></ej-daterangepicker>
4+
</div>
5+
</div>
6+
<div id="description">
7+
<p>
8+
<code>DateRangePicker</code> is an interactive component that allows user to select a range from the calendar or set a range value.
9+
</p>
10+
<p>More information on the DateRangePicker instantiation can be found in this
11+
<a href="http://ej2.syncfusion.com/angular/documentation/daterangepicker/" target="_blank"> documentation section</a>.</p>
12+
13+
</div>

src/daterangepicker/globalization-plnkr.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { Component, ViewEncapsulation, Inject, ViewChild } from '@angular/core';
2+
import { DateRangePickerComponent } from '@syncfusion/ej2-ng-calendars';
3+
import { loadCldr, L10n } from '@syncfusion/ej2-base';
4+
5+
@Component({
6+
selector: 'control-content',
7+
templateUrl: 'globalization.html',
8+
styleUrls: ['daterangepicker-style.css'],
9+
encapsulation: ViewEncapsulation.None
10+
})
11+
export class GlobalizationComponent {
12+
@ViewChild('ejDateRangePicker') ejDateRangePicker: DateRangePickerComponent;
13+
public date: Object = new Date();
14+
locale: string = 'de';
15+
ngOnInit(): void {
16+
L10n.load({
17+
'de': {
18+
'daterangepicker': {
19+
placeholder: 'Einen Bereich auswählen',
20+
startLabel: 'Anfangsdatum',
21+
endLabel: 'Enddatum',
22+
applyText: 'Sich bewerben',
23+
cancelText: 'Stornieren',
24+
selectedDays: 'Ausgewählte Tage',
25+
days: 'Tage',
26+
customRange: 'benutzerdefinierten Bereich'
27+
}
28+
},
29+
'en': {
30+
'daterangepicker': {
31+
placeholder: 'Select a range ',
32+
startLabel: 'Start Date',
33+
endLabel: 'End Date',
34+
applyText: 'Apply',
35+
cancelText: 'Cancel',
36+
selectedDays: 'Selected Days',
37+
days: 'Days',
38+
customRange: 'Custom Range'
39+
}
40+
},
41+
'ar': {
42+
'daterangepicker': {
43+
placeholder: 'حدد نطاقا',
44+
startLabel: 'تاريخ البدء',
45+
endLabel: 'تاريخ الانتهاء',
46+
applyText: 'تطبيق',
47+
cancelText: 'إلغاء',
48+
selectedDays: 'الأيام المحددة',
49+
days: 'أيام',
50+
customRange: 'نطاق مخصص'
51+
}
52+
}
53+
});
54+
55+
loadCldr(
56+
require('../common/cldr-data/supplemental/numberingSystems.json'),
57+
require('../common/cldr-data/main/de/ca-gregorian.json'),
58+
require('../common/cldr-data/main/de/numbers.json'),
59+
require('../common/cldr-data/main/de/timeZoneNames.json'),
60+
require('../common/cldr-data/main/ar/ca-gregorian.json'),
61+
require('../common/cldr-data/main/ar/numbers.json'),
62+
require('../common/cldr-data/main/ar/timeZoneNames.json'),
63+
);
64+
}
65+
changeLocale() {
66+
let culture: string = (document.getElementById('cultures') as HTMLSelectElement).value;
67+
this.ejDateRangePicker.locale = culture;
68+
this.ejDateRangePicker.locale === 'ar' ? this.ejDateRangePicker.enableRtl = true : this.ejDateRangePicker.enableRtl = false;
69+
this.ejDateRangePicker.dataBind();
70+
71+
}
72+
constructor( @Inject('sourceFiles') private sourceFiles: any) {
73+
sourceFiles.files = ['daterangepicker-style.css'];
74+
}
75+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<div class="control-section">
2+
<div class="col-lg-8 content-wrapper">
3+
<div class="content">
4+
<div>
5+
<ej-daterangepicker #ejDateRangePicker locale="de">></ej-daterangepicker>
6+
</div>
7+
</div>
8+
</div>
9+
<div class="col-lg-4 property-section ">
10+
<div class="property-panel-section ">
11+
<div class="property-panel-header ">Properties</div>
12+
<div class="property-panel-content ">
13+
<table id="property " class="property-panel-table " title="Properties ">
14+
<tr>
15+
<td>
16+
<div>Culture</div>
17+
</td>
18+
<td>
19+
<div>
20+
<select id="cultures" class="form-control " (change)="changeLocale()">
21+
<option value="de">de</option>
22+
<option value="ar">ar</option>
23+
<option value="en">en</option>
24+
</select>
25+
</div>
26+
</td>
27+
</tr>
28+
</table>
29+
</div>
30+
</div>
31+
</div>
32+
</div>
33+
<div id="description">
34+
<p>
35+
DateRangePicker component was rendered with <code>German</code> culture. Here the date separator, week header and month text content are updated based on current culture. You can also change the control culture by selecting it from the culture options in the properties panel.
36+
</p>
37+
<p>More information on the globalization configuration can be found in this <a href="http://ej2.syncfusion.com/angular/documentation/daterangepicker/globalization.html"
38+
target="_blank"> documentation section</a>.</p>
39+
40+
</div>

0 commit comments

Comments
 (0)