Mercurial > lada > lada-client
annotate app/view/widget/base/DateTimeField.js @ 654:e4419c5560e7
Added tag 2.0-alpha1 for changeset 9f557bd48c30
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 18 Mar 2015 15:45:15 +0100 |
parents | 1f51b6020f8c |
children | 777bf66dbb11 |
rev | line source |
---|---|
649
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Lada.view.widget.base.DateTimeField', { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 extend: 'Ext.form.field.Date', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 alias: 'widget.datetimefield', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 requires: [ |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 'Lada.view.widget.base.DateTimePicker' |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 ], |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 format: 'm/d/Y H:i', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 mimicBlur: function(e) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 var me = this, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 picker = me.picker; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 // ignore mousedown events within the picker element |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 if (!picker || |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 !e.within(picker.el, false, true) |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 ) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 me.callParent(arguments); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 collapseIf: function(e) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 var me = this; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 if (Ext.getVersion().major === 4 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 && !me.isDestroyed |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 && !e.within(me.bodyEl, false, true) |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 && !e.within(me.picker.el, false, true) |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 ) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 me.collapse(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 createPicker: function() { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 var me = this; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 return new Lada.view.widget.base.DateTimePicker({ |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 pickerField: me, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 floating: true, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 hidden: true, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 focusable: true, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 focusOnShow: true, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 minDate: me.minValue, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 maxDate: me.maxDate, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 disabledDatesRE: me.disabledDatesRE, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 disabledDatesText: me.disabledDatesText, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 disabledDays: me.disabledDays, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 disabledDatesText: me.disabledDaysText, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 format: me.format, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 startDay: me.startDay, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 minText: Ext.String.format(me.minText, me.formatDate(me.minValue)), |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 maxText: Ext.String.format(me.maxText, me.formatDate(me.maxValue)), |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 listeners: { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 scope: me, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 select: me.onSelect |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 keyNavConfig: { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 esc: function() { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 me.collapse(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 }); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 }); |