dialog.jquery-ui.es6.js 860 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * @file
  3. * Adds default classes to buttons for styling purposes.
  4. */
  5. (function ($) {
  6. $.widget('ui.dialog', $.ui.dialog, {
  7. options: {
  8. buttonClass: 'button',
  9. buttonPrimaryClass: 'button--primary',
  10. },
  11. _createButtons() {
  12. const opts = this.options;
  13. let primaryIndex;
  14. let $buttons;
  15. let index;
  16. const il = opts.buttons.length;
  17. for (index = 0; index < il; index++) {
  18. if (opts.buttons[index].primary && opts.buttons[index].primary === true) {
  19. primaryIndex = index;
  20. delete opts.buttons[index].primary;
  21. break;
  22. }
  23. }
  24. this._super();
  25. $buttons = this.uiButtonSet.children().addClass(opts.buttonClass);
  26. if (typeof primaryIndex !== 'undefined') {
  27. $buttons.eq(index).addClass(opts.buttonPrimaryClass);
  28. }
  29. },
  30. });
  31. }(jQuery));