PageSourceSearch

https://grupomedicastore.mx/modules/formmaker/views/js/jquery.ui.widget.js

js grupomedicastore.mx collected 2026-09-24 11:04:01 UTC 16,128 bytes, 541 lines download raw bytes

vendor: 15,867 bytes, lines 1-527
1/**
2 * Formmaker
3 *
4 * @author    silbersaiten <[email protected]>
5 * @copyright 2022 silbersaiten
6 * @license   See joined file licence.txt
7 * @version   1.4.0
8 * @website   https://www.silbersaiten.de
9 * @category  Module
10 * @support   silbersaiten <[email protected]>
11 */
12/*
13 * jQuery UI Widget 1.10.1+amd
14 * https://github.com/blueimp/jQuery-File-Upload
15 *
16 * Copyright 2013 jQuery Foundation and other contributors
17 * Released under the MIT license.
18 * http://jquery.org/license
19 *
20 * http://api.jqueryui.com/jQuery.widget/
21 */
22
23(function (factory) {
24    if (typeof define === "function" && define.amd) {
25        // Register as an anonymous AMD module:
26        define(["jquery"], factory);
27    } else {
28        // Browser globals:
29        factory(jQuery);
30    }
31}(function( $, undefined ) {
32
33var uuid = 0,
34	slice = Array.prototype.slice,
35	_cleanData = $.cleanData;
36$.cleanData = function( elems ) {
37	for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
38		try {
39			$( elem ).triggerHandler( "remove" );
40		// http://bugs.jquery.com/ticket/8235
41		} catch( e ) {}
42	}
43	_cleanData( elems );
44};
45
46$.widget = function( name, base, prototype ) {
47	var fullName, existingConstructor, constructor, basePrototype,
48		// proxiedPrototype allows the provided prototype to remain unmodified
49		// so that it can be used as a mixin for multiple widgets (#8876)
50		proxiedPrototype = {},
51		namespace = name.split( "." )[ 0 ];
52
53	name = name.split( "." )[ 1 ];
54	fullName = namespace + "-" + name;
55
56	if ( !prototype ) {
57		prototype = base;
58		base = $.Widget;
59	}
60
61	// create selector for plugin
62	$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
63		return !!$.data( elem, fullName );
64	};
65
66	$[ namespace ] = $[ namespace ] || {};
67	existingConstructor = $[ namespace ][ name ];
68	constructor = $[ namespace ][ name ] = function( options, element ) {
69		// allow instantiation without "new" keyword
70		if ( !this._createWidget ) {
71			return new constructor( options, element );
72		}
73
74		// allow instantiation without initializing for simple inheritance
75		// must use "new" keyword (the code above always passes args)
76		if ( arguments.length ) {
77			this._createWidget( options, element );
78		}
79	};
80	// extend with the existing constructor to carry over any static properties
81	$.extend( constructor, existingConstructor, {
82		version: prototype.version,
83		// copy the object used to create the prototype in case we need to
84		// redefine the widget later
85		_proto: $.extend( {}, prototype ),
86		// track widgets that inherit from this widget in case this widget is
87		// redefined after a widget inherits from it
88		_childConstructors: []
89	});
90
91	basePrototype = new base();
92	// we need to make the options hash a property directly on the new instance
93	// otherwise we'll modify the options hash on the prototype that we're
94	// inheriting from
95	basePrototype.options = $.widget.extend( {}, basePrototype.options );
96	$.each( prototype, function( prop, value ) {
97		if ( !$.isFunction( value ) ) {
98			proxiedPrototype[ prop ] = value;
99			return;
100		}
101		proxiedPrototype[ prop ] = (function() {
102			var _super = function() {
103					return base.prototype[ prop ].apply( this, arguments );
104				},
105				_superApply = function( args ) {
106					return base.prototype[ prop ].apply( this, args );
107				};
108			return function() {
109				var __super = this._super,
110					__superApply = this._superApply,
111					returnValue;
112
113				this._super = _super;
114				this._superApply = _superApply;
115
116				returnValue = value.apply( this, arguments );
117
118				this._super = __super;
119				this._superApply = __superApply;
120
121				return returnValue;
122			};
123		})();
124	});
125	constructor.prototype = $.widget.extend( basePrototype, {
126		// TODO: remove support for widgetEventPrefix
127		// always use the name + a colon as the prefix, e.g., draggable:start
128		// don't prefix for widgets that aren't DOM-based
129		widgetEventPrefix: basePrototype.widgetEventPrefix || name
130	}, proxiedPrototype, {
131		constructor: constructor,
132		namespace: namespace,
133		widgetName: name,
134		widgetFullName: fullName
135	});
136
137	// If this widget is being redefined then we need to find all widgets that
138	// are inheriting from it and redefine all of them so that they inherit from
139	// the new version of this widget. We're essentially trying to replace one
140	// level in the prototype chain.
141	if ( existingConstructor ) {
142		$.each( existingConstructor._childConstructors, function( i, child ) {
143			var childPrototype = child.prototype;
144
145			// redefine the child widget using the same prototype that was
146			// originally used, but inherit from the new version of the base
147			$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
148		});
149		// remove the list of existing child constructors from the old constructor
150		// so the old child constructors can be garbage collected
151		delete existingConstructor._childConstructors;
152	} else {
153		base._childConstructors.push( constructor );
154	}
155
156	$.widget.bridge( name, constructor );
157};
158
159$.widget.extend = function( target ) {
160	var input = slice.call( arguments, 1 ),
161		inputIndex = 0,
162		inputLength = input.length,
163		key,
164		value;
165	for ( ; inputIndex < inputLength; inputIndex++ ) {
166		for ( key in input[ inputIndex ] ) {
167			value = input[ inputIndex ][ key ];
168			if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
169				// Clone objects
170				if ( $.isPlainObject( value ) ) {
171					target[ key ] = $.isPlainObject( target[ key ] ) ?
172						$.widget.extend( {}, target[ key ], value ) :
173						// Don't extend strings, arrays, etc. with objects
174						$.widget.extend( {}, value );
175				// Copy everything else by reference
176				} else {
177					target[ key ] = value;
178				}
179			}
180		}
181	}
182	return target;
183};
184
185$.widget.bridge = function( name, object ) {
186	var fullName = object.prototype.widgetFullName || name;
187	$.fn[ name ] = function( options ) {
188		var isMethodCall = typeof options === "string",
189			args = slice.call( arguments, 1 ),
190			returnValue = this;
191
192		// allow multiple hashes to be passed on init
193		options = !isMethodCall && args.length ?
194			$.widget.extend.apply( null, [ options ].concat(args) ) :
195			options;
196
197		if ( isMethodCall ) {
198			this.each(function() {
199				var methodValue,
200					instance = $.data( this, fullName );
201				if ( !instance ) {
202					return $.error( "cannot call methods on " + name + " prior to initialization; " +
203						"attempted to call method '" + options + "'" );
204				}
205				if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
206					return $.error( "no such method '" + options + "' for " + name + " widget instance" );
207				}
208				methodValue = instance[ options ].apply( instance, args );
209				if ( methodValue !== instance && methodValue !== undefined ) {
210					returnValue = methodValue && methodValue.jquery ?
211						returnValue.pushStack( methodValue.get() ) :
212						methodValue;
213					return false;
214				}
215			});
216		} else {
217			this.each(function() {
218				var instance = $.data( this, fullName );
219				if ( instance ) {
220					instance.option( options || {} )._init();
221				} else {
222					$.data( this, fullName, new object( options, this ) );
223				}
224			});
225		}
226
227		return returnValue;
228	};
229};
230
231$.Widget = function( /* options, element */ ) {};
232$.Widget._childConstructors = [];
233
234$.Widget.prototype = {
235	widgetName: "widget",
236	widgetEventPrefix: "",
237	defaultElement: "<div>",
238	options: {
239		disabled: false,
240
241		// callbacks
242		create: null
243	},
244	_createWidget: function( options, element ) {
245		element = $( element || this.defaultElement || this )[ 0 ];
246		this.element = $( element );
247		this.uuid = uuid++;
248		this.eventNamespace = "." + this.widgetName + this.uuid;
249		this.options = $.widget.extend( {},
250			this.options,
251			this._getCreateOptions(),
252			options );
253
254		this.bindings = $();
255		this.hoverable = $();
256		this.focusable = $();
257
258		if ( element !== this ) {
259			$.data( element, this.widgetFullName, this );
260			this._on( true, this.element, {
261				remove: function( event ) {
262					if ( event.target === element ) {
263						this.destroy();
264					}
265				}
266			});
267			this.document = $( element.style ?
268				// element within the document
269				element.ownerDocument :
270				// element is window or document
271				element.document || element );
272			this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
273		}
274
275		this._create();
276		this._trigger( "create", null, this._getCreateEventData() );
277		this._init();
278	},
279	_getCreateOptions: $.noop,
280	_getCreateEventData: $.noop,
281	_create: $.noop,
282	_init: $.noop,
283
284	destroy: function() {
285		this._destroy();
286		// we can probably remove the unbind calls in 2.0
287		// all event bindings should go through this._on()
288		this.element
289			.unbind( this.eventNamespace )
290			// 1.9 BC for #7810
291			// TODO remove dual storage
292			.removeData( this.widgetName )
293			.removeData( this.widgetFullName )
294			// support: jquery <1.6.3
295			// http://bugs.jquery.com/ticket/9413
296			.removeData( $.camelCase( this.widgetFullName ) );
297		this.widget()
298			.unbind( this.eventNamespace )
299			.removeAttr( "aria-disabled" )
300			.removeClass(
301				this.widgetFullName + "-disabled " +
302				"ui-state-disabled" );
303
304		// clean up events and states
305		this.bindings.unbind( this.eventNamespace );
306		this.hoverable.removeClass( "ui-state-hover" );
307		this.focusable.removeClass( "ui-state-focus" );
308	},
309	_destroy: $.noop,
310
311	widget: function() {
312		return this.element;
313	},
314
315	option: function( key, value ) {
316		var options = key,
317			parts,
318			curOption,
319			i;
320
321		if ( arguments.length === 0 ) {
322			// don't return a reference to the internal hash
323			return $.widget.extend( {}, this.options );
324		}
325
326		if ( typeof key === "string" ) {
327			// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
328			options = {};
329			parts = key.split( "." );
330			key = parts.shift();
331			if ( parts.length ) {
332				curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
333				for ( i = 0; i < parts.length - 1; i++ ) {
334					curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
335					curOption = curOption[ parts[ i ] ];
336				}
337				key = parts.pop();
338				if ( value === undefined ) {
339					return curOption[ key ] === undefined ? null : curOption[ key ];
340				}
341				curOption[ key ] = value;
342			} else {
343				if ( value === undefined ) {
344					return this.options[ key ] === undefined ? null : this.options[ key ];
345				}
346				options[ key ] = value;
347			}
348		}
349
350		this._setOptions( options );
351
352		return this;
353	},
354	_setOptions: function( options ) {
355		var key;
356
357		for ( key in options ) {
358			this._setOption( key, options[ key ] );
359		}
360
361		return this;
362	},
363	_setOption: function( key, value ) {
364		this.options[ key ] = value;
365
366		if ( key === "disabled" ) {
367			this.widget()
368				.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
369				.attr( "aria-disabled", value );
370			this.hoverable.removeClass( "ui-state-hover" );
371			this.focusable.removeClass( "ui-state-focus" );
372		}
373
374		return this;
375	},
376
377	enable: function() {
378		return this._setOption( "disabled", false );
379	},
380	disable: function() {
381		return this._setOption( "disabled", true );
382	},
383
384	_on: function( suppressDisabledCheck, element, handlers ) {
385		var delegateElement,
386			instance = this;
387
388		// no suppressDisabledCheck flag, shuffle arguments
389		if ( typeof suppressDisabledCheck !== "boolean" ) {
390			handlers = element;
391			element = suppressDisabledCheck;
392			suppressDisabledCheck = false;
393		}
394
395		// no element argument, shuffle and use this.element
396		if ( !handlers ) {
397			handlers = element;
398			element = this.element;
399			delegateElement = this.widget();
400		} else {
401			// accept selectors, DOM elements
402			element = delegateElement = $( element );
403			this.bindings = this.bindings.add( element );
404		}
405
406		$.each( handlers, function( event, handler ) {
407			function handlerProxy() {
408				// allow widgets to customize the disabled handling
409				// - disabled as an array instead of boolean
410				// - disabled class as method for disabling individual parts
411				if ( !suppressDisabledCheck &&
412						( instance.options.disabled === true ||
413							$( this ).hasClass( "ui-state-disabled" ) ) ) {
414					return;
415				}
416				return ( typeof handler === "string" ? instance[ handler ] : handler )
417					.apply( instance, arguments );
418			}
419
420			// copy the guid so direct unbinding works
421			if ( typeof handler !== "string" ) {
422				handlerProxy.guid = handler.guid =
423					handler.guid || handlerProxy.guid || $.guid++;
424			}
425
426			var match = event.match( /^(\w+)\s*(.*)$/ ),
427				eventName = match[1] + instance.eventNamespace,
428				selector = match[2];
429			if ( selector ) {
430				delegateElement.delegate( selector, eventName, handlerProxy );
431			} else {
432				element.bind( eventName, handlerProxy );
433			}
434		});
435	},
436
437	_off: function( element, eventName ) {
438		eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
439		element.unbind( eventName ).undelegate( eventName );
440	},
441
442	_delay: function( handler, delay ) {
443		function handlerProxy() {
444			return ( typeof handler === "string" ? instance[ handler ] : handler )
445				.apply( instance, arguments );
446		}
447		var instance = this;
448		return setTimeout( handlerProxy, delay || 0 );
449	},
450
451	_hoverable: function( element ) {
452		this.hoverable = this.hoverable.add( element );
453		this._on( element, {
454			mouseenter: function( event ) {
455				$( event.currentTarget ).addClass( "ui-state-hover" );
456			},
457			mouseleave: function( event ) {
458				$( event.currentTarget ).removeClass( "ui-state-hover" );
459			}
460		});
461	},
462
463	_focusable: function( element ) {
464		this.focusable = this.focusable.add( element );
465		this._on( element, {
466			focusin: function( event ) {
467				$( event.currentTarget ).addClass( "ui-state-focus" );
468			},
469			focusout: function( event ) {
470				$( event.currentTarget ).removeClass( "ui-state-focus" );
471			}
472		});
473	},
474
475	_trigger: function( type, event, data ) {
476		var prop, orig,
477			callback = this.options[ type ];
478
479		data = data || {};
480		event = $.Event( event );
481		event.type = ( type === this.widgetEventPrefix ?
482			type :
483			this.widgetEventPrefix + type ).toLowerCase();
484		// the original event may come from any element
485		// so we need to reset the target on the new event
486		event.target = this.element[ 0 ];
487
488		// copy original event properties over to the new event
489		orig = event.originalEvent;
490		if ( orig ) {
491			for ( prop in orig ) {
492				if ( !( prop in event ) ) {
493					event[ prop ] = orig[ prop ];
494				}
495			}
496		}
497
498		this.element.trigger( event, data );
499		return !( $.isFunction( callback ) &&
500			callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
501			event.isDefaultPrevented() );
502	}
503};
504
505$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
506	$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
507		if ( typeof options === "string" ) {
508			options = { effect: options };
509		}
510		var hasOptions,
511			effectName = !options ?
512				method :
513				options === true || typeof options === "number" ?
514					defaultEffect :
515					options.effect || defaultEffect;
516		options = options || {};
517		if ( typeof options === "number" ) {
518			options = { duration: options };
519		}
520		hasOptions = !$.isEmptyObject( options );
521		options.complete = callback;
522		if ( options.delay ) {
523			element.delay( options.delay );
524		}
525		if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
526			element[ method ]( options );
527		} else if ( effectName !== method && element[ effectName ] ) {
528			element[ effectName ]( options.duration, options.easing, callback );
529		} else {
530			element.queue(function( next ) {
531				$( this )[ method ]();
532				if ( callback ) {
533					callback.call( element[ 0 ] );
534				}
535				next();
536			});
537		}
538	};
539});
540
541}));

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.