-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
206 lines (185 loc) · 5.88 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE html>
<html lang="de" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>datetime-local-picker</title>
<link rel="stylesheet" type="text/css" href="styles/main.css" />
<style>
</style>
</head>
<body>
<h1>datetime-local-picker</h1>
<div class="dtp" touch-action="scroll">
<label for="publishDate" class="dtp__label">Publish date:</label>
<input type="text"
name="publishDate"
value="2015-01-19T12:42:23.789+00:00"
class="dtp__output"
id="publishDate"
>
<button class="dtp__trigger" id="publishDateToggle">toggle</button>
</div>
<button id="toggleDisplayMode">toggle display mode</button>
<br/>
<div class="dtp" touch-action="scroll">
<label for="emptyDate" class="dtp__label">Empty non-required date:</label>
<input type="text" name="emptyDate" class="dtp__output" id="emptyDate">
<button class="dtp__trigger" id="emptyDateToggle">toggle</button>
</div>
<br/>
<div class="dtp" touch-action="scroll">
<label for="emptyReqDate" class="dtp__label">Empty required date (not hiding on selection):</label>
<input type="text" name="emptyReqDate" class="dtp__output" id="emptyReqDate" required>
<button class="dtp__trigger" id="emptyReqDateToggle">toggle</button>
</div>
<div class="dtp" touch-action="scroll">
<span>Multi month in-page picker (see console and use shift+cursor keys for difference)</span>
<button class="dtp__trigger" id="inpageToggle">toggle</button>
</div>
<!--
<div>
<input dir="rtl" type="datetime-local" value="2015-01-14T13:45:00.123">
</div>
-->
<script src="bower_components/pointerevents-polyfill/pointerevents.min.js"></script>
<script src="bower_components/requirejs/require.js"></script>
<script>
require.config({
baseUrl: './',
urlArgs: "cb=" + (+new Date()),
enforceDefine: true,
paths: {
'jquery': 'bower_components/jquery/dist/jquery.min',
'lodash': 'bower_components/lodash/lodash.min',
'moment': 'bower_components/moment/min/moment-with-locales.min',
'ldsh': 'bower_components/lodash-template-loader/loader'
},
lodashLoader: {
ext: ".html",
root: "src/",
templateSettings: {}
}
});
require([
'src/DatetimeLocalPicker',
'ldsh!calendar.tmpl'
], function(dtlp, calendars_tmpl) {
function onSelect(ev) {
console.log(ev.name, ev.selectedDate.toISOString(), ev);
}
function onSet(ev) {
console.log(ev.name, ev.currentDate.toISOString(), ev);
}
function onWhatever(ev) {
console.log(ev);
}
var picker = new dtlp({
inputElement: '#publishDate',
toggleElement: '#publishDateToggle',
locale: $('html').attr('lang'),
direction: $('html').attr('dir'),
hideOnSet: true,
defaultDisplayMode: 'table',
minWeeksPerMonth: 6,
numberOfMonths: 1,
constraints: {
minDate: '2001-01-01',
maxDate: '2030-05-14T13:59:59.999'
},
disableWeekends: false,
disabledDates: [
new Date('2015-01-20'),
'2015-01-27',
function (date) {
if (date.date()%4 === 0) {
return true;
}
return false;
}
],
templates: {
calendars: calendars_tmpl
//calendars: $('#calendars_template').text()
},
/*onSetCurrentDate: onSet,
onSetSelectedDate: onSelect,
onShow: onWhatever,
onHide: onWhatever,
onBeforeShow: onWhatever,
onBeforeHide: onWhatever,*/
debug: false
});
$('#toggleDisplayMode').on('click', function() {
if (picker.getDisplayMode() === 'table') {
picker.setDisplayMode('list');
} else {
picker.setDisplayMode('table');
}
});
window.foo = picker;
var emptypicker = new dtlp({
inputElement: '#emptyDate',
toggleElement: '#emptyDateToggle',
locale: $('html').attr('lang'),
direction: $('html').attr('dir'),
hideOnSet: true,
constraints: {
minDate: '2001-01-01',
maxDate: '2030-05-14T13:59:59.999'
},
templates: {
calendars: calendars_tmpl
}/*,
onSetCurrentDate: onSet,
onSetSelectedDate: onSelect*/
});
window.bar = emptypicker;
var emptyreqpicker = new dtlp({
inputElement: '#emptyReqDate',
toggleElement: '#emptyReqDateToggle',
locale: $('html').attr('lang'),
direction: $('html').attr('dir'),
constraints: {
minDate: '2001-01-01',
maxDate: '2030-05-14T13:59:59.999'
},
templates: {
calendars: calendars_tmpl
}/*,
onSetCurrentDate: onSet,
onSetSelectedDate: onSelect*/
});
window.baz = emptyreqpicker;
var inpagepicker = new dtlp({
toggleElement: '#inpageToggle',
//pickerElement: '…'
locale: $('html').attr('lang'),
direction: $('html').attr('dir'),
hideOnSet: false,
numberOfMonths: 2,
constraints: {
minDate: '2001-01-01',
maxDate: '2030-05-14T13:59:59.999'
},
templates: {
picker: '<div class="datepicker-inpage"><div class="datepicker__content"></div></div>',
calendars: calendars_tmpl
},
cssClasses: {
picker: 'datepicker-inpage',
pickerContent: 'datepicker__content'
},
onSetCurrentDate: onSet,
onSetSelectedDate: onSelect
});
window.inpage = inpagepicker;
});
</script>
<!-- alternative template loading: inline via script element -->
<script type="text/html" id="calendars_template">
// put calendars.tmpl.html content here and
// give it to the datepicker via $('#calendars_template').text()
</script>
</body>
</html>