vendor: 1,995 bytes, lines 1-69
1/*! jQuery UI - v1.14.0 - 2024-08-07 2* https://jqueryui.com 3* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/resizable.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/dialog.js, widgets/mouse.js 4* Copyright OpenJS Foundation and other contributors; Licensed MIT */ 5 6( function( factory ) { 7 "use strict"; 8 9 if ( typeof define === "function" && define.amd ) { 10 11 // AMD. Register as an anonymous module. 12 define( [ "jquery" ], factory ); 13 } else { 14 15 // Browser globals 16 factory( jQuery ); 17 } 18} )( function( $ ) { 19"use strict"; 20 21$.ui = $.ui || {}; 22 23var version = $.ui.version = "1.14.0"; 24 25 26/*! 27 * jQuery UI Widget 1.14.0 28 * https://jqueryui.com 29 * 30 * Copyright OpenJS Foundation and other contributors 31 * Released under the MIT license. 32 * https://jquery.org/license 33 */ 34 35//>>label: Widget 36//>>group: Core 37//>>description: Provides a factory for creating stateful widgets with a common API. 38//>>docs: https://api.jqueryui.com/jQuery.widget/ 39//>>demos: https://jqueryui.com/widget/ 40 41 42var widgetUuid = 0; 43var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 44var widgetSlice = Array.prototype.slice; 45 46$.cleanData = ( function( orig ) { 47 return function( elems ) { 48 var events, elem, i; 49 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 50 51 // Only trigger remove when necessary to save time 52 events = $._data( elem, "events" ); 53 if ( events && events.remove ) { 54 $( elem ).triggerHandler( "remove" ); 55 } 56 } 57 orig( elems ); 58 }; 59} )( $.cleanData ); 60 61$.widget = function( name, base, prototype ) { 62 var existingConstructor, constructor, basePrototype; 63 64 // ProxiedPrototype allows the provided prototype to remain unmodified 65 // so that it can be used as a mixin for multiple widgets (#8876) 66 var proxiedPrototype = {}; 67 68 var namespace = name.split( "." )[ 0 ]; 69 name = name.split( "." )[ 1 ];
vendor: 18,825 bytes, lines 69-769
69 70 var fullName = namespace + "-" + name; 71 72 if ( !prototype ) { 73 prototype = base; 74 base = $.Widget; 75 } 76 77 if ( Array.isArray( prototype ) ) { 78 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 79 } 80 81 // Create selector for plugin 82 $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { 83 return !!$.data( elem, fullName ); 84 }; 85 86 $[ namespace ] = $[ namespace ] || {}; 87 existingConstructor = $[ namespace ][ name ]; 88 constructor = $[ namespace ][ name ] = function( options, element ) { 89 90 // Allow instantiation without "new" keyword 91 if ( !this || !this._createWidget ) { 92 return new constructor( options, element ); 93 } 94 95 // Allow instantiation without initializing for simple inheritance 96 // must use "new" keyword (the code above always passes args) 97 if ( arguments.length ) { 98 this._createWidget( options, element ); 99 } 100 }; 101 102 // Extend with the existing constructor to carry over any static properties 103 $.extend( constructor, existingConstructor, { 104 version: prototype.version, 105 106 // Copy the object used to create the prototype in case we need to 107 // redefine the widget later 108 _proto: $.extend( {}, prototype ), 109 110 // Track widgets that inherit from this widget in case this widget is 111 // redefined after a widget inherits from it 112 _childConstructors: [] 113 } ); 114 115 basePrototype = new base(); 116 117 // We need to make the options hash a property directly on the new instance 118 // otherwise we'll modify the options hash on the prototype that we're 119 // inheriting from 120 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 121 $.each( prototype, function( prop, value ) { 122 if ( typeof value !== "function" ) { 123 proxiedPrototype[ prop ] = value; 124 return; 125 } 126 proxiedPrototype[ prop ] = ( function() { 127 function _super() { 128 return base.prototype[ prop ].apply( this, arguments ); 129 } 130 131 function _superApply( args ) { 132 return base.prototype[ prop ].apply( this, args ); 133 } 134 135 return function() { 136 var __super = this._super; 137 var __superApply = this._superApply; 138 var returnValue; 139 140 this._super = _super; 141 this._superApply = _superApply; 142 143 returnValue = value.apply( this, arguments ); 144 145 this._super = __super; 146 this._superApply = __superApply; 147 148 return returnValue; 149 }; 150 } )(); 151 } ); 152 constructor.prototype = $.widget.extend( basePrototype, { 153 154 // TODO: remove support for widgetEventPrefix 155 // always use the name + a colon as the prefix, e.g., draggable:start 156 // don't prefix for widgets that aren't DOM-based 157 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 158 }, proxiedPrototype, { 159 constructor: constructor, 160 namespace: namespace, 161 widgetName: name, 162 widgetFullName: fullName 163 } ); 164 165 // If this widget is being redefined then we need to find all widgets that 166 // are inheriting from it and redefine all of them so that they inherit from 167 // the new version of this widget. We're essentially trying to replace one 168 // level in the prototype chain. 169 if ( existingConstructor ) { 170 $.each( existingConstructor._childConstructors, function( i, child ) { 171 var childPrototype = child.prototype; 172 173 // Redefine the child widget using the same prototype that was 174 // originally used, but inherit from the new version of the base 175 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 176 child._proto ); 177 } ); 178 179 // Remove the list of existing child constructors from the old constructor 180 // so the old child constructors can be garbage collected 181 delete existingConstructor._childConstructors; 182 } else { 183 base._childConstructors.push( constructor ); 184 } 185 186 $.widget.bridge( name, constructor ); 187 188 return constructor; 189}; 190 191$.widget.extend = function( target ) { 192 var input = widgetSlice.call( arguments, 1 ); 193 var inputIndex = 0; 194 var inputLength = input.length; 195 var key; 196 var value; 197 198 for ( ; inputIndex < inputLength; inputIndex++ ) { 199 for ( key in input[ inputIndex ] ) { 200 value = input[ inputIndex ][ key ]; 201 if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { 202 203 // Clone objects 204 if ( $.isPlainObject( value ) ) { 205 target[ key ] = $.isPlainObject( target[ key ] ) ? 206 $.widget.extend( {}, target[ key ], value ) : 207 208 // Don't extend strings, arrays, etc. with objects 209 $.widget.extend( {}, value ); 210 211 // Copy everything else by reference 212 } else { 213 target[ key ] = value; 214 } 215 } 216 } 217 } 218 return target; 219}; 220 221$.widget.bridge = function( name, object ) { 222 var fullName = object.prototype.widgetFullName || name; 223 $.fn[ name ] = function( options ) { 224 var isMethodCall = typeof options === "string"; 225 var args = widgetSlice.call( arguments, 1 ); 226 var returnValue = this; 227 228 if ( isMethodCall ) { 229 230 // If this is an empty collection, we need to have the instance method 231 // return undefined instead of the jQuery instance 232 if ( !this.length && options === "instance" ) { 233 returnValue = undefined; 234 } else { 235 this.each( function() { 236 var methodValue; 237 var instance = $.data( this, fullName ); 238 239 if ( options === "instance" ) { 240 returnValue = instance; 241 return false; 242 } 243 244 if ( !instance ) { 245 return $.error( "cannot call methods on " + name + 246 " prior to initialization; " + 247 "attempted to call method '" + options + "'" ); 248 } 249 250 if ( typeof instance[ options ] !== "function" || 251 options.charAt( 0 ) === "_" ) { 252 return $.error( "no such method '" + options + "' for " + name + 253 " widget instance" ); 254 } 255 256 methodValue = instance[ options ].apply( instance, args ); 257 258 if ( methodValue !== instance && methodValue !== undefined ) { 259 returnValue = methodValue && methodValue.jquery ? 260 returnValue.pushStack( methodValue.get() ) : 261 methodValue; 262 return false; 263 } 264 } ); 265 } 266 } else { 267 268 // Allow multiple hashes to be passed on init 269 if ( args.length ) { 270 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 271 } 272 273 this.each( function() { 274 var instance = $.data( this, fullName ); 275 if ( instance ) { 276 instance.option( options || {} ); 277 if ( instance._init ) { 278 instance._init(); 279 } 280 } else { 281 $.data( this, fullName, new object( options, this ) ); 282 } 283 } ); 284 } 285 286 return returnValue; 287 }; 288}; 289 290$.Widget = function( /* options, element */ ) {}; 291$.Widget._childConstructors = []; 292 293$.Widget.prototype = { 294 widgetName: "widget", 295 widgetEventPrefix: "", 296 defaultElement: "<div>", 297 298 options: { 299 classes: {}, 300 disabled: false, 301 302 // Callbacks 303 create: null 304 }, 305 306 _createWidget: function( options, element ) { 307 element = $( element || this.defaultElement || this )[ 0 ]; 308 this.element = $( element ); 309 this.uuid = widgetUuid++; 310 this.eventNamespace = "." + this.widgetName + this.uuid; 311 312 this.bindings = $(); 313 this.hoverable = $(); 314 this.focusable = $(); 315 this.classesElementLookup = {}; 316 317 if ( element !== this ) { 318 $.data( element, this.widgetFullName, this ); 319 this._on( true, this.element, { 320 remove: function( event ) { 321 if ( event.target === element ) { 322 this.destroy(); 323 } 324 } 325 } ); 326 this.document = $( element.style ? 327 328 // Element within the document 329 element.ownerDocument : 330 331 // Element is window or document 332 element.document || element ); 333 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 334 } 335 336 this.options = $.widget.extend( {}, 337 this.options, 338 this._getCreateOptions(), 339 options ); 340 341 this._create(); 342 343 if ( this.options.disabled ) { 344 this._setOptionDisabled( this.options.disabled ); 345 } 346 347 this._trigger( "create", null, this._getCreateEventData() ); 348 this._init(); 349 }, 350 351 _getCreateOptions: function() { 352 return {}; 353 }, 354 355 _getCreateEventData: $.noop, 356 357 _create: $.noop, 358 359 _init: $.noop, 360 361 destroy: function() { 362 var that = this; 363 364 this._destroy(); 365 $.each( this.classesElementLookup, function( key, value ) { 366 that._removeClass( value, key ); 367 } ); 368 369 // We can probably remove the unbind calls in 2.0 370 // all event bindings should go through this._on() 371 this.element 372 .off( this.eventNamespace ) 373 .removeData( this.widgetFullName ); 374 this.widget() 375 .off( this.eventNamespace ) 376 .removeAttr( "aria-disabled" ); 377 378 // Clean up events and states 379 this.bindings.off( this.eventNamespace ); 380 }, 381 382 _destroy: $.noop, 383 384 widget: function() { 385 return this.element; 386 }, 387 388 option: function( key, value ) { 389 var options = key; 390 var parts; 391 var curOption; 392 var i; 393 394 if ( arguments.length === 0 ) { 395 396 // Don't return a reference to the internal hash 397 return $.widget.extend( {}, this.options ); 398 } 399 400 if ( typeof key === "string" ) { 401 402 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 403 options = {}; 404 parts = key.split( "." ); 405 key = parts.shift(); 406 if ( parts.length ) { 407 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 408 for ( i = 0; i < parts.length - 1; i++ ) { 409 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 410 curOption = curOption[ parts[ i ] ]; 411 } 412 key = parts.pop(); 413 if ( arguments.length === 1 ) { 414 return curOption[ key ] === undefined ? null : curOption[ key ]; 415 } 416 curOption[ key ] = value; 417 } else { 418 if ( arguments.length === 1 ) { 419 return this.options[ key ] === undefined ? null : this.options[ key ]; 420 } 421 options[ key ] = value; 422 } 423 } 424 425 this._setOptions( options ); 426 427 return this; 428 }, 429 430 _setOptions: function( options ) { 431 var key; 432 433 for ( key in options ) { 434 this._setOption( key, options[ key ] ); 435 } 436 437 return this; 438 }, 439 440 _setOption: function( key, value ) { 441 if ( key === "classes" ) { 442 this._setOptionClasses( value ); 443 } 444 445 this.options[ key ] = value; 446 447 if ( key === "disabled" ) { 448 this._setOptionDisabled( value ); 449 } 450 451 return this; 452 }, 453 454 _setOptionClasses: function( value ) { 455 var classKey, elements, currentElements; 456 457 for ( classKey in value ) { 458 currentElements = this.classesElementLookup[ classKey ]; 459 if ( value[ classKey ] === this.options.classes[ classKey ] || 460 !currentElements || 461 !currentElements.length ) { 462 continue; 463 } 464 465 // We are doing this to create a new jQuery object because the _removeClass() call 466 // on the next line is going to destroy the reference to the current elements being 467 // tracked. We need to save a copy of this collection so that we can add the new classes 468 // below. 469 elements = $( currentElements.get() ); 470 this._removeClass( currentElements, classKey ); 471 472 // We don't use _addClass() here, because that uses this.options.classes 473 // for generating the string of classes. We want to use the value passed in from 474 // _setOption(), this is the new value of the classes option which was passed to 475 // _setOption(). We pass this value directly to _classes(). 476 elements.addClass( this._classes( { 477 element: elements, 478 keys: classKey, 479 classes: value, 480 add: true 481 } ) ); 482 } 483 }, 484 485 _setOptionDisabled: function( value ) { 486 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 487 488 // If the widget is becoming disabled, then nothing is interactive 489 if ( value ) { 490 this._removeClass( this.hoverable, null, "ui-state-hover" ); 491 this._removeClass( this.focusable, null, "ui-state-focus" ); 492 } 493 }, 494 495 enable: function() { 496 return this._setOptions( { disabled: false } ); 497 }, 498 499 disable: function() { 500 return this._setOptions( { disabled: true } ); 501 }, 502 503 _classes: function( options ) { 504 var full = []; 505 var that = this; 506 507 options = $.extend( { 508 element: this.element, 509 classes: this.options.classes || {} 510 }, options ); 511 512 function bindRemoveEvent() { 513 var nodesToBind = []; 514 515 options.element.each( function( _, element ) { 516 var isTracked = $.map( that.classesElementLookup, function( elements ) { 517 return elements; 518 } ) 519 .some( function( elements ) { 520 return elements.is( element ); 521 } ); 522 523 if ( !isTracked ) { 524 nodesToBind.push( element ); 525 } 526 } ); 527 528 that._on( $( nodesToBind ), { 529 remove: "_untrackClassesElement" 530 } ); 531 } 532 533 function processClassString( classes, checkOption ) { 534 var current, i; 535 for ( i = 0; i < classes.length; i++ ) { 536 current = that.classesElementLookup[ classes[ i ] ] || $(); 537 if ( options.add ) { 538 bindRemoveEvent(); 539 current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); 540 } else { 541 current = $( current.not( options.element ).get() ); 542 } 543 that.classesElementLookup[ classes[ i ] ] = current; 544 full.push( classes[ i ] ); 545 if ( checkOption && options.classes[ classes[ i ] ] ) { 546 full.push( options.classes[ classes[ i ] ] ); 547 } 548 } 549 } 550 551 if ( options.keys ) { 552 processClassString( options.keys.match( /\S+/g ) || [], true ); 553 } 554 if ( options.extra ) { 555 processClassString( options.extra.match( /\S+/g ) || [] ); 556 } 557 558 return full.join( " " ); 559 }, 560 561 _untrackClassesElement: function( event ) { 562 var that = this; 563 $.each( that.classesElementLookup, function( key, value ) { 564 if ( $.inArray( event.target, value ) !== -1 ) { 565 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 566 } 567 } ); 568 569 this._off( $( event.target ) ); 570 }, 571 572 _removeClass: function( element, keys, extra ) { 573 return this._toggleClass( element, keys, extra, false ); 574 }, 575 576 _addClass: function( element, keys, extra ) { 577 return this._toggleClass( element, keys, extra, true ); 578 }, 579 580 _toggleClass: function( element, keys, extra, add ) { 581 add = ( typeof add === "boolean" ) ? add : extra; 582 var shift = ( typeof element === "string" || element === null ), 583 options = { 584 extra: shift ? keys : extra, 585 keys: shift ? element : keys, 586 element: shift ? this.element : element, 587 add: add 588 }; 589 options.element.toggleClass( this._classes( options ), add ); 590 return this; 591 }, 592 593 _on: function( suppressDisabledCheck, element, handlers ) { 594 var delegateElement; 595 var instance = this; 596 597 // No suppressDisabledCheck flag, shuffle arguments 598 if ( typeof suppressDisabledCheck !== "boolean" ) { 599 handlers = element; 600 element = suppressDisabledCheck; 601 suppressDisabledCheck = false; 602 } 603 604 // No element argument, shuffle and use this.element 605 if ( !handlers ) { 606 handlers = element; 607 element = this.element; 608 delegateElement = this.widget(); 609 } else { 610 element = delegateElement = $( element ); 611 this.bindings = this.bindings.add( element ); 612 } 613 614 $.each( handlers, function( event, handler ) { 615 function handlerProxy() { 616 617 // Allow widgets to customize the disabled handling 618 // - disabled as an array instead of boolean 619 // - disabled class as method for disabling individual parts 620 if ( !suppressDisabledCheck && 621 ( instance.options.disabled === true || 622 $( this ).hasClass( "ui-state-disabled" ) ) ) { 623 return; 624 } 625 return ( typeof handler === "string" ? instance[ handler ] : handler ) 626 .apply( instance, arguments ); 627 } 628 629 // Copy the guid so direct unbinding works 630 if ( typeof handler !== "string" ) { 631 handlerProxy.guid = handler.guid = 632 handler.guid || handlerProxy.guid || $.guid++; 633 } 634 635 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 636 var eventName = match[ 1 ] + instance.eventNamespace; 637 var selector = match[ 2 ]; 638 639 if ( selector ) { 640 delegateElement.on( eventName, selector, handlerProxy ); 641 } else { 642 element.on( eventName, handlerProxy ); 643 } 644 } ); 645 }, 646 647 _off: function( element, eventName ) { 648 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 649 this.eventNamespace; 650 element.off( eventName ); 651 652 // Clear the stack to avoid memory leaks (#10056) 653 this.bindings = $( this.bindings.not( element ).get() ); 654 this.focusable = $( this.focusable.not( element ).get() ); 655 this.hoverable = $( this.hoverable.not( element ).get() ); 656 }, 657 658 _delay: function( handler, delay ) { 659 function handlerProxy() { 660 return ( typeof handler === "string" ? instance[ handler ] : handler ) 661 .apply( instance, arguments ); 662 } 663 var instance = this; 664 return setTimeout( handlerProxy, delay || 0 ); 665 }, 666 667 _hoverable: function( element ) { 668 this.hoverable = this.hoverable.add( element ); 669 this._on( element, { 670 mouseenter: function( event ) { 671 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 672 }, 673 mouseleave: function( event ) { 674 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 675 } 676 } ); 677 }, 678 679 _focusable: function( element ) { 680 this.focusable = this.focusable.add( element ); 681 this._on( element, { 682 focusin: function( event ) { 683 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 684 }, 685 focusout: function( event ) { 686 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 687 } 688 } ); 689 }, 690 691 _trigger: function( type, event, data ) { 692 var prop, orig; 693 var callback = this.options[ type ]; 694 695 data = data || {}; 696 event = $.Event( event ); 697 event.type = ( type === this.widgetEventPrefix ? 698 type : 699 this.widgetEventPrefix + type ).toLowerCase(); 700 701 // The original event may come from any element 702 // so we need to reset the target on the new event 703 event.target = this.element[ 0 ]; 704 705 // Copy original event properties over to the new event 706 orig = event.originalEvent; 707 if ( orig ) { 708 for ( prop in orig ) { 709 if ( !( prop in event ) ) { 710 event[ prop ] = orig[ prop ]; 711 } 712 } 713 } 714 715 this.element.trigger( event, data ); 716 return !( typeof callback === "function" && 717 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 718 event.isDefaultPrevented() ); 719 } 720}; 721 722$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 723 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 724 if ( typeof options === "string" ) { 725 options = { effect: options }; 726 } 727 728 var hasOptions; 729 var effectName = !options ? 730 method : 731 options === true || typeof options === "number" ? 732 defaultEffect : 733 options.effect || defaultEffect; 734 735 options = options || {}; 736 if ( typeof options === "number" ) { 737 options = { duration: options }; 738 } else if ( options === true ) { 739 options = {}; 740 } 741 742 hasOptions = !$.isEmptyObject( options ); 743 options.complete = callback; 744 745 if ( options.delay ) { 746 element.delay( options.delay ); 747 } 748 749 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 750 element[ method ]( options ); 751 } else if ( effectName !== method && element[ effectName ] ) { 752 element[ effectName ]( options.duration, options.easing, callback ); 753 } else { 754 element.queue( function( next ) { 755 $( this )[ method ](); 756 if ( callback ) { 757 callback.call( element[ 0 ] ); 758 } 759 next(); 760 } ); 761 } 762 }; 763} ); 764 765var widget = $.widget; 766 767 768/*! 769 * jQuery UI Position 1.14.
vendor: 3,861 bytes, lines 769-912
7690 770 * https://jqueryui.com 771 * 772 * Copyright OpenJS Foundation and other contributors 773 * Released under the MIT license. 774 * https://jquery.org/license 775 * 776 * https://api.jqueryui.com/position/ 777 */ 778 779//>>label: Position 780//>>group: Core 781//>>description: Positions elements relative to other elements. 782//>>docs: https://api.jqueryui.com/position/ 783//>>demos: https://jqueryui.com/position/ 784 785 786( function() { 787var cachedScrollbarWidth, 788 max = Math.max, 789 abs = Math.abs, 790 rhorizontal = /left|center|right/, 791 rvertical = /top|center|bottom/, 792 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 793 rposition = /^\w+/, 794 rpercent = /%$/, 795 _position = $.fn.position; 796 797function getOffsets( offsets, width, height ) { 798 return [ 799 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 800 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 801 ]; 802} 803 804function parseCss( element, property ) { 805 return parseInt( $.css( element, property ), 10 ) || 0; 806} 807 808function isWindow( obj ) { 809 return obj != null && obj === obj.window; 810} 811 812function getDimensions( elem ) { 813 var raw = elem[ 0 ]; 814 if ( raw.nodeType === 9 ) { 815 return { 816 width: elem.width(), 817 height: elem.height(), 818 offset: { top: 0, left: 0 } 819 }; 820 } 821 if ( isWindow( raw ) ) { 822 return { 823 width: elem.width(), 824 height: elem.height(), 825 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 826 }; 827 } 828 if ( raw.preventDefault ) { 829 return { 830 width: 0, 831 height: 0, 832 offset: { top: raw.pageY, left: raw.pageX } 833 }; 834 } 835 return { 836 width: elem.outerWidth(), 837 height: elem.outerHeight(), 838 offset: elem.offset() 839 }; 840} 841 842$.position = { 843 scrollbarWidth: function() { 844 if ( cachedScrollbarWidth !== undefined ) { 845 return cachedScrollbarWidth; 846 } 847 var w1, w2, 848 div = $( "<div style=" + 849 "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + 850 "<div style='height:300px;width:auto;'></div></div>" ), 851 innerDiv = div.children()[ 0 ]; 852 853 $( "body" ).append( div ); 854 w1 = innerDiv.offsetWidth; 855 div.css( "overflow", "scroll" ); 856 857 w2 = innerDiv.offsetWidth; 858 859 if ( w1 === w2 ) { 860 w2 = div[ 0 ].clientWidth; 861 } 862 863 div.remove(); 864 865 return ( cachedScrollbarWidth = w1 - w2 ); 866 }, 867 getScrollInfo: function( within ) { 868 var overflowX = within.isWindow || within.isDocument ? "" : 869 within.element.css( "overflow-x" ), 870 overflowY = within.isWindow || within.isDocument ? "" : 871 within.element.css( "overflow-y" ), 872 hasOverflowX = overflowX === "scroll" || 873 ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ), 874 hasOverflowY = overflowY === "scroll" || 875 ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight ); 876 return { 877 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 878 height: hasOverflowX ? $.position.scrollbarWidth() : 0 879 }; 880 }, 881 getWithinInfo: function( element ) { 882 var withinElement = $( element || window ), 883 isElemWindow = isWindow( withinElement[ 0 ] ), 884 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, 885 hasOffset = !isElemWindow && !isDocument; 886 return { 887 element: withinElement, 888 isWindow: isElemWindow, 889 isDocument: isDocument, 890 offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, 891 scrollLeft: withinElement.scrollLeft(), 892 scrollTop: withinElement.scrollTop(), 893 width: withinElement.outerWidth(), 894 height: withinElement.outerHeight() 895 }; 896 } 897}; 898 899$.fn.position = function( options ) { 900 if ( !options || !options.of ) { 901 return _position.apply( this, arguments ); 902 } 903 904 // Make a copy, we don't want to modify arguments 905 options = $.extend( {}, options ); 906 907 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 908 909 // Make sure string options are treated as CSS selectors 910 target = typeof options.of === "string" ? 911 $( document ).find( options.of ) : 912 $( options.of ),
vendor: 10,992 bytes, lines 913-1266
913 914 within = $.position.getWithinInfo( options.within ), 915 scrollInfo = $.position.getScrollInfo( within ), 916 collision = ( options.collision || "flip" ).split( " " ), 917 offsets = {}; 918 919 dimensions = getDimensions( target ); 920 if ( target[ 0 ].preventDefault ) { 921 922 // Force left top to allow flipping 923 options.at = "left top"; 924 } 925 targetWidth = dimensions.width; 926 targetHeight = dimensions.height; 927 targetOffset = dimensions.offset; 928 929 // Clone to reuse original targetOffset later 930 basePosition = $.extend( {}, targetOffset ); 931 932 // Force my and at to have valid horizontal and vertical positions 933 // if a value is missing or invalid, it will be converted to center 934 $.each( [ "my", "at" ], function() { 935 var pos = ( options[ this ] || "" ).split( " " ), 936 horizontalOffset, 937 verticalOffset; 938 939 if ( pos.length === 1 ) { 940 pos = rhorizontal.test( pos[ 0 ] ) ? 941 pos.concat( [ "center" ] ) : 942 rvertical.test( pos[ 0 ] ) ? 943 [ "center" ].concat( pos ) : 944 [ "center", "center" ]; 945 } 946 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 947 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 948 949 // Calculate offsets 950 horizontalOffset = roffset.exec( pos[ 0 ] ); 951 verticalOffset = roffset.exec( pos[ 1 ] ); 952 offsets[ this ] = [ 953 horizontalOffset ? horizontalOffset[ 0 ] : 0, 954 verticalOffset ? verticalOffset[ 0 ] : 0 955 ]; 956 957 // Reduce to just the positions without the offsets 958 options[ this ] = [ 959 rposition.exec( pos[ 0 ] )[ 0 ], 960 rposition.exec( pos[ 1 ] )[ 0 ] 961 ]; 962 } ); 963 964 // Normalize collision option 965 if ( collision.length === 1 ) { 966 collision[ 1 ] = collision[ 0 ]; 967 } 968 969 if ( options.at[ 0 ] === "right" ) { 970 basePosition.left += targetWidth; 971 } else if ( options.at[ 0 ] === "center" ) { 972 basePosition.left += targetWidth / 2; 973 } 974 975 if ( options.at[ 1 ] === "bottom" ) { 976 basePosition.top += targetHeight; 977 } else if ( options.at[ 1 ] === "center" ) { 978 basePosition.top += targetHeight / 2; 979 } 980 981 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 982 basePosition.left += atOffset[ 0 ]; 983 basePosition.top += atOffset[ 1 ]; 984 985 return this.each( function() { 986 var collisionPosition, using, 987 elem = $( this ), 988 elemWidth = elem.outerWidth(), 989 elemHeight = elem.outerHeight(), 990 marginLeft = parseCss( this, "marginLeft" ), 991 marginTop = parseCss( this, "marginTop" ), 992 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + 993 scrollInfo.width, 994 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + 995 scrollInfo.height, 996 position = $.extend( {}, basePosition ), 997 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 998 999 if ( options.my[ 0 ] === "right" ) { 1000 position.left -= elemWidth; 1001 } else if ( options.my[ 0 ] === "center" ) { 1002 position.left -= elemWidth / 2; 1003 } 1004 1005 if ( options.my[ 1 ] === "bottom" ) { 1006 position.top -= elemHeight; 1007 } else if ( options.my[ 1 ] === "center" ) { 1008 position.top -= elemHeight / 2; 1009 } 1010 1011 position.left += myOffset[ 0 ]; 1012 position.top += myOffset[ 1 ]; 1013 1014 collisionPosition = { 1015 marginLeft: marginLeft, 1016 marginTop: marginTop 1017 }; 1018 1019 $.each( [ "left", "top" ], function( i, dir ) { 1020 if ( $.ui.position[ collision[ i ] ] ) { 1021 $.ui.position[ collision[ i ] ][ dir ]( position, { 1022 targetWidth: targetWidth, 1023 targetHeight: targetHeight, 1024 elemWidth: elemWidth, 1025 elemHeight: elemHeight, 1026 collisionPosition: collisionPosition, 1027 collisionWidth: collisionWidth, 1028 collisionHeight: collisionHeight, 1029 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 1030 my: options.my, 1031 at: options.at, 1032 within: within, 1033 elem: elem 1034 } ); 1035 } 1036 } ); 1037 1038 if ( options.using ) { 1039 1040 // Adds feedback as second argument to using callback, if present 1041 using = function( props ) { 1042 var left = targetOffset.left - position.left, 1043 right = left + targetWidth - elemWidth, 1044 top = targetOffset.top - position.top, 1045 bottom = top + targetHeight - elemHeight, 1046 feedback = { 1047 target: { 1048 element: target, 1049 left: targetOffset.left, 1050 top: targetOffset.top, 1051 width: targetWidth, 1052 height: targetHeight 1053 }, 1054 element: { 1055 element: elem, 1056 left: position.left, 1057 top: position.top, 1058 width: elemWidth, 1059 height: elemHeight 1060 }, 1061 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1062 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1063 }; 1064 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 1065 feedback.horizontal = "center"; 1066 } 1067 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 1068 feedback.vertical = "middle"; 1069 } 1070 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 1071 feedback.important = "horizontal"; 1072 } else { 1073 feedback.important = "vertical"; 1074 } 1075 options.using.call( this, props, feedback ); 1076 }; 1077 } 1078 1079 elem.offset( $.extend( position, { using: using } ) ); 1080 } ); 1081}; 1082 1083$.ui.position = { 1084 fit: { 1085 left: function( position, data ) { 1086 var within = data.within, 1087 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1088 outerWidth = within.width, 1089 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1090 overLeft = withinOffset - collisionPosLeft, 1091 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1092 newOverRight; 1093 1094 // Element is wider than within 1095 if ( data.collisionWidth > outerWidth ) { 1096 1097 // Element is initially over the left side of within 1098 if ( overLeft > 0 && overRight <= 0 ) { 1099 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 1100 withinOffset; 1101 position.left += overLeft - newOverRight; 1102 1103 // Element is initially over right side of within 1104 } else if ( overRight > 0 && overLeft <= 0 ) { 1105 position.left = withinOffset; 1106 1107 // Element is initially over both left and right sides of within 1108 } else { 1109 if ( overLeft > overRight ) { 1110 position.left = withinOffset + outerWidth - data.collisionWidth; 1111 } else { 1112 position.left = withinOffset; 1113 } 1114 } 1115 1116 // Too far left -> align with left edge 1117 } else if ( overLeft > 0 ) { 1118 position.left += overLeft; 1119 1120 // Too far right -> align with right edge 1121 } else if ( overRight > 0 ) { 1122 position.left -= overRight; 1123 1124 // Adjust based on position and margin 1125 } else { 1126 position.left = max( position.left - collisionPosLeft, position.left ); 1127 } 1128 }, 1129 top: function( position, data ) { 1130 var within = data.within, 1131 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1132 outerHeight = data.within.height, 1133 collisionPosTop = position.top - data.collisionPosition.marginTop, 1134 overTop = withinOffset - collisionPosTop, 1135 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1136 newOverBottom; 1137 1138 // Element is taller than within 1139 if ( data.collisionHeight > outerHeight ) { 1140 1141 // Element is initially over the top of within 1142 if ( overTop > 0 && overBottom <= 0 ) { 1143 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 1144 withinOffset; 1145 position.top += overTop - newOverBottom; 1146 1147 // Element is initially over bottom of within 1148 } else if ( overBottom > 0 && overTop <= 0 ) { 1149 position.top = withinOffset; 1150 1151 // Element is initially over both top and bottom of within 1152 } else { 1153 if ( overTop > overBottom ) { 1154 position.top = withinOffset + outerHeight - data.collisionHeight; 1155 } else { 1156 position.top = withinOffset; 1157 } 1158 } 1159 1160 // Too far up -> align with top 1161 } else if ( overTop > 0 ) { 1162 position.top += overTop; 1163 1164 // Too far down -> align with bottom edge 1165 } else if ( overBottom > 0 ) { 1166 position.top -= overBottom; 1167 1168 // Adjust based on position and margin 1169 } else { 1170 position.top = max( position.top - collisionPosTop, position.top ); 1171 } 1172 } 1173 }, 1174 flip: { 1175 left: function( position, data ) { 1176 var within = data.within, 1177 withinOffset = within.offset.left + within.scrollLeft, 1178 outerWidth = within.width, 1179 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1180 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1181 overLeft = collisionPosLeft - offsetLeft, 1182 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1183 myOffset = data.my[ 0 ] === "left" ? 1184 -data.elemWidth : 1185 data.my[ 0 ] === "right" ? 1186 data.elemWidth : 1187 0, 1188 atOffset = data.at[ 0 ] === "left" ? 1189 data.targetWidth : 1190 data.at[ 0 ] === "right" ? 1191 -data.targetWidth : 1192 0, 1193 offset = -2 * data.offset[ 0 ], 1194 newOverRight, 1195 newOverLeft; 1196 1197 if ( overLeft < 0 ) { 1198 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 1199 outerWidth - withinOffset; 1200 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 1201 position.left += myOffset + atOffset + offset; 1202 } 1203 } else if ( overRight > 0 ) { 1204 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 1205 atOffset + offset - offsetLeft; 1206 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 1207 position.left += myOffset + atOffset + offset; 1208 } 1209 } 1210 }, 1211 top: function( position, data ) { 1212 var within = data.within, 1213 withinOffset = within.offset.top + within.scrollTop, 1214 outerHeight = within.height, 1215 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1216 collisionPosTop = position.top - data.collisionPosition.marginTop, 1217 overTop = collisionPosTop - offsetTop, 1218 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1219 top = data.my[ 1 ] === "top", 1220 myOffset = top ? 1221 -data.elemHeight : 1222 data.my[ 1 ] === "bottom" ? 1223 data.elemHeight : 1224 0, 1225 atOffset = data.at[ 1 ] === "top" ? 1226 data.targetHeight : 1227 data.at[ 1 ] === "bottom" ? 1228 -data.targetHeight : 1229 0, 1230 offset = -2 * data.offset[ 1 ], 1231 newOverTop, 1232 newOverBottom; 1233 if ( overTop < 0 ) { 1234 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 1235 outerHeight - withinOffset; 1236 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { 1237 position.top += myOffset + atOffset + offset; 1238 } 1239 } else if ( overBottom > 0 ) { 1240 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 1241 offset - offsetTop; 1242 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { 1243 position.top += myOffset + atOffset + offset; 1244 } 1245 } 1246 } 1247 }, 1248 flipfit: { 1249 left: function() { 1250 $.ui.position.flip.left.apply( this, arguments ); 1251 $.ui.position.fit.left.apply( this, arguments ); 1252 }, 1253 top: function() { 1254 $.ui.position.flip.top.apply( this, arguments ); 1255 $.ui.position.fit.top.apply( this, arguments ); 1256 } 1257 } 1258}; 1259 1260} )(); 1261 1262var position = $.ui.position; 1263 1264 1265/*! 1266 * jQuery UI :data 1.1
12664.0 1267 * https://jqueryui.com 1268 * 1269 * Copyright OpenJS Foundation and other contributors 1270 * Released under the MIT license. 1271 * https://jquery.org/license 1272 */ 1273 1274//>>label: :data Selector
vendor: 15,242 bytes, lines 1275-1889
1275//>>group: Core 1276//>>description: Selects elements which have data stored under the specified key. 1277//>>docs: https://api.jqueryui.com/data-selector/ 1278 1279 1280var data = $.extend( $.expr.pseudos, { 1281 data: $.expr.createPseudo( function( dataName ) { 1282 return function( elem ) { 1283 return !!$.data( elem, dataName ); 1284 }; 1285 } ) 1286} ); 1287 1288/*! 1289 * jQuery UI Disable Selection 1.14.0 1290 * https://jqueryui.com 1291 * 1292 * Copyright OpenJS Foundation and other contributors 1293 * Released under the MIT license. 1294 * https://jquery.org/license 1295 */ 1296 1297//>>label: disableSelection 1298//>>group: Core 1299//>>description: Disable selection of text content within the set of matched elements. 1300//>>docs: https://api.jqueryui.com/disableSelection/ 1301 1302// This file is deprecated 1303 1304var disableSelection = $.fn.extend( { 1305 disableSelection: ( function() { 1306 var eventType = "onselectstart" in document.createElement( "div" ) ? 1307 "selectstart" : 1308 "mousedown"; 1309 1310 return function() { 1311 return this.on( eventType + ".ui-disableSelection", function( event ) { 1312 event.preventDefault(); 1313 } ); 1314 }; 1315 } )(), 1316 1317 enableSelection: function() { 1318 return this.off( ".ui-disableSelection" ); 1319 } 1320} ); 1321 1322 1323/*! 1324 * jQuery UI Focusable 1.14.0 1325 * https://jqueryui.com 1326 * 1327 * Copyright OpenJS Foundation and other contributors 1328 * Released under the MIT license. 1329 * https://jquery.org/license 1330 */ 1331 1332//>>label: :focusable Selector 1333//>>group: Core 1334//>>description: Selects elements which can be focused. 1335//>>docs: https://api.jqueryui.com/focusable-selector/ 1336 1337 1338// Selectors 1339$.ui.focusable = function( element, hasTabindex ) { 1340 var map, mapName, img, focusableIfVisible, fieldset, 1341 nodeName = element.nodeName.toLowerCase(); 1342 1343 if ( "area" === nodeName ) { 1344 map = element.parentNode; 1345 mapName = map.name; 1346 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 1347 return false; 1348 } 1349 img = $( "img[usemap='#" + mapName + "']" ); 1350 return img.length > 0 && img.is( ":visible" ); 1351 } 1352 1353 if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) { 1354 focusableIfVisible = !element.disabled; 1355 1356 if ( focusableIfVisible ) { 1357 1358 // Form controls within a disabled fieldset are disabled. 1359 // However, controls within the fieldset's legend do not get disabled. 1360 // Since controls generally aren't placed inside legends, we skip 1361 // this portion of the check. 1362 fieldset = $( element ).closest( "fieldset" )[ 0 ]; 1363 if ( fieldset ) { 1364 focusableIfVisible = !fieldset.disabled; 1365 } 1366 } 1367 } else if ( "a" === nodeName ) { 1368 focusableIfVisible = element.href || hasTabindex; 1369 } else { 1370 focusableIfVisible = hasTabindex; 1371 } 1372 1373 return focusableIfVisible && $( element ).is( ":visible" ) && 1374 $( element ).css( "visibility" ) === "visible"; 1375}; 1376 1377$.extend( $.expr.pseudos, { 1378 focusable: function( element ) { 1379 return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); 1380 } 1381} ); 1382 1383var focusable = $.ui.focusable; 1384 1385 1386/*! 1387 * jQuery UI Form Reset Mixin 1.14.0 1388 * https://jqueryui.com 1389 * 1390 * Copyright OpenJS Foundation and other contributors 1391 * Released under the MIT license. 1392 * https://jquery.org/license 1393 */ 1394 1395//>>label: Form Reset Mixin 1396//>>group: Core 1397//>>description: Refresh input widgets when their form is reset 1398//>>docs: https://api.jqueryui.com/form-reset-mixin/ 1399 1400 1401var formResetMixin = $.ui.formResetMixin = { 1402 _formResetHandler: function() { 1403 var form = $( this ); 1404 1405 // Wait for the form reset to actually happen before refreshing 1406 setTimeout( function() { 1407 var instances = form.data( "ui-form-reset-instances" ); 1408 $.each( instances, function() { 1409 this.refresh(); 1410 } ); 1411 } ); 1412 }, 1413 1414 _bindFormResetHandler: function() { 1415 this.form = $( this.element.prop( "form" ) ); 1416 if ( !this.form.length ) { 1417 return; 1418 } 1419 1420 var instances = this.form.data( "ui-form-reset-instances" ) || []; 1421 if ( !instances.length ) { 1422 1423 // We don't use _on() here because we use a single event handler per form 1424 this.form.on( "reset.ui-form-reset", this._formResetHandler ); 1425 } 1426 instances.push( this ); 1427 this.form.data( "ui-form-reset-instances", instances ); 1428 }, 1429 1430 _unbindFormResetHandler: function() { 1431 if ( !this.form.length ) { 1432 return; 1433 } 1434 1435 var instances = this.form.data( "ui-form-reset-instances" ); 1436 instances.splice( $.inArray( this, instances ), 1 ); 1437 if ( instances.length ) { 1438 this.form.data( "ui-form-reset-instances", instances ); 1439 } else { 1440 this.form 1441 .removeData( "ui-form-reset-instances" ) 1442 .off( "reset.ui-form-reset" ); 1443 } 1444 } 1445}; 1446 1447 1448/*! 1449 * jQuery UI Keycode 1.14.0 1450 * https://jqueryui.com 1451 * 1452 * Copyright OpenJS Foundation and other contributors 1453 * Released under the MIT license. 1454 * https://jquery.org/license 1455 */ 1456 1457//>>label: Keycode 1458//>>group: Core 1459//>>description: Provide keycodes as keynames 1460//>>docs: https://api.jqueryui.com/jQuery.ui.keyCode/ 1461 1462 1463var keycode = $.ui.keyCode = { 1464 BACKSPACE: 8, 1465 COMMA: 188, 1466 DELETE: 46, 1467 DOWN: 40, 1468 END: 35, 1469 ENTER: 13, 1470 ESCAPE: 27, 1471 HOME: 36, 1472 LEFT: 37, 1473 PAGE_DOWN: 34, 1474 PAGE_UP: 33, 1475 PERIOD: 190, 1476 RIGHT: 39, 1477 SPACE: 32, 1478 TAB: 9, 1479 UP: 38 1480}; 1481 1482 1483/*! 1484 * jQuery UI Labels 1.14.0 1485 * https://jqueryui.com 1486 * 1487 * Copyright OpenJS Foundation and other contributors 1488 * Released under the MIT license. 1489 * https://jquery.org/license 1490 */ 1491 1492//>>label: labels 1493//>>group: Core 1494//>>description: Find all the labels associated with a given input 1495//>>docs: https://api.jqueryui.com/labels/ 1496 1497 1498var labels = $.fn.labels = function() { 1499 var ancestor, selector, id, labels, ancestors; 1500 1501 if ( !this.length ) { 1502 return this.pushStack( [] ); 1503 } 1504 1505 // Check control.labels first 1506 if ( this[ 0 ].labels && this[ 0 ].labels.length ) { 1507 return this.pushStack( this[ 0 ].labels ); 1508 } 1509 1510 // If `control.labels` is empty - e.g. inside of document fragments - find 1511 // the labels manually 1512 labels = this.eq( 0 ).parents( "label" ); 1513 1514 // Look for the label based on the id 1515 id = this.attr( "id" ); 1516 if ( id ) { 1517 1518 // We don't search against the document in case the element 1519 // is disconnected from the DOM 1520 ancestor = this.eq( 0 ).parents().last(); 1521 1522 // Get a full set of top level ancestors 1523 ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); 1524 1525 // Create a selector for the label based on the id 1526 selector = "label[for='" + CSS.escape( id ) + "']"; 1527 1528 labels = labels.add( ancestors.find( selector ).addBack( selector ) ); 1529 1530 } 1531 1532 // Return whatever we have found for labels 1533 return this.pushStack( labels ); 1534}; 1535 1536 1537/*! 1538 * jQuery UI Scroll Parent 1.14.0 1539 * https://jqueryui.com 1540 * 1541 * Copyright OpenJS Foundation and other contributors 1542 * Released under the MIT license. 1543 * https://jquery.org/license 1544 */ 1545 1546//>>label: scrollParent 1547//>>group: Core 1548//>>description: Get the closest ancestor element that is scrollable. 1549//>>docs: https://api.jqueryui.com/scrollParent/ 1550 1551 1552var scrollParent = $.fn.scrollParent = function( includeHidden ) { 1553 var position = this.css( "position" ), 1554 excludeStaticParent = position === "absolute", 1555 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 1556 scrollParent = this.parents().filter( function() { 1557 var parent = $( this ); 1558 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 1559 return false; 1560 } 1561 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + 1562 parent.css( "overflow-x" ) ); 1563 } ).eq( 0 ); 1564 1565 return position === "fixed" || !scrollParent.length ? 1566 $( this[ 0 ].ownerDocument || document ) : 1567 scrollParent; 1568}; 1569 1570 1571/*! 1572 * jQuery UI Tabbable 1.14.0 1573 * https://jqueryui.com 1574 * 1575 * Copyright OpenJS Foundation and other contributors 1576 * Released under the MIT license. 1577 * https://jquery.org/license 1578 */ 1579 1580//>>label: :tabbable Selector 1581//>>group: Core 1582//>>description: Selects elements which can be tabbed to. 1583//>>docs: https://api.jqueryui.com/tabbable-selector/ 1584 1585 1586var tabbable = $.extend( $.expr.pseudos, { 1587 tabbable: function( element ) { 1588 var tabIndex = $.attr( element, "tabindex" ), 1589 hasTabindex = tabIndex != null; 1590 return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); 1591 } 1592} ); 1593 1594 1595/*! 1596 * jQuery UI Unique ID 1.14.0 1597 * https://jqueryui.com 1598 * 1599 * Copyright OpenJS Foundation and other contributors 1600 * Released under the MIT license. 1601 * https://jquery.org/license 1602 */ 1603 1604//>>label: uniqueId 1605//>>group: Core 1606//>>description: Functions to generate and remove uniqueId's 1607//>>docs: https://api.jqueryui.com/uniqueId/ 1608 1609 1610var uniqueId = $.fn.extend( { 1611 uniqueId: ( function() { 1612 var uuid = 0; 1613 1614 return function() { 1615 return this.each( function() { 1616 if ( !this.id ) { 1617 this.id = "ui-id-" + ( ++uuid ); 1618 } 1619 } ); 1620 }; 1621 } )(), 1622 1623 removeUniqueId: function() { 1624 return this.each( function() { 1625 if ( /^ui-id-\d+$/.test( this.id ) ) { 1626 $( this ).removeAttr( "id" ); 1627 } 1628 } ); 1629 } 1630} ); 1631 1632 1633/*! 1634 * jQuery UI Mouse 1.14.0 1635 * https://jqueryui.com 1636 * 1637 * Copyright OpenJS Foundation and other contributors 1638 * Released under the MIT license. 1639 * https://jquery.org/license 1640 */ 1641 1642//>>label: Mouse 1643//>>group: Widgets 1644//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 1645//>>docs: https://api.jqueryui.com/mouse/ 1646 1647 1648var mouseHandled = false; 1649$( document ).on( "mouseup", function() { 1650 mouseHandled = false; 1651} ); 1652 1653var widgetsMouse = $.widget( "ui.mouse", { 1654 version: "1.14.0", 1655 options: { 1656 cancel: "input, textarea, button, select, option", 1657 distance: 1, 1658 delay: 0 1659 }, 1660 _mouseInit: function() { 1661 var that = this; 1662 1663 this.element 1664 .on( "mousedown." + this.widgetName, function( event ) { 1665 return that._mouseDown( event ); 1666 } ) 1667 .on( "click." + this.widgetName, function( event ) { 1668 if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { 1669 $.removeData( event.target, that.widgetName + ".preventClickEvent" ); 1670 event.stopImmediatePropagation(); 1671 return false; 1672 } 1673 } ); 1674 1675 this.started = false; 1676 }, 1677 1678 // TODO: make sure destroying one instance of mouse doesn't mess with 1679 // other instances of mouse 1680 _mouseDestroy: function() { 1681 this.element.off( "." + this.widgetName ); 1682 if ( this._mouseMoveDelegate ) { 1683 this.document 1684 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1685 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1686 } 1687 }, 1688 1689 _mouseDown: function( event ) { 1690 1691 // don't let more than one widget handle mouseStart 1692 if ( mouseHandled ) { 1693 return; 1694 } 1695 1696 this._mouseMoved = false; 1697 1698 // We may have missed mouseup (out of window) 1699 if ( this._mouseStarted ) { 1700 this._mouseUp( event ); 1701 } 1702 1703 this._mouseDownEvent = event; 1704 1705 var that = this, 1706 btnIsLeft = event.which === 1, 1707 elIsCancel = typeof this.options.cancel === "string" ? 1708 $( event.target ).closest( this.options.cancel ).length : 1709 false; 1710 if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { 1711 return true; 1712 } 1713 1714 this.mouseDelayMet = !this.options.delay; 1715 if ( !this.mouseDelayMet ) { 1716 this._mouseDelayTimer = setTimeout( function() { 1717 that.mouseDelayMet = true; 1718 }, this.options.delay ); 1719 } 1720 1721 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 1722 this._mouseStarted = ( this._mouseStart( event ) !== false ); 1723 if ( !this._mouseStarted ) { 1724 event.preventDefault(); 1725 return true; 1726 } 1727 } 1728 1729 // Click event may never have fired (Gecko & Opera) 1730 if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { 1731 $.removeData( event.target, this.widgetName + ".preventClickEvent" ); 1732 } 1733 1734 // These delegates are required to keep context 1735 this._mouseMoveDelegate = function( event ) { 1736 return that._mouseMove( event ); 1737 }; 1738 this._mouseUpDelegate = function( event ) { 1739 return that._mouseUp( event ); 1740 }; 1741 1742 this.document 1743 .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1744 .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1745 1746 event.preventDefault(); 1747 1748 mouseHandled = true; 1749 return true; 1750 }, 1751 1752 _mouseMove: function( event ) { 1753 1754 // Only check for mouseups outside the document if you've moved inside the document 1755 // at least once. 1756 if ( this._mouseMoved && !event.which ) { 1757 1758 // Support: Safari <=8 - 9 1759 // Safari sets which to 0 if you press any of the following keys 1760 // during a drag (#14461) 1761 if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || 1762 event.originalEvent.metaKey || event.originalEvent.shiftKey ) { 1763 this.ignoreMissingWhich = true; 1764 } else if ( !this.ignoreMissingWhich ) { 1765 return this._mouseUp( event ); 1766 } 1767 } 1768 1769 if ( event.which || event.button ) { 1770 this._mouseMoved = true; 1771 } 1772 1773 if ( this._mouseStarted ) { 1774 this._mouseDrag( event ); 1775 return event.preventDefault(); 1776 } 1777 1778 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 1779 this._mouseStarted = 1780 ( this._mouseStart( this._mouseDownEvent, event ) !== false ); 1781 if ( this._mouseStarted ) { 1782 this._mouseDrag( event ); 1783 } else { 1784 this._mouseUp( event ); 1785 } 1786 } 1787 1788 return !this._mouseStarted; 1789 }, 1790 1791 _mouseUp: function( event ) { 1792 this.document 1793 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1794 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1795 1796 if ( this._mouseStarted ) { 1797 this._mouseStarted = false; 1798 1799 if ( event.target === this._mouseDownEvent.target ) { 1800 $.data( event.target, this.widgetName + ".preventClickEvent", true ); 1801 } 1802 1803 this._mouseStop( event ); 1804 } 1805 1806 if ( this._mouseDelayTimer ) { 1807 clearTimeout( this._mouseDelayTimer ); 1808 delete this._mouseDelayTimer; 1809 } 1810 1811 this.ignoreMissingWhich = false; 1812 mouseHandled = false; 1813 event.preventDefault(); 1814 }, 1815 1816 _mouseDistanceMet: function( event ) { 1817 return ( Math.max( 1818 Math.abs( this._mouseDownEvent.pageX - event.pageX ), 1819 Math.abs( this._mouseDownEvent.pageY - event.pageY ) 1820 ) >= this.options.distance 1821 ); 1822 }, 1823 1824 _mouseDelayMet: function( /* event */ ) { 1825 return this.mouseDelayMet; 1826 }, 1827 1828 // These are placeholder methods, to be overriden by extending plugin 1829 _mouseStart: function( /* event */ ) {}, 1830 _mouseDrag: function( /* event */ ) {}, 1831 _mouseStop: function( /* event */ ) {}, 1832 _mouseCapture: function( /* event */ ) { 1833 return true; 1834 } 1835} ); 1836 1837 1838 1839// $.ui.plugin is deprecated. Use $.widget() extensions instead. 1840var plugin = $.ui.plugin = { 1841 add: function( module, option, set ) { 1842 var i, 1843 proto = $.ui[ module ].prototype; 1844 for ( i in set ) { 1845 proto.plugins[ i ] = proto.plugins[ i ] || []; 1846 proto.plugins[ i ].push( [ option, set[ i ] ] ); 1847 } 1848 }, 1849 call: function( instance, name, args, allowDisconnected ) { 1850 var i, 1851 set = instance.plugins[ name ]; 1852 1853 if ( !set ) { 1854 return; 1855 } 1856 1857 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || 1858 instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 1859 return; 1860 } 1861 1862 for ( i = 0; i < set.length; i++ ) { 1863 if ( instance.options[ set[ i ][ 0 ] ] ) { 1864 set[ i ][ 1 ].apply( instance.element, args ); 1865 } 1866 } 1867 } 1868}; 1869 1870 1871/*! 1872 * jQuery UI Draggable 1.14.0 1873 * https://jqueryui.com 1874 * 1875 * Copyright OpenJS Foundation and other contributors 1876 * Released under the MIT license. 1877 * https://jquery.org/license 1878 */ 1879 1880//>>label: Draggable 1881//>>group: Interactions 1882//>>description: Enables dragging functionality for any element. 1883//>>docs: https://api.jqueryui.com/draggable/ 1884//>>demos: https://jqueryui.com/draggable/ 1885//>>css.structure: ../../themes/base/draggable.css 1886 1887 1888$.widget( "ui.draggable", $.ui.mouse, { 1889 version: "1.14.0
vendor: 13,254 bytes, lines 1889-2382
1889", 1890 widgetEventPrefix: "drag", 1891 options: { 1892 addClasses: true, 1893 appendTo: "parent", 1894 axis: false, 1895 connectToSortable: false, 1896 containment: false, 1897 cursor: "auto", 1898 cursorAt: false, 1899 grid: false, 1900 handle: false, 1901 helper: "original", 1902 iframeFix: false, 1903 opacity: false, 1904 refreshPositions: false, 1905 revert: false, 1906 revertDuration: 500, 1907 scope: "default", 1908 scroll: true, 1909 scrollSensitivity: 20, 1910 scrollSpeed: 20, 1911 snap: false, 1912 snapMode: "both", 1913 snapTolerance: 20, 1914 stack: false, 1915 zIndex: false, 1916 1917 // Callbacks 1918 drag: null, 1919 start: null, 1920 stop: null 1921 }, 1922 _create: function() { 1923 1924 if ( this.options.helper === "original" ) { 1925 this._setPositionRelative(); 1926 } 1927 if ( this.options.addClasses ) { 1928 this._addClass( "ui-draggable" ); 1929 } 1930 this._setHandleClassName(); 1931 1932 this._mouseInit(); 1933 }, 1934 1935 _setOption: function( key, value ) { 1936 this._super( key, value ); 1937 if ( key === "handle" ) { 1938 this._removeHandleClassName(); 1939 this._setHandleClassName(); 1940 } 1941 }, 1942 1943 _destroy: function() { 1944 if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { 1945 this.destroyOnClear = true; 1946 return; 1947 } 1948 this._removeHandleClassName(); 1949 this._mouseDestroy(); 1950 }, 1951 1952 _mouseCapture: function( event ) { 1953 var o = this.options; 1954 1955 // Among others, prevent a drag on a resizable-handle 1956 if ( this.helper || o.disabled || 1957 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { 1958 return false; 1959 } 1960 1961 //Quit if we're not on a valid handle 1962 this.handle = this._getHandle( event ); 1963 if ( !this.handle ) { 1964 return false; 1965 } 1966 1967 this._blurActiveElement( event ); 1968 1969 this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); 1970 1971 return true; 1972 1973 }, 1974 1975 _blockFrames: function( selector ) { 1976 this.iframeBlocks = this.document.find( selector ).map( function() { 1977 var iframe = $( this ); 1978 1979 return $( "<div>" ) 1980 .css( "position", "absolute" ) 1981 .appendTo( iframe.parent() ) 1982 .outerWidth( iframe.outerWidth() ) 1983 .outerHeight( iframe.outerHeight() ) 1984 .offset( iframe.offset() )[ 0 ]; 1985 } ); 1986 }, 1987 1988 _unblockFrames: function() { 1989 if ( this.iframeBlocks ) { 1990 this.iframeBlocks.remove(); 1991 delete this.iframeBlocks; 1992 } 1993 }, 1994 1995 _blurActiveElement: function( event ) { 1996 var activeElement = this.document[ 0 ].activeElement, 1997 target = $( event.target ); 1998 1999 // Don't blur if the event occurred on an element that is within 2000 // the currently focused element 2001 // See #10527, #12472 2002 if ( target.closest( activeElement ).length ) { 2003 return; 2004 } 2005 2006 // Blur any element that currently has focus, see #4261 2007 $( activeElement ).trigger( "blur" ); 2008 }, 2009 2010 _mouseStart: function( event ) { 2011 2012 var o = this.options; 2013 2014 //Create and append the visible helper 2015 this.helper = this._createHelper( event ); 2016 2017 this._addClass( this.helper, "ui-draggable-dragging" ); 2018 2019 //Cache the helper size 2020 this._cacheHelperProportions(); 2021 2022 //If ddmanager is used for droppables, set the global draggable 2023 if ( $.ui.ddmanager ) { 2024 $.ui.ddmanager.current = this; 2025 } 2026 2027 /* 2028 * - Position generation - 2029 * This block generates everything position related - it's the core of draggables. 2030 */ 2031 2032 //Cache the margins of the original element 2033 this._cacheMargins(); 2034 2035 //Store the helper's css position 2036 this.cssPosition = this.helper.css( "position" ); 2037 this.scrollParent = this.helper.scrollParent( true ); 2038 this.offsetParent = this.helper.offsetParent(); 2039 this.hasFixedAncestor = this.helper.parents().filter( function() { 2040 return $( this ).css( "position" ) === "fixed"; 2041 } ).length > 0; 2042 2043 //The element's absolute position on the page minus margins 2044 this.positionAbs = this.element.offset(); 2045 this._refreshOffsets( event ); 2046 2047 //Generate the original position 2048 this.originalPosition = this.position = this._generatePosition( event, false ); 2049 this.originalPageX = event.pageX; 2050 this.originalPageY = event.pageY; 2051 2052 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 2053 if ( o.cursorAt ) { 2054 this._adjustOffsetFromHelper( o.cursorAt ); 2055 } 2056 2057 //Set a containment if given in the options 2058 this._setContainment(); 2059 2060 //Trigger event + callbacks 2061 if ( this._trigger( "start", event ) === false ) { 2062 this._clear(); 2063 return false; 2064 } 2065 2066 //Recache the helper size 2067 this._cacheHelperProportions(); 2068 2069 //Prepare the droppable offsets 2070 if ( $.ui.ddmanager && !o.dropBehaviour ) { 2071 $.ui.ddmanager.prepareOffsets( this, event ); 2072 } 2073 2074 // Execute the drag once - this causes the helper not to be visible before getting its 2075 // correct position 2076 this._mouseDrag( event, true ); 2077 2078 // If the ddmanager is used for droppables, inform the manager that dragging has started 2079 // (see #5003) 2080 if ( $.ui.ddmanager ) { 2081 $.ui.ddmanager.dragStart( this, event ); 2082 } 2083 2084 return true; 2085 }, 2086 2087 _refreshOffsets: function( event ) { 2088 this.offset = { 2089 top: this.positionAbs.top - this.margins.top, 2090 left: this.positionAbs.left - this.margins.left, 2091 scroll: false, 2092 parent: this._getParentOffset(), 2093 relative: this._getRelativeOffset() 2094 }; 2095 2096 this.offset.click = { 2097 left: event.pageX - this.offset.left, 2098 top: event.pageY - this.offset.top 2099 }; 2100 }, 2101 2102 _mouseDrag: function( event, noPropagation ) { 2103 2104 // reset any necessary cached properties (see #5009) 2105 if ( this.hasFixedAncestor ) { 2106 this.offset.parent = this._getParentOffset(); 2107 } 2108 2109 //Compute the helpers position 2110 this.position = this._generatePosition( event, true ); 2111 this.positionAbs = this._convertPositionTo( "absolute" ); 2112 2113 //Call plugins and callbacks and use the resulting position if something is returned 2114 if ( !noPropagation ) { 2115 var ui = this._uiHash(); 2116 if ( this._trigger( "drag", event, ui ) === false ) { 2117 this._mouseUp( new $.Event( "mouseup", event ) ); 2118 return false; 2119 } 2120 this.position = ui.position; 2121 } 2122 2123 this.helper[ 0 ].style.left = this.position.left + "px"; 2124 this.helper[ 0 ].style.top = this.position.top + "px"; 2125 2126 if ( $.ui.ddmanager ) { 2127 $.ui.ddmanager.drag( this, event ); 2128 } 2129 2130 return false; 2131 }, 2132 2133 _mouseStop: function( event ) { 2134 2135 //If we are using droppables, inform the manager about the drop 2136 var that = this, 2137 dropped = false; 2138 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 2139 dropped = $.ui.ddmanager.drop( this, event ); 2140 } 2141 2142 //if a drop comes from outside (a sortable) 2143 if ( this.dropped ) { 2144 dropped = this.dropped; 2145 this.dropped = false; 2146 } 2147 2148 if ( ( this.options.revert === "invalid" && !dropped ) || 2149 ( this.options.revert === "valid" && dropped ) || 2150 this.options.revert === true || ( typeof this.options.revert === "function" && 2151 this.options.revert.call( this.element, dropped ) ) 2152 ) { 2153 $( this.helper ).animate( 2154 this.originalPosition, 2155 parseInt( this.options.revertDuration, 10 ), 2156 function() { 2157 if ( that._trigger( "stop", event ) !== false ) { 2158 that._clear(); 2159 } 2160 } 2161 ); 2162 } else { 2163 if ( this._trigger( "stop", event ) !== false ) { 2164 this._clear(); 2165 } 2166 } 2167 2168 return false; 2169 }, 2170 2171 _mouseUp: function( event ) { 2172 this._unblockFrames(); 2173 2174 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 2175 // (see #5003) 2176 if ( $.ui.ddmanager ) { 2177 $.ui.ddmanager.dragStop( this, event ); 2178 } 2179 2180 // Only need to focus if the event occurred on the draggable itself, see #10527 2181 if ( this.handleElement.is( event.target ) ) { 2182 2183 // The interaction is over; whether or not the click resulted in a drag, 2184 // focus the element 2185 this.element.trigger( "focus" ); 2186 } 2187 2188 return $.ui.mouse.prototype._mouseUp.call( this, event ); 2189 }, 2190 2191 cancel: function() { 2192 2193 if ( this.helper.is( ".ui-draggable-dragging" ) ) { 2194 this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); 2195 } else { 2196 this._clear(); 2197 } 2198 2199 return this; 2200 2201 }, 2202 2203 _getHandle: function( event ) { 2204 return this.options.handle ? 2205 !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 2206 true; 2207 }, 2208 2209 _setHandleClassName: function() { 2210 this.handleElement = this.options.handle ? 2211 this.element.find( this.options.handle ) : this.element; 2212 this._addClass( this.handleElement, "ui-draggable-handle" ); 2213 }, 2214 2215 _removeHandleClassName: function() { 2216 this._removeClass( this.handleElement, "ui-draggable-handle" ); 2217 }, 2218 2219 _createHelper: function( event ) { 2220 2221 var o = this.options, 2222 helperIsFunction = typeof o.helper === "function", 2223 helper = helperIsFunction ? 2224 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : 2225 ( o.helper === "clone" ? 2226 this.element.clone().removeAttr( "id" ) : 2227 this.element ); 2228 2229 if ( !helper.parents( "body" ).length ) { 2230 helper.appendTo( ( o.appendTo === "parent" ? 2231 this.element[ 0 ].parentNode : 2232 o.appendTo ) ); 2233 } 2234 2235 // https://bugs.jqueryui.com/ticket/9446 2236 // a helper function can return the original element 2237 // which wouldn't have been set to relative in _create 2238 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { 2239 this._setPositionRelative(); 2240 } 2241 2242 if ( helper[ 0 ] !== this.element[ 0 ] && 2243 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { 2244 helper.css( "position", "absolute" ); 2245 } 2246 2247 return helper; 2248 2249 }, 2250 2251 _setPositionRelative: function() { 2252 if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { 2253 this.element[ 0 ].style.position = "relative"; 2254 } 2255 }, 2256 2257 _adjustOffsetFromHelper: function( obj ) { 2258 if ( typeof obj === "string" ) { 2259 obj = obj.split( " " ); 2260 } 2261 if ( Array.isArray( obj ) ) { 2262 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 2263 } 2264 if ( "left" in obj ) { 2265 this.offset.click.left = obj.left + this.margins.left; 2266 } 2267 if ( "right" in obj ) { 2268 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 2269 } 2270 if ( "top" in obj ) { 2271 this.offset.click.top = obj.top + this.margins.top; 2272 } 2273 if ( "bottom" in obj ) { 2274 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 2275 } 2276 }, 2277 2278 _isRootNode: function( element ) { 2279 return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; 2280 }, 2281 2282 _getParentOffset: function() { 2283 2284 //Get the offsetParent and cache its position 2285 var po = this.offsetParent.offset(), 2286 document = this.document[ 0 ]; 2287 2288 // This is a special case where we need to modify a offset calculated on start, since the 2289 // following happened: 2290 // 1. The position of the helper is absolute, so it's position is calculated based on the 2291 // next positioned parent 2292 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 2293 // the document, which means that the scroll is included in the initial calculation of the 2294 // offset of the parent, and never recalculated upon drag 2295 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && 2296 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 2297 po.left += this.scrollParent.scrollLeft(); 2298 po.top += this.scrollParent.scrollTop(); 2299 } 2300 2301 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { 2302 po = { top: 0, left: 0 }; 2303 } 2304 2305 return { 2306 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 2307 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 2308 }; 2309 2310 }, 2311 2312 _getRelativeOffset: function() { 2313 if ( this.cssPosition !== "relative" ) { 2314 return { top: 0, left: 0 }; 2315 } 2316 2317 var p = this.element.position(), 2318 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 2319 2320 return { 2321 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 2322 ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), 2323 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 2324 ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) 2325 }; 2326 2327 }, 2328 2329 _cacheMargins: function() { 2330 this.margins = { 2331 left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), 2332 top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), 2333 right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), 2334 bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) 2335 }; 2336 }, 2337 2338 _cacheHelperProportions: function() { 2339 this.helperProportions = { 2340 width: this.helper.outerWidth(), 2341 height: this.helper.outerHeight() 2342 }; 2343 }, 2344 2345 _setContainment: function() { 2346 2347 var isUserScrollable, c, ce, 2348 o = this.options, 2349 document = this.document[ 0 ]; 2350 2351 this.relativeContainer = null; 2352 2353 if ( !o.containment ) { 2354 this.containment = null; 2355 return; 2356 } 2357 2358 if ( o.containment === "window" ) { 2359 this.containment = [ 2360 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 2361 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 2362 $( window ).scrollLeft() + $( window ).width() - 2363 this.helperProportions.width - this.margins.left, 2364 $( window ).scrollTop() + 2365 ( $( window ).height() || document.body.parentNode.scrollHeight ) - 2366 this.helperProportions.height - this.margins.top 2367 ]; 2368 return; 2369 } 2370 2371 if ( o.containment === "document" ) { 2372 this.containment = [ 2373 0, 2374 0, 2375 $( document ).width() - this.helperProportions.width - this.margins.left, 2376 ( $( document ).height() || document.body.parentNode.scrollHeight ) - 2377 this.helperProportions.height - this.margins.top 2378 ]; 2379 return; 2380 } 2381 2382 if ( o.containment.constructor === Array ) {
vendor: 10,369 bytes, lines 2383-2729
2383 this.containment = o.containment; 2384 return; 2385 } 2386 2387 if ( o.containment === "parent" ) { 2388 o.containment = this.helper[ 0 ].parentNode; 2389 } 2390 2391 c = $( o.containment ); 2392 ce = c[ 0 ]; 2393 2394 if ( !ce ) { 2395 return; 2396 } 2397 2398 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); 2399 2400 this.containment = [ 2401 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + 2402 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 2403 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + 2404 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), 2405 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 2406 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - 2407 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - 2408 this.helperProportions.width - 2409 this.margins.left - 2410 this.margins.right, 2411 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 2412 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - 2413 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - 2414 this.helperProportions.height - 2415 this.margins.top - 2416 this.margins.bottom 2417 ]; 2418 this.relativeContainer = c; 2419 }, 2420 2421 _convertPositionTo: function( d, pos ) { 2422 2423 if ( !pos ) { 2424 pos = this.position; 2425 } 2426 2427 var mod = d === "absolute" ? 1 : -1, 2428 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 2429 2430 return { 2431 top: ( 2432 2433 // The absolute mouse position 2434 pos.top + 2435 2436 // Only for relative positioned nodes: Relative offset from element to offset parent 2437 this.offset.relative.top * mod + 2438 2439 // The offsetParent's offset without borders (offset + border) 2440 this.offset.parent.top * mod - 2441 ( ( this.cssPosition === "fixed" ? 2442 -this.offset.scroll.top : 2443 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) 2444 ), 2445 left: ( 2446 2447 // The absolute mouse position 2448 pos.left + 2449 2450 // Only for relative positioned nodes: Relative offset from element to offset parent 2451 this.offset.relative.left * mod + 2452 2453 // The offsetParent's offset without borders (offset + border) 2454 this.offset.parent.left * mod - 2455 ( ( this.cssPosition === "fixed" ? 2456 -this.offset.scroll.left : 2457 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) 2458 ) 2459 }; 2460 2461 }, 2462 2463 _generatePosition: function( event, constrainPosition ) { 2464 2465 var containment, co, top, left, 2466 o = this.options, 2467 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), 2468 pageX = event.pageX, 2469 pageY = event.pageY; 2470 2471 // Cache the scroll 2472 if ( !scrollIsRootNode || !this.offset.scroll ) { 2473 this.offset.scroll = { 2474 top: this.scrollParent.scrollTop(), 2475 left: this.scrollParent.scrollLeft() 2476 }; 2477 } 2478 2479 /* 2480 * - Position constraining - 2481 * Constrain the position to a mix of grid, containment. 2482 */ 2483 2484 // If we are not dragging yet, we won't check for options 2485 if ( constrainPosition ) { 2486 if ( this.containment ) { 2487 if ( this.relativeContainer ) { 2488 co = this.relativeContainer.offset(); 2489 containment = [ 2490 this.containment[ 0 ] + co.left, 2491 this.containment[ 1 ] + co.top, 2492 this.containment[ 2 ] + co.left, 2493 this.containment[ 3 ] + co.top 2494 ]; 2495 } else { 2496 containment = this.containment; 2497 } 2498 2499 if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { 2500 pageX = containment[ 0 ] + this.offset.click.left; 2501 } 2502 if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { 2503 pageY = containment[ 1 ] + this.offset.click.top; 2504 } 2505 if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { 2506 pageX = containment[ 2 ] + this.offset.click.left; 2507 } 2508 if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { 2509 pageY = containment[ 3 ] + this.offset.click.top; 2510 } 2511 } 2512 2513 if ( o.grid ) { 2514 2515 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 2516 // argument errors in IE (see ticket #6950) 2517 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - 2518 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; 2519 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || 2520 top - this.offset.click.top > containment[ 3 ] ) ? 2521 top : 2522 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? 2523 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; 2524 2525 left = o.grid[ 0 ] ? this.originalPageX + 2526 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : 2527 this.originalPageX; 2528 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || 2529 left - this.offset.click.left > containment[ 2 ] ) ? 2530 left : 2531 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? 2532 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; 2533 } 2534 2535 if ( o.axis === "y" ) { 2536 pageX = this.originalPageX; 2537 } 2538 2539 if ( o.axis === "x" ) { 2540 pageY = this.originalPageY; 2541 } 2542 } 2543 2544 return { 2545 top: ( 2546 2547 // The absolute mouse position 2548 pageY - 2549 2550 // Click offset (relative to the element) 2551 this.offset.click.top - 2552 2553 // Only for relative positioned nodes: Relative offset from element to offset parent 2554 this.offset.relative.top - 2555 2556 // The offsetParent's offset without borders (offset + border) 2557 this.offset.parent.top + 2558 ( this.cssPosition === "fixed" ? 2559 -this.offset.scroll.top : 2560 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) 2561 ), 2562 left: ( 2563 2564 // The absolute mouse position 2565 pageX - 2566 2567 // Click offset (relative to the element) 2568 this.offset.click.left - 2569 2570 // Only for relative positioned nodes: Relative offset from element to offset parent 2571 this.offset.relative.left - 2572 2573 // The offsetParent's offset without borders (offset + border) 2574 this.offset.parent.left + 2575 ( this.cssPosition === "fixed" ? 2576 -this.offset.scroll.left : 2577 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) 2578 ) 2579 }; 2580 2581 }, 2582 2583 _clear: function() { 2584 this._removeClass( this.helper, "ui-draggable-dragging" ); 2585 if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { 2586 this.helper.remove(); 2587 } 2588 this.helper = null; 2589 this.cancelHelperRemoval = false; 2590 if ( this.destroyOnClear ) { 2591 this.destroy(); 2592 } 2593 }, 2594 2595 // From now on bulk stuff - mainly helpers 2596 2597 _trigger: function( type, event, ui ) { 2598 ui = ui || this._uiHash(); 2599 $.ui.plugin.call( this, type, [ event, ui, this ], true ); 2600 2601 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 2602 if ( /^(drag|start|stop)/.test( type ) ) { 2603 this.positionAbs = this._convertPositionTo( "absolute" ); 2604 ui.offset = this.positionAbs; 2605 } 2606 return $.Widget.prototype._trigger.call( this, type, event, ui ); 2607 }, 2608 2609 plugins: {}, 2610 2611 _uiHash: function() { 2612 return { 2613 helper: this.helper, 2614 position: this.position, 2615 originalPosition: this.originalPosition, 2616 offset: this.positionAbs 2617 }; 2618 } 2619 2620} ); 2621 2622$.ui.plugin.add( "draggable", "connectToSortable", { 2623 start: function( event, ui, draggable ) { 2624 var uiSortable = $.extend( {}, ui, { 2625 item: draggable.element 2626 } ); 2627 2628 draggable.sortables = []; 2629 $( draggable.options.connectToSortable ).each( function() { 2630 var sortable = $( this ).sortable( "instance" ); 2631 2632 if ( sortable && !sortable.options.disabled ) { 2633 draggable.sortables.push( sortable ); 2634 2635 // RefreshPositions is called at drag start to refresh the containerCache 2636 // which is used in drag. This ensures it's initialized and synchronized 2637 // with any changes that might have happened on the page since initialization. 2638 sortable.refreshPositions(); 2639 sortable._trigger( "activate", event, uiSortable ); 2640 } 2641 } ); 2642 }, 2643 stop: function( event, ui, draggable ) { 2644 var uiSortable = $.extend( {}, ui, { 2645 item: draggable.element 2646 } ); 2647 2648 draggable.cancelHelperRemoval = false; 2649 2650 $.each( draggable.sortables, function() { 2651 var sortable = this; 2652 2653 if ( sortable.isOver ) { 2654 sortable.isOver = 0; 2655 2656 // Allow this sortable to handle removing the helper 2657 draggable.cancelHelperRemoval = true; 2658 sortable.cancelHelperRemoval = false; 2659 2660 // Use _storedCSS To restore properties in the sortable, 2661 // as this also handles revert (#9675) since the draggable 2662 // may have modified them in unexpected ways (#8809) 2663 sortable._storedCSS = { 2664 position: sortable.placeholder.css( "position" ), 2665 top: sortable.placeholder.css( "top" ), 2666 left: sortable.placeholder.css( "left" ) 2667 }; 2668 2669 sortable._mouseStop( event ); 2670 2671 // Once drag has ended, the sortable should return to using 2672 // its original helper, not the shared helper from draggable 2673 sortable.options.helper = sortable.options._helper; 2674 } else { 2675 2676 // Prevent this Sortable from removing the helper. 2677 // However, don't set the draggable to remove the helper 2678 // either as another connected Sortable may yet handle the removal. 2679 sortable.cancelHelperRemoval = true; 2680 2681 sortable._trigger( "deactivate", event, uiSortable ); 2682 } 2683 } ); 2684 }, 2685 drag: function( event, ui, draggable ) { 2686 $.each( draggable.sortables, function() { 2687 var innermostIntersecting = false, 2688 sortable = this; 2689 2690 // Copy over variables that sortable's _intersectsWith uses 2691 sortable.positionAbs = draggable.positionAbs; 2692 sortable.helperProportions = draggable.helperProportions; 2693 sortable.offset.click = draggable.offset.click; 2694 2695 if ( sortable._intersectsWith( sortable.containerCache ) ) { 2696 innermostIntersecting = true; 2697 2698 $.each( draggable.sortables, function() { 2699 2700 // Copy over variables that sortable's _intersectsWith uses 2701 this.positionAbs = draggable.positionAbs; 2702 this.helperProportions = draggable.helperProportions; 2703 this.offset.click = draggable.offset.click; 2704 2705 if ( this !== sortable && 2706 this._intersectsWith( this.containerCache ) && 2707 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { 2708 innermostIntersecting = false; 2709 } 2710 2711 return innermostIntersecting; 2712 } ); 2713 } 2714 2715 if ( innermostIntersecting ) { 2716 2717 // If it intersects, we use a little isOver variable and set it once, 2718 // so that the move-in stuff gets fired only once. 2719 if ( !sortable.isOver ) { 2720 sortable.isOver = 1; 2721 2722 // Store draggable's parent in case we need to reappend to it later. 2723 draggable._parent = ui.helper.parent(); 2724 2725 sortable.currentItem = ui.helper 2726 .appendTo( sortable.element ) 2727 .data( "ui-sortable-item", true ); 2728 2729 // Store helper option to later restore it
vendor: 11,051 bytes, lines 2730-3107
2730 sortable.options._helper = sortable.options.helper; 2731 2732 sortable.options.helper = function() { 2733 return ui.helper[ 0 ]; 2734 }; 2735 2736 // Fire the start events of the sortable with our passed browser event, 2737 // and our own helper (so it doesn't create a new one) 2738 event.target = sortable.currentItem[ 0 ]; 2739 sortable._mouseCapture( event, true ); 2740 sortable._mouseStart( event, true, true ); 2741 2742 // Because the browser event is way off the new appended portlet, 2743 // modify necessary variables to reflect the changes 2744 sortable.offset.click.top = draggable.offset.click.top; 2745 sortable.offset.click.left = draggable.offset.click.left; 2746 sortable.offset.parent.left -= draggable.offset.parent.left - 2747 sortable.offset.parent.left; 2748 sortable.offset.parent.top -= draggable.offset.parent.top - 2749 sortable.offset.parent.top; 2750 2751 draggable._trigger( "toSortable", event ); 2752 2753 // Inform draggable that the helper is in a valid drop zone, 2754 // used solely in the revert option to handle "valid/invalid". 2755 draggable.dropped = sortable.element; 2756 2757 // Need to refreshPositions of all sortables in the case that 2758 // adding to one sortable changes the location of the other sortables (#9675) 2759 $.each( draggable.sortables, function() { 2760 this.refreshPositions(); 2761 } ); 2762 2763 // Hack so receive/update callbacks work (mostly) 2764 draggable.currentItem = draggable.element; 2765 sortable.fromOutside = draggable; 2766 } 2767 2768 if ( sortable.currentItem ) { 2769 sortable._mouseDrag( event ); 2770 2771 // Copy the sortable's position because the draggable's can potentially reflect 2772 // a relative position, while sortable is always absolute, which the dragged 2773 // element has now become. (#8809) 2774 ui.position = sortable.position; 2775 } 2776 } else { 2777 2778 // If it doesn't intersect with the sortable, and it intersected before, 2779 // we fake the drag stop of the sortable, but make sure it doesn't remove 2780 // the helper by using cancelHelperRemoval. 2781 if ( sortable.isOver ) { 2782 2783 sortable.isOver = 0; 2784 sortable.cancelHelperRemoval = true; 2785 2786 // Calling sortable's mouseStop would trigger a revert, 2787 // so revert must be temporarily false until after mouseStop is called. 2788 sortable.options._revert = sortable.options.revert; 2789 sortable.options.revert = false; 2790 2791 sortable._trigger( "out", event, sortable._uiHash( sortable ) ); 2792 sortable._mouseStop( event, true ); 2793 2794 // Restore sortable behaviors that were modfied 2795 // when the draggable entered the sortable area (#9481) 2796 sortable.options.revert = sortable.options._revert; 2797 sortable.options.helper = sortable.options._helper; 2798 2799 if ( sortable.placeholder ) { 2800 sortable.placeholder.remove(); 2801 } 2802 2803 // Restore and recalculate the draggable's offset considering the sortable 2804 // may have modified them in unexpected ways. (#8809, #10669) 2805 ui.helper.appendTo( draggable._parent ); 2806 draggable._refreshOffsets( event ); 2807 ui.position = draggable._generatePosition( event, true ); 2808 2809 draggable._trigger( "fromSortable", event ); 2810 2811 // Inform draggable that the helper is no longer in a valid drop zone 2812 draggable.dropped = false; 2813 2814 // Need to refreshPositions of all sortables just in case removing 2815 // from one sortable changes the location of other sortables (#9675) 2816 $.each( draggable.sortables, function() { 2817 this.refreshPositions(); 2818 } ); 2819 } 2820 } 2821 } ); 2822 } 2823} ); 2824 2825$.ui.plugin.add( "draggable", "cursor", { 2826 start: function( event, ui, instance ) { 2827 var t = $( "body" ), 2828 o = instance.options; 2829 2830 if ( t.css( "cursor" ) ) { 2831 o._cursor = t.css( "cursor" ); 2832 } 2833 t.css( "cursor", o.cursor ); 2834 }, 2835 stop: function( event, ui, instance ) { 2836 var o = instance.options; 2837 if ( o._cursor ) { 2838 $( "body" ).css( "cursor", o._cursor ); 2839 } 2840 } 2841} ); 2842 2843$.ui.plugin.add( "draggable", "opacity", { 2844 start: function( event, ui, instance ) { 2845 var t = $( ui.helper ), 2846 o = instance.options; 2847 if ( t.css( "opacity" ) ) { 2848 o._opacity = t.css( "opacity" ); 2849 } 2850 t.css( "opacity", o.opacity ); 2851 }, 2852 stop: function( event, ui, instance ) { 2853 var o = instance.options; 2854 if ( o._opacity ) { 2855 $( ui.helper ).css( "opacity", o._opacity ); 2856 } 2857 } 2858} ); 2859 2860$.ui.plugin.add( "draggable", "scroll", { 2861 start: function( event, ui, i ) { 2862 if ( !i.scrollParentNotHidden ) { 2863 i.scrollParentNotHidden = i.helper.scrollParent( false ); 2864 } 2865 2866 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && 2867 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { 2868 i.overflowOffset = i.scrollParentNotHidden.offset(); 2869 } 2870 }, 2871 drag: function( event, ui, i ) { 2872 2873 var o = i.options, 2874 scrolled = false, 2875 scrollParent = i.scrollParentNotHidden[ 0 ], 2876 document = i.document[ 0 ]; 2877 2878 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { 2879 if ( !o.axis || o.axis !== "x" ) { 2880 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < 2881 o.scrollSensitivity ) { 2882 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 2883 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { 2884 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 2885 } 2886 } 2887 2888 if ( !o.axis || o.axis !== "y" ) { 2889 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < 2890 o.scrollSensitivity ) { 2891 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 2892 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { 2893 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 2894 } 2895 } 2896 2897 } else { 2898 2899 if ( !o.axis || o.axis !== "x" ) { 2900 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { 2901 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); 2902 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < 2903 o.scrollSensitivity ) { 2904 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); 2905 } 2906 } 2907 2908 if ( !o.axis || o.axis !== "y" ) { 2909 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { 2910 scrolled = $( document ).scrollLeft( 2911 $( document ).scrollLeft() - o.scrollSpeed 2912 ); 2913 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < 2914 o.scrollSensitivity ) { 2915 scrolled = $( document ).scrollLeft( 2916 $( document ).scrollLeft() + o.scrollSpeed 2917 ); 2918 } 2919 } 2920 2921 } 2922 2923 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 2924 $.ui.ddmanager.prepareOffsets( i, event ); 2925 } 2926 2927 } 2928} ); 2929 2930$.ui.plugin.add( "draggable", "snap", { 2931 start: function( event, ui, i ) { 2932 2933 var o = i.options; 2934 2935 i.snapElements = []; 2936 2937 $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) 2938 .each( function() { 2939 var $t = $( this ), 2940 $o = $t.offset(); 2941 if ( this !== i.element[ 0 ] ) { 2942 i.snapElements.push( { 2943 item: this, 2944 width: $t.outerWidth(), height: $t.outerHeight(), 2945 top: $o.top, left: $o.left 2946 } ); 2947 } 2948 } ); 2949 2950 }, 2951 drag: function( event, ui, inst ) { 2952 2953 var ts, bs, ls, rs, l, r, t, b, i, first, 2954 o = inst.options, 2955 d = o.snapTolerance, 2956 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 2957 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 2958 2959 for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { 2960 2961 l = inst.snapElements[ i ].left - inst.margins.left; 2962 r = l + inst.snapElements[ i ].width; 2963 t = inst.snapElements[ i ].top - inst.margins.top; 2964 b = t + inst.snapElements[ i ].height; 2965 2966 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 2967 !$.contains( inst.snapElements[ i ].item.ownerDocument, 2968 inst.snapElements[ i ].item ) ) { 2969 if ( inst.snapElements[ i ].snapping ) { 2970 if ( inst.options.snap.release ) { 2971 inst.options.snap.release.call( 2972 inst.element, 2973 event, 2974 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) 2975 ); 2976 } 2977 } 2978 inst.snapElements[ i ].snapping = false; 2979 continue; 2980 } 2981 2982 if ( o.snapMode !== "inner" ) { 2983 ts = Math.abs( t - y2 ) <= d; 2984 bs = Math.abs( b - y1 ) <= d; 2985 ls = Math.abs( l - x2 ) <= d; 2986 rs = Math.abs( r - x1 ) <= d; 2987 if ( ts ) { 2988 ui.position.top = inst._convertPositionTo( "relative", { 2989 top: t - inst.helperProportions.height, 2990 left: 0 2991 } ).top; 2992 } 2993 if ( bs ) { 2994 ui.position.top = inst._convertPositionTo( "relative", { 2995 top: b, 2996 left: 0 2997 } ).top; 2998 } 2999 if ( ls ) { 3000 ui.position.left = inst._convertPositionTo( "relative", { 3001 top: 0, 3002 left: l - inst.helperProportions.width 3003 } ).left; 3004 } 3005 if ( rs ) { 3006 ui.position.left = inst._convertPositionTo( "relative", { 3007 top: 0, 3008 left: r 3009 } ).left; 3010 } 3011 } 3012 3013 first = ( ts || bs || ls || rs ); 3014 3015 if ( o.snapMode !== "outer" ) { 3016 ts = Math.abs( t - y1 ) <= d; 3017 bs = Math.abs( b - y2 ) <= d; 3018 ls = Math.abs( l - x1 ) <= d; 3019 rs = Math.abs( r - x2 ) <= d; 3020 if ( ts ) { 3021 ui.position.top = inst._convertPositionTo( "relative", { 3022 top: t, 3023 left: 0 3024 } ).top; 3025 } 3026 if ( bs ) { 3027 ui.position.top = inst._convertPositionTo( "relative", { 3028 top: b - inst.helperProportions.height, 3029 left: 0 3030 } ).top; 3031 } 3032 if ( ls ) { 3033 ui.position.left = inst._convertPositionTo( "relative", { 3034 top: 0, 3035 left: l 3036 } ).left; 3037 } 3038 if ( rs ) { 3039 ui.position.left = inst._convertPositionTo( "relative", { 3040 top: 0, 3041 left: r - inst.helperProportions.width 3042 } ).left; 3043 } 3044 } 3045 3046 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { 3047 if ( inst.options.snap.snap ) { 3048 inst.options.snap.snap.call( 3049 inst.element, 3050 event, 3051 $.extend( inst._uiHash(), { 3052 snapItem: inst.snapElements[ i ].item 3053 } ) ); 3054 } 3055 } 3056 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); 3057 3058 } 3059 3060 } 3061} ); 3062 3063$.ui.plugin.add( "draggable", "stack", { 3064 start: function( event, ui, instance ) { 3065 var min, 3066 o = instance.options, 3067 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { 3068 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - 3069 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); 3070 } ); 3071 3072 if ( !group.length ) { 3073 return; 3074 } 3075 3076 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; 3077 $( group ).each( function( i ) { 3078 $( this ).css( "zIndex", min + i ); 3079 } ); 3080 this.css( "zIndex", ( min + group.length ) ); 3081 } 3082} ); 3083 3084$.ui.plugin.add( "draggable", "zIndex", { 3085 start: function( event, ui, instance ) { 3086 var t = $( ui.helper ), 3087 o = instance.options; 3088 3089 if ( t.css( "zIndex" ) ) { 3090 o._zIndex = t.css( "zIndex" ); 3091 } 3092 t.css( "zIndex", o.zIndex ); 3093 }, 3094 stop: function( event, ui, instance ) { 3095 var o = instance.options; 3096 3097 if ( o._zIndex ) { 3098 $( ui.helper ).css( "zIndex", o._zIndex ); 3099 } 3100 } 3101} ); 3102 3103var widgetsDraggable = $.ui.draggable; 3104 3105 3106/*! 3107 * jQuery UI Resizable 1.14.
31070 3108 * https://jqueryui.com 3109 * 3110 * Copyright OpenJS Foundation and other contributors 3111 * Released under the MIT license. 3112 * https://jquery.org/license 3113 */ 3114 3115//>>label: Resizable 3116//>>group: Interactions 3117//>>description: Enables resize functionality for any element. 3118//>>docs: https://api.jqueryui.com/resizable/ 3119//>>demos: https://jqueryui.com/resizable/ 3120//>>css.structure: ../../themes/base/core.css 3121//>>css.structure: ../../themes/base/resizable.css 3122//>>css.theme: ../../themes/base/theme.css 3123 3124 3125$.widget( "ui.resizable", $.ui.mouse, { 3126 version: "1.14.0", 3127 widgetEventPrefix: "resize", 3128 options: { 3129 alsoResize: false, 3130 animate: false, 3131 animateDuration: "slow", 3132 animateEasing: "swing", 3133 aspectRatio: false, 3134 autoHide: false, 3135 classes: { 3136 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 3137 }, 3138 containment: false, 3139 ghost: false, 3140 grid: false, 3141 handles: "e,s,se", 3142 helper: false, 3143 maxHeight: null, 3144 maxWidth: null, 3145 minHeight: 10, 3146 minWidth: 10, 3147 3148 // See #7960 3149 zIndex: 90, 3150 3151 // Callbacks 3152 resize: null, 3153 start: null, 3154 stop: null 3155 }, 3156 3157 _num: function( value ) { 3158 return parseFloat( value ) || 0; 3159 }, 3160 3161 _isNumber: function( value ) { 3162 return !isNaN( parseFloat( value ) ); 3163 }, 3164 3165 _hasScroll: function( el, a ) { 3166 3167 if ( $( el ).css( "overflow" ) === "hidden" ) { 3168 return false;
vendor: 2,099 bytes, lines 3169-3246
3169 } 3170 3171 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", 3172 has = false; 3173 3174 if ( el[ scroll ] > 0 ) { 3175 return true; 3176 } 3177 3178 // TODO: determine which cases actually cause this to happen 3179 // if the element doesn't have the scroll set, see if it's possible to 3180 // set the scroll 3181 try { 3182 el[ scroll ] = 1; 3183 has = ( el[ scroll ] > 0 ); 3184 el[ scroll ] = 0; 3185 } catch ( e ) { 3186 3187 // `el` might be a string, then setting `scroll` will throw 3188 // an error in strict mode; ignore it. 3189 } 3190 return has; 3191 }, 3192 3193 _create: function() { 3194 3195 var margins, 3196 o = this.options, 3197 that = this; 3198 this._addClass( "ui-resizable" ); 3199 3200 $.extend( this, { 3201 _aspectRatio: !!( o.aspectRatio ), 3202 aspectRatio: o.aspectRatio, 3203 originalElement: this.element, 3204 _proportionallyResizeElements: [], 3205 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 3206 } ); 3207 3208 // Wrap the element if it cannot hold child nodes 3209 if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { 3210 3211 this.element.wrap( 3212 $( "<div class='ui-wrapper'></div>" ).css( { 3213 overflow: "hidden", 3214 position: this.element.css( "position" ), 3215 width: this.element.outerWidth(), 3216 height: this.element.outerHeight(), 3217 top: this.element.css( "top" ), 3218 left: this.element.css( "left" ) 3219 } ) 3220 ); 3221 3222 this.element = this.element.parent().data( 3223 "ui-resizable", this.element.resizable( "instance" ) 3224 ); 3225 3226 this.elementIsWrapper = true; 3227 3228 margins = { 3229 marginTop: this.originalElement.css( "marginTop" ), 3230 marginRight: this.originalElement.css( "marginRight" ), 3231 marginBottom: this.originalElement.css( "marginBottom" ), 3232 marginLeft: this.originalElement.css( "marginLeft" ) 3233 }; 3234 3235 this.element.css( margins ); 3236 3237 // Support: Safari 3238 // Prevent Safari textarea resize 3239 this.originalResizeStyle = this.originalElement.css( "resize" ); 3240 this.originalElement.css( "resize", "none" ); 3241 3242 this._proportionallyResizeElements.push( this.originalElement.css( { 3243 position: "static", 3244 zoom: 1, 3245 display: "block" 3246 } )
vendor: 23,890 bytes, lines 3246-4195
3246 ); 3247 3248 this._proportionallyResize(); 3249 } 3250 3251 this._setupHandles(); 3252 3253 if ( o.autoHide ) { 3254 $( this.element ) 3255 .on( "mouseenter", function() { 3256 if ( o.disabled ) { 3257 return; 3258 } 3259 that._removeClass( "ui-resizable-autohide" ); 3260 that._handles.show(); 3261 } ) 3262 .on( "mouseleave", function() { 3263 if ( o.disabled ) { 3264 return; 3265 } 3266 if ( !that.resizing ) { 3267 that._addClass( "ui-resizable-autohide" ); 3268 that._handles.hide(); 3269 } 3270 } ); 3271 } 3272 3273 this._mouseInit(); 3274 }, 3275 3276 _destroy: function() { 3277 3278 this._mouseDestroy(); 3279 this._addedHandles.remove(); 3280 3281 var wrapper, 3282 _destroy = function( exp ) { 3283 $( exp ) 3284 .removeData( "resizable" ) 3285 .removeData( "ui-resizable" ) 3286 .off( ".resizable" ); 3287 }; 3288 3289 // TODO: Unwrap at same DOM position 3290 if ( this.elementIsWrapper ) { 3291 _destroy( this.element ); 3292 wrapper = this.element; 3293 this.originalElement.css( { 3294 position: wrapper.css( "position" ), 3295 width: wrapper.outerWidth(), 3296 height: wrapper.outerHeight(), 3297 top: wrapper.css( "top" ), 3298 left: wrapper.css( "left" ) 3299 } ).insertAfter( wrapper ); 3300 wrapper.remove(); 3301 } 3302 3303 this.originalElement.css( "resize", this.originalResizeStyle ); 3304 _destroy( this.originalElement ); 3305 3306 return this; 3307 }, 3308 3309 _setOption: function( key, value ) { 3310 this._super( key, value ); 3311 3312 switch ( key ) { 3313 case "handles": 3314 this._removeHandles(); 3315 this._setupHandles(); 3316 break; 3317 case "aspectRatio": 3318 this._aspectRatio = !!value; 3319 break; 3320 default: 3321 break; 3322 } 3323 }, 3324 3325 _setupHandles: function() { 3326 var o = this.options, handle, i, n, hname, axis, that = this; 3327 this.handles = o.handles || 3328 ( !$( ".ui-resizable-handle", this.element ).length ? 3329 "e,s,se" : { 3330 n: ".ui-resizable-n", 3331 e: ".ui-resizable-e", 3332 s: ".ui-resizable-s", 3333 w: ".ui-resizable-w", 3334 se: ".ui-resizable-se", 3335 sw: ".ui-resizable-sw", 3336 ne: ".ui-resizable-ne", 3337 nw: ".ui-resizable-nw" 3338 } ); 3339 3340 this._handles = $(); 3341 this._addedHandles = $(); 3342 if ( this.handles.constructor === String ) { 3343 3344 if ( this.handles === "all" ) { 3345 this.handles = "n,e,s,w,se,sw,ne,nw"; 3346 } 3347 3348 n = this.handles.split( "," ); 3349 this.handles = {}; 3350 3351 for ( i = 0; i < n.length; i++ ) { 3352 3353 handle = String.prototype.trim.call( n[ i ] ); 3354 hname = "ui-resizable-" + handle; 3355 axis = $( "<div>" ); 3356 this._addClass( axis, "ui-resizable-handle " + hname ); 3357 3358 axis.css( { zIndex: o.zIndex } ); 3359 3360 this.handles[ handle ] = ".ui-resizable-" + handle; 3361 if ( !this.element.children( this.handles[ handle ] ).length ) { 3362 this.element.append( axis ); 3363 this._addedHandles = this._addedHandles.add( axis ); 3364 } 3365 } 3366 3367 } 3368 3369 this._renderAxis = function( target ) { 3370 3371 var i, axis, padPos, padWrapper; 3372 3373 target = target || this.element; 3374 3375 for ( i in this.handles ) { 3376 3377 if ( this.handles[ i ].constructor === String ) { 3378 this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); 3379 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { 3380 this.handles[ i ] = $( this.handles[ i ] ); 3381 this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); 3382 } 3383 3384 if ( this.elementIsWrapper && 3385 this.originalElement[ 0 ] 3386 .nodeName 3387 .match( /^(textarea|input|select|button)$/i ) ) { 3388 axis = $( this.handles[ i ], this.element ); 3389 3390 padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? 3391 axis.outerHeight() : 3392 axis.outerWidth(); 3393 3394 padPos = [ "padding", 3395 /ne|nw|n/.test( i ) ? "Top" : 3396 /se|sw|s/.test( i ) ? "Bottom" : 3397 /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); 3398 3399 target.css( padPos, padWrapper ); 3400 3401 this._proportionallyResize(); 3402 } 3403 3404 this._handles = this._handles.add( this.handles[ i ] ); 3405 } 3406 }; 3407 3408 // TODO: make renderAxis a prototype function 3409 this._renderAxis( this.element ); 3410 3411 this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); 3412 this._handles.disableSelection(); 3413 3414 this._handles.on( "mouseover", function() { 3415 if ( !that.resizing ) { 3416 if ( this.className ) { 3417 axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); 3418 } 3419 that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; 3420 } 3421 } ); 3422 3423 if ( o.autoHide ) { 3424 this._handles.hide(); 3425 this._addClass( "ui-resizable-autohide" ); 3426 } 3427 }, 3428 3429 _removeHandles: function() { 3430 this._addedHandles.remove(); 3431 }, 3432 3433 _mouseCapture: function( event ) { 3434 var i, handle, 3435 capture = false; 3436 3437 for ( i in this.handles ) { 3438 handle = $( this.handles[ i ] )[ 0 ]; 3439 if ( handle === event.target || $.contains( handle, event.target ) ) { 3440 capture = true; 3441 } 3442 } 3443 3444 return !this.options.disabled && capture; 3445 }, 3446 3447 _mouseStart: function( event ) { 3448 3449 var curleft, curtop, cursor, 3450 o = this.options, 3451 el = this.element; 3452 3453 this.resizing = true; 3454 3455 this._renderProxy(); 3456 3457 curleft = this._num( this.helper.css( "left" ) ); 3458 curtop = this._num( this.helper.css( "top" ) ); 3459 3460 if ( o.containment ) { 3461 curleft += $( o.containment ).scrollLeft() || 0; 3462 curtop += $( o.containment ).scrollTop() || 0; 3463 } 3464 3465 this.offset = this.helper.offset(); 3466 this.position = { left: curleft, top: curtop }; 3467 3468 this.size = this._helper ? { 3469 width: this.helper.width(), 3470 height: this.helper.height() 3471 } : { 3472 width: el.width(), 3473 height: el.height() 3474 }; 3475 3476 this.originalSize = this._helper ? { 3477 width: el.outerWidth(), 3478 height: el.outerHeight() 3479 } : { 3480 width: el.width(), 3481 height: el.height() 3482 }; 3483 3484 this.sizeDiff = { 3485 width: el.outerWidth() - el.width(), 3486 height: el.outerHeight() - el.height() 3487 }; 3488 3489 this.originalPosition = { left: curleft, top: curtop }; 3490 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 3491 3492 this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? 3493 o.aspectRatio : 3494 ( ( this.originalSize.width / this.originalSize.height ) || 1 ); 3495 3496 cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); 3497 $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); 3498 3499 this._addClass( "ui-resizable-resizing" ); 3500 this._propagate( "start", event ); 3501 return true; 3502 }, 3503 3504 _mouseDrag: function( event ) { 3505 3506 var data, props, 3507 smp = this.originalMousePosition, 3508 a = this.axis, 3509 dx = ( event.pageX - smp.left ) || 0, 3510 dy = ( event.pageY - smp.top ) || 0, 3511 trigger = this._change[ a ]; 3512 3513 this._updatePrevProperties(); 3514 3515 if ( !trigger ) { 3516 return false; 3517 } 3518 3519 data = trigger.apply( this, [ event, dx, dy ] ); 3520 3521 this._updateVirtualBoundaries( event.shiftKey ); 3522 if ( this._aspectRatio || event.shiftKey ) { 3523 data = this._updateRatio( data, event ); 3524 } 3525 3526 data = this._respectSize( data, event ); 3527 3528 this._updateCache( data ); 3529 3530 this._propagate( "resize", event ); 3531 3532 props = this._applyChanges(); 3533 3534 if ( !this._helper && this._proportionallyResizeElements.length ) { 3535 this._proportionallyResize(); 3536 } 3537 3538 if ( !$.isEmptyObject( props ) ) { 3539 this._updatePrevProperties(); 3540 this._trigger( "resize", event, this.ui() ); 3541 this._applyChanges(); 3542 } 3543 3544 return false; 3545 }, 3546 3547 _mouseStop: function( event ) { 3548 3549 this.resizing = false; 3550 var pr, ista, soffseth, soffsetw, s, left, top, 3551 o = this.options, that = this; 3552 3553 if ( this._helper ) { 3554 3555 pr = this._proportionallyResizeElements; 3556 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); 3557 soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; 3558 soffsetw = ista ? 0 : that.sizeDiff.width; 3559 3560 s = { 3561 width: ( that.helper.width() - soffsetw ), 3562 height: ( that.helper.height() - soffseth ) 3563 }; 3564 left = ( parseFloat( that.element.css( "left" ) ) + 3565 ( that.position.left - that.originalPosition.left ) ) || null; 3566 top = ( parseFloat( that.element.css( "top" ) ) + 3567 ( that.position.top - that.originalPosition.top ) ) || null; 3568 3569 if ( !o.animate ) { 3570 this.element.css( $.extend( s, { top: top, left: left } ) ); 3571 } 3572 3573 that.helper.height( that.size.height ); 3574 that.helper.width( that.size.width ); 3575 3576 if ( this._helper && !o.animate ) { 3577 this._proportionallyResize(); 3578 } 3579 } 3580 3581 $( "body" ).css( "cursor", "auto" ); 3582 3583 this._removeClass( "ui-resizable-resizing" ); 3584 3585 this._propagate( "stop", event ); 3586 3587 if ( this._helper ) { 3588 this.helper.remove(); 3589 } 3590 3591 return false; 3592 3593 }, 3594 3595 _updatePrevProperties: function() { 3596 this.prevPosition = { 3597 top: this.position.top, 3598 left: this.position.left 3599 }; 3600 this.prevSize = { 3601 width: this.size.width, 3602 height: this.size.height 3603 }; 3604 }, 3605 3606 _applyChanges: function() { 3607 var props = {}; 3608 3609 if ( this.position.top !== this.prevPosition.top ) { 3610 props.top = this.position.top + "px"; 3611 } 3612 if ( this.position.left !== this.prevPosition.left ) { 3613 props.left = this.position.left + "px"; 3614 } 3615 3616 this.helper.css( props ); 3617 3618 if ( this.size.width !== this.prevSize.width ) { 3619 props.width = this.size.width + "px"; 3620 this.helper.width( props.width ); 3621 } 3622 if ( this.size.height !== this.prevSize.height ) { 3623 props.height = this.size.height + "px"; 3624 this.helper.height( props.height ); 3625 } 3626 3627 return props; 3628 }, 3629 3630 _updateVirtualBoundaries: function( forceAspectRatio ) { 3631 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 3632 o = this.options; 3633 3634 b = { 3635 minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, 3636 maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, 3637 minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, 3638 maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity 3639 }; 3640 3641 if ( this._aspectRatio || forceAspectRatio ) { 3642 pMinWidth = b.minHeight * this.aspectRatio; 3643 pMinHeight = b.minWidth / this.aspectRatio; 3644 pMaxWidth = b.maxHeight * this.aspectRatio; 3645 pMaxHeight = b.maxWidth / this.aspectRatio; 3646 3647 if ( pMinWidth > b.minWidth ) { 3648 b.minWidth = pMinWidth; 3649 } 3650 if ( pMinHeight > b.minHeight ) { 3651 b.minHeight = pMinHeight; 3652 } 3653 if ( pMaxWidth < b.maxWidth ) { 3654 b.maxWidth = pMaxWidth; 3655 } 3656 if ( pMaxHeight < b.maxHeight ) { 3657 b.maxHeight = pMaxHeight; 3658 } 3659 } 3660 this._vBoundaries = b; 3661 }, 3662 3663 _updateCache: function( data ) { 3664 this.offset = this.helper.offset(); 3665 if ( this._isNumber( data.left ) ) { 3666 this.position.left = data.left; 3667 } 3668 if ( this._isNumber( data.top ) ) { 3669 this.position.top = data.top; 3670 } 3671 if ( this._isNumber( data.height ) ) { 3672 this.size.height = data.height; 3673 } 3674 if ( this._isNumber( data.width ) ) { 3675 this.size.width = data.width; 3676 } 3677 }, 3678 3679 _updateRatio: function( data ) { 3680 3681 var cpos = this.position, 3682 csize = this.size, 3683 a = this.axis; 3684 3685 if ( this._isNumber( data.height ) ) { 3686 data.width = ( data.height * this.aspectRatio ); 3687 } else if ( this._isNumber( data.width ) ) { 3688 data.height = ( data.width / this.aspectRatio ); 3689 } 3690 3691 if ( a === "sw" ) { 3692 data.left = cpos.left + ( csize.width - data.width ); 3693 data.top = null; 3694 } 3695 if ( a === "nw" ) { 3696 data.top = cpos.top + ( csize.height - data.height ); 3697 data.left = cpos.left + ( csize.width - data.width ); 3698 } 3699 3700 return data; 3701 }, 3702 3703 _respectSize: function( data ) { 3704 3705 var o = this._vBoundaries, 3706 a = this.axis, 3707 ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), 3708 ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), 3709 isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), 3710 isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), 3711 dw = this.originalPosition.left + this.originalSize.width, 3712 dh = this.originalPosition.top + this.originalSize.height, 3713 cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); 3714 if ( isminw ) { 3715 data.width = o.minWidth; 3716 } 3717 if ( isminh ) { 3718 data.height = o.minHeight; 3719 } 3720 if ( ismaxw ) { 3721 data.width = o.maxWidth; 3722 } 3723 if ( ismaxh ) { 3724 data.height = o.maxHeight; 3725 } 3726 3727 if ( isminw && cw ) { 3728 data.left = dw - o.minWidth; 3729 } 3730 if ( ismaxw && cw ) { 3731 data.left = dw - o.maxWidth; 3732 } 3733 if ( isminh && ch ) { 3734 data.top = dh - o.minHeight; 3735 } 3736 if ( ismaxh && ch ) { 3737 data.top = dh - o.maxHeight; 3738 } 3739 3740 // Fixing jump error on top/left - bug #2330 3741 if ( !data.width && !data.height && !data.left && data.top ) { 3742 data.top = null; 3743 } else if ( !data.width && !data.height && !data.top && data.left ) { 3744 data.left = null; 3745 } 3746 3747 return data; 3748 }, 3749 3750 _getPaddingPlusBorderDimensions: function( element ) { 3751 var i = 0, 3752 widths = [], 3753 borders = [ 3754 element.css( "borderTopWidth" ), 3755 element.css( "borderRightWidth" ), 3756 element.css( "borderBottomWidth" ), 3757 element.css( "borderLeftWidth" ) 3758 ], 3759 paddings = [ 3760 element.css( "paddingTop" ), 3761 element.css( "paddingRight" ), 3762 element.css( "paddingBottom" ), 3763 element.css( "paddingLeft" ) 3764 ]; 3765 3766 for ( ; i < 4; i++ ) { 3767 widths[ i ] = ( parseFloat( borders[ i ] ) || 0 ); 3768 widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 ); 3769 } 3770 3771 return { 3772 height: widths[ 0 ] + widths[ 2 ], 3773 width: widths[ 1 ] + widths[ 3 ] 3774 }; 3775 }, 3776 3777 _proportionallyResize: function() { 3778 3779 if ( !this._proportionallyResizeElements.length ) { 3780 return; 3781 } 3782 3783 var prel, 3784 i = 0, 3785 element = this.helper || this.element; 3786 3787 for ( ; i < this._proportionallyResizeElements.length; i++ ) { 3788 3789 prel = this._proportionallyResizeElements[ i ]; 3790 3791 // TODO: Seems like a bug to cache this.outerDimensions 3792 // considering that we are in a loop. 3793 if ( !this.outerDimensions ) { 3794 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); 3795 } 3796 3797 prel.css( { 3798 height: ( element.height() - this.outerDimensions.height ) || 0, 3799 width: ( element.width() - this.outerDimensions.width ) || 0 3800 } ); 3801 3802 } 3803 3804 }, 3805 3806 _renderProxy: function() { 3807 3808 var el = this.element, o = this.options; 3809 this.elementOffset = el.offset(); 3810 3811 if ( this._helper ) { 3812 3813 this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } ); 3814 3815 this._addClass( this.helper, this._helper ); 3816 this.helper.css( { 3817 width: this.element.outerWidth(), 3818 height: this.element.outerHeight(), 3819 position: "absolute", 3820 left: this.elementOffset.left + "px", 3821 top: this.elementOffset.top + "px", 3822 zIndex: ++o.zIndex //TODO: Don't modify option 3823 } ); 3824 3825 this.helper 3826 .appendTo( "body" ) 3827 .disableSelection(); 3828 3829 } else { 3830 this.helper = this.element; 3831 } 3832 3833 }, 3834 3835 _change: { 3836 e: function( event, dx ) { 3837 return { width: this.originalSize.width + dx }; 3838 }, 3839 w: function( event, dx ) { 3840 var cs = this.originalSize, sp = this.originalPosition; 3841 return { left: sp.left + dx, width: cs.width - dx }; 3842 }, 3843 n: function( event, dx, dy ) { 3844 var cs = this.originalSize, sp = this.originalPosition; 3845 return { top: sp.top + dy, height: cs.height - dy }; 3846 }, 3847 s: function( event, dx, dy ) { 3848 return { height: this.originalSize.height + dy }; 3849 }, 3850 se: function( event, dx, dy ) { 3851 return $.extend( this._change.s.apply( this, arguments ), 3852 this._change.e.apply( this, [ event, dx, dy ] ) ); 3853 }, 3854 sw: function( event, dx, dy ) { 3855 return $.extend( this._change.s.apply( this, arguments ), 3856 this._change.w.apply( this, [ event, dx, dy ] ) ); 3857 }, 3858 ne: function( event, dx, dy ) { 3859 return $.extend( this._change.n.apply( this, arguments ), 3860 this._change.e.apply( this, [ event, dx, dy ] ) ); 3861 }, 3862 nw: function( event, dx, dy ) { 3863 return $.extend( this._change.n.apply( this, arguments ), 3864 this._change.w.apply( this, [ event, dx, dy ] ) ); 3865 } 3866 }, 3867 3868 _propagate: function( n, event ) { 3869 $.ui.plugin.call( this, n, [ event, this.ui() ] ); 3870 if ( n !== "resize" ) { 3871 this._trigger( n, event, this.ui() ); 3872 } 3873 }, 3874 3875 plugins: {}, 3876 3877 ui: function() { 3878 return { 3879 originalElement: this.originalElement, 3880 element: this.element, 3881 helper: this.helper, 3882 position: this.position, 3883 size: this.size, 3884 originalSize: this.originalSize, 3885 originalPosition: this.originalPosition 3886 }; 3887 } 3888 3889} ); 3890 3891/* 3892 * Resizable Extensions 3893 */ 3894 3895$.ui.plugin.add( "resizable", "animate", { 3896 3897 stop: function( event ) { 3898 var that = $( this ).resizable( "instance" ), 3899 o = that.options, 3900 pr = that._proportionallyResizeElements, 3901 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ), 3902 soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height, 3903 soffsetw = ista ? 0 : that.sizeDiff.width, 3904 style = { 3905 width: ( that.size.width - soffsetw ), 3906 height: ( that.size.height - soffseth ) 3907 }, 3908 left = ( parseFloat( that.element.css( "left" ) ) + 3909 ( that.position.left - that.originalPosition.left ) ) || null, 3910 top = ( parseFloat( that.element.css( "top" ) ) + 3911 ( that.position.top - that.originalPosition.top ) ) || null; 3912 3913 that.element.animate( 3914 $.extend( style, top && left ? { top: top, left: left } : {} ), { 3915 duration: o.animateDuration, 3916 easing: o.animateEasing, 3917 step: function() { 3918 3919 var data = { 3920 width: parseFloat( that.element.css( "width" ) ), 3921 height: parseFloat( that.element.css( "height" ) ), 3922 top: parseFloat( that.element.css( "top" ) ), 3923 left: parseFloat( that.element.css( "left" ) ) 3924 }; 3925 3926 if ( pr && pr.length ) { 3927 $( pr[ 0 ] ).css( { width: data.width, height: data.height } ); 3928 } 3929 3930 // Propagating resize, and updating values for each animation step 3931 that._updateCache( data ); 3932 that._propagate( "resize", event ); 3933 3934 } 3935 } 3936 ); 3937 } 3938 3939} ); 3940 3941$.ui.plugin.add( "resizable", "containment", { 3942 3943 start: function() { 3944 var element, p, co, ch, cw, width, height, 3945 that = $( this ).resizable( "instance" ), 3946 o = that.options, 3947 el = that.element, 3948 oc = o.containment, 3949 ce = ( oc instanceof $ ) ? 3950 oc.get( 0 ) : 3951 ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; 3952 3953 if ( !ce ) { 3954 return; 3955 } 3956 3957 that.containerElement = $( ce ); 3958 3959 if ( /document/.test( oc ) || oc === document ) { 3960 that.containerOffset = { 3961 left: 0, 3962 top: 0 3963 }; 3964 that.containerPosition = { 3965 left: 0, 3966 top: 0 3967 }; 3968 3969 that.parentData = { 3970 element: $( document ), 3971 left: 0, 3972 top: 0, 3973 width: $( document ).width(), 3974 height: $( document ).height() || document.body.parentNode.scrollHeight 3975 }; 3976 } else { 3977 element = $( ce ); 3978 p = []; 3979 $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) { 3980 p[ i ] = that._num( element.css( "padding" + name ) ); 3981 } ); 3982 3983 that.containerOffset = element.offset(); 3984 that.containerPosition = element.position(); 3985 that.containerSize = { 3986 height: ( element.innerHeight() - p[ 3 ] ), 3987 width: ( element.innerWidth() - p[ 1 ] ) 3988 }; 3989 3990 co = that.containerOffset; 3991 ch = that.containerSize.height; 3992 cw = that.containerSize.width; 3993 width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw ); 3994 height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch ); 3995 3996 that.parentData = { 3997 element: ce, 3998 left: co.left, 3999 top: co.top, 4000 width: width, 4001 height: height 4002 }; 4003 } 4004 }, 4005 4006 resize: function( event ) { 4007 var woset, hoset, isParent, isOffsetRelative, 4008 that = $( this ).resizable( "instance" ), 4009 o = that.options, 4010 co = that.containerOffset, 4011 cp = that.position, 4012 pRatio = that._aspectRatio || event.shiftKey, 4013 cop = { 4014 top: 0, 4015 left: 0 4016 }, 4017 ce = that.containerElement, 4018 continueResize = true; 4019 4020 if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { 4021 cop = co; 4022 } 4023 4024 if ( cp.left < ( that._helper ? co.left : 0 ) ) { 4025 that.size.width = that.size.width + 4026 ( that._helper ? 4027 ( that.position.left - co.left ) : 4028 ( that.position.left - cop.left ) ); 4029 4030 if ( pRatio ) { 4031 that.size.height = that.size.width / that.aspectRatio; 4032 continueResize = false; 4033 } 4034 that.position.left = o.helper ? co.left : 0; 4035 } 4036 4037 if ( cp.top < ( that._helper ? co.top : 0 ) ) { 4038 that.size.height = that.size.height + 4039 ( that._helper ? 4040 ( that.position.top - co.top ) : 4041 that.position.top ); 4042 4043 if ( pRatio ) { 4044 that.size.width = that.size.height * that.aspectRatio; 4045 continueResize = false; 4046 } 4047 that.position.top = that._helper ? co.top : 0; 4048 } 4049 4050 isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); 4051 isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); 4052 4053 if ( isParent && isOffsetRelative ) { 4054 that.offset.left = that.parentData.left + that.position.left; 4055 that.offset.top = that.parentData.top + that.position.top; 4056 } else { 4057 that.offset.left = that.element.offset().left; 4058 that.offset.top = that.element.offset().top; 4059 } 4060 4061 woset = Math.abs( that.sizeDiff.width + 4062 ( that._helper ? 4063 that.offset.left - cop.left : 4064 ( that.offset.left - co.left ) ) ); 4065 4066 hoset = Math.abs( that.sizeDiff.height + 4067 ( that._helper ? 4068 that.offset.top - cop.top : 4069 ( that.offset.top - co.top ) ) ); 4070 4071 if ( woset + that.size.width >= that.parentData.width ) { 4072 that.size.width = that.parentData.width - woset; 4073 if ( pRatio ) { 4074 that.size.height = that.size.width / that.aspectRatio; 4075 continueResize = false; 4076 } 4077 } 4078 4079 if ( hoset + that.size.height >= that.parentData.height ) { 4080 that.size.height = that.parentData.height - hoset; 4081 if ( pRatio ) { 4082 that.size.width = that.size.height * that.aspectRatio; 4083 continueResize = false; 4084 } 4085 } 4086 4087 if ( !continueResize ) { 4088 that.position.left = that.prevPosition.left; 4089 that.position.top = that.prevPosition.top; 4090 that.size.width = that.prevSize.width; 4091 that.size.height = that.prevSize.height; 4092 } 4093 }, 4094 4095 stop: function() { 4096 var that = $( this ).resizable( "instance" ), 4097 o = that.options, 4098 co = that.containerOffset, 4099 cop = that.containerPosition, 4100 ce = that.containerElement, 4101 helper = $( that.helper ), 4102 ho = helper.offset(), 4103 w = helper.outerWidth() - that.sizeDiff.width, 4104 h = helper.outerHeight() - that.sizeDiff.height; 4105 4106 if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { 4107 $( this ).css( { 4108 left: ho.left - cop.left - co.left, 4109 width: w, 4110 height: h 4111 } ); 4112 } 4113 4114 if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { 4115 $( this ).css( { 4116 left: ho.left - cop.left - co.left, 4117 width: w, 4118 height: h 4119 } ); 4120 } 4121 } 4122} ); 4123 4124$.ui.plugin.add( "resizable", "alsoResize", { 4125 4126 start: function() { 4127 var that = $( this ).resizable( "instance" ), 4128 o = that.options; 4129 4130 $( o.alsoResize ).each( function() { 4131 var el = $( this ); 4132 el.data( "ui-resizable-alsoresize", { 4133 width: parseFloat( el.css( "width" ) ), height: parseFloat( el.css( "height" ) ), 4134 left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) 4135 } ); 4136 } ); 4137 }, 4138 4139 resize: function( event, ui ) { 4140 var that = $( this ).resizable( "instance" ), 4141 o = that.options, 4142 os = that.originalSize, 4143 op = that.originalPosition, 4144 delta = { 4145 height: ( that.size.height - os.height ) || 0, 4146 width: ( that.size.width - os.width ) || 0, 4147 top: ( that.position.top - op.top ) || 0, 4148 left: ( that.position.left - op.left ) || 0 4149 }; 4150 4151 $( o.alsoResize ).each( function() { 4152 var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {}, 4153 css = el.parents( ui.originalElement[ 0 ] ).length ? 4154 [ "width", "height" ] : 4155 [ "width", "height", "top", "left" ]; 4156 4157 $.each( css, function( i, prop ) { 4158 var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 ); 4159 if ( sum && sum >= 0 ) { 4160 style[ prop ] = sum || null; 4161 } 4162 } ); 4163 4164 el.css( style ); 4165 } ); 4166 }, 4167 4168 stop: function() { 4169 $( this ).removeData( "ui-resizable-alsoresize" ); 4170 } 4171} ); 4172 4173$.ui.plugin.add( "resizable", "ghost", { 4174 4175 start: function() { 4176 4177 var that = $( this ).resizable( "instance" ), cs = that.size; 4178 4179 that.ghost = that.originalElement.clone(); 4180 that.ghost.css( { 4181 opacity: 0.25, 4182 display: "block", 4183 position: "relative", 4184 height: cs.height, 4185 width: cs.width, 4186 margin: 0, 4187 left: 0, 4188 top: 0 4189 } ); 4190 4191 that._addClass( that.ghost, "ui-resizable-ghost" ); 4192 4193 // DEPRECATED 4194 // TODO: remove after 1.12 4195 if ( $.uiBackCompat
4195=== true && typeof that.options.ghost === "string" ) { 4196 4197 // Ghost option 4198 that.ghost.addClass( this.options.ghost ); 4199 } 4200 4201 that.ghost.appendTo( that.helper ); 4202 4203 }, 4204 4205 resize: function() { 4206 var that = $( this ).resizable( "instance" ); 4207 if ( that.ghost ) { 4208 that.ghost.css( { 4209 position: "relative", 4210 height: that.size.height,
vendor: 2,986 bytes, lines 4211-4324
4211 width: that.size.width 4212 } ); 4213 } 4214 }, 4215 4216 stop: function() { 4217 var that = $( this ).resizable( "instance" ); 4218 if ( that.ghost && that.helper ) { 4219 that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) ); 4220 } 4221 } 4222 4223} ); 4224 4225$.ui.plugin.add( "resizable", "grid", { 4226 4227 resize: function() { 4228 var outerDimensions, 4229 that = $( this ).resizable( "instance" ), 4230 o = that.options, 4231 cs = that.size, 4232 os = that.originalSize, 4233 op = that.originalPosition, 4234 a = that.axis, 4235 grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, 4236 gridX = ( grid[ 0 ] || 1 ), 4237 gridY = ( grid[ 1 ] || 1 ), 4238 ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX, 4239 oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY, 4240 newWidth = os.width + ox, 4241 newHeight = os.height + oy, 4242 isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ), 4243 isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ), 4244 isMinWidth = o.minWidth && ( o.minWidth > newWidth ), 4245 isMinHeight = o.minHeight && ( o.minHeight > newHeight ); 4246 4247 o.grid = grid; 4248 4249 if ( isMinWidth ) { 4250 newWidth += gridX; 4251 } 4252 if ( isMinHeight ) { 4253 newHeight += gridY; 4254 } 4255 if ( isMaxWidth ) { 4256 newWidth -= gridX; 4257 } 4258 if ( isMaxHeight ) { 4259 newHeight -= gridY; 4260 } 4261 4262 if ( /^(se|s|e)$/.test( a ) ) { 4263 that.size.width = newWidth; 4264 that.size.height = newHeight; 4265 } else if ( /^(ne)$/.test( a ) ) { 4266 that.size.width = newWidth; 4267 that.size.height = newHeight; 4268 that.position.top = op.top - oy; 4269 } else if ( /^(sw)$/.test( a ) ) { 4270 that.size.width = newWidth; 4271 that.size.height = newHeight; 4272 that.position.left = op.left - ox; 4273 } else { 4274 if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) { 4275 outerDimensions = that._getPaddingPlusBorderDimensions( this ); 4276 } 4277 4278 if ( newHeight - gridY > 0 ) { 4279 that.size.height = newHeight; 4280 that.position.top = op.top - oy; 4281 } else { 4282 newHeight = gridY - outerDimensions.height; 4283 that.size.height = newHeight; 4284 that.position.top = op.top + os.height - newHeight; 4285 } 4286 if ( newWidth - gridX > 0 ) { 4287 that.size.width = newWidth; 4288 that.position.left = op.left - ox; 4289 } else { 4290 newWidth = gridX - outerDimensions.width; 4291 that.size.width = newWidth; 4292 that.position.left = op.left + os.width - newWidth; 4293 } 4294 } 4295 } 4296 4297} ); 4298 4299var widgetsResizable = $.ui.resizable; 4300 4301 4302/*! 4303 * jQuery UI Controlgroup 1.14.0 4304 * https://jqueryui.com 4305 * 4306 * Copyright OpenJS Foundation and other contributors 4307 * Released under the MIT license. 4308 * https://jquery.org/license 4309 */ 4310 4311//>>label: Controlgroup 4312//>>group: Widgets 4313//>>description: Visually groups form control widgets 4314//>>docs: https://api.jqueryui.com/controlgroup/ 4315//>>demos: https://jqueryui.com/controlgroup/ 4316//>>css.structure: ../../themes/base/core.css 4317//>>css.structure: ../../themes/base/controlgroup.css 4318//>>css.theme: ../../themes/base/theme.css 4319 4320 4321var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 4322 4323var widgetsControlgroup = $.widget( "ui.controlgroup", { 4324 version: "1.14.0
vendor: 7,736 bytes, lines 4324-4588
4324", 4325 defaultElement: "<div>", 4326 options: { 4327 direction: "horizontal", 4328 disabled: null, 4329 onlyVisible: true, 4330 items: { 4331 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 4332 "controlgroupLabel": ".ui-controlgroup-label", 4333 "checkboxradio": "input[type='checkbox'], input[type='radio']", 4334 "selectmenu": "select", 4335 "spinner": ".ui-spinner-input" 4336 } 4337 }, 4338 4339 _create: function() { 4340 this._enhance(); 4341 }, 4342 4343 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 4344 _enhance: function() { 4345 this.element.attr( "role", "toolbar" ); 4346 this.refresh(); 4347 }, 4348 4349 _destroy: function() { 4350 this._callChildMethod( "destroy" ); 4351 this.childWidgets.removeData( "ui-controlgroup-data" ); 4352 this.element.removeAttr( "role" ); 4353 if ( this.options.items.controlgroupLabel ) { 4354 this.element 4355 .find( this.options.items.controlgroupLabel ) 4356 .find( ".ui-controlgroup-label-contents" ) 4357 .contents().unwrap(); 4358 } 4359 }, 4360 4361 _initWidgets: function() { 4362 var that = this, 4363 childWidgets = []; 4364 4365 // First we iterate over each of the items options 4366 $.each( this.options.items, function( widget, selector ) { 4367 var labels; 4368 var options = {}; 4369 4370 // Make sure the widget has a selector set 4371 if ( !selector ) { 4372 return; 4373 } 4374 4375 if ( widget === "controlgroupLabel" ) { 4376 labels = that.element.find( selector ); 4377 labels.each( function() { 4378 var element = $( this ); 4379 4380 if ( element.children( ".ui-controlgroup-label-contents" ).length ) { 4381 return; 4382 } 4383 element.contents() 4384 .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" ); 4385 } ); 4386 that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); 4387 childWidgets = childWidgets.concat( labels.get() ); 4388 return; 4389 } 4390 4391 // Make sure the widget actually exists 4392 if ( !$.fn[ widget ] ) { 4393 return; 4394 } 4395 4396 // We assume everything is in the middle to start because we can't determine 4397 // first / last elements until all enhancments are done. 4398 if ( that[ "_" + widget + "Options" ] ) { 4399 options = that[ "_" + widget + "Options" ]( "middle" ); 4400 } else { 4401 options = { classes: {} }; 4402 } 4403 4404 // Find instances of this widget inside controlgroup and init them 4405 that.element 4406 .find( selector ) 4407 .each( function() { 4408 var element = $( this ); 4409 var instance = element[ widget ]( "instance" ); 4410 4411 // We need to clone the default options for this type of widget to avoid 4412 // polluting the variable options which has a wider scope than a single widget. 4413 var instanceOptions = $.widget.extend( {}, options ); 4414 4415 // If the button is the child of a spinner ignore it 4416 // TODO: Find a more generic solution 4417 if ( widget === "button" && element.parent( ".ui-spinner" ).length ) { 4418 return; 4419 } 4420 4421 // Create the widget if it doesn't exist 4422 if ( !instance ) { 4423 instance = element[ widget ]()[ widget ]( "instance" ); 4424 } 4425 if ( instance ) { 4426 instanceOptions.classes = 4427 that._resolveClassesValues( instanceOptions.classes, instance ); 4428 } 4429 element[ widget ]( instanceOptions ); 4430 4431 // Store an instance of the controlgroup to be able to reference 4432 // from the outermost element for changing options and refresh 4433 var widgetElement = element[ widget ]( "widget" ); 4434 $.data( widgetElement[ 0 ], "ui-controlgroup-data", 4435 instance ? instance : element[ widget ]( "instance" ) ); 4436 4437 childWidgets.push( widgetElement[ 0 ] ); 4438 } ); 4439 } ); 4440 4441 this.childWidgets = $( $.uniqueSort( childWidgets ) ); 4442 this._addClass( this.childWidgets, "ui-controlgroup-item" ); 4443 }, 4444 4445 _callChildMethod: function( method ) { 4446 this.childWidgets.each( function() { 4447 var element = $( this ), 4448 data = element.data( "ui-controlgroup-data" ); 4449 if ( data && data[ method ] ) { 4450 data[ method ](); 4451 } 4452 } ); 4453 }, 4454 4455 _updateCornerClass: function( element, position ) { 4456 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 4457 var add = this._buildSimpleOptions( position, "label" ).classes.label; 4458 4459 this._removeClass( element, null, remove ); 4460 this._addClass( element, null, add ); 4461 }, 4462 4463 _buildSimpleOptions: function( position, key ) { 4464 var direction = this.options.direction === "vertical"; 4465 var result = { 4466 classes: {} 4467 }; 4468 result.classes[ key ] = { 4469 "middle": "", 4470 "first": "ui-corner-" + ( direction ? "top" : "left" ), 4471 "last": "ui-corner-" + ( direction ? "bottom" : "right" ), 4472 "only": "ui-corner-all" 4473 }[ position ]; 4474 4475 return result; 4476 }, 4477 4478 _spinnerOptions: function( position ) { 4479 var options = this._buildSimpleOptions( position, "ui-spinner" ); 4480 4481 options.classes[ "ui-spinner-up" ] = ""; 4482 options.classes[ "ui-spinner-down" ] = ""; 4483 4484 return options; 4485 }, 4486 4487 _buttonOptions: function( position ) { 4488 return this._buildSimpleOptions( position, "ui-button" ); 4489 }, 4490 4491 _checkboxradioOptions: function( position ) { 4492 return this._buildSimpleOptions( position, "ui-checkboxradio-label" ); 4493 }, 4494 4495 _selectmenuOptions: function( position ) { 4496 var direction = this.options.direction === "vertical"; 4497 return { 4498 width: direction ? "auto" : false, 4499 classes: { 4500 middle: { 4501 "ui-selectmenu-button-open": "", 4502 "ui-selectmenu-button-closed": "" 4503 }, 4504 first: { 4505 "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ), 4506 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" ) 4507 }, 4508 last: { 4509 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 4510 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" ) 4511 }, 4512 only: { 4513 "ui-selectmenu-button-open": "ui-corner-top", 4514 "ui-selectmenu-button-closed": "ui-corner-all" 4515 } 4516 4517 }[ position ] 4518 }; 4519 }, 4520 4521 _resolveClassesValues: function( classes, instance ) { 4522 var result = {}; 4523 $.each( classes, function( key ) { 4524 var current = instance.options.classes[ key ] || ""; 4525 current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) ); 4526 result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " ); 4527 } ); 4528 return result; 4529 }, 4530 4531 _setOption: function( key, value ) { 4532 if ( key === "direction" ) { 4533 this._removeClass( "ui-controlgroup-" + this.options.direction ); 4534 } 4535 4536 this._super( key, value ); 4537 if ( key === "disabled" ) { 4538 this._callChildMethod( value ? "disable" : "enable" ); 4539 return; 4540 } 4541 4542 this.refresh(); 4543 }, 4544 4545 refresh: function() { 4546 var children, 4547 that = this; 4548 4549 this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction ); 4550 4551 if ( this.options.direction === "horizontal" ) { 4552 this._addClass( null, "ui-helper-clearfix" ); 4553 } 4554 this._initWidgets(); 4555 4556 children = this.childWidgets; 4557 4558 // We filter here because we need to track all childWidgets not just the visible ones 4559 if ( this.options.onlyVisible ) { 4560 children = children.filter( ":visible" ); 4561 } 4562 4563 if ( children.length ) { 4564 4565 // We do this last because we need to make sure all enhancment is done 4566 // before determining first and last 4567 $.each( [ "first", "last" ], function( index, value ) { 4568 var instance = children[ value ]().data( "ui-controlgroup-data" ); 4569 4570 if ( instance && that[ "_" + instance.widgetName + "Options" ] ) { 4571 var options = that[ "_" + instance.widgetName + "Options" ]( 4572 children.length === 1 ? "only" : value 4573 ); 4574 options.classes = that._resolveClassesValues( options.classes, instance ); 4575 instance.element[ instance.widgetName ]( options ); 4576 } else { 4577 that._updateCornerClass( children[ value ](), value ); 4578 } 4579 } ); 4580 4581 // Finally call the refresh method on each of the child widgets. 4582 this._callChildMethod( "refresh" ); 4583 } 4584 } 4585} ); 4586 4587/*! 4588 * jQuery UI Checkboxradio 1.14.
vendor: 7,789 bytes, lines 4588-4878
45880 4589 * https://jqueryui.com 4590 * 4591 * Copyright OpenJS Foundation and other contributors 4592 * Released under the MIT license. 4593 * https://jquery.org/license 4594 */ 4595 4596//>>label: Checkboxradio 4597//>>group: Widgets 4598//>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 4599//>>docs: https://api.jqueryui.com/checkboxradio/ 4600//>>demos: https://jqueryui.com/checkboxradio/ 4601//>>css.structure: ../../themes/base/core.css 4602//>>css.structure: ../../themes/base/button.css 4603//>>css.structure: ../../themes/base/checkboxradio.css 4604//>>css.theme: ../../themes/base/theme.css 4605 4606 4607$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { 4608 version: "1.14.0", 4609 options: { 4610 disabled: null, 4611 label: null, 4612 icon: true, 4613 classes: { 4614 "ui-checkboxradio-label": "ui-corner-all", 4615 "ui-checkboxradio-icon": "ui-corner-all" 4616 } 4617 }, 4618 4619 _getCreateOptions: function() { 4620 var disabled, labels, labelContents; 4621 var options = this._super() || {}; 4622 4623 // We read the type here, because it makes more sense to throw a element type error first, 4624 // rather then the error for lack of a label. Often if its the wrong type, it 4625 // won't have a label (e.g. calling on a div, btn, etc) 4626 this._readType(); 4627 4628 labels = this.element.labels(); 4629 4630 // If there are multiple labels, use the last one 4631 this.label = $( labels[ labels.length - 1 ] ); 4632 if ( !this.label.length ) { 4633 $.error( "No label found for checkboxradio widget" ); 4634 } 4635 4636 this.originalLabel = ""; 4637 4638 // We need to get the label text but this may also need to make sure it does not contain the 4639 // input itself. 4640 // The label contents could be text, html, or a mix. We wrap all elements 4641 // and read the wrapper's `innerHTML` to get a string representation of 4642 // the label, without the input as part of it. 4643 labelContents = this.label.contents().not( this.element[ 0 ] ); 4644 4645 if ( labelContents.length ) { 4646 this.originalLabel += labelContents 4647 .clone() 4648 .wrapAll( "<div></div>" ) 4649 .parent() 4650 .html(); 4651 } 4652 4653 // Set the label option if we found label text 4654 if ( this.originalLabel ) { 4655 options.label = this.originalLabel; 4656 } 4657 4658 disabled = this.element[ 0 ].disabled; 4659 if ( disabled != null ) { 4660 options.disabled = disabled; 4661 } 4662 return options; 4663 }, 4664 4665 _create: function() { 4666 var checked = this.element[ 0 ].checked; 4667 4668 this._bindFormResetHandler(); 4669 4670 if ( this.options.disabled == null ) { 4671 this.options.disabled = this.element[ 0 ].disabled; 4672 } 4673 4674 this._setOption( "disabled", this.options.disabled ); 4675 this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" ); 4676 this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" ); 4677 4678 if ( this.type === "radio" ) { 4679 this._addClass( this.label, "ui-checkboxradio-radio-label" ); 4680 } 4681 4682 if ( this.options.label && this.options.label !== this.originalLabel ) { 4683 this._updateLabel(); 4684 } else if ( this.originalLabel ) { 4685 this.options.label = this.originalLabel; 4686 } 4687 4688 this._enhance(); 4689 4690 if ( checked ) { 4691 this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); 4692 } 4693 4694 this._on( { 4695 change: "_toggleClasses", 4696 focus: function() { 4697 this._addClass( this.label, null, "ui-state-focus ui-visual-focus" ); 4698 }, 4699 blur: function() { 4700 this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" ); 4701 } 4702 } ); 4703 }, 4704 4705 _readType: function() { 4706 var nodeName = this.element[ 0 ].nodeName.toLowerCase(); 4707 this.type = this.element[ 0 ].type; 4708 if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) { 4709 $.error( "Can't create checkboxradio on element.nodeName=" + nodeName + 4710 " and element.type=" + this.type ); 4711 } 4712 }, 4713 4714 // Support jQuery Mobile enhanced option 4715 _enhance: function() { 4716 this._updateIcon( this.element[ 0 ].checked ); 4717 }, 4718 4719 widget: function() { 4720 return this.label; 4721 }, 4722 4723 _getRadioGroup: function() { 4724 var group; 4725 var name = this.element[ 0 ].name; 4726 var nameSelector = "input[name='" + CSS.escape( name ) + "']"; 4727 4728 if ( !name ) { 4729 return $( [] ); 4730 } 4731 4732 if ( this.form.length ) { 4733 group = $( this.form[ 0 ].elements ).filter( nameSelector ); 4734 } else { 4735 4736 // Not inside a form, check all inputs that also are not inside a form 4737 group = $( nameSelector ).filter( function() { 4738 return $( $( this ).prop( "form" ) ).length === 0; 4739 } ); 4740 } 4741 4742 return group.not( this.element ); 4743 }, 4744 4745 _toggleClasses: function() { 4746 var checked = this.element[ 0 ].checked; 4747 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 4748 4749 if ( this.options.icon && this.type === "checkbox" ) { 4750 this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked ) 4751 ._toggleClass( this.icon, null, "ui-icon-blank", !checked ); 4752 } 4753 4754 if ( this.type === "radio" ) { 4755 this._getRadioGroup() 4756 .each( function() { 4757 var instance = $( this ).checkboxradio( "instance" ); 4758 4759 if ( instance ) { 4760 instance._removeClass( instance.label, 4761 "ui-checkboxradio-checked", "ui-state-active" ); 4762 } 4763 } ); 4764 } 4765 }, 4766 4767 _destroy: function() { 4768 this._unbindFormResetHandler(); 4769 4770 if ( this.icon ) { 4771 this.icon.remove(); 4772 this.iconSpace.remove(); 4773 } 4774 }, 4775 4776 _setOption: function( key, value ) { 4777 4778 // We don't allow the value to be set to nothing 4779 if ( key === "label" && !value ) { 4780 return; 4781 } 4782 4783 this._super( key, value ); 4784 4785 if ( key === "disabled" ) { 4786 this._toggleClass( this.label, null, "ui-state-disabled", value ); 4787 this.element[ 0 ].disabled = value; 4788 4789 // Don't refresh when setting disabled 4790 return; 4791 } 4792 this.refresh(); 4793 }, 4794 4795 _updateIcon: function( checked ) { 4796 var toAdd = "ui-icon ui-icon-background "; 4797 4798 if ( this.options.icon ) { 4799 if ( !this.icon ) { 4800 this.icon = $( "<span>" ); 4801 this.iconSpace = $( "<span> </span>" ); 4802 this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" ); 4803 } 4804 4805 if ( this.type === "checkbox" ) { 4806 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 4807 this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" ); 4808 } else { 4809 toAdd += "ui-icon-blank"; 4810 } 4811 this._addClass( this.icon, "ui-checkboxradio-icon", toAdd ); 4812 if ( !checked ) { 4813 this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" ); 4814 } 4815 this.icon.prependTo( this.label ).after( this.iconSpace ); 4816 } else if ( this.icon !== undefined ) { 4817 this.icon.remove(); 4818 this.iconSpace.remove(); 4819 delete this.icon; 4820 } 4821 }, 4822 4823 _updateLabel: function() { 4824 4825 // Remove the contents of the label ( minus the icon, icon space, and input ) 4826 var contents = this.label.contents().not( this.element[ 0 ] ); 4827 if ( this.icon ) { 4828 contents = contents.not( this.icon[ 0 ] ); 4829 } 4830 if ( this.iconSpace ) { 4831 contents = contents.not( this.iconSpace[ 0 ] ); 4832 } 4833 contents.remove(); 4834 4835 this.label.append( this.options.label ); 4836 }, 4837 4838 refresh: function() { 4839 var checked = this.element[ 0 ].checked, 4840 isDisabled = this.element[ 0 ].disabled; 4841 4842 this._updateIcon( checked ); 4843 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 4844 if ( this.options.label !== null ) { 4845 this._updateLabel(); 4846 } 4847 4848 if ( isDisabled !== this.options.disabled ) { 4849 this._setOptions( { "disabled": isDisabled } ); 4850 } 4851 } 4852 4853} ] ); 4854 4855var widgetsCheckboxradio = $.ui.checkboxradio; 4856 4857 4858/*! 4859 * jQuery UI Button 1.14.0 4860 * https://jqueryui.com 4861 * 4862 * Copyright OpenJS Foundation and other contributors 4863 * Released under the MIT license. 4864 * https://jquery.org/license 4865 */ 4866 4867//>>label: Button 4868//>>group: Widgets 4869//>>description: Enhances a form with themeable buttons. 4870//>>docs: https://api.jqueryui.com/button/ 4871//>>demos: https://jqueryui.com/button/ 4872//>>css.structure: ../../themes/base/core.css 4873//>>css.structure: ../../themes/base/button.css 4874//>>css.theme: ../../themes/base/theme.css 4875 4876 4877$.widget( "ui.button", { 4878 version: "1.14.0
vendor: 10,731 bytes, lines 4878-5283
4878", 4879 defaultElement: "<button>", 4880 options: { 4881 classes: { 4882 "ui-button": "ui-corner-all" 4883 }, 4884 disabled: null, 4885 icon: null, 4886 iconPosition: "beginning", 4887 label: null, 4888 showLabel: true 4889 }, 4890 4891 _getCreateOptions: function() { 4892 var disabled, 4893 4894 // This is to support cases like in jQuery Mobile where the base widget does have 4895 // an implementation of _getCreateOptions 4896 options = this._super() || {}; 4897 4898 this.isInput = this.element.is( "input" ); 4899 4900 disabled = this.element[ 0 ].disabled; 4901 if ( disabled != null ) { 4902 options.disabled = disabled; 4903 } 4904 4905 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 4906 if ( this.originalLabel ) { 4907 options.label = this.originalLabel; 4908 } 4909 4910 return options; 4911 }, 4912 4913 _create: function() { 4914 if ( !this.option.showLabel & !this.options.icon ) { 4915 this.options.showLabel = true; 4916 } 4917 4918 // We have to check the option again here even though we did in _getCreateOptions, 4919 // because null may have been passed on init which would override what was set in 4920 // _getCreateOptions 4921 if ( this.options.disabled == null ) { 4922 this.options.disabled = this.element[ 0 ].disabled || false; 4923 } 4924 4925 this.hasTitle = !!this.element.attr( "title" ); 4926 4927 // Check to see if the label needs to be set or if its already correct 4928 if ( this.options.label && this.options.label !== this.originalLabel ) { 4929 if ( this.isInput ) { 4930 this.element.val( this.options.label ); 4931 } else { 4932 this.element.html( this.options.label ); 4933 } 4934 } 4935 this._addClass( "ui-button", "ui-widget" ); 4936 this._setOption( "disabled", this.options.disabled ); 4937 this._enhance(); 4938 4939 if ( this.element.is( "a" ) ) { 4940 this._on( { 4941 "keyup": function( event ) { 4942 if ( event.keyCode === $.ui.keyCode.SPACE ) { 4943 event.preventDefault(); 4944 4945 // If a native click is available use it, so we 4946 // actually cause navigation. Otherwise, just trigger 4947 // a click event. 4948 if ( this.element[ 0 ].click ) { 4949 this.element[ 0 ].click(); 4950 } else { 4951 this.element.trigger( "click" ); 4952 } 4953 } 4954 } 4955 } ); 4956 } 4957 }, 4958 4959 _enhance: function() { 4960 if ( !this.element.is( "button" ) ) { 4961 this.element.attr( "role", "button" ); 4962 } 4963 4964 if ( this.options.icon ) { 4965 this._updateIcon( "icon", this.options.icon ); 4966 this._updateTooltip(); 4967 } 4968 }, 4969 4970 _updateTooltip: function() { 4971 this.title = this.element.attr( "title" ); 4972 4973 if ( !this.options.showLabel && !this.title ) { 4974 this.element.attr( "title", this.options.label ); 4975 } 4976 }, 4977 4978 _updateIcon: function( option, value ) { 4979 var icon = option !== "iconPosition", 4980 position = icon ? this.options.iconPosition : value, 4981 displayBlock = position === "top" || position === "bottom"; 4982 4983 // Create icon 4984 if ( !this.icon ) { 4985 this.icon = $( "<span>" ); 4986 4987 this._addClass( this.icon, "ui-button-icon", "ui-icon" ); 4988 4989 if ( !this.options.showLabel ) { 4990 this._addClass( "ui-button-icon-only" ); 4991 } 4992 } else if ( icon ) { 4993 4994 // If we are updating the icon remove the old icon class 4995 this._removeClass( this.icon, null, this.options.icon ); 4996 } 4997 4998 // If we are updating the icon add the new icon class 4999 if ( icon ) { 5000 this._addClass( this.icon, null, value ); 5001 } 5002 5003 this._attachIcon( position ); 5004 5005 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 5006 // the iconSpace if there is one. 5007 if ( displayBlock ) { 5008 this._addClass( this.icon, null, "ui-widget-icon-block" ); 5009 if ( this.iconSpace ) { 5010 this.iconSpace.remove(); 5011 } 5012 } else { 5013 5014 // Position is beginning or end so remove the ui-widget-icon-block class and add the 5015 // space if it does not exist 5016 if ( !this.iconSpace ) { 5017 this.iconSpace = $( "<span> </span>" ); 5018 this._addClass( this.iconSpace, "ui-button-icon-space" ); 5019 } 5020 this._removeClass( this.icon, null, "ui-wiget-icon-block" ); 5021 this._attachIconSpace( position ); 5022 } 5023 }, 5024 5025 _destroy: function() { 5026 this.element.removeAttr( "role" ); 5027 5028 if ( this.icon ) { 5029 this.icon.remove(); 5030 } 5031 if ( this.iconSpace ) { 5032 this.iconSpace.remove(); 5033 } 5034 if ( !this.hasTitle ) { 5035 this.element.removeAttr( "title" ); 5036 } 5037 }, 5038 5039 _attachIconSpace: function( iconPosition ) { 5040 this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace ); 5041 }, 5042 5043 _attachIcon: function( iconPosition ) { 5044 this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon ); 5045 }, 5046 5047 _setOptions: function( options ) { 5048 var newShowLabel = options.showLabel === undefined ? 5049 this.options.showLabel : 5050 options.showLabel, 5051 newIcon = options.icon === undefined ? this.options.icon : options.icon; 5052 5053 if ( !newShowLabel && !newIcon ) { 5054 options.showLabel = true; 5055 } 5056 this._super( options ); 5057 }, 5058 5059 _setOption: function( key, value ) { 5060 if ( key === "icon" ) { 5061 if ( value ) { 5062 this._updateIcon( key, value ); 5063 } else if ( this.icon ) { 5064 this.icon.remove(); 5065 if ( this.iconSpace ) { 5066 this.iconSpace.remove(); 5067 } 5068 } 5069 } 5070 5071 if ( key === "iconPosition" ) { 5072 this._updateIcon( key, value ); 5073 } 5074 5075 // Make sure we can't end up with a button that has neither text nor icon 5076 if ( key === "showLabel" ) { 5077 this._toggleClass( "ui-button-icon-only", null, !value ); 5078 this._updateTooltip(); 5079 } 5080 5081 if ( key === "label" ) { 5082 if ( this.isInput ) { 5083 this.element.val( value ); 5084 } else { 5085 5086 // If there is an icon, append it, else nothing then append the value 5087 // this avoids removal of the icon when setting label text 5088 this.element.html( value ); 5089 if ( this.icon ) { 5090 this._attachIcon( this.options.iconPosition ); 5091 this._attachIconSpace( this.options.iconPosition ); 5092 } 5093 } 5094 } 5095 5096 this._super( key, value ); 5097 5098 if ( key === "disabled" ) { 5099 this._toggleClass( null, "ui-state-disabled", value ); 5100 this.element[ 0 ].disabled = value; 5101 if ( value ) { 5102 this.element.trigger( "blur" ); 5103 } 5104 } 5105 }, 5106 5107 refresh: function() { 5108 5109 // Make sure to only check disabled if its an element that supports this otherwise 5110 // check for the disabled class to determine state 5111 var isDisabled = this.element.is( "input, button" ) ? 5112 this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" ); 5113 5114 if ( isDisabled !== this.options.disabled ) { 5115 this._setOptions( { disabled: isDisabled } ); 5116 } 5117 5118 this._updateTooltip(); 5119 } 5120} ); 5121 5122// DEPRECATED 5123if ( $.uiBackCompat === true ) { 5124 5125 // Text and Icons options 5126 $.widget( "ui.button", $.ui.button, { 5127 options: { 5128 text: true, 5129 icons: { 5130 primary: null, 5131 secondary: null 5132 } 5133 }, 5134 5135 _create: function() { 5136 if ( this.options.showLabel && !this.options.text ) { 5137 this.options.showLabel = this.options.text; 5138 } 5139 if ( !this.options.showLabel && this.options.text ) { 5140 this.options.text = this.options.showLabel; 5141 } 5142 if ( !this.options.icon && ( this.options.icons.primary || 5143 this.options.icons.secondary ) ) { 5144 if ( this.options.icons.primary ) { 5145 this.options.icon = this.options.icons.primary; 5146 } else { 5147 this.options.icon = this.options.icons.secondary; 5148 this.options.iconPosition = "end"; 5149 } 5150 } else if ( this.options.icon ) { 5151 this.options.icons.primary = this.options.icon; 5152 } 5153 this._super(); 5154 }, 5155 5156 _setOption: function( key, value ) { 5157 if ( key === "text" ) { 5158 this._super( "showLabel", value ); 5159 return; 5160 } 5161 if ( key === "showLabel" ) { 5162 this.options.text = value; 5163 } 5164 if ( key === "icon" ) { 5165 this.options.icons.primary = value; 5166 } 5167 if ( key === "icons" ) { 5168 if ( value.primary ) { 5169 this._super( "icon", value.primary ); 5170 this._super( "iconPosition", "beginning" ); 5171 } else if ( value.secondary ) { 5172 this._super( "icon", value.secondary ); 5173 this._super( "iconPosition", "end" ); 5174 } 5175 } 5176 this._superApply( arguments ); 5177 } 5178 } ); 5179 5180 $.fn.button = ( function( orig ) { 5181 return function( options ) { 5182 var isMethodCall = typeof options === "string"; 5183 var args = Array.prototype.slice.call( arguments, 1 ); 5184 var returnValue = this; 5185 5186 if ( isMethodCall ) { 5187 5188 // If this is an empty collection, we need to have the instance method 5189 // return undefined instead of the jQuery instance 5190 if ( !this.length && options === "instance" ) { 5191 returnValue = undefined; 5192 } else { 5193 this.each( function() { 5194 var methodValue; 5195 var type = $( this ).attr( "type" ); 5196 var name = type !== "checkbox" && type !== "radio" ? 5197 "button" : 5198 "checkboxradio"; 5199 var instance = $.data( this, "ui-" + name ); 5200 5201 if ( options === "instance" ) { 5202 returnValue = instance; 5203 return false; 5204 } 5205 5206 if ( !instance ) { 5207 return $.error( "cannot call methods on button" + 5208 " prior to initialization; " + 5209 "attempted to call method '" + options + "'" ); 5210 } 5211 5212 if ( typeof instance[ options ] !== "function" || 5213 options.charAt( 0 ) === "_" ) { 5214 return $.error( "no such method '" + options + "' for button" + 5215 " widget instance" ); 5216 } 5217 5218 methodValue = instance[ options ].apply( instance, args ); 5219 5220 if ( methodValue !== instance && methodValue !== undefined ) { 5221 returnValue = methodValue && methodValue.jquery ? 5222 returnValue.pushStack( methodValue.get() ) : 5223 methodValue; 5224 return false; 5225 } 5226 } ); 5227 } 5228 } else { 5229 5230 // Allow multiple hashes to be passed on init 5231 if ( args.length ) { 5232 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 5233 } 5234 5235 this.each( function() { 5236 var type = $( this ).attr( "type" ); 5237 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 5238 var instance = $.data( this, "ui-" + name ); 5239 5240 if ( instance ) { 5241 instance.option( options || {} ); 5242 if ( instance._init ) { 5243 instance._init(); 5244 } 5245 } else { 5246 if ( name === "button" ) { 5247 orig.call( $( this ), options ); 5248 return; 5249 } 5250 5251 $( this ).checkboxradio( $.extend( { icon: false }, options ) ); 5252 } 5253 } ); 5254 } 5255 5256 return returnValue; 5257 }; 5258 } )( $.fn.button ); 5259 5260 $.fn.buttonset = function() { 5261 if ( !$.ui.controlgroup ) { 5262 $.error( "Controlgroup widget missing" ); 5263 } 5264 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) { 5265 return this.controlgroup.apply( this, 5266 [ arguments[ 0 ], "items.button", arguments[ 2 ] ] ); 5267 } 5268 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) { 5269 return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] ); 5270 } 5271 if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) { 5272 arguments[ 0 ].items = { 5273 button: arguments[ 0 ].items 5274 }; 5275 } 5276 return this.controlgroup.apply( this, arguments ); 5277 }; 5278} 5279 5280var widgetsButton = $.ui.button; 5281 5282 5283/*
vendor: 1,231 bytes, lines 5283-5338
5283! 5284 * jQuery UI Dialog 1.14.0 5285 * https://jqueryui.com 5286 * 5287 * Copyright OpenJS Foundation and other contributors 5288 * Released under the MIT license. 5289 * https://jquery.org/license 5290 */ 5291 5292//>>label: Dialog 5293//>>group: Widgets 5294//>>description: Displays customizable dialog windows. 5295//>>docs: https://api.jqueryui.com/dialog/ 5296//>>demos: https://jqueryui.com/dialog/ 5297//>>css.structure: ../../themes/base/core.css 5298//>>css.structure: ../../themes/base/dialog.css 5299//>>css.theme: ../../themes/base/theme.css 5300 5301 5302$.widget( "ui.dialog", { 5303 version: "1.14.0", 5304 options: { 5305 appendTo: "body", 5306 autoOpen: true, 5307 buttons: [], 5308 classes: { 5309 "ui-dialog": "ui-corner-all", 5310 "ui-dialog-titlebar": "ui-corner-all" 5311 }, 5312 closeOnEscape: true, 5313 closeText: "Close", 5314 draggable: true, 5315 hide: null, 5316 height: "auto", 5317 maxHeight: null, 5318 maxWidth: null, 5319 minHeight: 150, 5320 minWidth: 150, 5321 modal: false, 5322 position: { 5323 my: "center", 5324 at: "center", 5325 of: window, 5326 collision: "fit", 5327 5328 // Ensure the titlebar is always visible 5329 using: function( pos ) { 5330 var topOffset = $( this ).css( pos ).offset().top; 5331 if ( topOffset < 0 ) { 5332 $( this ).css( "top", pos.top - topOffset ); 5333 } 5334 } 5335 }, 5336 resizable: true, 5337 show: null, 5338 title: null
vendor: 8,955 bytes, lines 5338-5695
5338, 5339 width: 300, 5340 5341 // Callbacks 5342 beforeClose: null, 5343 close: null, 5344 drag: null, 5345 dragStart: null, 5346 dragStop: null, 5347 focus: null, 5348 open: null, 5349 resize: null, 5350 resizeStart: null, 5351 resizeStop: null 5352 }, 5353 5354 sizeRelatedOptions: { 5355 buttons: true, 5356 height: true, 5357 maxHeight: true, 5358 maxWidth: true, 5359 minHeight: true, 5360 minWidth: true, 5361 width: true 5362 }, 5363 5364 resizableRelatedOptions: { 5365 maxHeight: true, 5366 maxWidth: true, 5367 minHeight: true, 5368 minWidth: true 5369 }, 5370 5371 _create: function() { 5372 this.originalCss = { 5373 display: this.element[ 0 ].style.display, 5374 width: this.element[ 0 ].style.width, 5375 minHeight: this.element[ 0 ].style.minHeight, 5376 maxHeight: this.element[ 0 ].style.maxHeight, 5377 height: this.element[ 0 ].style.height 5378 }; 5379 this.originalPosition = { 5380 parent: this.element.parent(), 5381 index: this.element.parent().children().index( this.element ) 5382 }; 5383 this.originalTitle = this.element.attr( "title" ); 5384 if ( this.options.title == null && this.originalTitle != null ) { 5385 this.options.title = this.originalTitle; 5386 } 5387 5388 // Dialogs can't be disabled 5389 if ( this.options.disabled ) { 5390 this.options.disabled = false; 5391 } 5392 5393 this._createWrapper(); 5394 5395 this.element 5396 .show() 5397 .removeAttr( "title" ) 5398 .appendTo( this.uiDialog ); 5399 5400 this._addClass( "ui-dialog-content", "ui-widget-content" ); 5401 5402 this._createTitlebar(); 5403 this._createButtonPane(); 5404 5405 if ( this.options.draggable && $.fn.draggable ) { 5406 this._makeDraggable(); 5407 } 5408 if ( this.options.resizable && $.fn.resizable ) { 5409 this._makeResizable(); 5410 } 5411 5412 this._isOpen = false; 5413 5414 this._trackFocus(); 5415 }, 5416 5417 _init: function() { 5418 if ( this.options.autoOpen ) { 5419 this.open(); 5420 } 5421 }, 5422 5423 _appendTo: function() { 5424 var element = this.options.appendTo; 5425 if ( element && ( element.jquery || element.nodeType ) ) { 5426 return $( element ); 5427 } 5428 return this.document.find( element || "body" ).eq( 0 ); 5429 }, 5430 5431 _destroy: function() { 5432 var next, 5433 originalPosition = this.originalPosition; 5434 5435 this._untrackInstance(); 5436 this._destroyOverlay(); 5437 5438 this.element 5439 .removeUniqueId() 5440 .css( this.originalCss ) 5441 5442 // Without detaching first, the following becomes really slow 5443 .detach(); 5444 5445 this.uiDialog.remove(); 5446 5447 if ( this.originalTitle ) { 5448 this.element.attr( "title", this.originalTitle ); 5449 } 5450 5451 next = originalPosition.parent.children().eq( originalPosition.index ); 5452 5453 // Don't try to place the dialog next to itself (#8613) 5454 if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { 5455 next.before( this.element ); 5456 } else { 5457 originalPosition.parent.append( this.element ); 5458 } 5459 }, 5460 5461 widget: function() { 5462 return this.uiDialog; 5463 }, 5464 5465 disable: $.noop, 5466 enable: $.noop, 5467 5468 close: function( event ) { 5469 var that = this; 5470 5471 if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { 5472 return; 5473 } 5474 5475 this._isOpen = false; 5476 this._focusedElement = null; 5477 this._destroyOverlay(); 5478 this._untrackInstance(); 5479 5480 if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) { 5481 5482 // Hiding a focused element doesn't trigger blur in WebKit 5483 // so in case we have nothing to focus on, explicitly blur the active element 5484 // https://bugs.webkit.org/show_bug.cgi?id=47182 5485 $( this.document[ 0 ].activeElement ).trigger( "blur" ); 5486 } 5487 5488 this._hide( this.uiDialog, this.options.hide, function() { 5489 that._trigger( "close", event ); 5490 } ); 5491 }, 5492 5493 isOpen: function() { 5494 return this._isOpen; 5495 }, 5496 5497 moveToTop: function() { 5498 this._moveToTop(); 5499 }, 5500 5501 _moveToTop: function( event, silent ) { 5502 var moved = false, 5503 zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() { 5504 return +$( this ).css( "z-index" ); 5505 } ).get(), 5506 zIndexMax = Math.max.apply( null, zIndices ); 5507 5508 if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { 5509 this.uiDialog.css( "z-index", zIndexMax + 1 ); 5510 moved = true; 5511 } 5512 5513 if ( moved && !silent ) { 5514 this._trigger( "focus", event ); 5515 } 5516 return moved; 5517 }, 5518 5519 open: function() { 5520 var that = this; 5521 if ( this._isOpen ) { 5522 if ( this._moveToTop() ) { 5523 this._focusTabbable(); 5524 } 5525 return; 5526 } 5527 5528 this._isOpen = true; 5529 this.opener = $( this.document[ 0 ].activeElement ); 5530 5531 this._size(); 5532 this._position(); 5533 this._createOverlay(); 5534 this._moveToTop( null, true ); 5535 5536 // Ensure the overlay is moved to the top with the dialog, but only when 5537 // opening. The overlay shouldn't move after the dialog is open so that 5538 // modeless dialogs opened after the modal dialog stack properly. 5539 if ( this.overlay ) { 5540 this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); 5541 } 5542 5543 this._show( this.uiDialog, this.options.show, function() { 5544 that._focusTabbable(); 5545 that._trigger( "focus" ); 5546 } ); 5547 5548 // Track the dialog immediately upon opening in case a focus event 5549 // somehow occurs outside of the dialog before an element inside the 5550 // dialog is focused (#10152) 5551 this._makeFocusTarget(); 5552 5553 this._trigger( "open" ); 5554 }, 5555 5556 _focusTabbable: function() { 5557 5558 // Set focus to the first match: 5559 // 1. An element that was focused previously 5560 // 2. First element inside the dialog matching [autofocus] 5561 // 3. Tabbable element inside the content element 5562 // 4. Tabbable element inside the buttonpane 5563 // 5. The close button 5564 // 6. The dialog itself 5565 var hasFocus = this._focusedElement; 5566 if ( !hasFocus ) { 5567 hasFocus = this.element.find( "[autofocus]" ); 5568 } 5569 if ( !hasFocus.length ) { 5570 hasFocus = this.element.find( ":tabbable" ); 5571 } 5572 if ( !hasFocus.length ) { 5573 hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); 5574 } 5575 if ( !hasFocus.length ) { 5576 hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); 5577 } 5578 if ( !hasFocus.length ) { 5579 hasFocus = this.uiDialog; 5580 } 5581 hasFocus.eq( 0 ).trigger( "focus" ); 5582 }, 5583 5584 _restoreTabbableFocus: function() { 5585 var activeElement = this.document[ 0 ].activeElement, 5586 isActive = this.uiDialog[ 0 ] === activeElement || 5587 $.contains( this.uiDialog[ 0 ], activeElement ); 5588 if ( !isActive ) { 5589 this._focusTabbable(); 5590 } 5591 }, 5592 5593 _keepFocus: function( event ) { 5594 event.preventDefault(); 5595 this._restoreTabbableFocus(); 5596 }, 5597 5598 _createWrapper: function() { 5599 this.uiDialog = $( "<div>" ) 5600 .hide() 5601 .attr( { 5602 5603 // Setting tabIndex makes the div focusable 5604 tabIndex: -1, 5605 role: "dialog", 5606 "aria-modal": this.options.modal ? "true" : null 5607 } ) 5608 .appendTo( this._appendTo() ); 5609 5610 this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" ); 5611 this._on( this.uiDialog, { 5612 keydown: function( event ) { 5613 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 5614 event.keyCode === $.ui.keyCode.ESCAPE ) { 5615 event.preventDefault(); 5616 this.close( event ); 5617 return; 5618 } 5619 5620 // Prevent tabbing out of dialogs 5621 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { 5622 return; 5623 } 5624 var tabbables = this.uiDialog.find( ":tabbable" ), 5625 first = tabbables.first(), 5626 last = tabbables.last(); 5627 5628 if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) && 5629 !event.shiftKey ) { 5630 this._delay( function() { 5631 first.trigger( "focus" ); 5632 } ); 5633 event.preventDefault(); 5634 } else if ( ( event.target === first[ 0 ] || 5635 event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) { 5636 this._delay( function() { 5637 last.trigger( "focus" ); 5638 } ); 5639 event.preventDefault(); 5640 } 5641 }, 5642 mousedown: function( event ) { 5643 if ( this._moveToTop( event ) ) { 5644 this._focusTabbable(); 5645 } 5646 } 5647 } ); 5648 5649 // We assume that any existing aria-describedby attribute means 5650 // that the dialog content is marked up properly 5651 // otherwise we brute force the content as the description 5652 if ( !this.element.find( "[aria-describedby]" ).length ) { 5653 this.uiDialog.attr( { 5654 "aria-describedby": this.element.uniqueId().attr( "id" ) 5655 } ); 5656 } 5657 }, 5658 5659 _createTitlebar: function() { 5660 var uiDialogTitle; 5661 5662 this.uiDialogTitlebar = $( "<div>" ); 5663 this._addClass( this.uiDialogTitlebar, 5664 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" ); 5665 this._on( this.uiDialogTitlebar, { 5666 mousedown: function( event ) { 5667 5668 // Don't prevent click on close button (#8838) 5669 // Focusing a dialog that is partially scrolled out of view 5670 // causes the browser to scroll it into view, preventing the click event 5671 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { 5672 5673 // Dialog isn't getting focus when dragging (#8063) 5674 this.uiDialog.trigger( "focus" ); 5675 } 5676 } 5677 } ); 5678 5679 this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) 5680 .button( { 5681 label: $( "<a>" ).text( this.options.closeText ).html(), 5682 icon: "ui-icon-closethick", 5683 showLabel: false 5684 } ) 5685 .appendTo( this.uiDialogTitlebar ); 5686 5687 this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" ); 5688 this._on( this.uiDialogTitlebarClose, { 5689 click: function( event ) { 5690 event.preventDefault(); 5691 this.close( event ); 5692 } 5693 } ); 5694 5695
vendor: 12,400 bytes, lines 5695-6196
5695uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar ); 5696 this._addClass( uiDialogTitle, "ui-dialog-title" ); 5697 this._title( uiDialogTitle ); 5698 5699 this.uiDialogTitlebar.prependTo( this.uiDialog ); 5700 5701 this.uiDialog.attr( { 5702 "aria-labelledby": uiDialogTitle.attr( "id" ) 5703 } ); 5704 }, 5705 5706 _title: function( title ) { 5707 if ( this.options.title ) { 5708 title.text( this.options.title ); 5709 } else { 5710 title.html( " " ); 5711 } 5712 }, 5713 5714 _createButtonPane: function() { 5715 this.uiDialogButtonPane = $( "<div>" ); 5716 this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane", 5717 "ui-widget-content ui-helper-clearfix" ); 5718 5719 this.uiButtonSet = $( "<div>" ) 5720 .appendTo( this.uiDialogButtonPane ); 5721 this._addClass( this.uiButtonSet, "ui-dialog-buttonset" ); 5722 5723 this._createButtons(); 5724 }, 5725 5726 _createButtons: function() { 5727 var that = this, 5728 buttons = this.options.buttons; 5729 5730 // If we already have a button pane, remove it 5731 this.uiDialogButtonPane.remove(); 5732 this.uiButtonSet.empty(); 5733 5734 if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) { 5735 this._removeClass( this.uiDialog, "ui-dialog-buttons" ); 5736 return; 5737 } 5738 5739 $.each( buttons, function( name, props ) { 5740 var click, buttonOptions; 5741 props = typeof props === "function" ? 5742 { click: props, text: name } : 5743 props; 5744 5745 // Default to a non-submitting button 5746 props = $.extend( { type: "button" }, props ); 5747 5748 // Change the context for the click callback to be the main element 5749 click = props.click; 5750 buttonOptions = { 5751 icon: props.icon, 5752 iconPosition: props.iconPosition, 5753 showLabel: props.showLabel, 5754 5755 // Deprecated options 5756 icons: props.icons, 5757 text: props.text 5758 }; 5759 5760 delete props.click; 5761 delete props.icon; 5762 delete props.iconPosition; 5763 delete props.showLabel; 5764 5765 // Deprecated options 5766 delete props.icons; 5767 if ( typeof props.text === "boolean" ) { 5768 delete props.text; 5769 } 5770 5771 $( "<button></button>", props ) 5772 .button( buttonOptions ) 5773 .appendTo( that.uiButtonSet ) 5774 .on( "click", function() { 5775 click.apply( that.element[ 0 ], arguments ); 5776 } ); 5777 } ); 5778 this._addClass( this.uiDialog, "ui-dialog-buttons" ); 5779 this.uiDialogButtonPane.appendTo( this.uiDialog ); 5780 }, 5781 5782 _makeDraggable: function() { 5783 var that = this, 5784 options = this.options; 5785 5786 function filteredUi( ui ) { 5787 return { 5788 position: ui.position, 5789 offset: ui.offset 5790 }; 5791 } 5792 5793 this.uiDialog.draggable( { 5794 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 5795 handle: ".ui-dialog-titlebar", 5796 containment: "document", 5797 start: function( event, ui ) { 5798 that._addClass( $( this ), "ui-dialog-dragging" ); 5799 that._blockFrames(); 5800 that._trigger( "dragStart", event, filteredUi( ui ) ); 5801 }, 5802 drag: function( event, ui ) { 5803 that._trigger( "drag", event, filteredUi( ui ) ); 5804 }, 5805 stop: function( event, ui ) { 5806 var left = ui.offset.left - that.document.scrollLeft(), 5807 top = ui.offset.top - that.document.scrollTop(); 5808 5809 options.position = { 5810 my: "left top", 5811 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 5812 "top" + ( top >= 0 ? "+" : "" ) + top, 5813 of: that.window 5814 }; 5815 that._removeClass( $( this ), "ui-dialog-dragging" ); 5816 that._unblockFrames(); 5817 that._trigger( "dragStop", event, filteredUi( ui ) ); 5818 } 5819 } ); 5820 }, 5821 5822 _makeResizable: function() { 5823 var that = this, 5824 options = this.options, 5825 handles = options.resizable, 5826 5827 // .ui-resizable has position: relative defined in the stylesheet 5828 // but dialogs have to use absolute or fixed positioning 5829 position = this.uiDialog.css( "position" ), 5830 resizeHandles = typeof handles === "string" ? 5831 handles : 5832 "n,e,s,w,se,sw,ne,nw"; 5833 5834 function filteredUi( ui ) { 5835 return { 5836 originalPosition: ui.originalPosition, 5837 originalSize: ui.originalSize, 5838 position: ui.position, 5839 size: ui.size 5840 }; 5841 } 5842 5843 this.uiDialog.resizable( { 5844 cancel: ".ui-dialog-content", 5845 containment: "document", 5846 alsoResize: this.element, 5847 maxWidth: options.maxWidth, 5848 maxHeight: options.maxHeight, 5849 minWidth: options.minWidth, 5850 minHeight: this._minHeight(), 5851 handles: resizeHandles, 5852 start: function( event, ui ) { 5853 that._addClass( $( this ), "ui-dialog-resizing" ); 5854 that._blockFrames(); 5855 that._trigger( "resizeStart", event, filteredUi( ui ) ); 5856 }, 5857 resize: function( event, ui ) { 5858 that._trigger( "resize", event, filteredUi( ui ) ); 5859 }, 5860 stop: function( event, ui ) { 5861 var offset = that.uiDialog.offset(), 5862 left = offset.left - that.document.scrollLeft(), 5863 top = offset.top - that.document.scrollTop(); 5864 5865 options.height = that.uiDialog.height(); 5866 options.width = that.uiDialog.width(); 5867 options.position = { 5868 my: "left top", 5869 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 5870 "top" + ( top >= 0 ? "+" : "" ) + top, 5871 of: that.window 5872 }; 5873 that._removeClass( $( this ), "ui-dialog-resizing" ); 5874 that._unblockFrames(); 5875 that._trigger( "resizeStop", event, filteredUi( ui ) ); 5876 } 5877 } ) 5878 .css( "position", position ); 5879 }, 5880 5881 _trackFocus: function() { 5882 this._on( this.widget(), { 5883 focusin: function( event ) { 5884 this._makeFocusTarget(); 5885 this._focusedElement = $( event.target ); 5886 } 5887 } ); 5888 }, 5889 5890 _makeFocusTarget: function() { 5891 this._untrackInstance(); 5892 this._trackingInstances().unshift( this ); 5893 }, 5894 5895 _untrackInstance: function() { 5896 var instances = this._trackingInstances(), 5897 exists = $.inArray( this, instances ); 5898 if ( exists !== -1 ) { 5899 instances.splice( exists, 1 ); 5900 } 5901 }, 5902 5903 _trackingInstances: function() { 5904 var instances = this.document.data( "ui-dialog-instances" ); 5905 if ( !instances ) { 5906 instances = []; 5907 this.document.data( "ui-dialog-instances", instances ); 5908 } 5909 return instances; 5910 }, 5911 5912 _minHeight: function() { 5913 var options = this.options; 5914 5915 return options.height === "auto" ? 5916 options.minHeight : 5917 Math.min( options.minHeight, options.height ); 5918 }, 5919 5920 _position: function() { 5921 5922 // Need to show the dialog to get the actual offset in the position plugin 5923 var isVisible = this.uiDialog.is( ":visible" ); 5924 if ( !isVisible ) { 5925 this.uiDialog.show(); 5926 } 5927 this.uiDialog.position( this.options.position ); 5928 if ( !isVisible ) { 5929 this.uiDialog.hide(); 5930 } 5931 }, 5932 5933 _setOptions: function( options ) { 5934 var that = this, 5935 resize = false, 5936 resizableOptions = {}; 5937 5938 $.each( options, function( key, value ) { 5939 that._setOption( key, value ); 5940 5941 if ( key in that.sizeRelatedOptions ) { 5942 resize = true; 5943 } 5944 if ( key in that.resizableRelatedOptions ) { 5945 resizableOptions[ key ] = value; 5946 } 5947 } ); 5948 5949 if ( resize ) { 5950 this._size(); 5951 this._position(); 5952 } 5953 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 5954 this.uiDialog.resizable( "option", resizableOptions ); 5955 } 5956 }, 5957 5958 _setOption: function( key, value ) { 5959 var isDraggable, isResizable, 5960 uiDialog = this.uiDialog; 5961 5962 if ( key === "disabled" ) { 5963 return; 5964 } 5965 5966 this._super( key, value ); 5967 5968 if ( key === "appendTo" ) { 5969 this.uiDialog.appendTo( this._appendTo() ); 5970 } 5971 5972 if ( key === "buttons" ) { 5973 this._createButtons(); 5974 } 5975 5976 if ( key === "closeText" ) { 5977 this.uiDialogTitlebarClose.button( { 5978 5979 // Ensure that we always pass a string 5980 label: $( "<a>" ).text( "" + this.options.closeText ).html() 5981 } ); 5982 } 5983 5984 if ( key === "draggable" ) { 5985 isDraggable = uiDialog.is( ":data(ui-draggable)" ); 5986 if ( isDraggable && !value ) { 5987 uiDialog.draggable( "destroy" ); 5988 } 5989 5990 if ( !isDraggable && value ) { 5991 this._makeDraggable(); 5992 } 5993 } 5994 5995 if ( key === "position" ) { 5996 this._position(); 5997 } 5998 5999 if ( key === "resizable" ) { 6000 6001 // currently resizable, becoming non-resizable 6002 isResizable = uiDialog.is( ":data(ui-resizable)" ); 6003 if ( isResizable && !value ) { 6004 uiDialog.resizable( "destroy" ); 6005 } 6006 6007 // Currently resizable, changing handles 6008 if ( isResizable && typeof value === "string" ) { 6009 uiDialog.resizable( "option", "handles", value ); 6010 } 6011 6012 // Currently non-resizable, becoming resizable 6013 if ( !isResizable && value !== false ) { 6014 this._makeResizable(); 6015 } 6016 } 6017 6018 if ( key === "title" ) { 6019 this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); 6020 } 6021 6022 if ( key === "modal" ) { 6023 uiDialog.attr( "aria-modal", value ? "true" : null ); 6024 } 6025 }, 6026 6027 _size: function() { 6028 6029 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 6030 // divs will both have width and height set, so we need to reset them 6031 var nonContentHeight, minContentHeight, maxContentHeight, 6032 options = this.options; 6033 6034 // Reset content sizing 6035 this.element.show().css( { 6036 width: "auto", 6037 minHeight: 0, 6038 maxHeight: "none", 6039 height: 0 6040 } ); 6041 6042 if ( options.minWidth > options.width ) { 6043 options.width = options.minWidth; 6044 } 6045 6046 // Reset wrapper sizing 6047 // determine the height of all the non-content elements 6048 nonContentHeight = this.uiDialog.css( { 6049 height: "auto", 6050 width: options.width 6051 } ) 6052 .outerHeight(); 6053 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 6054 maxContentHeight = typeof options.maxHeight === "number" ? 6055 Math.max( 0, options.maxHeight - nonContentHeight ) : 6056 "none"; 6057 6058 if ( options.height === "auto" ) { 6059 this.element.css( { 6060 minHeight: minContentHeight, 6061 maxHeight: maxContentHeight, 6062 height: "auto" 6063 } ); 6064 } else { 6065 this.element.height( Math.max( 0, options.height - nonContentHeight ) ); 6066 } 6067 6068 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 6069 this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); 6070 } 6071 }, 6072 6073 _blockFrames: function() { 6074 this.iframeBlocks = this.document.find( "iframe" ).map( function() { 6075 var iframe = $( this ); 6076 6077 return $( "<div>" ) 6078 .css( { 6079 position: "absolute", 6080 width: iframe.outerWidth(), 6081 height: iframe.outerHeight() 6082 } ) 6083 .appendTo( iframe.parent() ) 6084 .offset( iframe.offset() )[ 0 ]; 6085 } ); 6086 }, 6087 6088 _unblockFrames: function() { 6089 if ( this.iframeBlocks ) { 6090 this.iframeBlocks.remove(); 6091 delete this.iframeBlocks; 6092 } 6093 }, 6094 6095 _allowInteraction: function( event ) { 6096 if ( $( event.target ).closest( ".ui-dialog" ).length ) { 6097 return true; 6098 } 6099 6100 // TODO: Remove hack when datepicker implements 6101 // the .ui-front logic (#8989) 6102 return !!$( event.target ).closest( ".ui-datepicker" ).length; 6103 }, 6104 6105 _createOverlay: function() { 6106 if ( !this.options.modal ) { 6107 return; 6108 } 6109 6110 // We use a delay in case the overlay is created from an 6111 // event that we're going to be cancelling (#2804) 6112 var isOpening = true; 6113 this._delay( function() { 6114 isOpening = false; 6115 } ); 6116 6117 if ( !this.document.data( "ui-dialog-overlays" ) ) { 6118 6119 // Prevent use of anchors and inputs 6120 // This doesn't use `_on()` because it is a shared event handler 6121 // across all open modal dialogs. 6122 this.document.on( "focusin.ui-dialog", function( event ) { 6123 if ( isOpening ) { 6124 return; 6125 } 6126 6127 var instance = this._trackingInstances()[ 0 ]; 6128 if ( !instance._allowInteraction( event ) ) { 6129 event.preventDefault(); 6130 instance._focusTabbable(); 6131 } 6132 }.bind( this ) ); 6133 } 6134 6135 this.overlay = $( "<div>" ) 6136 .appendTo( this._appendTo() ); 6137 6138 this._addClass( this.overlay, null, "ui-widget-overlay ui-front" ); 6139 this._on( this.overlay, { 6140 mousedown: "_keepFocus" 6141 } ); 6142 this.document.data( "ui-dialog-overlays", 6143 ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 ); 6144 }, 6145 6146 _destroyOverlay: function() { 6147 if ( !this.options.modal ) { 6148 return; 6149 } 6150 6151 if ( this.overlay ) { 6152 var overlays = this.document.data( "ui-dialog-overlays" ) - 1; 6153 6154 if ( !overlays ) { 6155 this.document.off( "focusin.ui-dialog" ); 6156 this.document.removeData( "ui-dialog-overlays" ); 6157 } else { 6158 this.document.data( "ui-dialog-overlays", overlays ); 6159 } 6160 6161 this.overlay.remove(); 6162 this.overlay = null; 6163 } 6164 } 6165} ); 6166 6167// DEPRECATED 6168// TODO: switch return back to widget declaration at top of file when this is removed 6169if ( $.uiBackCompat === true ) { 6170 6171 // Backcompat for dialogClass option 6172 $.widget( "ui.dialog", $.ui.dialog, { 6173 options: { 6174 dialogClass: "" 6175 }, 6176 _createWrapper: function() { 6177 this._super(); 6178 this.uiDialog.addClass( this.options.dialogClass ); 6179 }, 6180 _setOption: function( key, value ) { 6181 if ( key === "dialogClass" ) { 6182 this.uiDialog 6183 .removeClass( this.options.dialogClass ) 6184 .addClass( value ); 6185 } 6186 this._superApply( arguments ); 6187 } 6188 } ); 6189} 6190 6191var widgetsDialog = $.ui.dialog; 6192 6193 6194 6195 6196} );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.