Mercurial > lada > lada-client
annotate app/view/widget/base/DateTimeField.js @ 1360:d1dce50fa9a6
Fix reset button in Ortserstellung form.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 07 Feb 2017 18:56:35 +0100 |
parents | 777bf66dbb11 |
children |
rev | line source |
---|---|
892
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
2 * Software engineering by Intevation GmbH |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
3 * |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
7 */ |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
8 |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
9 /** |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
10 * This Widget extends a Datefield in order to create a |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
11 * something like a DateTimePicker |
777bf66dbb11
even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents:
649
diff
changeset
|
12 */ |
649
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 Ext.define('Lada.view.widget.base.DateTimeField', { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 extend: 'Ext.form.field.Date', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 alias: 'widget.datetimefield', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 requires: [ |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 'Lada.view.widget.base.DateTimePicker' |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 ], |
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 format: 'm/d/Y H:i', |
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 mimicBlur: 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 picker = me.picker; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 // ignore mousedown events within the picker element |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 if (!picker || |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 !e.within(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.callParent(arguments); |
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 collapseIf: function(e) { |
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 if (Ext.getVersion().major === 4 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 && !me.isDestroyed |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 && !e.within(me.bodyEl, false, true) |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 && !e.within(me.picker.el, false, true) |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 ) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 me.collapse(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 createPicker: function() { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 var me = this; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 return new Lada.view.widget.base.DateTimePicker({ |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 pickerField: me, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 floating: true, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 hidden: true, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 focusable: true, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 focusOnShow: true, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 minDate: me.minValue, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 maxDate: me.maxDate, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 disabledDatesRE: me.disabledDatesRE, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 disabledDatesText: me.disabledDatesText, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 disabledDays: me.disabledDays, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 disabledDatesText: me.disabledDaysText, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 format: me.format, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 startDay: me.startDay, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 minText: Ext.String.format(me.minText, me.formatDate(me.minValue)), |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 maxText: Ext.String.format(me.maxText, me.formatDate(me.maxValue)), |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 listeners: { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 scope: me, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 select: me.onSelect |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 keyNavConfig: { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 esc: function() { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 me.collapse(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 }); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 }); |