28f5b977c95e2c8075bd057a578c6fa7f4d93338
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Resources / Public / JavaScript / Wizard / Ux / Ext.ux.form.spinnerfield.js
1 /*!
2 * Ext JS Library 3.3.1
3 * Copyright(c) 2006-2010 Sencha Inc.
4 * licensing@sencha.com
5 * http://www.sencha.com/license
6 */
7 Ext.ns('Ext.ux.form');
8
9 /**
10 * @class Ext.ux.form.SpinnerField
11 * @extends Ext.form.NumberField
12 * Creates a field utilizing Ext.ux.Spinner
13 * @xtype spinnerfield
14 */
15 Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, {
16 actionMode: 'wrap',
17 deferHeight: true,
18 autoSize: Ext.emptyFn,
19 onBlur: Ext.emptyFn,
20 adjustSize: Ext.BoxComponent.prototype.adjustSize,
21
22 constructor: function(config) {
23 var spinnerConfig = Ext.copyTo({}, config, 'incrementValue,alternateIncrementValue,accelerate,defaultValue,triggerClass,splitterClass');
24
25 var spl = this.spinner = new Ext.ux.Spinner(spinnerConfig);
26
27 var plugins = config.plugins
28 ? (Ext.isArray(config.plugins)
29 ? config.plugins.push(spl)
30 : [config.plugins, spl])
31 : spl;
32
33 Ext.ux.form.SpinnerField.superclass.constructor.call(this, Ext.apply(config, {plugins: plugins}));
34 },
35
36 // private
37 getResizeEl: function(){
38 return this.wrap;
39 },
40
41 // private
42 getPositionEl: function(){
43 return this.wrap;
44 },
45
46 // private
47 alignErrorIcon: function(){
48 if (this.wrap) {
49 this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
50 }
51 },
52
53 validateBlur: function(){
54 return true;
55 }
56 });
57
58 Ext.reg('spinnerfield', Ext.ux.form.SpinnerField);
59
60 //backwards compat
61 Ext.form.SpinnerField = Ext.ux.form.SpinnerField;