You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.0 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. Ext.ns('Ext.ux.form');
  16. /**
  17. * @class Ext.ux.form.SpinnerField
  18. * @extends Ext.form.NumberField
  19. * Creates a field utilizing Ext.ux.Spinner
  20. * @xtype spinnerfield
  21. */
  22. Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, {
  23. actionMode: 'wrap',
  24. deferHeight: true,
  25. autoSize: Ext.emptyFn,
  26. onBlur: Ext.emptyFn,
  27. adjustSize: Ext.BoxComponent.prototype.adjustSize,
  28. constructor: function(config) {
  29. var spinnerConfig = Ext.copyTo({}, config, 'incrementValue,alternateIncrementValue,accelerate,defaultValue,triggerClass,splitterClass');
  30. var spl = this.spinner = new Ext.ux.Spinner(spinnerConfig);
  31. var plugins = config.plugins
  32. ? (Ext.isArray(config.plugins)
  33. ? config.plugins.push(spl)
  34. : [config.plugins, spl])
  35. : spl;
  36. Ext.ux.form.SpinnerField.superclass.constructor.call(this, Ext.apply(config, {plugins: plugins}));
  37. },
  38. // private
  39. getResizeEl: function(){
  40. return this.wrap;
  41. },
  42. // private
  43. getPositionEl: function(){
  44. return this.wrap;
  45. },
  46. // private
  47. alignErrorIcon: function(){
  48. if (this.wrap) {
  49. this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
  50. }
  51. },
  52. validateBlur: function(){
  53. return true;
  54. }
  55. });
  56. Ext.reg('spinnerfield', Ext.ux.form.SpinnerField);
  57. //backwards compat
  58. Ext.form.SpinnerField = Ext.ux.form.SpinnerField;