vendor: 9,044 bytes, lines 1-282
1/*! jQuery UI - v1.12.1+CommonJS - 2018-02-10 2 * http://jqueryui.com 3 * Includes: widget.js 4 * Copyright jQuery Foundation and other contributors; Licensed MIT */ 5 6(function( factory ) { 7 // if ( typeof define === "function" && define.amd ) { 8 9 // // AMD. Register as an anonymous module. 10 // define([ "jquery" ], factory ); 11 // } else if ( typeof exports === "object" ) { 12 13 // // Node/CommonJS 14 // factory( require( "jquery" ) ); 15 // } else { 16 17 // // Browser globals 18 // factory( jQuery ); 19 // } 20 21 'use strict'; 22 // è·åå ¨å±å¯¹è±¡ï¼æµè§å¨ä¸º windowï¼Node.js 为 globalï¼ 23 var globalObj = typeof window !== 'undefined' ? window : global; 24 25 // æ¾å¼æ£æ¥å ¨å±å¯¹è±¡ä¸ç define 26 if (typeof globalObj.define === 'function' && globalObj.define.amd) { 27 // ä½ä¸ºå¿å AMD æ¨¡åæ³¨å 28 globalObj.define('jquery.ui.widget',['jquery'], factory); 29 } else if (typeof exports === 'object') { 30 // Node/CommonJS ç¯å¢ 31 factory(require('jquery')); 32 } else { 33 // æµè§å¨å ¨å±ç¯å¢ 34 factory(globalObj.jQuery); 35 } 36}(function( $ ) { 37 38 $.ui = $.ui || {}; 39 40 var version = $.ui.version = "1.12.1"; 41 42 43 /*! 44 * jQuery UI Widget 1.12.1 45 * http://jqueryui.com 46 * 47 * Copyright jQuery Foundation and other contributors 48 * Released under the MIT license. 49 * http://jquery.org/license 50 */ 51 52 //>>label: Widget 53 //>>group: Core 54 //>>description: Provides a factory for creating stateful widgets with a common API. 55 //>>docs: http://api.jqueryui.com/jQuery.widget/ 56 //>>demos: http://jqueryui.com/widget/ 57 58 59 60 var widgetUuid = 0; 61 var widgetSlice = Array.prototype.slice; 62 63 $.cleanData = ( function( orig ) { 64 return function( elems ) { 65 var events, elem, i; 66 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 67 try { 68 69 // Only trigger remove when necessary to save time 70 events = $._data( elem, "events" ); 71 if ( events && events.remove ) { 72 $( elem ).triggerHandler( "remove" ); 73 } 74 75 // Http://bugs.jquery.com/ticket/8235 76 } catch ( e ) {} 77 } 78 orig( elems ); 79 }; 80 } )( $.cleanData ); 81 82 $.widget = function( name, base, prototype ) { 83 var existingConstructor, constructor, basePrototype; 84 85 // ProxiedPrototype allows the provided prototype to remain unmodified 86 // so that it can be used as a mixin for multiple widgets (#8876) 87 var proxiedPrototype = {}; 88 89 var namespace = name.split( "." )[ 0 ]; 90 name = name.split( "." )[ 1 ]; 91 var fullName = namespace + "-" + name; 92 93 if ( !prototype ) { 94 prototype = base; 95 base = $.Widget; 96 } 97 98 if ( $.isArray( prototype ) ) { 99 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 100 } 101 102 // Create selector for plugin 103 $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { 104 return !!$.data( elem, fullName ); 105 }; 106 107 $[ namespace ] = $[ namespace ] || {}; 108 existingConstructor = $[ namespace ][ name ]; 109 constructor = $[ namespace ][ name ] = function( options, element ) { 110 111 // Allow instantiation without "new" keyword 112 if ( !this._createWidget ) { 113 return new constructor( options, element ); 114 } 115 116 // Allow instantiation without initializing for simple inheritance 117 // must use "new" keyword (the code above always passes args) 118 if ( arguments.length ) { 119 this._createWidget( options, element ); 120 } 121 }; 122 123 // Extend with the existing constructor to carry over any static properties 124 $.extend( constructor, existingConstructor, { 125 version: prototype.version, 126 127 // Copy the object used to create the prototype in case we need to 128 // redefine the widget later 129 _proto: $.extend( {}, prototype ), 130 131 // Track widgets that inherit from this widget in case this widget is 132 // redefined after a widget inherits from it 133 _childConstructors: [] 134 } ); 135 136 basePrototype = new base(); 137 138 // We need to make the options hash a property directly on the new instance 139 // otherwise we'll modify the options hash on the prototype that we're 140 // inheriting from 141 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 142 $.each( prototype, function( prop, value ) { 143 if ( !$.isFunction( value ) ) { 144 proxiedPrototype[ prop ] = value; 145 return; 146 } 147 proxiedPrototype[ prop ] = ( function() { 148 function _super() { 149 return base.prototype[ prop ].apply( this, arguments ); 150 } 151 152 function _superApply( args ) { 153 return base.prototype[ prop ].apply( this, args ); 154 } 155 156 return function() { 157 var __mmsuper = this._super; 158 var __mmsuperApply = this._superApply; 159 var returnValue; 160 161 this._super = _super; 162 this._superApply = _superApply; 163 164 returnValue = value.apply( this, arguments ); 165 166 this._super = __mmsuper; 167 this._superApply = __mmsuperApply; 168 169 return returnValue; 170 }; 171 } )(); 172 } ); 173 constructor.prototype = $.widget.extend( basePrototype, { 174 175 // TODO: remove support for widgetEventPrefix 176 // always use the name + a colon as the prefix, e.g., draggable:start 177 // don't prefix for widgets that aren't DOM-based 178 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 179 }, proxiedPrototype, { 180 constructor: constructor, 181 namespace: namespace, 182 widgetName: name, 183 widgetFullName: fullName 184 } ); 185 186 // If this widget is being redefined then we need to find all widgets that 187 // are inheriting from it and redefine all of them so that they inherit from 188 // the new version of this widget. We're essentially trying to replace one 189 // level in the prototype chain. 190 if ( existingConstructor ) { 191 $.each( existingConstructor._childConstructors, function( i, child ) { 192 var childPrototype = child.prototype; 193 194 // Redefine the child widget using the same prototype that was 195 // originally used, but inherit from the new version of the base 196 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 197 child._proto ); 198 } ); 199 200 // Remove the list of existing child constructors from the old constructor 201 // so the old child constructors can be garbage collected 202 delete existingConstructor._childConstructors; 203 } else { 204 base._childConstructors.push( constructor ); 205 } 206 207 $.widget.bridge( name, constructor ); 208 209 return constructor; 210 }; 211 212 $.widget.extend = function( target ) { 213 var input = widgetSlice.call( arguments, 1 ); 214 var inputIndex = 0; 215 var inputLength = input.length; 216 var key; 217 var value; 218 219 for ( ; inputIndex < inputLength; inputIndex++ ) { 220 for ( key in input[ inputIndex ] ) { 221 value = input[ inputIndex ][ key ]; 222 if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { 223 224 // Clone objects 225 if ( $.isPlainObject( value ) ) { 226 target[ key ] = $.isPlainObject( target[ key ] ) ? 227 $.widget.extend( {}, target[ key ], value ) : 228 229 // Don't extend strings, arrays, etc. with objects 230 $.widget.extend( {}, value ); 231 232 // Copy everything else by reference 233 } else { 234 target[ key ] = value; 235 } 236 } 237 } 238 } 239 return target; 240 }; 241 242 $.widget.bridge = function( name, object ) { 243 var fullName = object.prototype.widgetFullName || name; 244 $.fn[ name ] = function( options ) { 245 var isMethodCall = typeof options === "string"; 246 var args = widgetSlice.call( arguments, 1 ); 247 var returnValue = this; 248 249 if ( isMethodCall ) { 250 251 // If this is an empty collection, we need to have the instance method 252 // return undefined instead of the jQuery instance 253 if ( !this.length && options === "instance" ) { 254 returnValue = undefined; 255 } else { 256 this.each( function() { 257 var methodValue; 258 var instance = $.data( this, fullName ); 259 260 if ( options === "instance" ) { 261 returnValue = instance; 262 return false; 263 } 264 265 if ( !instance ) { 266 return $.error( "cannot call methods on " + name + 267 " prior to initialization; " + 268 "attempted to call method '" + options + "'" ); 269 } 270 271 if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) { 272 return $.error( "no such method '" + options + "' for " + name + 273 " widget instance" ); 274 } 275 276 methodValue = instance[ options ].apply( instance, args ); 277 278 if ( methodValue !== instance && methodValue !== undefined ) { 279 returnValue = methodValue && methodValue.jquery ? 280 returnValue.pushStack( methodValue.get() ) : 281 methodValue; 282 return false;
vendor: 5,158 bytes, lines 283-485
283 } 284 } ); 285 } 286 } else { 287 288 // Allow multiple hashes to be passed on init 289 if ( args.length ) { 290 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 291 } 292 293 this.each( function() { 294 var instance = $.data( this, fullName ); 295 if ( instance ) { 296 instance.option( options || {} ); 297 if ( instance._init ) { 298 instance._init(); 299 } 300 } else { 301 $.data( this, fullName, new object( options, this ) ); 302 } 303 } ); 304 } 305 306 return returnValue; 307 }; 308 }; 309 310 $.Widget = function( /* options, element */ ) {}; 311 $.Widget._childConstructors = []; 312 313 $.Widget.prototype = { 314 widgetName: "widget", 315 widgetEventPrefix: "", 316 defaultElement: "<div>", 317 318 options: { 319 classes: {}, 320 disabled: false, 321 322 // Callbacks 323 create: null 324 }, 325 326 _createWidget: function( options, element ) { 327 element = $( element || this.defaultElement || this )[ 0 ]; 328 this.element = $( element ); 329 this.uuid = widgetUuid++; 330 this.eventNamespace = "." + this.widgetName + this.uuid; 331 332 this.bindings = $(); 333 this.hoverable = $(); 334 this.focusable = $(); 335 this.classesElementLookup = {}; 336 337 if ( element !== this ) { 338 $.data( element, this.widgetFullName, this ); 339 this._on( true, this.element, { 340 remove: function( event ) { 341 if ( event.target === element ) { 342 this.destroy(); 343 } 344 } 345 } ); 346 this.document = $( element.style ? 347 348 // Element within the document 349 element.ownerDocument : 350 351 // Element is window or document 352 element.document || element ); 353 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 354 } 355 356 this.options = $.widget.extend( {}, 357 this.options, 358 this._getCreateOptions(), 359 options ); 360 361 this._create(); 362 363 if ( this.options.disabled ) { 364 this._setOptionDisabled( this.options.disabled ); 365 } 366 367 this._trigger( "create", null, this._getCreateEventData() ); 368 this._init(); 369 }, 370 371 _getCreateOptions: function() { 372 return {}; 373 }, 374 375 _getCreateEventData: $.noop, 376 377 _create: $.noop, 378 379 _init: $.noop, 380 381 destroy: function() { 382 var that = this; 383 384 this._destroy(); 385 $.each( this.classesElementLookup, function( key, value ) { 386 that._removeClass( value, key ); 387 } ); 388 389 // We can probably remove the unbind calls in 2.0 390 // all event bindings should go through this._on() 391 this.element 392 .off( this.eventNamespace ) 393 .removeData( this.widgetFullName ); 394 this.widget() 395 .off( this.eventNamespace ) 396 .removeAttr( "aria-disabled" ); 397 398 // Clean up events and states 399 this.bindings.off( this.eventNamespace ); 400 }, 401 402 _destroy: $.noop, 403 404 widget: function() { 405 return this.element; 406 }, 407 408 option: function( key, value ) { 409 var options = key; 410 var parts; 411 var curOption; 412 var i; 413 414 if ( arguments.length === 0 ) { 415 416 // Don't return a reference to the internal hash 417 return $.widget.extend( {}, this.options ); 418 } 419 420 if ( typeof key === "string" ) { 421 422 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 423 options = {}; 424 parts = key.split( "." ); 425 key = parts.shift(); 426 if ( parts.length ) { 427 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 428 for ( i = 0; i < parts.length - 1; i++ ) { 429 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 430 curOption = curOption[ parts[ i ] ]; 431 } 432 key = parts.pop(); 433 if ( arguments.length === 1 ) { 434 return curOption[ key ] === undefined ? null : curOption[ key ]; 435 } 436 curOption[ key ] = value; 437 } else { 438 if ( arguments.length === 1 ) { 439 return this.options[ key ] === undefined ? null : this.options[ key ]; 440 } 441 options[ key ] = value; 442 } 443 } 444 445 this._setOptions( options ); 446 447 return this; 448 }, 449 450 _setOptions: function( options ) { 451 var key; 452 453 for ( key in options ) { 454 this._setOption( key, options[ key ] ); 455 } 456 457 return this; 458 }, 459 460 _setOption: function( key, value ) { 461 if ( key === "classes" ) { 462 this._setOptionClasses( value ); 463 } 464 465 this.options[ key ] = value; 466 467 if ( key === "disabled" ) { 468 this._setOptionDisabled( value ); 469 } 470 471 return this; 472 }, 473 474 _setOptionClasses: function( value ) { 475 var classKey, elements, currentElements; 476 477 for ( classKey in value ) { 478 currentElements = this.classesElementLookup[ classKey ]; 479 if ( value[ classKey ] === this.options.classes[ classKey ] || 480 !currentElements || 481 !currentElements.length ) { 482 continue; 483 } 484 485 // We are doing this to create a new jQuery object because the _removeClass() call
vendor: 8,808 bytes, lines 486-749
486 // on the next line is going to destroy the reference to the current elements being 487 // tracked. We need to save a copy of this collection so that we can add the new classes 488 // below. 489 elements = $( currentElements.get() ); 490 this._removeClass( currentElements, classKey ); 491 492 // We don't use _addClass() here, because that uses this.options.classes 493 // for generating the string of classes. We want to use the value passed in from 494 // _setOption(), this is the new value of the classes option which was passed to 495 // _setOption(). We pass this value directly to _classes(). 496 elements.addClass( this._classes( { 497 element: elements, 498 keys: classKey, 499 classes: value, 500 add: true 501 } ) ); 502 } 503 }, 504 505 _setOptionDisabled: function( value ) { 506 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 507 508 // If the widget is becoming disabled, then nothing is interactive 509 if ( value ) { 510 this._removeClass( this.hoverable, null, "ui-state-hover" ); 511 this._removeClass( this.focusable, null, "ui-state-focus" ); 512 } 513 }, 514 515 enable: function() { 516 return this._setOptions( { disabled: false } ); 517 }, 518 519 disable: function() { 520 return this._setOptions( { disabled: true } ); 521 }, 522 523 _classes: function( options ) { 524 var full = []; 525 var that = this; 526 527 options = $.extend( { 528 element: this.element, 529 classes: this.options.classes || {} 530 }, options ); 531 532 function processClassString( classes, checkOption ) { 533 var current, i; 534 for ( i = 0; i < classes.length; i++ ) { 535 current = that.classesElementLookup[ classes[ i ] ] || $(); 536 if ( options.add ) { 537 current = $( $.unique( current.get().concat( options.element.get() ) ) ); 538 } else { 539 current = $( current.not( options.element ).get() ); 540 } 541 that.classesElementLookup[ classes[ i ] ] = current; 542 full.push( classes[ i ] ); 543 if ( checkOption && options.classes[ classes[ i ] ] ) { 544 full.push( options.classes[ classes[ i ] ] ); 545 } 546 } 547 } 548 549 this._on( options.element, { 550 "remove": "_untrackClassesElement" 551 } ); 552 553 if ( options.keys ) { 554 processClassString( options.keys.match( /\S+/g ) || [], true ); 555 } 556 if ( options.extra ) { 557 processClassString( options.extra.match( /\S+/g ) || [] ); 558 } 559 560 return full.join( " " ); 561 }, 562 563 _untrackClassesElement: function( event ) { 564 var that = this; 565 $.each( that.classesElementLookup, function( key, value ) { 566 if ( $.inArray( event.target, value ) !== -1 ) { 567 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 568 } 569 } ); 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 ).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 !( $.isFunction( callback ) && 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 } 739 740 hasOptions = !$.isEmptyObject( options ); 741 options.complete = callback; 742 743 if ( options.delay ) { 744 element.delay( options.delay ); 745 } 746 747 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 748 element[ method ]( options ); 749 } else if ( effectName !== method && element[ effectName ] ) {
750 element[ effectName ]( options.duration, options.easing, callback ); 751 } else { 752 element.queue( function( next ) { 753 $( this )[ method ](); 754 if ( callback ) { 755 callback.call( element[ 0 ] ); 756 } 757 next(); 758 } ); 759 } 760 }; 761 } ); 762 763 var widget = $.widget; 764 765 return $.widget; 766 767 768}));
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.