|
356 | 356 | // github.com/jquery/jquery-ui/commit/acfda4be521e48c6b61cc458a715ef163892ac36 |
357 | 357 | // window has it's own flow of z-indexes, so we revert z-index |
358 | 358 | // value and use native flow manager instead |
359 | | - if (this.overlay) { |
| 359 | + if (this.options.modal) { |
| 360 | + if (this.overlay) { |
| 361 | + this.overlay.css('zIndex', ''); |
| 362 | + } |
| 363 | + |
| 364 | + this._modalZIndexes({ |
| 365 | + revertActive: false |
| 366 | + }); |
| 367 | + this.moveToTop(null, true); |
| 368 | + } else if (this.overlay) { |
360 | 369 | this.overlay.css('zIndex', ''); |
361 | 370 | this.moveToTop(null, true); |
362 | 371 | } |
|
1289 | 1298 |
|
1290 | 1299 | // this._afterConfirmCloseButtonsBuild(); |
1291 | 1300 |
|
1292 | | - this._removeTopClasses(); |
1293 | | - this.$helpWindow.window('moveToTop'); |
| 1301 | + var $helpWindowParent = this.$helpWindow.parent(); |
| 1302 | + var helpInstance = this.$helpWindow.data(this._cnst.dataPrefix + 'window'); |
| 1303 | + |
| 1304 | + this._removeTopClasses($('.' + this.classes.window).not($helpWindowParent)); |
| 1305 | + |
| 1306 | + if (helpInstance) { |
| 1307 | + helpInstance._modalZIndexes({ |
| 1308 | + revertActive: false |
| 1309 | + }); |
| 1310 | + helpInstance._setTopClasses($helpWindowParent); |
| 1311 | + } |
1294 | 1312 |
|
1295 | 1313 | // position window on the center of it's parent window |
1296 | | - var $helpWindowParent = this.$helpWindow.parent(), |
1297 | | - taskbar = this._getTaskbarInstance(), |
| 1314 | + var taskbar = this._getTaskbarInstance(), |
1298 | 1315 | pd = taskbar._extendedPosition.call($helpWindowParent, 'offset'), |
1299 | 1316 | wd = taskbar._extendedPosition.call(this.$elem, 'offset'), |
1300 | 1317 | css = {}, |
|
1664 | 1681 |
|
1665 | 1682 | this['$' + b] = $('<button></button>').button({showLabel: false}).attr('data-button-name', b).addClass(this.classes['button' + B] + ' ' + this.classes.button).on({ |
1666 | 1683 | click: function() { |
| 1684 | + var helpOpened = false; |
| 1685 | + |
1667 | 1686 | // trigger action |
1668 | 1687 | if (b === 'help') { |
1669 | | - self._openHelp(); |
| 1688 | + helpOpened = self._openHelp(); |
1670 | 1689 | } |
1671 | 1690 |
|
1672 | 1691 | if (b === 'newtab') { |
|
1687 | 1706 |
|
1688 | 1707 | if (b === 'minimize') { |
1689 | 1708 | this.blur(); |
1690 | | - } else { |
| 1709 | + } else if (!helpOpened) { |
1691 | 1710 | self.moveToTop(); |
1692 | 1711 | } |
1693 | 1712 | }, |
|
1816 | 1835 | }); |
1817 | 1836 | }); |
1818 | 1837 |
|
1819 | | - // set new z-indexes |
| 1838 | + // set new z-indexes; skip windows managed by modal overlay logic |
1820 | 1839 | $.each(windows, function(index, set) { |
| 1840 | + if (self._isCoveredByModalOverlay(set[1])) { |
| 1841 | + return; |
| 1842 | + } |
| 1843 | + |
1821 | 1844 | set[1].css('zIndex', initialZIndex); |
1822 | 1845 | initialZIndex++; |
1823 | 1846 | }); |
1824 | 1847 |
|
| 1848 | + if ($modal.length || this.options.modal) { |
| 1849 | + this._refreshActiveModalZIndexes($modal.add(this.options.modal ? this.$elem : $())); |
| 1850 | + } |
| 1851 | + |
1825 | 1852 | var move; |
1826 | 1853 |
|
1827 | 1854 | if ($elem instanceof $) { |
|
3388 | 3415 | set.call(this, true); |
3389 | 3416 | }); |
3390 | 3417 |
|
3391 | | - $setCover = this._sortByZIndex($setCover, 'desc'); |
3392 | | - var zIndexDown = zIndex; |
| 3418 | + var taskbar = this._getTaskbarInstance(); |
| 3419 | + var baseZ = taskbar ? taskbar.options.windowsInitialZIndex : this._cnst.lowestPossibleZIndex; |
| 3420 | + |
| 3421 | + $setCover = this._sortByZIndex($setCover, 'asc'); |
3393 | 3422 |
|
3394 | 3423 | $setCover.each(function() { |
3395 | | - $(this).css('zIndex', --zIndexDown); |
| 3424 | + $(this).css('zIndex', baseZ++); |
3396 | 3425 | }); |
| 3426 | + |
| 3427 | + zIndex = baseZ - 1; |
3397 | 3428 | } |
3398 | 3429 |
|
3399 | 3430 | // noinspection JSUnusedGlobalSymbols |
3400 | 3431 | this.$overlaySet = $setCover; |
3401 | 3432 |
|
3402 | 3433 | if (!this.overlay) { |
3403 | 3434 | this._createOverlay(); |
3404 | | - this._hideOverlay(false); |
3405 | 3435 | } |
3406 | 3436 |
|
3407 | 3437 | if (zIndex === this._cnst.lowestPossibleZIndex) { |
|
3425 | 3455 | } |
3426 | 3456 |
|
3427 | 3457 | this.$elem.css('zIndex', ++zIndex); |
| 3458 | + this._showOverlay(); |
| 3459 | + }, |
| 3460 | + |
| 3461 | + _isCoveredByModalOverlay: function($elem) { |
| 3462 | + return $elem.is('[class*="' + this.classes.coveredByOverlay + '"]'); |
3428 | 3463 | }, |
3429 | 3464 |
|
3430 | 3465 | _modalZIndexes: function(options) { |
|
3436 | 3471 | this._setModalZIndexes(); |
3437 | 3472 | }, |
3438 | 3473 |
|
| 3474 | + _refreshActiveModalZIndexes: function($modals) { |
| 3475 | + var self = this; |
| 3476 | + var $targetModals = $modals.filter('.' + this.classes.windowTop); |
| 3477 | + |
| 3478 | + if (!$targetModals.length) { |
| 3479 | + $targetModals = $modals; |
| 3480 | + } |
| 3481 | + |
| 3482 | + $targetModals.each(function() { |
| 3483 | + var instance = $(this).children('.' + self.classes.windowContent).data(self._cnst.dataPrefix + 'window'); |
| 3484 | + |
| 3485 | + if (instance && instance.options.modal) { |
| 3486 | + instance._modalZIndexes({ |
| 3487 | + revertActive: false |
| 3488 | + }); |
| 3489 | + } |
| 3490 | + }); |
| 3491 | + }, |
| 3492 | + |
3439 | 3493 | _revertModalZIndexes: function(force) { |
3440 | 3494 | if (!this.options.modal) { |
3441 | 3495 | return; |
|
3593 | 3647 | return; |
3594 | 3648 | } |
3595 | 3649 |
|
3596 | | - var opacity = this._getTaskbarInstance()._styleIndicator(this.classes.uiWidgetOverlay, 'opacity').opacity; |
| 3650 | + var taskbar = this._getTaskbarInstance(); |
| 3651 | + var opacity = taskbar._styleIndicator(this.classes.dialogOverlay + ' ' + this.classes.uiWidgetOverlay, 'opacity').opacity; |
| 3652 | + |
| 3653 | + if (!opacity || parseFloat(opacity, 10) < 0.01) { |
| 3654 | + opacity = taskbar._styleIndicator(this.classes.uiWidgetOverlay, 'opacity').opacity; |
| 3655 | + } |
| 3656 | + |
| 3657 | + if (!opacity || parseFloat(opacity, 10) < 0.01) { |
| 3658 | + opacity = 0.3; |
| 3659 | + } |
| 3660 | + |
3597 | 3661 | this.overlay.show().stop(false, true); |
3598 | 3662 |
|
3599 | 3663 | var props = { |
|
0 commit comments