jquery-ui-rails 3.0.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jquery-ui-rails might be problematic. Click here for more details.
- data/History.md +10 -0
- data/README.md +1 -1
- data/Rakefile +4 -5
- data/lib/jquery/ui/rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.ui.accordion.js +130 -290
- data/vendor/assets/javascripts/jquery.ui.autocomplete.js +30 -18
- data/vendor/assets/javascripts/jquery.ui.button.js +9 -8
- data/vendor/assets/javascripts/jquery.ui.core.js +19 -53
- data/vendor/assets/javascripts/jquery.ui.datepicker-be.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CA.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ky.js +24 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nb.js +22 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nn.js +22 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker.js +1076 -878
- data/vendor/assets/javascripts/jquery.ui.dialog.js +456 -547
- data/vendor/assets/javascripts/jquery.ui.draggable.js +317 -207
- data/vendor/assets/javascripts/jquery.ui.droppable.js +177 -100
- data/vendor/assets/javascripts/jquery.ui.effect-blind.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-bounce.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-clip.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-drop.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-explode.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-fade.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-fold.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-highlight.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-pulsate.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-scale.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-shake.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-slide.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-transfer.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.effect.js +91 -99
- data/vendor/assets/javascripts/jquery.ui.menu.js +20 -9
- data/vendor/assets/javascripts/jquery.ui.mouse.js +25 -25
- data/vendor/assets/javascripts/jquery.ui.position.js +39 -59
- data/vendor/assets/javascripts/jquery.ui.progressbar.js +73 -33
- data/vendor/assets/javascripts/jquery.ui.resizable.js +461 -294
- data/vendor/assets/javascripts/jquery.ui.selectable.js +67 -51
- data/vendor/assets/javascripts/jquery.ui.slider.js +100 -95
- data/vendor/assets/javascripts/jquery.ui.sortable.js +411 -257
- data/vendor/assets/javascripts/jquery.ui.spinner.js +19 -5
- data/vendor/assets/javascripts/jquery.ui.tabs.js +47 -567
- data/vendor/assets/javascripts/jquery.ui.tooltip.js +14 -10
- data/vendor/assets/javascripts/jquery.ui.widget.js +33 -40
- data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +30 -8
- data/vendor/assets/stylesheets/jquery.ui.all.css.erb +2 -2
- data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +2 -5
- data/vendor/assets/stylesheets/jquery.ui.base.css.erb +2 -2
- data/vendor/assets/stylesheets/jquery.ui.button.css.erb +100 -26
- data/vendor/assets/stylesheets/jquery.ui.core.css.erb +65 -12
- data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +166 -55
- data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +61 -14
- data/vendor/assets/stylesheets/jquery.ui.menu.css.erb +61 -14
- data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +20 -4
- data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +70 -13
- data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +7 -3
- data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +63 -15
- data/vendor/assets/stylesheets/jquery.ui.spinner.css.erb +52 -10
- data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +44 -10
- data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +196 -38
- data/vendor/assets/stylesheets/jquery.ui.tooltip.css.erb +4 -6
- metadata +8 -3
@@ -3,10 +3,10 @@
|
|
3
3
|
//= require jquery.ui.mouse
|
4
4
|
|
5
5
|
/*!
|
6
|
-
* jQuery UI Resizable 1.
|
6
|
+
* jQuery UI Resizable 1.10.0
|
7
7
|
* http://jqueryui.com
|
8
8
|
*
|
9
|
-
* Copyright
|
9
|
+
* Copyright 2013 jQuery Foundation and other contributors
|
10
10
|
* Released under the MIT license.
|
11
11
|
* http://jquery.org/license
|
12
12
|
*
|
@@ -19,8 +19,16 @@
|
|
19
19
|
*/
|
20
20
|
(function( $, undefined ) {
|
21
21
|
|
22
|
+
function num(v) {
|
23
|
+
return parseInt(v, 10) || 0;
|
24
|
+
}
|
25
|
+
|
26
|
+
function isNumber(value) {
|
27
|
+
return !isNaN(parseInt(value, 10));
|
28
|
+
}
|
29
|
+
|
22
30
|
$.widget("ui.resizable", $.ui.mouse, {
|
23
|
-
version: "1.
|
31
|
+
version: "1.10.0",
|
24
32
|
widgetEventPrefix: "resize",
|
25
33
|
options: {
|
26
34
|
alsoResize: false,
|
@@ -38,11 +46,19 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
38
46
|
maxWidth: null,
|
39
47
|
minHeight: 10,
|
40
48
|
minWidth: 10,
|
41
|
-
|
49
|
+
// See #7960
|
50
|
+
zIndex: 90,
|
51
|
+
|
52
|
+
// callbacks
|
53
|
+
resize: null,
|
54
|
+
start: null,
|
55
|
+
stop: null
|
42
56
|
},
|
43
57
|
_create: function() {
|
44
58
|
|
45
|
-
var
|
59
|
+
var n, i, handle, axis, hname,
|
60
|
+
that = this,
|
61
|
+
o = this.options;
|
46
62
|
this.element.addClass("ui-resizable");
|
47
63
|
|
48
64
|
$.extend(this, {
|
@@ -50,7 +66,7 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
50
66
|
aspectRatio: o.aspectRatio,
|
51
67
|
originalElement: this.element,
|
52
68
|
_proportionallyResizeElements: [],
|
53
|
-
_helper: o.helper || o.ghost || o.animate ? o.helper ||
|
69
|
+
_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
|
54
70
|
});
|
55
71
|
|
56
72
|
//Wrap the element if it cannot hold child nodes
|
@@ -58,18 +74,18 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
58
74
|
|
59
75
|
//Create a wrapper element and set the wrapper to the new current internal element
|
60
76
|
this.element.wrap(
|
61
|
-
$(
|
62
|
-
position: this.element.css(
|
77
|
+
$("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
|
78
|
+
position: this.element.css("position"),
|
63
79
|
width: this.element.outerWidth(),
|
64
80
|
height: this.element.outerHeight(),
|
65
|
-
top: this.element.css(
|
66
|
-
left: this.element.css(
|
81
|
+
top: this.element.css("top"),
|
82
|
+
left: this.element.css("left")
|
67
83
|
})
|
68
84
|
);
|
69
85
|
|
70
86
|
//Overwrite the original this.element
|
71
87
|
this.element = this.element.parent().data(
|
72
|
-
"resizable", this.element.data(
|
88
|
+
"ui-resizable", this.element.data("ui-resizable")
|
73
89
|
);
|
74
90
|
|
75
91
|
this.elementIsWrapper = true;
|
@@ -79,41 +95,46 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
79
95
|
this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
|
80
96
|
|
81
97
|
//Prevent Safari textarea resize
|
82
|
-
this.originalResizeStyle = this.originalElement.css(
|
83
|
-
this.originalElement.css(
|
98
|
+
this.originalResizeStyle = this.originalElement.css("resize");
|
99
|
+
this.originalElement.css("resize", "none");
|
84
100
|
|
85
101
|
//Push the actual element to our proportionallyResize internal array
|
86
|
-
this._proportionallyResizeElements.push(this.originalElement.css({ position:
|
102
|
+
this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" }));
|
87
103
|
|
88
104
|
// avoid IE jump (hard set the margin)
|
89
|
-
this.originalElement.css({ margin: this.originalElement.css(
|
105
|
+
this.originalElement.css({ margin: this.originalElement.css("margin") });
|
90
106
|
|
91
107
|
// fix handlers offset
|
92
108
|
this._proportionallyResize();
|
93
109
|
|
94
110
|
}
|
95
111
|
|
96
|
-
this.handles = o.handles || (!$(
|
97
|
-
if(this.handles.constructor
|
112
|
+
this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" });
|
113
|
+
if(this.handles.constructor === String) {
|
98
114
|
|
99
|
-
if(this.handles
|
100
|
-
|
115
|
+
if ( this.handles === "all") {
|
116
|
+
this.handles = "n,e,s,w,se,sw,ne,nw";
|
117
|
+
}
|
118
|
+
|
119
|
+
n = this.handles.split(",");
|
120
|
+
this.handles = {};
|
101
121
|
|
102
|
-
for(
|
122
|
+
for(i = 0; i < n.length; i++) {
|
103
123
|
|
104
|
-
|
105
|
-
|
124
|
+
handle = $.trim(n[i]);
|
125
|
+
hname = "ui-resizable-"+handle;
|
126
|
+
axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
|
106
127
|
|
107
128
|
// Apply zIndex to all handles - see #7960
|
108
129
|
axis.css({ zIndex: o.zIndex });
|
109
130
|
|
110
131
|
//TODO : What's going on here?
|
111
|
-
if (
|
112
|
-
axis.addClass(
|
113
|
-
}
|
132
|
+
if ("se" === handle) {
|
133
|
+
axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
|
134
|
+
}
|
114
135
|
|
115
136
|
//Insert into internal handles object and append to element
|
116
|
-
this.handles[handle] =
|
137
|
+
this.handles[handle] = ".ui-resizable-"+handle;
|
117
138
|
this.element.append(axis);
|
118
139
|
}
|
119
140
|
|
@@ -121,26 +142,29 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
121
142
|
|
122
143
|
this._renderAxis = function(target) {
|
123
144
|
|
145
|
+
var i, axis, padPos, padWrapper;
|
146
|
+
|
124
147
|
target = target || this.element;
|
125
148
|
|
126
|
-
for(
|
149
|
+
for(i in this.handles) {
|
127
150
|
|
128
|
-
if(this.handles[i].constructor
|
151
|
+
if(this.handles[i].constructor === String) {
|
129
152
|
this.handles[i] = $(this.handles[i], this.element).show();
|
153
|
+
}
|
130
154
|
|
131
155
|
//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
|
132
156
|
if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
|
133
157
|
|
134
|
-
|
158
|
+
axis = $(this.handles[i], this.element);
|
135
159
|
|
136
160
|
//Checking the correct pad and border
|
137
161
|
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
|
138
162
|
|
139
163
|
//The padding type i have to apply...
|
140
|
-
|
141
|
-
/ne|nw|n/.test(i) ?
|
142
|
-
/se|sw|s/.test(i) ?
|
143
|
-
/^e$/.test(i) ?
|
164
|
+
padPos = [ "padding",
|
165
|
+
/ne|nw|n/.test(i) ? "Top" :
|
166
|
+
/se|sw|s/.test(i) ? "Bottom" :
|
167
|
+
/^e$/.test(i) ? "Right" : "Left" ].join("");
|
144
168
|
|
145
169
|
target.css(padPos, padWrapper);
|
146
170
|
|
@@ -149,25 +173,26 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
149
173
|
}
|
150
174
|
|
151
175
|
//TODO: What's that good for? There's not anything to be executed left
|
152
|
-
if(!$(this.handles[i]).length)
|
176
|
+
if(!$(this.handles[i]).length) {
|
153
177
|
continue;
|
154
|
-
|
178
|
+
}
|
155
179
|
}
|
156
180
|
};
|
157
181
|
|
158
182
|
//TODO: make renderAxis a prototype function
|
159
183
|
this._renderAxis(this.element);
|
160
184
|
|
161
|
-
this._handles = $(
|
185
|
+
this._handles = $(".ui-resizable-handle", this.element)
|
162
186
|
.disableSelection();
|
163
187
|
|
164
188
|
//Matching axis name
|
165
189
|
this._handles.mouseover(function() {
|
166
190
|
if (!that.resizing) {
|
167
|
-
if (this.className)
|
168
|
-
|
191
|
+
if (this.className) {
|
192
|
+
axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
|
193
|
+
}
|
169
194
|
//Axis, default = se
|
170
|
-
that.axis = axis && axis[1] ? axis[1] :
|
195
|
+
that.axis = axis && axis[1] ? axis[1] : "se";
|
171
196
|
}
|
172
197
|
});
|
173
198
|
|
@@ -177,12 +202,16 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
177
202
|
$(this.element)
|
178
203
|
.addClass("ui-resizable-autohide")
|
179
204
|
.mouseenter(function() {
|
180
|
-
if (o.disabled)
|
205
|
+
if (o.disabled) {
|
206
|
+
return;
|
207
|
+
}
|
181
208
|
$(this).removeClass("ui-resizable-autohide");
|
182
209
|
that._handles.show();
|
183
210
|
})
|
184
211
|
.mouseleave(function(){
|
185
|
-
if (o.disabled)
|
212
|
+
if (o.disabled) {
|
213
|
+
return;
|
214
|
+
}
|
186
215
|
if (!that.resizing) {
|
187
216
|
$(this).addClass("ui-resizable-autohide");
|
188
217
|
that._handles.hide();
|
@@ -199,57 +228,66 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
199
228
|
|
200
229
|
this._mouseDestroy();
|
201
230
|
|
202
|
-
var
|
203
|
-
|
204
|
-
|
205
|
-
|
231
|
+
var wrapper,
|
232
|
+
_destroy = function(exp) {
|
233
|
+
$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
|
234
|
+
.removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();
|
235
|
+
};
|
206
236
|
|
207
237
|
//TODO: Unwrap at same DOM position
|
208
238
|
if (this.elementIsWrapper) {
|
209
239
|
_destroy(this.element);
|
210
|
-
|
240
|
+
wrapper = this.element;
|
211
241
|
this.originalElement.css({
|
212
|
-
position: wrapper.css(
|
242
|
+
position: wrapper.css("position"),
|
213
243
|
width: wrapper.outerWidth(),
|
214
244
|
height: wrapper.outerHeight(),
|
215
|
-
top: wrapper.css(
|
216
|
-
left: wrapper.css(
|
245
|
+
top: wrapper.css("top"),
|
246
|
+
left: wrapper.css("left")
|
217
247
|
}).insertAfter( wrapper );
|
218
248
|
wrapper.remove();
|
219
249
|
}
|
220
250
|
|
221
|
-
this.originalElement.css(
|
251
|
+
this.originalElement.css("resize", this.originalResizeStyle);
|
222
252
|
_destroy(this.originalElement);
|
223
253
|
|
224
254
|
return this;
|
225
255
|
},
|
226
256
|
|
227
257
|
_mouseCapture: function(event) {
|
228
|
-
var handle
|
229
|
-
|
230
|
-
|
231
|
-
|
258
|
+
var i, handle,
|
259
|
+
capture = false;
|
260
|
+
|
261
|
+
for (i in this.handles) {
|
262
|
+
handle = $(this.handles[i])[0];
|
263
|
+
if (handle === event.target || $.contains(handle, event.target)) {
|
264
|
+
capture = true;
|
232
265
|
}
|
233
266
|
}
|
234
267
|
|
235
|
-
return !this.options.disabled &&
|
268
|
+
return !this.options.disabled && capture;
|
236
269
|
},
|
237
270
|
|
238
271
|
_mouseStart: function(event) {
|
239
272
|
|
240
|
-
var
|
273
|
+
var curleft, curtop, cursor,
|
274
|
+
o = this.options,
|
275
|
+
iniPos = this.element.position(),
|
276
|
+
el = this.element;
|
241
277
|
|
242
278
|
this.resizing = true;
|
243
|
-
this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
|
244
279
|
|
245
280
|
// bugfix for http://dev.jquery.com/ticket/1749
|
246
|
-
if (
|
247
|
-
el.css({ position:
|
281
|
+
if ( (/absolute/).test( el.css("position") ) ) {
|
282
|
+
el.css({ position: "absolute", top: el.css("top"), left: el.css("left") });
|
283
|
+
} else if (el.is(".ui-draggable")) {
|
284
|
+
el.css({ position: "absolute", top: iniPos.top, left: iniPos.left });
|
248
285
|
}
|
249
286
|
|
250
287
|
this._renderProxy();
|
251
288
|
|
252
|
-
|
289
|
+
curleft = num(this.helper.css("left"));
|
290
|
+
curtop = num(this.helper.css("top"));
|
253
291
|
|
254
292
|
if (o.containment) {
|
255
293
|
curleft += $(o.containment).scrollLeft() || 0;
|
@@ -266,10 +304,10 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
266
304
|
this.originalMousePosition = { left: event.pageX, top: event.pageY };
|
267
305
|
|
268
306
|
//Aspect Ratio
|
269
|
-
this.aspectRatio = (typeof o.aspectRatio
|
307
|
+
this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
|
270
308
|
|
271
|
-
|
272
|
-
$(
|
309
|
+
cursor = $(".ui-resizable-" + this.axis).css("cursor");
|
310
|
+
$("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
|
273
311
|
|
274
312
|
el.addClass("ui-resizable-resizing");
|
275
313
|
this._propagate("start", event);
|
@@ -279,38 +317,60 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
279
317
|
_mouseDrag: function(event) {
|
280
318
|
|
281
319
|
//Increase performance, avoid regex
|
282
|
-
var
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
320
|
+
var data,
|
321
|
+
el = this.helper, props = {},
|
322
|
+
smp = this.originalMousePosition,
|
323
|
+
a = this.axis,
|
324
|
+
prevTop = this.position.top,
|
325
|
+
prevLeft = this.position.left,
|
326
|
+
prevWidth = this.size.width,
|
327
|
+
prevHeight = this.size.height,
|
328
|
+
dx = (event.pageX-smp.left)||0,
|
329
|
+
dy = (event.pageY-smp.top)||0,
|
330
|
+
trigger = this._change[a];
|
331
|
+
|
332
|
+
if (!trigger) {
|
333
|
+
return false;
|
334
|
+
}
|
288
335
|
|
289
336
|
// Calculate the attrs that will be change
|
290
|
-
|
337
|
+
data = trigger.apply(this, [event, dx, dy]);
|
291
338
|
|
292
339
|
// Put this in the mouseDrag handler since the user can start pressing shift while resizing
|
293
340
|
this._updateVirtualBoundaries(event.shiftKey);
|
294
|
-
if (this._aspectRatio || event.shiftKey)
|
341
|
+
if (this._aspectRatio || event.shiftKey) {
|
295
342
|
data = this._updateRatio(data, event);
|
343
|
+
}
|
296
344
|
|
297
345
|
data = this._respectSize(data, event);
|
298
346
|
|
347
|
+
this._updateCache(data);
|
348
|
+
|
299
349
|
// plugins callbacks need to be called first
|
300
350
|
this._propagate("resize", event);
|
301
351
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
352
|
+
if (this.position.top !== prevTop) {
|
353
|
+
props.top = this.position.top + "px";
|
354
|
+
}
|
355
|
+
if (this.position.left !== prevLeft) {
|
356
|
+
props.left = this.position.left + "px";
|
357
|
+
}
|
358
|
+
if (this.size.width !== prevWidth) {
|
359
|
+
props.width = this.size.width + "px";
|
360
|
+
}
|
361
|
+
if (this.size.height !== prevHeight) {
|
362
|
+
props.height = this.size.height + "px";
|
363
|
+
}
|
364
|
+
el.css(props);
|
306
365
|
|
307
|
-
if (!this._helper && this._proportionallyResizeElements.length)
|
366
|
+
if (!this._helper && this._proportionallyResizeElements.length) {
|
308
367
|
this._proportionallyResize();
|
368
|
+
}
|
309
369
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
370
|
+
// Call the user callback if the element was resized
|
371
|
+
if ( ! $.isEmptyObject(props) ) {
|
372
|
+
this._trigger("resize", event, this.ui());
|
373
|
+
}
|
314
374
|
|
315
375
|
return false;
|
316
376
|
},
|
@@ -318,39 +378,49 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
318
378
|
_mouseStop: function(event) {
|
319
379
|
|
320
380
|
this.resizing = false;
|
321
|
-
var
|
381
|
+
var pr, ista, soffseth, soffsetw, s, left, top,
|
382
|
+
o = this.options, that = this;
|
322
383
|
|
323
384
|
if(this._helper) {
|
324
|
-
var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
|
325
|
-
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
|
326
|
-
soffsetw = ista ? 0 : that.sizeDiff.width;
|
327
385
|
|
328
|
-
|
329
|
-
|
330
|
-
|
386
|
+
pr = this._proportionallyResizeElements;
|
387
|
+
ista = pr.length && (/textarea/i).test(pr[0].nodeName);
|
388
|
+
soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height;
|
389
|
+
soffsetw = ista ? 0 : that.sizeDiff.width;
|
390
|
+
|
391
|
+
s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) };
|
392
|
+
left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null;
|
393
|
+
top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
|
331
394
|
|
332
|
-
if (!o.animate)
|
395
|
+
if (!o.animate) {
|
333
396
|
this.element.css($.extend(s, { top: top, left: left }));
|
397
|
+
}
|
334
398
|
|
335
399
|
that.helper.height(that.size.height);
|
336
400
|
that.helper.width(that.size.width);
|
337
401
|
|
338
|
-
if (this._helper && !o.animate)
|
402
|
+
if (this._helper && !o.animate) {
|
403
|
+
this._proportionallyResize();
|
404
|
+
}
|
339
405
|
}
|
340
406
|
|
341
|
-
$(
|
407
|
+
$("body").css("cursor", "auto");
|
342
408
|
|
343
409
|
this.element.removeClass("ui-resizable-resizing");
|
344
410
|
|
345
411
|
this._propagate("stop", event);
|
346
412
|
|
347
|
-
if (this._helper)
|
413
|
+
if (this._helper) {
|
414
|
+
this.helper.remove();
|
415
|
+
}
|
416
|
+
|
348
417
|
return false;
|
349
418
|
|
350
419
|
},
|
351
420
|
|
352
421
|
_updateVirtualBoundaries: function(forceAspectRatio) {
|
353
|
-
var
|
422
|
+
var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
|
423
|
+
o = this.options;
|
354
424
|
|
355
425
|
b = {
|
356
426
|
minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
|
@@ -367,35 +437,55 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
367
437
|
pMaxWidth = b.maxHeight * this.aspectRatio;
|
368
438
|
pMaxHeight = b.maxWidth / this.aspectRatio;
|
369
439
|
|
370
|
-
if(pMinWidth > b.minWidth)
|
371
|
-
|
372
|
-
|
373
|
-
if(
|
440
|
+
if(pMinWidth > b.minWidth) {
|
441
|
+
b.minWidth = pMinWidth;
|
442
|
+
}
|
443
|
+
if(pMinHeight > b.minHeight) {
|
444
|
+
b.minHeight = pMinHeight;
|
445
|
+
}
|
446
|
+
if(pMaxWidth < b.maxWidth) {
|
447
|
+
b.maxWidth = pMaxWidth;
|
448
|
+
}
|
449
|
+
if(pMaxHeight < b.maxHeight) {
|
450
|
+
b.maxHeight = pMaxHeight;
|
451
|
+
}
|
374
452
|
}
|
375
453
|
this._vBoundaries = b;
|
376
454
|
},
|
377
455
|
|
378
456
|
_updateCache: function(data) {
|
379
|
-
var o = this.options;
|
380
457
|
this.offset = this.helper.offset();
|
381
|
-
if (isNumber(data.left))
|
382
|
-
|
383
|
-
|
384
|
-
if (isNumber(data.
|
458
|
+
if (isNumber(data.left)) {
|
459
|
+
this.position.left = data.left;
|
460
|
+
}
|
461
|
+
if (isNumber(data.top)) {
|
462
|
+
this.position.top = data.top;
|
463
|
+
}
|
464
|
+
if (isNumber(data.height)) {
|
465
|
+
this.size.height = data.height;
|
466
|
+
}
|
467
|
+
if (isNumber(data.width)) {
|
468
|
+
this.size.width = data.width;
|
469
|
+
}
|
385
470
|
},
|
386
471
|
|
387
|
-
_updateRatio: function(data
|
472
|
+
_updateRatio: function( data ) {
|
388
473
|
|
389
|
-
var
|
474
|
+
var cpos = this.position,
|
475
|
+
csize = this.size,
|
476
|
+
a = this.axis;
|
390
477
|
|
391
|
-
if (isNumber(data.height))
|
392
|
-
|
478
|
+
if (isNumber(data.height)) {
|
479
|
+
data.width = (data.height * this.aspectRatio);
|
480
|
+
} else if (isNumber(data.width)) {
|
481
|
+
data.height = (data.width / this.aspectRatio);
|
482
|
+
}
|
393
483
|
|
394
|
-
if (a
|
484
|
+
if (a === "sw") {
|
395
485
|
data.left = cpos.left + (csize.width - data.width);
|
396
486
|
data.top = null;
|
397
487
|
}
|
398
|
-
if (a
|
488
|
+
if (a === "nw") {
|
399
489
|
data.top = cpos.top + (csize.height - data.height);
|
400
490
|
data.left = cpos.left + (csize.width - data.width);
|
401
491
|
}
|
@@ -403,51 +493,72 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
403
493
|
return data;
|
404
494
|
},
|
405
495
|
|
406
|
-
_respectSize: function(data
|
407
|
-
|
408
|
-
var
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
if (
|
416
|
-
|
417
|
-
|
418
|
-
|
496
|
+
_respectSize: function( data ) {
|
497
|
+
|
498
|
+
var o = this._vBoundaries,
|
499
|
+
a = this.axis,
|
500
|
+
ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
|
501
|
+
isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
|
502
|
+
dw = this.originalPosition.left + this.originalSize.width,
|
503
|
+
dh = this.position.top + this.size.height,
|
504
|
+
cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
|
505
|
+
if (isminw) {
|
506
|
+
data.width = o.minWidth;
|
507
|
+
}
|
508
|
+
if (isminh) {
|
509
|
+
data.height = o.minHeight;
|
510
|
+
}
|
511
|
+
if (ismaxw) {
|
512
|
+
data.width = o.maxWidth;
|
513
|
+
}
|
514
|
+
if (ismaxh) {
|
515
|
+
data.height = o.maxHeight;
|
516
|
+
}
|
419
517
|
|
420
|
-
if (isminw && cw)
|
421
|
-
|
422
|
-
|
423
|
-
if (
|
518
|
+
if (isminw && cw) {
|
519
|
+
data.left = dw - o.minWidth;
|
520
|
+
}
|
521
|
+
if (ismaxw && cw) {
|
522
|
+
data.left = dw - o.maxWidth;
|
523
|
+
}
|
524
|
+
if (isminh && ch) {
|
525
|
+
data.top = dh - o.minHeight;
|
526
|
+
}
|
527
|
+
if (ismaxh && ch) {
|
528
|
+
data.top = dh - o.maxHeight;
|
529
|
+
}
|
424
530
|
|
425
531
|
// fixing jump error on top/left - bug #2330
|
426
|
-
|
427
|
-
|
428
|
-
else if (
|
532
|
+
if (!data.width && !data.height && !data.left && data.top) {
|
533
|
+
data.top = null;
|
534
|
+
} else if (!data.width && !data.height && !data.top && data.left) {
|
535
|
+
data.left = null;
|
536
|
+
}
|
429
537
|
|
430
538
|
return data;
|
431
539
|
},
|
432
540
|
|
433
541
|
_proportionallyResize: function() {
|
434
542
|
|
435
|
-
|
436
|
-
|
437
|
-
|
543
|
+
if (!this._proportionallyResizeElements.length) {
|
544
|
+
return;
|
545
|
+
}
|
546
|
+
|
547
|
+
var i, j, borders, paddings, prel,
|
548
|
+
element = this.helper || this.element;
|
438
549
|
|
439
|
-
for (
|
550
|
+
for ( i=0; i < this._proportionallyResizeElements.length; i++) {
|
440
551
|
|
441
|
-
|
552
|
+
prel = this._proportionallyResizeElements[i];
|
442
553
|
|
443
554
|
if (!this.borderDif) {
|
444
|
-
|
445
|
-
|
555
|
+
this.borderDif = [];
|
556
|
+
borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")];
|
557
|
+
paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")];
|
446
558
|
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
});
|
559
|
+
for ( j = 0; j < borders.length; j++ ) {
|
560
|
+
this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 );
|
561
|
+
}
|
451
562
|
}
|
452
563
|
|
453
564
|
prel.css({
|
@@ -455,7 +566,7 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
455
566
|
width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
|
456
567
|
});
|
457
568
|
|
458
|
-
}
|
569
|
+
}
|
459
570
|
|
460
571
|
},
|
461
572
|
|
@@ -466,18 +577,14 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
466
577
|
|
467
578
|
if(this._helper) {
|
468
579
|
|
469
|
-
this.helper = this.helper || $(
|
470
|
-
|
471
|
-
// fix ie6 offset TODO: This seems broken
|
472
|
-
var ie6offset = ($.ui.ie6 ? 1 : 0),
|
473
|
-
pxyoffset = ( $.ui.ie6 ? 2 : -1 );
|
580
|
+
this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
|
474
581
|
|
475
582
|
this.helper.addClass(this._helper).css({
|
476
|
-
width: this.element.outerWidth()
|
477
|
-
height: this.element.outerHeight()
|
478
|
-
position:
|
479
|
-
left: this.elementOffset.left
|
480
|
-
top: this.elementOffset.top
|
583
|
+
width: this.element.outerWidth() - 1,
|
584
|
+
height: this.element.outerHeight() - 1,
|
585
|
+
position: "absolute",
|
586
|
+
left: this.elementOffset.left +"px",
|
587
|
+
top: this.elementOffset.top +"px",
|
481
588
|
zIndex: ++o.zIndex //TODO: Don't modify option
|
482
589
|
});
|
483
590
|
|
@@ -492,15 +599,15 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
492
599
|
},
|
493
600
|
|
494
601
|
_change: {
|
495
|
-
e: function(event, dx
|
602
|
+
e: function(event, dx) {
|
496
603
|
return { width: this.originalSize.width + dx };
|
497
604
|
},
|
498
|
-
w: function(event, dx
|
499
|
-
var
|
605
|
+
w: function(event, dx) {
|
606
|
+
var cs = this.originalSize, sp = this.originalPosition;
|
500
607
|
return { left: sp.left + dx, width: cs.width - dx };
|
501
608
|
},
|
502
609
|
n: function(event, dx, dy) {
|
503
|
-
var
|
610
|
+
var cs = this.originalSize, sp = this.originalPosition;
|
504
611
|
return { top: sp.top + dy, height: cs.height - dy };
|
505
612
|
},
|
506
613
|
s: function(event, dx, dy) {
|
@@ -522,7 +629,7 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
522
629
|
|
523
630
|
_propagate: function(n, event) {
|
524
631
|
$.ui.plugin.call(this, n, [event, this.ui()]);
|
525
|
-
(n
|
632
|
+
(n !== "resize" && this._trigger(n, event, this.ui()));
|
526
633
|
},
|
527
634
|
|
528
635
|
plugins: {},
|
@@ -545,76 +652,18 @@ $.widget("ui.resizable", $.ui.mouse, {
|
|
545
652
|
* Resizable Extensions
|
546
653
|
*/
|
547
654
|
|
548
|
-
$.ui.plugin.add("resizable", "alsoResize", {
|
549
|
-
|
550
|
-
start: function (event, ui) {
|
551
|
-
var that = $(this).data("resizable"), o = that.options;
|
552
|
-
|
553
|
-
var _store = function (exp) {
|
554
|
-
$(exp).each(function() {
|
555
|
-
var el = $(this);
|
556
|
-
el.data("resizable-alsoresize", {
|
557
|
-
width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
|
558
|
-
left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)
|
559
|
-
});
|
560
|
-
});
|
561
|
-
};
|
562
|
-
|
563
|
-
if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
|
564
|
-
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
|
565
|
-
else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
|
566
|
-
}else{
|
567
|
-
_store(o.alsoResize);
|
568
|
-
}
|
569
|
-
},
|
570
|
-
|
571
|
-
resize: function (event, ui) {
|
572
|
-
var that = $(this).data("resizable"), o = that.options, os = that.originalSize, op = that.originalPosition;
|
573
|
-
|
574
|
-
var delta = {
|
575
|
-
height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
|
576
|
-
top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
|
577
|
-
},
|
578
|
-
|
579
|
-
_alsoResize = function (exp, c) {
|
580
|
-
$(exp).each(function() {
|
581
|
-
var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
|
582
|
-
css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
|
583
|
-
|
584
|
-
$.each(css, function (i, prop) {
|
585
|
-
var sum = (start[prop]||0) + (delta[prop]||0);
|
586
|
-
if (sum && sum >= 0)
|
587
|
-
style[prop] = sum || null;
|
588
|
-
});
|
589
|
-
|
590
|
-
el.css(style);
|
591
|
-
});
|
592
|
-
};
|
593
|
-
|
594
|
-
if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
|
595
|
-
$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
|
596
|
-
}else{
|
597
|
-
_alsoResize(o.alsoResize);
|
598
|
-
}
|
599
|
-
},
|
600
|
-
|
601
|
-
stop: function (event, ui) {
|
602
|
-
$(this).removeData("resizable-alsoresize");
|
603
|
-
}
|
604
|
-
});
|
605
|
-
|
606
655
|
$.ui.plugin.add("resizable", "animate", {
|
607
656
|
|
608
|
-
stop: function(event
|
609
|
-
var that = $(this).data("resizable"),
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
657
|
+
stop: function( event ) {
|
658
|
+
var that = $(this).data("ui-resizable"),
|
659
|
+
o = that.options,
|
660
|
+
pr = that._proportionallyResizeElements,
|
661
|
+
ista = pr.length && (/textarea/i).test(pr[0].nodeName),
|
662
|
+
soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height,
|
663
|
+
soffsetw = ista ? 0 : that.sizeDiff.width,
|
664
|
+
style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
|
665
|
+
left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null,
|
666
|
+
top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
|
618
667
|
|
619
668
|
that.element.animate(
|
620
669
|
$.extend(style, top && left ? { top: top, left: left } : {}), {
|
@@ -623,13 +672,15 @@ $.ui.plugin.add("resizable", "animate", {
|
|
623
672
|
step: function() {
|
624
673
|
|
625
674
|
var data = {
|
626
|
-
width: parseInt(that.element.css(
|
627
|
-
height: parseInt(that.element.css(
|
628
|
-
top: parseInt(that.element.css(
|
629
|
-
left: parseInt(that.element.css(
|
675
|
+
width: parseInt(that.element.css("width"), 10),
|
676
|
+
height: parseInt(that.element.css("height"), 10),
|
677
|
+
top: parseInt(that.element.css("top"), 10),
|
678
|
+
left: parseInt(that.element.css("left"), 10)
|
630
679
|
};
|
631
680
|
|
632
|
-
if (pr && pr.length)
|
681
|
+
if (pr && pr.length) {
|
682
|
+
$(pr[0]).css({ width: data.width, height: data.height });
|
683
|
+
}
|
633
684
|
|
634
685
|
// propagating resize, and updating values for each animation step
|
635
686
|
that._updateCache(data);
|
@@ -644,14 +695,21 @@ $.ui.plugin.add("resizable", "animate", {
|
|
644
695
|
|
645
696
|
$.ui.plugin.add("resizable", "containment", {
|
646
697
|
|
647
|
-
start: function(
|
648
|
-
var
|
649
|
-
|
650
|
-
|
698
|
+
start: function() {
|
699
|
+
var element, p, co, ch, cw, width, height,
|
700
|
+
that = $(this).data("ui-resizable"),
|
701
|
+
o = that.options,
|
702
|
+
el = that.element,
|
703
|
+
oc = o.containment,
|
704
|
+
ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
|
705
|
+
|
706
|
+
if (!ce) {
|
707
|
+
return;
|
708
|
+
}
|
651
709
|
|
652
710
|
that.containerElement = $(ce);
|
653
711
|
|
654
|
-
if (/document/.test(oc) || oc
|
712
|
+
if (/document/.test(oc) || oc === document) {
|
655
713
|
that.containerOffset = { left: 0, top: 0 };
|
656
714
|
that.containerPosition = { left: 0, top: 0 };
|
657
715
|
|
@@ -663,15 +721,19 @@ $.ui.plugin.add("resizable", "containment", {
|
|
663
721
|
|
664
722
|
// i'm a node, so compute top, left, right, bottom
|
665
723
|
else {
|
666
|
-
|
724
|
+
element = $(ce);
|
725
|
+
p = [];
|
667
726
|
$([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
|
668
727
|
|
669
728
|
that.containerOffset = element.offset();
|
670
729
|
that.containerPosition = element.position();
|
671
730
|
that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
|
672
731
|
|
673
|
-
|
674
|
-
|
732
|
+
co = that.containerOffset;
|
733
|
+
ch = that.containerSize.height;
|
734
|
+
cw = that.containerSize.width;
|
735
|
+
width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw );
|
736
|
+
height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
|
675
737
|
|
676
738
|
that.parentData = {
|
677
739
|
element: ce, left: co.left, top: co.top, width: width, height: height
|
@@ -679,114 +741,227 @@ $.ui.plugin.add("resizable", "containment", {
|
|
679
741
|
}
|
680
742
|
},
|
681
743
|
|
682
|
-
resize: function(event
|
683
|
-
var
|
684
|
-
|
685
|
-
|
744
|
+
resize: function( event ) {
|
745
|
+
var woset, hoset, isParent, isOffsetRelative,
|
746
|
+
that = $(this).data("ui-resizable"),
|
747
|
+
o = that.options,
|
748
|
+
co = that.containerOffset, cp = that.position,
|
749
|
+
pRatio = that._aspectRatio || event.shiftKey,
|
750
|
+
cop = { top:0, left:0 }, ce = that.containerElement;
|
686
751
|
|
687
|
-
if (ce[0]
|
752
|
+
if (ce[0] !== document && (/static/).test(ce.css("position"))) {
|
753
|
+
cop = co;
|
754
|
+
}
|
688
755
|
|
689
756
|
if (cp.left < (that._helper ? co.left : 0)) {
|
690
757
|
that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
|
691
|
-
if (pRatio)
|
758
|
+
if (pRatio) {
|
759
|
+
that.size.height = that.size.width / that.aspectRatio;
|
760
|
+
}
|
692
761
|
that.position.left = o.helper ? co.left : 0;
|
693
762
|
}
|
694
763
|
|
695
764
|
if (cp.top < (that._helper ? co.top : 0)) {
|
696
765
|
that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
|
697
|
-
if (pRatio)
|
766
|
+
if (pRatio) {
|
767
|
+
that.size.width = that.size.height * that.aspectRatio;
|
768
|
+
}
|
698
769
|
that.position.top = that._helper ? co.top : 0;
|
699
770
|
}
|
700
771
|
|
701
772
|
that.offset.left = that.parentData.left+that.position.left;
|
702
773
|
that.offset.top = that.parentData.top+that.position.top;
|
703
774
|
|
704
|
-
|
705
|
-
|
775
|
+
woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width );
|
776
|
+
hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
|
706
777
|
|
707
|
-
|
708
|
-
|
778
|
+
isParent = that.containerElement.get(0) === that.element.parent().get(0);
|
779
|
+
isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));
|
709
780
|
|
710
|
-
if(isParent && isOffsetRelative)
|
781
|
+
if(isParent && isOffsetRelative) {
|
782
|
+
woset -= that.parentData.left;
|
783
|
+
}
|
711
784
|
|
712
785
|
if (woset + that.size.width >= that.parentData.width) {
|
713
786
|
that.size.width = that.parentData.width - woset;
|
714
|
-
if (pRatio)
|
787
|
+
if (pRatio) {
|
788
|
+
that.size.height = that.size.width / that.aspectRatio;
|
789
|
+
}
|
715
790
|
}
|
716
791
|
|
717
792
|
if (hoset + that.size.height >= that.parentData.height) {
|
718
793
|
that.size.height = that.parentData.height - hoset;
|
719
|
-
if (pRatio)
|
794
|
+
if (pRatio) {
|
795
|
+
that.size.width = that.size.height * that.aspectRatio;
|
796
|
+
}
|
720
797
|
}
|
721
798
|
},
|
722
799
|
|
723
|
-
stop: function(
|
724
|
-
var that = $(this).data("resizable"),
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
800
|
+
stop: function(){
|
801
|
+
var that = $(this).data("ui-resizable"),
|
802
|
+
o = that.options,
|
803
|
+
co = that.containerOffset,
|
804
|
+
cop = that.containerPosition,
|
805
|
+
ce = that.containerElement,
|
806
|
+
helper = $(that.helper),
|
807
|
+
ho = helper.offset(),
|
808
|
+
w = helper.outerWidth() - that.sizeDiff.width,
|
809
|
+
h = helper.outerHeight() - that.sizeDiff.height;
|
810
|
+
|
811
|
+
if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
|
730
812
|
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
813
|
+
}
|
731
814
|
|
732
|
-
if (that._helper && !o.animate && (/static/).test(ce.css(
|
815
|
+
if (that._helper && !o.animate && (/static/).test(ce.css("position"))) {
|
733
816
|
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
817
|
+
}
|
818
|
+
|
819
|
+
}
|
820
|
+
});
|
821
|
+
|
822
|
+
$.ui.plugin.add("resizable", "alsoResize", {
|
823
|
+
|
824
|
+
start: function () {
|
825
|
+
var that = $(this).data("ui-resizable"),
|
826
|
+
o = that.options,
|
827
|
+
_store = function (exp) {
|
828
|
+
$(exp).each(function() {
|
829
|
+
var el = $(this);
|
830
|
+
el.data("ui-resizable-alsoresize", {
|
831
|
+
width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
|
832
|
+
left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
|
833
|
+
});
|
834
|
+
});
|
835
|
+
};
|
836
|
+
|
837
|
+
if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) {
|
838
|
+
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
|
839
|
+
else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
|
840
|
+
}else{
|
841
|
+
_store(o.alsoResize);
|
842
|
+
}
|
843
|
+
},
|
844
|
+
|
845
|
+
resize: function (event, ui) {
|
846
|
+
var that = $(this).data("ui-resizable"),
|
847
|
+
o = that.options,
|
848
|
+
os = that.originalSize,
|
849
|
+
op = that.originalPosition,
|
850
|
+
delta = {
|
851
|
+
height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
|
852
|
+
top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
|
853
|
+
},
|
854
|
+
|
855
|
+
_alsoResize = function (exp, c) {
|
856
|
+
$(exp).each(function() {
|
857
|
+
var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
|
858
|
+
css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
|
859
|
+
|
860
|
+
$.each(css, function (i, prop) {
|
861
|
+
var sum = (start[prop]||0) + (delta[prop]||0);
|
862
|
+
if (sum && sum >= 0) {
|
863
|
+
style[prop] = sum || null;
|
864
|
+
}
|
865
|
+
});
|
866
|
+
|
867
|
+
el.css(style);
|
868
|
+
});
|
869
|
+
};
|
734
870
|
|
871
|
+
if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) {
|
872
|
+
$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
|
873
|
+
}else{
|
874
|
+
_alsoResize(o.alsoResize);
|
875
|
+
}
|
876
|
+
},
|
877
|
+
|
878
|
+
stop: function () {
|
879
|
+
$(this).removeData("resizable-alsoresize");
|
735
880
|
}
|
736
881
|
});
|
737
882
|
|
738
883
|
$.ui.plugin.add("resizable", "ghost", {
|
739
884
|
|
740
|
-
start: function(
|
885
|
+
start: function() {
|
741
886
|
|
742
|
-
var that = $(this).data("resizable"), o = that.options, cs = that.size;
|
887
|
+
var that = $(this).data("ui-resizable"), o = that.options, cs = that.size;
|
743
888
|
|
744
889
|
that.ghost = that.originalElement.clone();
|
745
890
|
that.ghost
|
746
|
-
.css({ opacity: .25, display:
|
747
|
-
.addClass(
|
748
|
-
.addClass(typeof o.ghost
|
891
|
+
.css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
|
892
|
+
.addClass("ui-resizable-ghost")
|
893
|
+
.addClass(typeof o.ghost === "string" ? o.ghost : "");
|
749
894
|
|
750
895
|
that.ghost.appendTo(that.helper);
|
751
896
|
|
752
897
|
},
|
753
898
|
|
754
|
-
resize: function(
|
755
|
-
var that = $(this).data("resizable")
|
756
|
-
if (that.ghost)
|
899
|
+
resize: function(){
|
900
|
+
var that = $(this).data("ui-resizable");
|
901
|
+
if (that.ghost) {
|
902
|
+
that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width });
|
903
|
+
}
|
757
904
|
},
|
758
905
|
|
759
|
-
stop: function(
|
760
|
-
var that = $(this).data("resizable")
|
761
|
-
if (that.ghost && that.helper)
|
906
|
+
stop: function() {
|
907
|
+
var that = $(this).data("ui-resizable");
|
908
|
+
if (that.ghost && that.helper) {
|
909
|
+
that.helper.get(0).removeChild(that.ghost.get(0));
|
910
|
+
}
|
762
911
|
}
|
763
912
|
|
764
913
|
});
|
765
914
|
|
766
915
|
$.ui.plugin.add("resizable", "grid", {
|
767
916
|
|
768
|
-
resize: function(
|
769
|
-
var that = $(this).data("resizable"),
|
770
|
-
|
771
|
-
|
917
|
+
resize: function() {
|
918
|
+
var that = $(this).data("ui-resizable"),
|
919
|
+
o = that.options,
|
920
|
+
cs = that.size,
|
921
|
+
os = that.originalSize,
|
922
|
+
op = that.originalPosition,
|
923
|
+
a = that.axis,
|
924
|
+
grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
|
925
|
+
gridX = (grid[0]||1),
|
926
|
+
gridY = (grid[1]||1),
|
927
|
+
ox = Math.round((cs.width - os.width) / gridX) * gridX,
|
928
|
+
oy = Math.round((cs.height - os.height) / gridY) * gridY,
|
929
|
+
newWidth = os.width + ox,
|
930
|
+
newHeight = os.height + oy,
|
931
|
+
isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
|
932
|
+
isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
|
933
|
+
isMinWidth = o.minWidth && (o.minWidth > newWidth),
|
934
|
+
isMinHeight = o.minHeight && (o.minHeight > newHeight);
|
935
|
+
|
936
|
+
o.grid = grid;
|
937
|
+
|
938
|
+
if (isMinWidth) {
|
939
|
+
newWidth = newWidth + gridX;
|
940
|
+
}
|
941
|
+
if (isMinHeight) {
|
942
|
+
newHeight = newHeight + gridY;
|
943
|
+
}
|
944
|
+
if (isMaxWidth) {
|
945
|
+
newWidth = newWidth - gridX;
|
946
|
+
}
|
947
|
+
if (isMaxHeight) {
|
948
|
+
newHeight = newHeight - gridY;
|
949
|
+
}
|
772
950
|
|
773
951
|
if (/^(se|s|e)$/.test(a)) {
|
774
|
-
that.size.width =
|
775
|
-
that.size.height =
|
776
|
-
}
|
777
|
-
|
778
|
-
that.size.
|
779
|
-
that.size.height = os.height + oy;
|
952
|
+
that.size.width = newWidth;
|
953
|
+
that.size.height = newHeight;
|
954
|
+
} else if (/^(ne)$/.test(a)) {
|
955
|
+
that.size.width = newWidth;
|
956
|
+
that.size.height = newHeight;
|
780
957
|
that.position.top = op.top - oy;
|
781
|
-
}
|
782
|
-
|
783
|
-
that.size.
|
784
|
-
that.size.height = os.height + oy;
|
958
|
+
} else if (/^(sw)$/.test(a)) {
|
959
|
+
that.size.width = newWidth;
|
960
|
+
that.size.height = newHeight;
|
785
961
|
that.position.left = op.left - ox;
|
786
|
-
}
|
787
|
-
|
788
|
-
that.size.
|
789
|
-
that.size.height = os.height + oy;
|
962
|
+
} else {
|
963
|
+
that.size.width = newWidth;
|
964
|
+
that.size.height = newHeight;
|
790
965
|
that.position.top = op.top - oy;
|
791
966
|
that.position.left = op.left - ox;
|
792
967
|
}
|
@@ -794,12 +969,4 @@ $.ui.plugin.add("resizable", "grid", {
|
|
794
969
|
|
795
970
|
});
|
796
971
|
|
797
|
-
var num = function(v) {
|
798
|
-
return parseInt(v, 10) || 0;
|
799
|
-
};
|
800
|
-
|
801
|
-
var isNumber = function(value) {
|
802
|
-
return !isNaN(parseInt(value, 10));
|
803
|
-
};
|
804
|
-
|
805
972
|
})(jQuery);
|