HMSTimeMinuteField.js 822 B

12345678910111213141516171819202122232425262728293031323334
  1. Ext.define('erp.view.core.form.HMSTimeMinuteField', {
  2. extend : 'Ext.form.field.Text',
  3. alias : 'widget.hmstimeminutefield',
  4. initComponent : function() {
  5. this.callParent(arguments);
  6. this.addEvents({
  7. afterChangeValue : true
  8. });
  9. },
  10. height:22,
  11. onTriggerClick : function() {
  12. var me = this;
  13. if (this.minutePicker && !this.minutePicker.hidden) {
  14. this.minutePicker.hide();
  15. return;
  16. }
  17. this.createMinutePicker().show();
  18. },
  19. regex : /^(([01]?[0-9])|(2[0-3])):[0-5][0-9]:[0-5][0-9]$/,
  20. regexText : '时间格式不正确!',
  21. setValue : function(value) {
  22. if(value != null && value != ""){
  23. value=value.replace(new RegExp(/(:)/g),":");
  24. if (!this.regex.test(value)) {
  25. value=null;
  26. }
  27. }
  28. this.callParent(arguments);
  29. },
  30. hasValid : function() {
  31. return this.regex.test(this.value);
  32. }
  33. });