jquery-ui-rails-dox-fork 7.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/.travis.yml +2 -0
- data/CONTRIBUTING.txt +30 -0
- data/Gemfile +3 -0
- data/History.md +172 -0
- data/License.txt +2 -0
- data/README.md +311 -0
- data/Rakefile +263 -0
- data/VERSIONS.md +41 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_444444_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_555555_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_777620_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_777777_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cc0000_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/javascripts/jquery-ui/core.js +15 -0
- data/app/assets/javascripts/jquery-ui/data.js +45 -0
- data/app/assets/javascripts/jquery-ui/disable-selection.js +51 -0
- data/app/assets/javascripts/jquery-ui/effect.all.js +15 -0
- data/app/assets/javascripts/jquery-ui/effect.js +975 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-blind.js +76 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-bounce.js +116 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-clip.js +71 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-drop.js +75 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-explode.js +117 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-fade.js +53 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-fold.js +95 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-highlight.js +63 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-puff.js +49 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-pulsate.js +70 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-scale.js +63 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-shake.js +80 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-size.js +199 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-slide.js +82 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-transfer.js +46 -0
- data/app/assets/javascripts/jquery-ui/focusable.js +89 -0
- data/app/assets/javascripts/jquery-ui/form-reset-mixin.js +83 -0
- data/app/assets/javascripts/jquery-ui/form.js +25 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-af.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar-DZ.js +42 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar.js +42 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-az.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-be.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-bg.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-bs.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ca.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-cs.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-cy-GB.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-da.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-de-AT.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-de.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-el.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-AU.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-GB.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-NZ.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-eo.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-es.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-et.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-eu.js +39 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fa.js +76 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fi.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fo.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CA.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CH.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr.js +42 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-gl.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-he.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hi.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hr.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hu.js +39 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hy.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-id.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-is.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-it-CH.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-it.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ja.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ka.js +51 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-kk.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-km.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ko.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ky.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lb.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lt.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lv.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-mk.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ml.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ms.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nb.js +52 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl-BE.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nn.js +52 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-no.js +53 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pl.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt-BR.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt.js +47 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-rm.js +64 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ro.js +43 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ru.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sk.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sl.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sq.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr-SR.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sv.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ta.js +56 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-th.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-tj.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-tr.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-uk.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-vi.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-CN.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-HK.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-TW.js +40 -0
- data/app/assets/javascripts/jquery-ui/ie.js +20 -0
- data/app/assets/javascripts/jquery-ui/jquery-patch.js +91 -0
- data/app/assets/javascripts/jquery-ui/jquery-var-for-color.js +24 -0
- data/app/assets/javascripts/jquery-ui/keycode.js +51 -0
- data/app/assets/javascripts/jquery-ui/labels.js +71 -0
- data/app/assets/javascripts/jquery-ui/plugin.js +49 -0
- data/app/assets/javascripts/jquery-ui/position.js +513 -0
- data/app/assets/javascripts/jquery-ui/safe-active-element.js +46 -0
- data/app/assets/javascripts/jquery-ui/safe-blur.js +27 -0
- data/app/assets/javascripts/jquery-ui/scroll-parent.js +50 -0
- data/app/assets/javascripts/jquery-ui/tabbable.js +41 -0
- data/app/assets/javascripts/jquery-ui/unique-id.js +54 -0
- data/app/assets/javascripts/jquery-ui/vendor/jquery-color/jquery.color.js +722 -0
- data/app/assets/javascripts/jquery-ui/version.js +20 -0
- data/app/assets/javascripts/jquery-ui/widget.js +758 -0
- data/app/assets/javascripts/jquery-ui/widgets/accordion.js +627 -0
- data/app/assets/javascripts/jquery-ui/widgets/autocomplete.js +685 -0
- data/app/assets/javascripts/jquery-ui/widgets/button.js +454 -0
- data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +294 -0
- data/app/assets/javascripts/jquery-ui/widgets/controlgroup.js +304 -0
- data/app/assets/javascripts/jquery-ui/widgets/datepicker.js +2243 -0
- data/app/assets/javascripts/jquery-ui/widgets/dialog.js +968 -0
- data/app/assets/javascripts/jquery-ui/widgets/draggable.js +1268 -0
- data/app/assets/javascripts/jquery-ui/widgets/droppable.js +508 -0
- data/app/assets/javascripts/jquery-ui/widgets/menu.js +720 -0
- data/app/assets/javascripts/jquery-ui/widgets/mouse.js +241 -0
- data/app/assets/javascripts/jquery-ui/widgets/progressbar.js +184 -0
- data/app/assets/javascripts/jquery-ui/widgets/resizable.js +1225 -0
- data/app/assets/javascripts/jquery-ui/widgets/selectable.js +321 -0
- data/app/assets/javascripts/jquery-ui/widgets/selectmenu.js +702 -0
- data/app/assets/javascripts/jquery-ui/widgets/slider.js +760 -0
- data/app/assets/javascripts/jquery-ui/widgets/sortable.js +1622 -0
- data/app/assets/javascripts/jquery-ui/widgets/spinner.js +588 -0
- data/app/assets/javascripts/jquery-ui/widgets/tabs.js +931 -0
- data/app/assets/javascripts/jquery-ui/widgets/tooltip.js +533 -0
- data/app/assets/javascripts/jquery-ui.js +57 -0
- data/app/assets/stylesheets/jquery-ui/accordion.css +26 -0
- data/app/assets/stylesheets/jquery-ui/all.css +14 -0
- data/app/assets/stylesheets/jquery-ui/autocomplete.css +19 -0
- data/app/assets/stylesheets/jquery-ui/base.css +32 -0
- data/app/assets/stylesheets/jquery-ui/button.css +85 -0
- data/app/assets/stylesheets/jquery-ui/checkboxradio.css +37 -0
- data/app/assets/stylesheets/jquery-ui/controlgroup.css +68 -0
- data/app/assets/stylesheets/jquery-ui/core.css +100 -0
- data/app/assets/stylesheets/jquery-ui/datepicker.css +188 -0
- data/app/assets/stylesheets/jquery-ui/dialog.css +104 -0
- data/app/assets/stylesheets/jquery-ui/draggable.css +15 -0
- data/app/assets/stylesheets/jquery-ui/menu.css +67 -0
- data/app/assets/stylesheets/jquery-ui/progressbar.css +31 -0
- data/app/assets/stylesheets/jquery-ui/resizable.css +81 -0
- data/app/assets/stylesheets/jquery-ui/selectable.css +20 -0
- data/app/assets/stylesheets/jquery-ui/selectmenu.css +53 -0
- data/app/assets/stylesheets/jquery-ui/slider.css +78 -0
- data/app/assets/stylesheets/jquery-ui/sortable.css +15 -0
- data/app/assets/stylesheets/jquery-ui/spinner.css +55 -0
- data/app/assets/stylesheets/jquery-ui/tabs.css +54 -0
- data/app/assets/stylesheets/jquery-ui/theme.css.erb +456 -0
- data/app/assets/stylesheets/jquery-ui/tooltip.css +22 -0
- data/app/assets/stylesheets/jquery-ui.css +1 -0
- data/lib/jquery/ui/rails/engine.rb +8 -0
- data/lib/jquery/ui/rails/version.rb +8 -0
- data/lib/jquery/ui/rails.rb +2 -0
- data/lib/jquery-ui-rails.rb +1 -0
- metadata +250 -0
@@ -0,0 +1,1225 @@
|
|
1
|
+
//= require jquery-ui/widgets/mouse
|
2
|
+
//= require jquery-ui/disable-selection
|
3
|
+
//= require jquery-ui/plugin
|
4
|
+
//= require jquery-ui/version
|
5
|
+
//= require jquery-ui/widget
|
6
|
+
|
7
|
+
/*!
|
8
|
+
* jQuery UI Resizable 1.13.2
|
9
|
+
* http://jqueryui.com
|
10
|
+
*
|
11
|
+
* Copyright jQuery Foundation and other contributors
|
12
|
+
* Released under the MIT license.
|
13
|
+
* http://jquery.org/license
|
14
|
+
*/
|
15
|
+
|
16
|
+
//>>label: Resizable
|
17
|
+
//>>group: Interactions
|
18
|
+
//>>description: Enables resize functionality for any element.
|
19
|
+
//>>docs: http://api.jqueryui.com/resizable/
|
20
|
+
//>>demos: http://jqueryui.com/resizable/
|
21
|
+
//>>css.structure: ../../themes/base/core.css
|
22
|
+
//>>css.structure: ../../themes/base/resizable.css
|
23
|
+
//>>css.theme: ../../themes/base/theme.css
|
24
|
+
|
25
|
+
( function( factory ) {
|
26
|
+
"use strict";
|
27
|
+
|
28
|
+
if ( typeof define === "function" && define.amd ) {
|
29
|
+
|
30
|
+
// AMD. Register as an anonymous module.
|
31
|
+
define( [
|
32
|
+
"jquery",
|
33
|
+
"./mouse",
|
34
|
+
"../disable-selection",
|
35
|
+
"../plugin",
|
36
|
+
"../version",
|
37
|
+
"../widget"
|
38
|
+
], factory );
|
39
|
+
} else {
|
40
|
+
|
41
|
+
// Browser globals
|
42
|
+
factory( jQuery );
|
43
|
+
}
|
44
|
+
} )( function( $ ) {
|
45
|
+
"use strict";
|
46
|
+
|
47
|
+
$.widget( "ui.resizable", $.ui.mouse, {
|
48
|
+
version: "1.13.2",
|
49
|
+
widgetEventPrefix: "resize",
|
50
|
+
options: {
|
51
|
+
alsoResize: false,
|
52
|
+
animate: false,
|
53
|
+
animateDuration: "slow",
|
54
|
+
animateEasing: "swing",
|
55
|
+
aspectRatio: false,
|
56
|
+
autoHide: false,
|
57
|
+
classes: {
|
58
|
+
"ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
|
59
|
+
},
|
60
|
+
containment: false,
|
61
|
+
ghost: false,
|
62
|
+
grid: false,
|
63
|
+
handles: "e,s,se",
|
64
|
+
helper: false,
|
65
|
+
maxHeight: null,
|
66
|
+
maxWidth: null,
|
67
|
+
minHeight: 10,
|
68
|
+
minWidth: 10,
|
69
|
+
|
70
|
+
// See #7960
|
71
|
+
zIndex: 90,
|
72
|
+
|
73
|
+
// Callbacks
|
74
|
+
resize: null,
|
75
|
+
start: null,
|
76
|
+
stop: null
|
77
|
+
},
|
78
|
+
|
79
|
+
_num: function( value ) {
|
80
|
+
return parseFloat( value ) || 0;
|
81
|
+
},
|
82
|
+
|
83
|
+
_isNumber: function( value ) {
|
84
|
+
return !isNaN( parseFloat( value ) );
|
85
|
+
},
|
86
|
+
|
87
|
+
_hasScroll: function( el, a ) {
|
88
|
+
|
89
|
+
if ( $( el ).css( "overflow" ) === "hidden" ) {
|
90
|
+
return false;
|
91
|
+
}
|
92
|
+
|
93
|
+
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
94
|
+
has = false;
|
95
|
+
|
96
|
+
if ( el[ scroll ] > 0 ) {
|
97
|
+
return true;
|
98
|
+
}
|
99
|
+
|
100
|
+
// TODO: determine which cases actually cause this to happen
|
101
|
+
// if the element doesn't have the scroll set, see if it's possible to
|
102
|
+
// set the scroll
|
103
|
+
try {
|
104
|
+
el[ scroll ] = 1;
|
105
|
+
has = ( el[ scroll ] > 0 );
|
106
|
+
el[ scroll ] = 0;
|
107
|
+
} catch ( e ) {
|
108
|
+
|
109
|
+
// `el` might be a string, then setting `scroll` will throw
|
110
|
+
// an error in strict mode; ignore it.
|
111
|
+
}
|
112
|
+
return has;
|
113
|
+
},
|
114
|
+
|
115
|
+
_create: function() {
|
116
|
+
|
117
|
+
var margins,
|
118
|
+
o = this.options,
|
119
|
+
that = this;
|
120
|
+
this._addClass( "ui-resizable" );
|
121
|
+
|
122
|
+
$.extend( this, {
|
123
|
+
_aspectRatio: !!( o.aspectRatio ),
|
124
|
+
aspectRatio: o.aspectRatio,
|
125
|
+
originalElement: this.element,
|
126
|
+
_proportionallyResizeElements: [],
|
127
|
+
_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
|
128
|
+
} );
|
129
|
+
|
130
|
+
// Wrap the element if it cannot hold child nodes
|
131
|
+
if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
|
132
|
+
|
133
|
+
this.element.wrap(
|
134
|
+
$( "<div class='ui-wrapper'></div>" ).css( {
|
135
|
+
overflow: "hidden",
|
136
|
+
position: this.element.css( "position" ),
|
137
|
+
width: this.element.outerWidth(),
|
138
|
+
height: this.element.outerHeight(),
|
139
|
+
top: this.element.css( "top" ),
|
140
|
+
left: this.element.css( "left" )
|
141
|
+
} )
|
142
|
+
);
|
143
|
+
|
144
|
+
this.element = this.element.parent().data(
|
145
|
+
"ui-resizable", this.element.resizable( "instance" )
|
146
|
+
);
|
147
|
+
|
148
|
+
this.elementIsWrapper = true;
|
149
|
+
|
150
|
+
margins = {
|
151
|
+
marginTop: this.originalElement.css( "marginTop" ),
|
152
|
+
marginRight: this.originalElement.css( "marginRight" ),
|
153
|
+
marginBottom: this.originalElement.css( "marginBottom" ),
|
154
|
+
marginLeft: this.originalElement.css( "marginLeft" )
|
155
|
+
};
|
156
|
+
|
157
|
+
this.element.css( margins );
|
158
|
+
this.originalElement.css( "margin", 0 );
|
159
|
+
|
160
|
+
// support: Safari
|
161
|
+
// Prevent Safari textarea resize
|
162
|
+
this.originalResizeStyle = this.originalElement.css( "resize" );
|
163
|
+
this.originalElement.css( "resize", "none" );
|
164
|
+
|
165
|
+
this._proportionallyResizeElements.push( this.originalElement.css( {
|
166
|
+
position: "static",
|
167
|
+
zoom: 1,
|
168
|
+
display: "block"
|
169
|
+
} ) );
|
170
|
+
|
171
|
+
// Support: IE9
|
172
|
+
// avoid IE jump (hard set the margin)
|
173
|
+
this.originalElement.css( margins );
|
174
|
+
|
175
|
+
this._proportionallyResize();
|
176
|
+
}
|
177
|
+
|
178
|
+
this._setupHandles();
|
179
|
+
|
180
|
+
if ( o.autoHide ) {
|
181
|
+
$( this.element )
|
182
|
+
.on( "mouseenter", function() {
|
183
|
+
if ( o.disabled ) {
|
184
|
+
return;
|
185
|
+
}
|
186
|
+
that._removeClass( "ui-resizable-autohide" );
|
187
|
+
that._handles.show();
|
188
|
+
} )
|
189
|
+
.on( "mouseleave", function() {
|
190
|
+
if ( o.disabled ) {
|
191
|
+
return;
|
192
|
+
}
|
193
|
+
if ( !that.resizing ) {
|
194
|
+
that._addClass( "ui-resizable-autohide" );
|
195
|
+
that._handles.hide();
|
196
|
+
}
|
197
|
+
} );
|
198
|
+
}
|
199
|
+
|
200
|
+
this._mouseInit();
|
201
|
+
},
|
202
|
+
|
203
|
+
_destroy: function() {
|
204
|
+
|
205
|
+
this._mouseDestroy();
|
206
|
+
this._addedHandles.remove();
|
207
|
+
|
208
|
+
var wrapper,
|
209
|
+
_destroy = function( exp ) {
|
210
|
+
$( exp )
|
211
|
+
.removeData( "resizable" )
|
212
|
+
.removeData( "ui-resizable" )
|
213
|
+
.off( ".resizable" );
|
214
|
+
};
|
215
|
+
|
216
|
+
// TODO: Unwrap at same DOM position
|
217
|
+
if ( this.elementIsWrapper ) {
|
218
|
+
_destroy( this.element );
|
219
|
+
wrapper = this.element;
|
220
|
+
this.originalElement.css( {
|
221
|
+
position: wrapper.css( "position" ),
|
222
|
+
width: wrapper.outerWidth(),
|
223
|
+
height: wrapper.outerHeight(),
|
224
|
+
top: wrapper.css( "top" ),
|
225
|
+
left: wrapper.css( "left" )
|
226
|
+
} ).insertAfter( wrapper );
|
227
|
+
wrapper.remove();
|
228
|
+
}
|
229
|
+
|
230
|
+
this.originalElement.css( "resize", this.originalResizeStyle );
|
231
|
+
_destroy( this.originalElement );
|
232
|
+
|
233
|
+
return this;
|
234
|
+
},
|
235
|
+
|
236
|
+
_setOption: function( key, value ) {
|
237
|
+
this._super( key, value );
|
238
|
+
|
239
|
+
switch ( key ) {
|
240
|
+
case "handles":
|
241
|
+
this._removeHandles();
|
242
|
+
this._setupHandles();
|
243
|
+
break;
|
244
|
+
case "aspectRatio":
|
245
|
+
this._aspectRatio = !!value;
|
246
|
+
break;
|
247
|
+
default:
|
248
|
+
break;
|
249
|
+
}
|
250
|
+
},
|
251
|
+
|
252
|
+
_setupHandles: function() {
|
253
|
+
var o = this.options, handle, i, n, hname, axis, that = this;
|
254
|
+
this.handles = o.handles ||
|
255
|
+
( !$( ".ui-resizable-handle", this.element ).length ?
|
256
|
+
"e,s,se" : {
|
257
|
+
n: ".ui-resizable-n",
|
258
|
+
e: ".ui-resizable-e",
|
259
|
+
s: ".ui-resizable-s",
|
260
|
+
w: ".ui-resizable-w",
|
261
|
+
se: ".ui-resizable-se",
|
262
|
+
sw: ".ui-resizable-sw",
|
263
|
+
ne: ".ui-resizable-ne",
|
264
|
+
nw: ".ui-resizable-nw"
|
265
|
+
} );
|
266
|
+
|
267
|
+
this._handles = $();
|
268
|
+
this._addedHandles = $();
|
269
|
+
if ( this.handles.constructor === String ) {
|
270
|
+
|
271
|
+
if ( this.handles === "all" ) {
|
272
|
+
this.handles = "n,e,s,w,se,sw,ne,nw";
|
273
|
+
}
|
274
|
+
|
275
|
+
n = this.handles.split( "," );
|
276
|
+
this.handles = {};
|
277
|
+
|
278
|
+
for ( i = 0; i < n.length; i++ ) {
|
279
|
+
|
280
|
+
handle = String.prototype.trim.call( n[ i ] );
|
281
|
+
hname = "ui-resizable-" + handle;
|
282
|
+
axis = $( "<div>" );
|
283
|
+
this._addClass( axis, "ui-resizable-handle " + hname );
|
284
|
+
|
285
|
+
axis.css( { zIndex: o.zIndex } );
|
286
|
+
|
287
|
+
this.handles[ handle ] = ".ui-resizable-" + handle;
|
288
|
+
if ( !this.element.children( this.handles[ handle ] ).length ) {
|
289
|
+
this.element.append( axis );
|
290
|
+
this._addedHandles = this._addedHandles.add( axis );
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
294
|
+
}
|
295
|
+
|
296
|
+
this._renderAxis = function( target ) {
|
297
|
+
|
298
|
+
var i, axis, padPos, padWrapper;
|
299
|
+
|
300
|
+
target = target || this.element;
|
301
|
+
|
302
|
+
for ( i in this.handles ) {
|
303
|
+
|
304
|
+
if ( this.handles[ i ].constructor === String ) {
|
305
|
+
this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
|
306
|
+
} else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
|
307
|
+
this.handles[ i ] = $( this.handles[ i ] );
|
308
|
+
this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
|
309
|
+
}
|
310
|
+
|
311
|
+
if ( this.elementIsWrapper &&
|
312
|
+
this.originalElement[ 0 ]
|
313
|
+
.nodeName
|
314
|
+
.match( /^(textarea|input|select|button)$/i ) ) {
|
315
|
+
axis = $( this.handles[ i ], this.element );
|
316
|
+
|
317
|
+
padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
|
318
|
+
axis.outerHeight() :
|
319
|
+
axis.outerWidth();
|
320
|
+
|
321
|
+
padPos = [ "padding",
|
322
|
+
/ne|nw|n/.test( i ) ? "Top" :
|
323
|
+
/se|sw|s/.test( i ) ? "Bottom" :
|
324
|
+
/^e$/.test( i ) ? "Right" : "Left" ].join( "" );
|
325
|
+
|
326
|
+
target.css( padPos, padWrapper );
|
327
|
+
|
328
|
+
this._proportionallyResize();
|
329
|
+
}
|
330
|
+
|
331
|
+
this._handles = this._handles.add( this.handles[ i ] );
|
332
|
+
}
|
333
|
+
};
|
334
|
+
|
335
|
+
// TODO: make renderAxis a prototype function
|
336
|
+
this._renderAxis( this.element );
|
337
|
+
|
338
|
+
this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
|
339
|
+
this._handles.disableSelection();
|
340
|
+
|
341
|
+
this._handles.on( "mouseover", function() {
|
342
|
+
if ( !that.resizing ) {
|
343
|
+
if ( this.className ) {
|
344
|
+
axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
|
345
|
+
}
|
346
|
+
that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
|
347
|
+
}
|
348
|
+
} );
|
349
|
+
|
350
|
+
if ( o.autoHide ) {
|
351
|
+
this._handles.hide();
|
352
|
+
this._addClass( "ui-resizable-autohide" );
|
353
|
+
}
|
354
|
+
},
|
355
|
+
|
356
|
+
_removeHandles: function() {
|
357
|
+
this._addedHandles.remove();
|
358
|
+
},
|
359
|
+
|
360
|
+
_mouseCapture: function( event ) {
|
361
|
+
var i, handle,
|
362
|
+
capture = false;
|
363
|
+
|
364
|
+
for ( i in this.handles ) {
|
365
|
+
handle = $( this.handles[ i ] )[ 0 ];
|
366
|
+
if ( handle === event.target || $.contains( handle, event.target ) ) {
|
367
|
+
capture = true;
|
368
|
+
}
|
369
|
+
}
|
370
|
+
|
371
|
+
return !this.options.disabled && capture;
|
372
|
+
},
|
373
|
+
|
374
|
+
_mouseStart: function( event ) {
|
375
|
+
|
376
|
+
var curleft, curtop, cursor,
|
377
|
+
o = this.options,
|
378
|
+
el = this.element;
|
379
|
+
|
380
|
+
this.resizing = true;
|
381
|
+
|
382
|
+
this._renderProxy();
|
383
|
+
|
384
|
+
curleft = this._num( this.helper.css( "left" ) );
|
385
|
+
curtop = this._num( this.helper.css( "top" ) );
|
386
|
+
|
387
|
+
if ( o.containment ) {
|
388
|
+
curleft += $( o.containment ).scrollLeft() || 0;
|
389
|
+
curtop += $( o.containment ).scrollTop() || 0;
|
390
|
+
}
|
391
|
+
|
392
|
+
this.offset = this.helper.offset();
|
393
|
+
this.position = { left: curleft, top: curtop };
|
394
|
+
|
395
|
+
this.size = this._helper ? {
|
396
|
+
width: this.helper.width(),
|
397
|
+
height: this.helper.height()
|
398
|
+
} : {
|
399
|
+
width: el.width(),
|
400
|
+
height: el.height()
|
401
|
+
};
|
402
|
+
|
403
|
+
this.originalSize = this._helper ? {
|
404
|
+
width: el.outerWidth(),
|
405
|
+
height: el.outerHeight()
|
406
|
+
} : {
|
407
|
+
width: el.width(),
|
408
|
+
height: el.height()
|
409
|
+
};
|
410
|
+
|
411
|
+
this.sizeDiff = {
|
412
|
+
width: el.outerWidth() - el.width(),
|
413
|
+
height: el.outerHeight() - el.height()
|
414
|
+
};
|
415
|
+
|
416
|
+
this.originalPosition = { left: curleft, top: curtop };
|
417
|
+
this.originalMousePosition = { left: event.pageX, top: event.pageY };
|
418
|
+
|
419
|
+
this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
|
420
|
+
o.aspectRatio :
|
421
|
+
( ( this.originalSize.width / this.originalSize.height ) || 1 );
|
422
|
+
|
423
|
+
cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
|
424
|
+
$( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
|
425
|
+
|
426
|
+
this._addClass( "ui-resizable-resizing" );
|
427
|
+
this._propagate( "start", event );
|
428
|
+
return true;
|
429
|
+
},
|
430
|
+
|
431
|
+
_mouseDrag: function( event ) {
|
432
|
+
|
433
|
+
var data, props,
|
434
|
+
smp = this.originalMousePosition,
|
435
|
+
a = this.axis,
|
436
|
+
dx = ( event.pageX - smp.left ) || 0,
|
437
|
+
dy = ( event.pageY - smp.top ) || 0,
|
438
|
+
trigger = this._change[ a ];
|
439
|
+
|
440
|
+
this._updatePrevProperties();
|
441
|
+
|
442
|
+
if ( !trigger ) {
|
443
|
+
return false;
|
444
|
+
}
|
445
|
+
|
446
|
+
data = trigger.apply( this, [ event, dx, dy ] );
|
447
|
+
|
448
|
+
this._updateVirtualBoundaries( event.shiftKey );
|
449
|
+
if ( this._aspectRatio || event.shiftKey ) {
|
450
|
+
data = this._updateRatio( data, event );
|
451
|
+
}
|
452
|
+
|
453
|
+
data = this._respectSize( data, event );
|
454
|
+
|
455
|
+
this._updateCache( data );
|
456
|
+
|
457
|
+
this._propagate( "resize", event );
|
458
|
+
|
459
|
+
props = this._applyChanges();
|
460
|
+
|
461
|
+
if ( !this._helper && this._proportionallyResizeElements.length ) {
|
462
|
+
this._proportionallyResize();
|
463
|
+
}
|
464
|
+
|
465
|
+
if ( !$.isEmptyObject( props ) ) {
|
466
|
+
this._updatePrevProperties();
|
467
|
+
this._trigger( "resize", event, this.ui() );
|
468
|
+
this._applyChanges();
|
469
|
+
}
|
470
|
+
|
471
|
+
return false;
|
472
|
+
},
|
473
|
+
|
474
|
+
_mouseStop: function( event ) {
|
475
|
+
|
476
|
+
this.resizing = false;
|
477
|
+
var pr, ista, soffseth, soffsetw, s, left, top,
|
478
|
+
o = this.options, that = this;
|
479
|
+
|
480
|
+
if ( this._helper ) {
|
481
|
+
|
482
|
+
pr = this._proportionallyResizeElements;
|
483
|
+
ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
|
484
|
+
soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
|
485
|
+
soffsetw = ista ? 0 : that.sizeDiff.width;
|
486
|
+
|
487
|
+
s = {
|
488
|
+
width: ( that.helper.width() - soffsetw ),
|
489
|
+
height: ( that.helper.height() - soffseth )
|
490
|
+
};
|
491
|
+
left = ( parseFloat( that.element.css( "left" ) ) +
|
492
|
+
( that.position.left - that.originalPosition.left ) ) || null;
|
493
|
+
top = ( parseFloat( that.element.css( "top" ) ) +
|
494
|
+
( that.position.top - that.originalPosition.top ) ) || null;
|
495
|
+
|
496
|
+
if ( !o.animate ) {
|
497
|
+
this.element.css( $.extend( s, { top: top, left: left } ) );
|
498
|
+
}
|
499
|
+
|
500
|
+
that.helper.height( that.size.height );
|
501
|
+
that.helper.width( that.size.width );
|
502
|
+
|
503
|
+
if ( this._helper && !o.animate ) {
|
504
|
+
this._proportionallyResize();
|
505
|
+
}
|
506
|
+
}
|
507
|
+
|
508
|
+
$( "body" ).css( "cursor", "auto" );
|
509
|
+
|
510
|
+
this._removeClass( "ui-resizable-resizing" );
|
511
|
+
|
512
|
+
this._propagate( "stop", event );
|
513
|
+
|
514
|
+
if ( this._helper ) {
|
515
|
+
this.helper.remove();
|
516
|
+
}
|
517
|
+
|
518
|
+
return false;
|
519
|
+
|
520
|
+
},
|
521
|
+
|
522
|
+
_updatePrevProperties: function() {
|
523
|
+
this.prevPosition = {
|
524
|
+
top: this.position.top,
|
525
|
+
left: this.position.left
|
526
|
+
};
|
527
|
+
this.prevSize = {
|
528
|
+
width: this.size.width,
|
529
|
+
height: this.size.height
|
530
|
+
};
|
531
|
+
},
|
532
|
+
|
533
|
+
_applyChanges: function() {
|
534
|
+
var props = {};
|
535
|
+
|
536
|
+
if ( this.position.top !== this.prevPosition.top ) {
|
537
|
+
props.top = this.position.top + "px";
|
538
|
+
}
|
539
|
+
if ( this.position.left !== this.prevPosition.left ) {
|
540
|
+
props.left = this.position.left + "px";
|
541
|
+
}
|
542
|
+
if ( this.size.width !== this.prevSize.width ) {
|
543
|
+
props.width = this.size.width + "px";
|
544
|
+
}
|
545
|
+
if ( this.size.height !== this.prevSize.height ) {
|
546
|
+
props.height = this.size.height + "px";
|
547
|
+
}
|
548
|
+
|
549
|
+
this.helper.css( props );
|
550
|
+
|
551
|
+
return props;
|
552
|
+
},
|
553
|
+
|
554
|
+
_updateVirtualBoundaries: function( forceAspectRatio ) {
|
555
|
+
var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
|
556
|
+
o = this.options;
|
557
|
+
|
558
|
+
b = {
|
559
|
+
minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
|
560
|
+
maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
|
561
|
+
minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
|
562
|
+
maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
|
563
|
+
};
|
564
|
+
|
565
|
+
if ( this._aspectRatio || forceAspectRatio ) {
|
566
|
+
pMinWidth = b.minHeight * this.aspectRatio;
|
567
|
+
pMinHeight = b.minWidth / this.aspectRatio;
|
568
|
+
pMaxWidth = b.maxHeight * this.aspectRatio;
|
569
|
+
pMaxHeight = b.maxWidth / this.aspectRatio;
|
570
|
+
|
571
|
+
if ( pMinWidth > b.minWidth ) {
|
572
|
+
b.minWidth = pMinWidth;
|
573
|
+
}
|
574
|
+
if ( pMinHeight > b.minHeight ) {
|
575
|
+
b.minHeight = pMinHeight;
|
576
|
+
}
|
577
|
+
if ( pMaxWidth < b.maxWidth ) {
|
578
|
+
b.maxWidth = pMaxWidth;
|
579
|
+
}
|
580
|
+
if ( pMaxHeight < b.maxHeight ) {
|
581
|
+
b.maxHeight = pMaxHeight;
|
582
|
+
}
|
583
|
+
}
|
584
|
+
this._vBoundaries = b;
|
585
|
+
},
|
586
|
+
|
587
|
+
_updateCache: function( data ) {
|
588
|
+
this.offset = this.helper.offset();
|
589
|
+
if ( this._isNumber( data.left ) ) {
|
590
|
+
this.position.left = data.left;
|
591
|
+
}
|
592
|
+
if ( this._isNumber( data.top ) ) {
|
593
|
+
this.position.top = data.top;
|
594
|
+
}
|
595
|
+
if ( this._isNumber( data.height ) ) {
|
596
|
+
this.size.height = data.height;
|
597
|
+
}
|
598
|
+
if ( this._isNumber( data.width ) ) {
|
599
|
+
this.size.width = data.width;
|
600
|
+
}
|
601
|
+
},
|
602
|
+
|
603
|
+
_updateRatio: function( data ) {
|
604
|
+
|
605
|
+
var cpos = this.position,
|
606
|
+
csize = this.size,
|
607
|
+
a = this.axis;
|
608
|
+
|
609
|
+
if ( this._isNumber( data.height ) ) {
|
610
|
+
data.width = ( data.height * this.aspectRatio );
|
611
|
+
} else if ( this._isNumber( data.width ) ) {
|
612
|
+
data.height = ( data.width / this.aspectRatio );
|
613
|
+
}
|
614
|
+
|
615
|
+
if ( a === "sw" ) {
|
616
|
+
data.left = cpos.left + ( csize.width - data.width );
|
617
|
+
data.top = null;
|
618
|
+
}
|
619
|
+
if ( a === "nw" ) {
|
620
|
+
data.top = cpos.top + ( csize.height - data.height );
|
621
|
+
data.left = cpos.left + ( csize.width - data.width );
|
622
|
+
}
|
623
|
+
|
624
|
+
return data;
|
625
|
+
},
|
626
|
+
|
627
|
+
_respectSize: function( data ) {
|
628
|
+
|
629
|
+
var o = this._vBoundaries,
|
630
|
+
a = this.axis,
|
631
|
+
ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
|
632
|
+
ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
|
633
|
+
isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
|
634
|
+
isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
|
635
|
+
dw = this.originalPosition.left + this.originalSize.width,
|
636
|
+
dh = this.originalPosition.top + this.originalSize.height,
|
637
|
+
cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
|
638
|
+
if ( isminw ) {
|
639
|
+
data.width = o.minWidth;
|
640
|
+
}
|
641
|
+
if ( isminh ) {
|
642
|
+
data.height = o.minHeight;
|
643
|
+
}
|
644
|
+
if ( ismaxw ) {
|
645
|
+
data.width = o.maxWidth;
|
646
|
+
}
|
647
|
+
if ( ismaxh ) {
|
648
|
+
data.height = o.maxHeight;
|
649
|
+
}
|
650
|
+
|
651
|
+
if ( isminw && cw ) {
|
652
|
+
data.left = dw - o.minWidth;
|
653
|
+
}
|
654
|
+
if ( ismaxw && cw ) {
|
655
|
+
data.left = dw - o.maxWidth;
|
656
|
+
}
|
657
|
+
if ( isminh && ch ) {
|
658
|
+
data.top = dh - o.minHeight;
|
659
|
+
}
|
660
|
+
if ( ismaxh && ch ) {
|
661
|
+
data.top = dh - o.maxHeight;
|
662
|
+
}
|
663
|
+
|
664
|
+
// Fixing jump error on top/left - bug #2330
|
665
|
+
if ( !data.width && !data.height && !data.left && data.top ) {
|
666
|
+
data.top = null;
|
667
|
+
} else if ( !data.width && !data.height && !data.top && data.left ) {
|
668
|
+
data.left = null;
|
669
|
+
}
|
670
|
+
|
671
|
+
return data;
|
672
|
+
},
|
673
|
+
|
674
|
+
_getPaddingPlusBorderDimensions: function( element ) {
|
675
|
+
var i = 0,
|
676
|
+
widths = [],
|
677
|
+
borders = [
|
678
|
+
element.css( "borderTopWidth" ),
|
679
|
+
element.css( "borderRightWidth" ),
|
680
|
+
element.css( "borderBottomWidth" ),
|
681
|
+
element.css( "borderLeftWidth" )
|
682
|
+
],
|
683
|
+
paddings = [
|
684
|
+
element.css( "paddingTop" ),
|
685
|
+
element.css( "paddingRight" ),
|
686
|
+
element.css( "paddingBottom" ),
|
687
|
+
element.css( "paddingLeft" )
|
688
|
+
];
|
689
|
+
|
690
|
+
for ( ; i < 4; i++ ) {
|
691
|
+
widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
|
692
|
+
widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
|
693
|
+
}
|
694
|
+
|
695
|
+
return {
|
696
|
+
height: widths[ 0 ] + widths[ 2 ],
|
697
|
+
width: widths[ 1 ] + widths[ 3 ]
|
698
|
+
};
|
699
|
+
},
|
700
|
+
|
701
|
+
_proportionallyResize: function() {
|
702
|
+
|
703
|
+
if ( !this._proportionallyResizeElements.length ) {
|
704
|
+
return;
|
705
|
+
}
|
706
|
+
|
707
|
+
var prel,
|
708
|
+
i = 0,
|
709
|
+
element = this.helper || this.element;
|
710
|
+
|
711
|
+
for ( ; i < this._proportionallyResizeElements.length; i++ ) {
|
712
|
+
|
713
|
+
prel = this._proportionallyResizeElements[ i ];
|
714
|
+
|
715
|
+
// TODO: Seems like a bug to cache this.outerDimensions
|
716
|
+
// considering that we are in a loop.
|
717
|
+
if ( !this.outerDimensions ) {
|
718
|
+
this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
|
719
|
+
}
|
720
|
+
|
721
|
+
prel.css( {
|
722
|
+
height: ( element.height() - this.outerDimensions.height ) || 0,
|
723
|
+
width: ( element.width() - this.outerDimensions.width ) || 0
|
724
|
+
} );
|
725
|
+
|
726
|
+
}
|
727
|
+
|
728
|
+
},
|
729
|
+
|
730
|
+
_renderProxy: function() {
|
731
|
+
|
732
|
+
var el = this.element, o = this.options;
|
733
|
+
this.elementOffset = el.offset();
|
734
|
+
|
735
|
+
if ( this._helper ) {
|
736
|
+
|
737
|
+
this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } );
|
738
|
+
|
739
|
+
this._addClass( this.helper, this._helper );
|
740
|
+
this.helper.css( {
|
741
|
+
width: this.element.outerWidth(),
|
742
|
+
height: this.element.outerHeight(),
|
743
|
+
position: "absolute",
|
744
|
+
left: this.elementOffset.left + "px",
|
745
|
+
top: this.elementOffset.top + "px",
|
746
|
+
zIndex: ++o.zIndex //TODO: Don't modify option
|
747
|
+
} );
|
748
|
+
|
749
|
+
this.helper
|
750
|
+
.appendTo( "body" )
|
751
|
+
.disableSelection();
|
752
|
+
|
753
|
+
} else {
|
754
|
+
this.helper = this.element;
|
755
|
+
}
|
756
|
+
|
757
|
+
},
|
758
|
+
|
759
|
+
_change: {
|
760
|
+
e: function( event, dx ) {
|
761
|
+
return { width: this.originalSize.width + dx };
|
762
|
+
},
|
763
|
+
w: function( event, dx ) {
|
764
|
+
var cs = this.originalSize, sp = this.originalPosition;
|
765
|
+
return { left: sp.left + dx, width: cs.width - dx };
|
766
|
+
},
|
767
|
+
n: function( event, dx, dy ) {
|
768
|
+
var cs = this.originalSize, sp = this.originalPosition;
|
769
|
+
return { top: sp.top + dy, height: cs.height - dy };
|
770
|
+
},
|
771
|
+
s: function( event, dx, dy ) {
|
772
|
+
return { height: this.originalSize.height + dy };
|
773
|
+
},
|
774
|
+
se: function( event, dx, dy ) {
|
775
|
+
return $.extend( this._change.s.apply( this, arguments ),
|
776
|
+
this._change.e.apply( this, [ event, dx, dy ] ) );
|
777
|
+
},
|
778
|
+
sw: function( event, dx, dy ) {
|
779
|
+
return $.extend( this._change.s.apply( this, arguments ),
|
780
|
+
this._change.w.apply( this, [ event, dx, dy ] ) );
|
781
|
+
},
|
782
|
+
ne: function( event, dx, dy ) {
|
783
|
+
return $.extend( this._change.n.apply( this, arguments ),
|
784
|
+
this._change.e.apply( this, [ event, dx, dy ] ) );
|
785
|
+
},
|
786
|
+
nw: function( event, dx, dy ) {
|
787
|
+
return $.extend( this._change.n.apply( this, arguments ),
|
788
|
+
this._change.w.apply( this, [ event, dx, dy ] ) );
|
789
|
+
}
|
790
|
+
},
|
791
|
+
|
792
|
+
_propagate: function( n, event ) {
|
793
|
+
$.ui.plugin.call( this, n, [ event, this.ui() ] );
|
794
|
+
if ( n !== "resize" ) {
|
795
|
+
this._trigger( n, event, this.ui() );
|
796
|
+
}
|
797
|
+
},
|
798
|
+
|
799
|
+
plugins: {},
|
800
|
+
|
801
|
+
ui: function() {
|
802
|
+
return {
|
803
|
+
originalElement: this.originalElement,
|
804
|
+
element: this.element,
|
805
|
+
helper: this.helper,
|
806
|
+
position: this.position,
|
807
|
+
size: this.size,
|
808
|
+
originalSize: this.originalSize,
|
809
|
+
originalPosition: this.originalPosition
|
810
|
+
};
|
811
|
+
}
|
812
|
+
|
813
|
+
} );
|
814
|
+
|
815
|
+
/*
|
816
|
+
* Resizable Extensions
|
817
|
+
*/
|
818
|
+
|
819
|
+
$.ui.plugin.add( "resizable", "animate", {
|
820
|
+
|
821
|
+
stop: function( event ) {
|
822
|
+
var that = $( this ).resizable( "instance" ),
|
823
|
+
o = that.options,
|
824
|
+
pr = that._proportionallyResizeElements,
|
825
|
+
ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
|
826
|
+
soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
|
827
|
+
soffsetw = ista ? 0 : that.sizeDiff.width,
|
828
|
+
style = {
|
829
|
+
width: ( that.size.width - soffsetw ),
|
830
|
+
height: ( that.size.height - soffseth )
|
831
|
+
},
|
832
|
+
left = ( parseFloat( that.element.css( "left" ) ) +
|
833
|
+
( that.position.left - that.originalPosition.left ) ) || null,
|
834
|
+
top = ( parseFloat( that.element.css( "top" ) ) +
|
835
|
+
( that.position.top - that.originalPosition.top ) ) || null;
|
836
|
+
|
837
|
+
that.element.animate(
|
838
|
+
$.extend( style, top && left ? { top: top, left: left } : {} ), {
|
839
|
+
duration: o.animateDuration,
|
840
|
+
easing: o.animateEasing,
|
841
|
+
step: function() {
|
842
|
+
|
843
|
+
var data = {
|
844
|
+
width: parseFloat( that.element.css( "width" ) ),
|
845
|
+
height: parseFloat( that.element.css( "height" ) ),
|
846
|
+
top: parseFloat( that.element.css( "top" ) ),
|
847
|
+
left: parseFloat( that.element.css( "left" ) )
|
848
|
+
};
|
849
|
+
|
850
|
+
if ( pr && pr.length ) {
|
851
|
+
$( pr[ 0 ] ).css( { width: data.width, height: data.height } );
|
852
|
+
}
|
853
|
+
|
854
|
+
// Propagating resize, and updating values for each animation step
|
855
|
+
that._updateCache( data );
|
856
|
+
that._propagate( "resize", event );
|
857
|
+
|
858
|
+
}
|
859
|
+
}
|
860
|
+
);
|
861
|
+
}
|
862
|
+
|
863
|
+
} );
|
864
|
+
|
865
|
+
$.ui.plugin.add( "resizable", "containment", {
|
866
|
+
|
867
|
+
start: function() {
|
868
|
+
var element, p, co, ch, cw, width, height,
|
869
|
+
that = $( this ).resizable( "instance" ),
|
870
|
+
o = that.options,
|
871
|
+
el = that.element,
|
872
|
+
oc = o.containment,
|
873
|
+
ce = ( oc instanceof $ ) ?
|
874
|
+
oc.get( 0 ) :
|
875
|
+
( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
|
876
|
+
|
877
|
+
if ( !ce ) {
|
878
|
+
return;
|
879
|
+
}
|
880
|
+
|
881
|
+
that.containerElement = $( ce );
|
882
|
+
|
883
|
+
if ( /document/.test( oc ) || oc === document ) {
|
884
|
+
that.containerOffset = {
|
885
|
+
left: 0,
|
886
|
+
top: 0
|
887
|
+
};
|
888
|
+
that.containerPosition = {
|
889
|
+
left: 0,
|
890
|
+
top: 0
|
891
|
+
};
|
892
|
+
|
893
|
+
that.parentData = {
|
894
|
+
element: $( document ),
|
895
|
+
left: 0,
|
896
|
+
top: 0,
|
897
|
+
width: $( document ).width(),
|
898
|
+
height: $( document ).height() || document.body.parentNode.scrollHeight
|
899
|
+
};
|
900
|
+
} else {
|
901
|
+
element = $( ce );
|
902
|
+
p = [];
|
903
|
+
$( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
|
904
|
+
p[ i ] = that._num( element.css( "padding" + name ) );
|
905
|
+
} );
|
906
|
+
|
907
|
+
that.containerOffset = element.offset();
|
908
|
+
that.containerPosition = element.position();
|
909
|
+
that.containerSize = {
|
910
|
+
height: ( element.innerHeight() - p[ 3 ] ),
|
911
|
+
width: ( element.innerWidth() - p[ 1 ] )
|
912
|
+
};
|
913
|
+
|
914
|
+
co = that.containerOffset;
|
915
|
+
ch = that.containerSize.height;
|
916
|
+
cw = that.containerSize.width;
|
917
|
+
width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw );
|
918
|
+
height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch );
|
919
|
+
|
920
|
+
that.parentData = {
|
921
|
+
element: ce,
|
922
|
+
left: co.left,
|
923
|
+
top: co.top,
|
924
|
+
width: width,
|
925
|
+
height: height
|
926
|
+
};
|
927
|
+
}
|
928
|
+
},
|
929
|
+
|
930
|
+
resize: function( event ) {
|
931
|
+
var woset, hoset, isParent, isOffsetRelative,
|
932
|
+
that = $( this ).resizable( "instance" ),
|
933
|
+
o = that.options,
|
934
|
+
co = that.containerOffset,
|
935
|
+
cp = that.position,
|
936
|
+
pRatio = that._aspectRatio || event.shiftKey,
|
937
|
+
cop = {
|
938
|
+
top: 0,
|
939
|
+
left: 0
|
940
|
+
},
|
941
|
+
ce = that.containerElement,
|
942
|
+
continueResize = true;
|
943
|
+
|
944
|
+
if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
|
945
|
+
cop = co;
|
946
|
+
}
|
947
|
+
|
948
|
+
if ( cp.left < ( that._helper ? co.left : 0 ) ) {
|
949
|
+
that.size.width = that.size.width +
|
950
|
+
( that._helper ?
|
951
|
+
( that.position.left - co.left ) :
|
952
|
+
( that.position.left - cop.left ) );
|
953
|
+
|
954
|
+
if ( pRatio ) {
|
955
|
+
that.size.height = that.size.width / that.aspectRatio;
|
956
|
+
continueResize = false;
|
957
|
+
}
|
958
|
+
that.position.left = o.helper ? co.left : 0;
|
959
|
+
}
|
960
|
+
|
961
|
+
if ( cp.top < ( that._helper ? co.top : 0 ) ) {
|
962
|
+
that.size.height = that.size.height +
|
963
|
+
( that._helper ?
|
964
|
+
( that.position.top - co.top ) :
|
965
|
+
that.position.top );
|
966
|
+
|
967
|
+
if ( pRatio ) {
|
968
|
+
that.size.width = that.size.height * that.aspectRatio;
|
969
|
+
continueResize = false;
|
970
|
+
}
|
971
|
+
that.position.top = that._helper ? co.top : 0;
|
972
|
+
}
|
973
|
+
|
974
|
+
isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
|
975
|
+
isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
|
976
|
+
|
977
|
+
if ( isParent && isOffsetRelative ) {
|
978
|
+
that.offset.left = that.parentData.left + that.position.left;
|
979
|
+
that.offset.top = that.parentData.top + that.position.top;
|
980
|
+
} else {
|
981
|
+
that.offset.left = that.element.offset().left;
|
982
|
+
that.offset.top = that.element.offset().top;
|
983
|
+
}
|
984
|
+
|
985
|
+
woset = Math.abs( that.sizeDiff.width +
|
986
|
+
( that._helper ?
|
987
|
+
that.offset.left - cop.left :
|
988
|
+
( that.offset.left - co.left ) ) );
|
989
|
+
|
990
|
+
hoset = Math.abs( that.sizeDiff.height +
|
991
|
+
( that._helper ?
|
992
|
+
that.offset.top - cop.top :
|
993
|
+
( that.offset.top - co.top ) ) );
|
994
|
+
|
995
|
+
if ( woset + that.size.width >= that.parentData.width ) {
|
996
|
+
that.size.width = that.parentData.width - woset;
|
997
|
+
if ( pRatio ) {
|
998
|
+
that.size.height = that.size.width / that.aspectRatio;
|
999
|
+
continueResize = false;
|
1000
|
+
}
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
if ( hoset + that.size.height >= that.parentData.height ) {
|
1004
|
+
that.size.height = that.parentData.height - hoset;
|
1005
|
+
if ( pRatio ) {
|
1006
|
+
that.size.width = that.size.height * that.aspectRatio;
|
1007
|
+
continueResize = false;
|
1008
|
+
}
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
if ( !continueResize ) {
|
1012
|
+
that.position.left = that.prevPosition.left;
|
1013
|
+
that.position.top = that.prevPosition.top;
|
1014
|
+
that.size.width = that.prevSize.width;
|
1015
|
+
that.size.height = that.prevSize.height;
|
1016
|
+
}
|
1017
|
+
},
|
1018
|
+
|
1019
|
+
stop: function() {
|
1020
|
+
var that = $( this ).resizable( "instance" ),
|
1021
|
+
o = that.options,
|
1022
|
+
co = that.containerOffset,
|
1023
|
+
cop = that.containerPosition,
|
1024
|
+
ce = that.containerElement,
|
1025
|
+
helper = $( that.helper ),
|
1026
|
+
ho = helper.offset(),
|
1027
|
+
w = helper.outerWidth() - that.sizeDiff.width,
|
1028
|
+
h = helper.outerHeight() - that.sizeDiff.height;
|
1029
|
+
|
1030
|
+
if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
|
1031
|
+
$( this ).css( {
|
1032
|
+
left: ho.left - cop.left - co.left,
|
1033
|
+
width: w,
|
1034
|
+
height: h
|
1035
|
+
} );
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
|
1039
|
+
$( this ).css( {
|
1040
|
+
left: ho.left - cop.left - co.left,
|
1041
|
+
width: w,
|
1042
|
+
height: h
|
1043
|
+
} );
|
1044
|
+
}
|
1045
|
+
}
|
1046
|
+
} );
|
1047
|
+
|
1048
|
+
$.ui.plugin.add( "resizable", "alsoResize", {
|
1049
|
+
|
1050
|
+
start: function() {
|
1051
|
+
var that = $( this ).resizable( "instance" ),
|
1052
|
+
o = that.options;
|
1053
|
+
|
1054
|
+
$( o.alsoResize ).each( function() {
|
1055
|
+
var el = $( this );
|
1056
|
+
el.data( "ui-resizable-alsoresize", {
|
1057
|
+
width: parseFloat( el.width() ), height: parseFloat( el.height() ),
|
1058
|
+
left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
|
1059
|
+
} );
|
1060
|
+
} );
|
1061
|
+
},
|
1062
|
+
|
1063
|
+
resize: function( event, ui ) {
|
1064
|
+
var that = $( this ).resizable( "instance" ),
|
1065
|
+
o = that.options,
|
1066
|
+
os = that.originalSize,
|
1067
|
+
op = that.originalPosition,
|
1068
|
+
delta = {
|
1069
|
+
height: ( that.size.height - os.height ) || 0,
|
1070
|
+
width: ( that.size.width - os.width ) || 0,
|
1071
|
+
top: ( that.position.top - op.top ) || 0,
|
1072
|
+
left: ( that.position.left - op.left ) || 0
|
1073
|
+
};
|
1074
|
+
|
1075
|
+
$( o.alsoResize ).each( function() {
|
1076
|
+
var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
|
1077
|
+
css = el.parents( ui.originalElement[ 0 ] ).length ?
|
1078
|
+
[ "width", "height" ] :
|
1079
|
+
[ "width", "height", "top", "left" ];
|
1080
|
+
|
1081
|
+
$.each( css, function( i, prop ) {
|
1082
|
+
var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
|
1083
|
+
if ( sum && sum >= 0 ) {
|
1084
|
+
style[ prop ] = sum || null;
|
1085
|
+
}
|
1086
|
+
} );
|
1087
|
+
|
1088
|
+
el.css( style );
|
1089
|
+
} );
|
1090
|
+
},
|
1091
|
+
|
1092
|
+
stop: function() {
|
1093
|
+
$( this ).removeData( "ui-resizable-alsoresize" );
|
1094
|
+
}
|
1095
|
+
} );
|
1096
|
+
|
1097
|
+
$.ui.plugin.add( "resizable", "ghost", {
|
1098
|
+
|
1099
|
+
start: function() {
|
1100
|
+
|
1101
|
+
var that = $( this ).resizable( "instance" ), cs = that.size;
|
1102
|
+
|
1103
|
+
that.ghost = that.originalElement.clone();
|
1104
|
+
that.ghost.css( {
|
1105
|
+
opacity: 0.25,
|
1106
|
+
display: "block",
|
1107
|
+
position: "relative",
|
1108
|
+
height: cs.height,
|
1109
|
+
width: cs.width,
|
1110
|
+
margin: 0,
|
1111
|
+
left: 0,
|
1112
|
+
top: 0
|
1113
|
+
} );
|
1114
|
+
|
1115
|
+
that._addClass( that.ghost, "ui-resizable-ghost" );
|
1116
|
+
|
1117
|
+
// DEPRECATED
|
1118
|
+
// TODO: remove after 1.12
|
1119
|
+
if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
|
1120
|
+
|
1121
|
+
// Ghost option
|
1122
|
+
that.ghost.addClass( this.options.ghost );
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
that.ghost.appendTo( that.helper );
|
1126
|
+
|
1127
|
+
},
|
1128
|
+
|
1129
|
+
resize: function() {
|
1130
|
+
var that = $( this ).resizable( "instance" );
|
1131
|
+
if ( that.ghost ) {
|
1132
|
+
that.ghost.css( {
|
1133
|
+
position: "relative",
|
1134
|
+
height: that.size.height,
|
1135
|
+
width: that.size.width
|
1136
|
+
} );
|
1137
|
+
}
|
1138
|
+
},
|
1139
|
+
|
1140
|
+
stop: function() {
|
1141
|
+
var that = $( this ).resizable( "instance" );
|
1142
|
+
if ( that.ghost && that.helper ) {
|
1143
|
+
that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
|
1144
|
+
}
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
} );
|
1148
|
+
|
1149
|
+
$.ui.plugin.add( "resizable", "grid", {
|
1150
|
+
|
1151
|
+
resize: function() {
|
1152
|
+
var outerDimensions,
|
1153
|
+
that = $( this ).resizable( "instance" ),
|
1154
|
+
o = that.options,
|
1155
|
+
cs = that.size,
|
1156
|
+
os = that.originalSize,
|
1157
|
+
op = that.originalPosition,
|
1158
|
+
a = that.axis,
|
1159
|
+
grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
|
1160
|
+
gridX = ( grid[ 0 ] || 1 ),
|
1161
|
+
gridY = ( grid[ 1 ] || 1 ),
|
1162
|
+
ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
|
1163
|
+
oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
|
1164
|
+
newWidth = os.width + ox,
|
1165
|
+
newHeight = os.height + oy,
|
1166
|
+
isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
|
1167
|
+
isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
|
1168
|
+
isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
|
1169
|
+
isMinHeight = o.minHeight && ( o.minHeight > newHeight );
|
1170
|
+
|
1171
|
+
o.grid = grid;
|
1172
|
+
|
1173
|
+
if ( isMinWidth ) {
|
1174
|
+
newWidth += gridX;
|
1175
|
+
}
|
1176
|
+
if ( isMinHeight ) {
|
1177
|
+
newHeight += gridY;
|
1178
|
+
}
|
1179
|
+
if ( isMaxWidth ) {
|
1180
|
+
newWidth -= gridX;
|
1181
|
+
}
|
1182
|
+
if ( isMaxHeight ) {
|
1183
|
+
newHeight -= gridY;
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
if ( /^(se|s|e)$/.test( a ) ) {
|
1187
|
+
that.size.width = newWidth;
|
1188
|
+
that.size.height = newHeight;
|
1189
|
+
} else if ( /^(ne)$/.test( a ) ) {
|
1190
|
+
that.size.width = newWidth;
|
1191
|
+
that.size.height = newHeight;
|
1192
|
+
that.position.top = op.top - oy;
|
1193
|
+
} else if ( /^(sw)$/.test( a ) ) {
|
1194
|
+
that.size.width = newWidth;
|
1195
|
+
that.size.height = newHeight;
|
1196
|
+
that.position.left = op.left - ox;
|
1197
|
+
} else {
|
1198
|
+
if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
|
1199
|
+
outerDimensions = that._getPaddingPlusBorderDimensions( this );
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
if ( newHeight - gridY > 0 ) {
|
1203
|
+
that.size.height = newHeight;
|
1204
|
+
that.position.top = op.top - oy;
|
1205
|
+
} else {
|
1206
|
+
newHeight = gridY - outerDimensions.height;
|
1207
|
+
that.size.height = newHeight;
|
1208
|
+
that.position.top = op.top + os.height - newHeight;
|
1209
|
+
}
|
1210
|
+
if ( newWidth - gridX > 0 ) {
|
1211
|
+
that.size.width = newWidth;
|
1212
|
+
that.position.left = op.left - ox;
|
1213
|
+
} else {
|
1214
|
+
newWidth = gridX - outerDimensions.width;
|
1215
|
+
that.size.width = newWidth;
|
1216
|
+
that.position.left = op.left + os.width - newWidth;
|
1217
|
+
}
|
1218
|
+
}
|
1219
|
+
}
|
1220
|
+
|
1221
|
+
} );
|
1222
|
+
|
1223
|
+
return $.ui.resizable;
|
1224
|
+
|
1225
|
+
} );
|