Dialog.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. Ext.define('uas.auth.Dialog', {
  2. extend: 'Ext.form.Panel',
  3. xtype: 'authdialog',
  4. requires: [
  5. 'Ext.form.Panel'
  6. ],
  7. /*
  8. * Seek out the first enabled, focusable, empty textfield when the form is focused
  9. */
  10. defaultFocus: 'textfield:focusable:not([hidden]):not([disabled]):not([value])',
  11. /**
  12. * @cfg {Boolean} [autoComplete=false]
  13. * Enables browser (or Password Managers) support for autoCompletion of User Id and
  14. * password.
  15. */
  16. autoComplete : false,
  17. initComponent: function () {
  18. var me = this, listen;
  19. if (me.autoComplete) {
  20. // Use standard FORM tag for detection by browser or password tools
  21. me.autoEl = Ext.applyIf(
  22. me.autoEl || {},
  23. {
  24. tag: 'form',
  25. name: 'authdialog',
  26. method: 'post'
  27. });
  28. }
  29. me.addCls('auth-dialog');
  30. me.callParent();
  31. if (me.autoComplete) {
  32. listen = {
  33. afterrender : 'doAutoComplete',
  34. scope : me,
  35. single : true
  36. };
  37. Ext.each(me.query('textfield'), function (field) {
  38. field.on(listen);
  39. });
  40. }
  41. },
  42. doAutoComplete : function(target) {
  43. if (target.inputEl && target.autoComplete !== false) {
  44. target.inputEl.set({ autocomplete: 'on' });
  45. }
  46. }
  47. });