jquery-ui-rails 5.0.4 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitmodules +1 -1
- data/.travis.yml +1 -1
- data/History.md +23 -2
- data/README.md +67 -50
- data/Rakefile +58 -29
- data/VERSIONS.md +4 -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 -304
- 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 -16
- data/app/assets/javascripts/jquery-ui/effect.js +565 -891
- 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 +40 -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 +107 -111
- 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 +359 -163
- data/app/assets/javascripts/jquery-ui/{accordion.js → widgets/accordion.js} +200 -163
- data/app/assets/javascripts/jquery-ui/{autocomplete.js → widgets/autocomplete.js} +153 -106
- data/app/assets/javascripts/jquery-ui/widgets/button.js +454 -0
- data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +289 -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/{dialog.js → widgets/dialog.js} +267 -181
- data/app/assets/javascripts/jquery-ui/{draggable.js → widgets/draggable.js} +430 -294
- data/app/assets/javascripts/jquery-ui/{droppable.js → widgets/droppable.js} +174 -84
- data/app/assets/javascripts/jquery-ui/{menu.js → widgets/menu.js} +228 -158
- data/app/assets/javascripts/jquery-ui/widgets/mouse.js +241 -0
- data/app/assets/javascripts/jquery-ui/{progressbar.js → widgets/progressbar.js} +63 -41
- 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/{selectmenu.js → widgets/selectmenu.js} +259 -177
- data/app/assets/javascripts/jquery-ui/{slider.js → widgets/slider.js} +199 -160
- data/app/assets/javascripts/jquery-ui/widgets/sortable.js +1623 -0
- data/app/assets/javascripts/jquery-ui/{spinner.js → widgets/spinner.js} +184 -114
- data/app/assets/javascripts/jquery-ui/{tabs.js → widgets/tabs.js} +258 -211
- data/app/assets/javascripts/jquery-ui/{tooltip.js → widgets/tooltip.js} +165 -100
- data/app/assets/javascripts/jquery-ui.js +53 -33
- data/app/assets/stylesheets/jquery-ui/accordion.css +1 -15
- data/app/assets/stylesheets/jquery-ui/all.css +1 -1
- data/app/assets/stylesheets/jquery-ui/autocomplete.css +1 -3
- data/app/assets/stylesheets/jquery-ui/base.css +3 -1
- data/app/assets/stylesheets/jquery-ui/button.css +35 -68
- 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 +12 -8
- data/app/assets/stylesheets/jquery-ui/datepicker.css +11 -2
- data/app/assets/stylesheets/jquery-ui/dialog.css +38 -11
- data/app/assets/stylesheets/jquery-ui/draggable.css +1 -2
- data/app/assets/stylesheets/jquery-ui/menu.css +7 -7
- data/app/assets/stylesheets/jquery-ui/progressbar.css +2 -3
- data/app/assets/stylesheets/jquery-ui/resizable.css +1 -2
- data/app/assets/stylesheets/jquery-ui/selectable.css +1 -2
- data/app/assets/stylesheets/jquery-ui/selectmenu.css +11 -22
- data/app/assets/stylesheets/jquery-ui/slider.css +2 -3
- data/app/assets/stylesheets/jquery-ui/sortable.css +1 -2
- data/app/assets/stylesheets/jquery-ui/spinner.css +7 -22
- data/app/assets/stylesheets/jquery-ui/tabs.css +1 -2
- data/app/assets/stylesheets/jquery-ui/theme.css.erb +121 -92
- data/app/assets/stylesheets/jquery-ui/tooltip.css +1 -4
- data/lib/jquery/ui/rails/version.rb +2 -2
- metadata +153 -146
- data/app/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/javascripts/jquery-ui/button.js +0 -414
- data/app/assets/javascripts/jquery-ui/datepicker-af.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-ar-DZ.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-ar.js +0 -38
- data/app/assets/javascripts/jquery-ui/datepicker-az.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-be.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-bg.js +0 -38
- data/app/assets/javascripts/jquery-ui/datepicker-bs.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-ca.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-cs.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-cy-GB.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-da.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-de.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-el.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-en-AU.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-en-GB.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-en-NZ.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-eo.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-es.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-et.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-eu.js +0 -36
- data/app/assets/javascripts/jquery-ui/datepicker-fa.js +0 -73
- data/app/assets/javascripts/jquery-ui/datepicker-fi.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-fo.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-fr-CA.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-fr-CH.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-fr.js +0 -39
- data/app/assets/javascripts/jquery-ui/datepicker-gl.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-he.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-hi.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-hr.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-hu.js +0 -36
- data/app/assets/javascripts/jquery-ui/datepicker-hy.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-id.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-is.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-it-CH.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-it.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-ja.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-ka.js +0 -35
- data/app/assets/javascripts/jquery-ui/datepicker-kk.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-km.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-ko.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-ky.js +0 -38
- data/app/assets/javascripts/jquery-ui/datepicker-lb.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-lt.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-lv.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-mk.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-ml.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-ms.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-nb.js +0 -36
- data/app/assets/javascripts/jquery-ui/datepicker-nl-BE.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-nl.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-nn.js +0 -36
- data/app/assets/javascripts/jquery-ui/datepicker-no.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-pl.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-pt-BR.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-pt.js +0 -36
- data/app/assets/javascripts/jquery-ui/datepicker-rm.js +0 -35
- data/app/assets/javascripts/jquery-ui/datepicker-ro.js +0 -40
- data/app/assets/javascripts/jquery-ui/datepicker-ru.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-sk.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-sl.js +0 -38
- data/app/assets/javascripts/jquery-ui/datepicker-sq.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-sr-SR.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-sr.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-sv.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-ta.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-th.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-tj.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-tr.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-uk.js +0 -38
- data/app/assets/javascripts/jquery-ui/datepicker-vi.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-zh-CN.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-zh-HK.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker-zh-TW.js +0 -37
- data/app/assets/javascripts/jquery-ui/datepicker.js +0 -2086
- data/app/assets/javascripts/jquery-ui/effect-blind.js +0 -92
- data/app/assets/javascripts/jquery-ui/effect-bounce.js +0 -125
- data/app/assets/javascripts/jquery-ui/effect-clip.js +0 -79
- data/app/assets/javascripts/jquery-ui/effect-drop.js +0 -77
- data/app/assets/javascripts/jquery-ui/effect-explode.js +0 -109
- data/app/assets/javascripts/jquery-ui/effect-fade.js +0 -42
- data/app/assets/javascripts/jquery-ui/effect-fold.js +0 -88
- data/app/assets/javascripts/jquery-ui/effect-highlight.js +0 -62
- data/app/assets/javascripts/jquery-ui/effect-puff.js +0 -63
- data/app/assets/javascripts/jquery-ui/effect-pulsate.js +0 -75
- data/app/assets/javascripts/jquery-ui/effect-scale.js +0 -92
- data/app/assets/javascripts/jquery-ui/effect-shake.js +0 -86
- data/app/assets/javascripts/jquery-ui/effect-size.js +0 -235
- data/app/assets/javascripts/jquery-ui/effect-slide.js +0 -76
- data/app/assets/javascripts/jquery-ui/effect-transfer.js +0 -59
- data/app/assets/javascripts/jquery-ui/mouse.js +0 -202
- data/app/assets/javascripts/jquery-ui/resizable.js +0 -1183
- data/app/assets/javascripts/jquery-ui/selectable.js +0 -291
- data/app/assets/javascripts/jquery-ui/sortable.js +0 -1308
@@ -1,1308 +0,0 @@
|
|
1
|
-
//= require jquery-ui/core
|
2
|
-
//= require jquery-ui/widget
|
3
|
-
//= require jquery-ui/mouse
|
4
|
-
|
5
|
-
/*!
|
6
|
-
* jQuery UI Sortable 1.11.3
|
7
|
-
* http://jqueryui.com
|
8
|
-
*
|
9
|
-
* Copyright jQuery Foundation and other contributors
|
10
|
-
* Released under the MIT license.
|
11
|
-
* http://jquery.org/license
|
12
|
-
*
|
13
|
-
* http://api.jqueryui.com/sortable/
|
14
|
-
*/
|
15
|
-
(function( factory ) {
|
16
|
-
if ( typeof define === "function" && define.amd ) {
|
17
|
-
|
18
|
-
// AMD. Register as an anonymous module.
|
19
|
-
define([
|
20
|
-
"jquery",
|
21
|
-
"./core",
|
22
|
-
"./mouse",
|
23
|
-
"./widget"
|
24
|
-
], factory );
|
25
|
-
} else {
|
26
|
-
|
27
|
-
// Browser globals
|
28
|
-
factory( jQuery );
|
29
|
-
}
|
30
|
-
}(function( $ ) {
|
31
|
-
|
32
|
-
return $.widget("ui.sortable", $.ui.mouse, {
|
33
|
-
version: "1.11.3",
|
34
|
-
widgetEventPrefix: "sort",
|
35
|
-
ready: false,
|
36
|
-
options: {
|
37
|
-
appendTo: "parent",
|
38
|
-
axis: false,
|
39
|
-
connectWith: false,
|
40
|
-
containment: false,
|
41
|
-
cursor: "auto",
|
42
|
-
cursorAt: false,
|
43
|
-
dropOnEmpty: true,
|
44
|
-
forcePlaceholderSize: false,
|
45
|
-
forceHelperSize: false,
|
46
|
-
grid: false,
|
47
|
-
handle: false,
|
48
|
-
helper: "original",
|
49
|
-
items: "> *",
|
50
|
-
opacity: false,
|
51
|
-
placeholder: false,
|
52
|
-
revert: false,
|
53
|
-
scroll: true,
|
54
|
-
scrollSensitivity: 20,
|
55
|
-
scrollSpeed: 20,
|
56
|
-
scope: "default",
|
57
|
-
tolerance: "intersect",
|
58
|
-
zIndex: 1000,
|
59
|
-
|
60
|
-
// callbacks
|
61
|
-
activate: null,
|
62
|
-
beforeStop: null,
|
63
|
-
change: null,
|
64
|
-
deactivate: null,
|
65
|
-
out: null,
|
66
|
-
over: null,
|
67
|
-
receive: null,
|
68
|
-
remove: null,
|
69
|
-
sort: null,
|
70
|
-
start: null,
|
71
|
-
stop: null,
|
72
|
-
update: null
|
73
|
-
},
|
74
|
-
|
75
|
-
_isOverAxis: function( x, reference, size ) {
|
76
|
-
return ( x >= reference ) && ( x < ( reference + size ) );
|
77
|
-
},
|
78
|
-
|
79
|
-
_isFloating: function( item ) {
|
80
|
-
return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
|
81
|
-
},
|
82
|
-
|
83
|
-
_create: function() {
|
84
|
-
|
85
|
-
var o = this.options;
|
86
|
-
this.containerCache = {};
|
87
|
-
this.element.addClass("ui-sortable");
|
88
|
-
|
89
|
-
//Get the items
|
90
|
-
this.refresh();
|
91
|
-
|
92
|
-
//Let's determine if the items are being displayed horizontally
|
93
|
-
this.floating = this.items.length ? o.axis === "x" || this._isFloating(this.items[0].item) : false;
|
94
|
-
|
95
|
-
//Let's determine the parent's offset
|
96
|
-
this.offset = this.element.offset();
|
97
|
-
|
98
|
-
//Initialize mouse events for interaction
|
99
|
-
this._mouseInit();
|
100
|
-
|
101
|
-
this._setHandleClassName();
|
102
|
-
|
103
|
-
//We're ready to go
|
104
|
-
this.ready = true;
|
105
|
-
|
106
|
-
},
|
107
|
-
|
108
|
-
_setOption: function( key, value ) {
|
109
|
-
this._super( key, value );
|
110
|
-
|
111
|
-
if ( key === "handle" ) {
|
112
|
-
this._setHandleClassName();
|
113
|
-
}
|
114
|
-
},
|
115
|
-
|
116
|
-
_setHandleClassName: function() {
|
117
|
-
this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
|
118
|
-
$.each( this.items, function() {
|
119
|
-
( this.instance.options.handle ?
|
120
|
-
this.item.find( this.instance.options.handle ) : this.item )
|
121
|
-
.addClass( "ui-sortable-handle" );
|
122
|
-
});
|
123
|
-
},
|
124
|
-
|
125
|
-
_destroy: function() {
|
126
|
-
this.element
|
127
|
-
.removeClass( "ui-sortable ui-sortable-disabled" )
|
128
|
-
.find( ".ui-sortable-handle" )
|
129
|
-
.removeClass( "ui-sortable-handle" );
|
130
|
-
this._mouseDestroy();
|
131
|
-
|
132
|
-
for ( var i = this.items.length - 1; i >= 0; i-- ) {
|
133
|
-
this.items[i].item.removeData(this.widgetName + "-item");
|
134
|
-
}
|
135
|
-
|
136
|
-
return this;
|
137
|
-
},
|
138
|
-
|
139
|
-
_mouseCapture: function(event, overrideHandle) {
|
140
|
-
var currentItem = null,
|
141
|
-
validHandle = false,
|
142
|
-
that = this;
|
143
|
-
|
144
|
-
if (this.reverting) {
|
145
|
-
return false;
|
146
|
-
}
|
147
|
-
|
148
|
-
if(this.options.disabled || this.options.type === "static") {
|
149
|
-
return false;
|
150
|
-
}
|
151
|
-
|
152
|
-
//We have to refresh the items data once first
|
153
|
-
this._refreshItems(event);
|
154
|
-
|
155
|
-
//Find out if the clicked node (or one of its parents) is a actual item in this.items
|
156
|
-
$(event.target).parents().each(function() {
|
157
|
-
if($.data(this, that.widgetName + "-item") === that) {
|
158
|
-
currentItem = $(this);
|
159
|
-
return false;
|
160
|
-
}
|
161
|
-
});
|
162
|
-
if($.data(event.target, that.widgetName + "-item") === that) {
|
163
|
-
currentItem = $(event.target);
|
164
|
-
}
|
165
|
-
|
166
|
-
if(!currentItem) {
|
167
|
-
return false;
|
168
|
-
}
|
169
|
-
if(this.options.handle && !overrideHandle) {
|
170
|
-
$(this.options.handle, currentItem).find("*").addBack().each(function() {
|
171
|
-
if(this === event.target) {
|
172
|
-
validHandle = true;
|
173
|
-
}
|
174
|
-
});
|
175
|
-
if(!validHandle) {
|
176
|
-
return false;
|
177
|
-
}
|
178
|
-
}
|
179
|
-
|
180
|
-
this.currentItem = currentItem;
|
181
|
-
this._removeCurrentsFromItems();
|
182
|
-
return true;
|
183
|
-
|
184
|
-
},
|
185
|
-
|
186
|
-
_mouseStart: function(event, overrideHandle, noActivation) {
|
187
|
-
|
188
|
-
var i, body,
|
189
|
-
o = this.options;
|
190
|
-
|
191
|
-
this.currentContainer = this;
|
192
|
-
|
193
|
-
//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
|
194
|
-
this.refreshPositions();
|
195
|
-
|
196
|
-
//Create and append the visible helper
|
197
|
-
this.helper = this._createHelper(event);
|
198
|
-
|
199
|
-
//Cache the helper size
|
200
|
-
this._cacheHelperProportions();
|
201
|
-
|
202
|
-
/*
|
203
|
-
* - Position generation -
|
204
|
-
* This block generates everything position related - it's the core of draggables.
|
205
|
-
*/
|
206
|
-
|
207
|
-
//Cache the margins of the original element
|
208
|
-
this._cacheMargins();
|
209
|
-
|
210
|
-
//Get the next scrolling parent
|
211
|
-
this.scrollParent = this.helper.scrollParent();
|
212
|
-
|
213
|
-
//The element's absolute position on the page minus margins
|
214
|
-
this.offset = this.currentItem.offset();
|
215
|
-
this.offset = {
|
216
|
-
top: this.offset.top - this.margins.top,
|
217
|
-
left: this.offset.left - this.margins.left
|
218
|
-
};
|
219
|
-
|
220
|
-
$.extend(this.offset, {
|
221
|
-
click: { //Where the click happened, relative to the element
|
222
|
-
left: event.pageX - this.offset.left,
|
223
|
-
top: event.pageY - this.offset.top
|
224
|
-
},
|
225
|
-
parent: this._getParentOffset(),
|
226
|
-
relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
|
227
|
-
});
|
228
|
-
|
229
|
-
// Only after we got the offset, we can change the helper's position to absolute
|
230
|
-
// TODO: Still need to figure out a way to make relative sorting possible
|
231
|
-
this.helper.css("position", "absolute");
|
232
|
-
this.cssPosition = this.helper.css("position");
|
233
|
-
|
234
|
-
//Generate the original position
|
235
|
-
this.originalPosition = this._generatePosition(event);
|
236
|
-
this.originalPageX = event.pageX;
|
237
|
-
this.originalPageY = event.pageY;
|
238
|
-
|
239
|
-
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
|
240
|
-
(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
|
241
|
-
|
242
|
-
//Cache the former DOM position
|
243
|
-
this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
|
244
|
-
|
245
|
-
//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
|
246
|
-
if(this.helper[0] !== this.currentItem[0]) {
|
247
|
-
this.currentItem.hide();
|
248
|
-
}
|
249
|
-
|
250
|
-
//Create the placeholder
|
251
|
-
this._createPlaceholder();
|
252
|
-
|
253
|
-
//Set a containment if given in the options
|
254
|
-
if(o.containment) {
|
255
|
-
this._setContainment();
|
256
|
-
}
|
257
|
-
|
258
|
-
if( o.cursor && o.cursor !== "auto" ) { // cursor option
|
259
|
-
body = this.document.find( "body" );
|
260
|
-
|
261
|
-
// support: IE
|
262
|
-
this.storedCursor = body.css( "cursor" );
|
263
|
-
body.css( "cursor", o.cursor );
|
264
|
-
|
265
|
-
this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
|
266
|
-
}
|
267
|
-
|
268
|
-
if(o.opacity) { // opacity option
|
269
|
-
if (this.helper.css("opacity")) {
|
270
|
-
this._storedOpacity = this.helper.css("opacity");
|
271
|
-
}
|
272
|
-
this.helper.css("opacity", o.opacity);
|
273
|
-
}
|
274
|
-
|
275
|
-
if(o.zIndex) { // zIndex option
|
276
|
-
if (this.helper.css("zIndex")) {
|
277
|
-
this._storedZIndex = this.helper.css("zIndex");
|
278
|
-
}
|
279
|
-
this.helper.css("zIndex", o.zIndex);
|
280
|
-
}
|
281
|
-
|
282
|
-
//Prepare scrolling
|
283
|
-
if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
|
284
|
-
this.overflowOffset = this.scrollParent.offset();
|
285
|
-
}
|
286
|
-
|
287
|
-
//Call callbacks
|
288
|
-
this._trigger("start", event, this._uiHash());
|
289
|
-
|
290
|
-
//Recache the helper size
|
291
|
-
if(!this._preserveHelperProportions) {
|
292
|
-
this._cacheHelperProportions();
|
293
|
-
}
|
294
|
-
|
295
|
-
|
296
|
-
//Post "activate" events to possible containers
|
297
|
-
if( !noActivation ) {
|
298
|
-
for ( i = this.containers.length - 1; i >= 0; i-- ) {
|
299
|
-
this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
|
300
|
-
}
|
301
|
-
}
|
302
|
-
|
303
|
-
//Prepare possible droppables
|
304
|
-
if($.ui.ddmanager) {
|
305
|
-
$.ui.ddmanager.current = this;
|
306
|
-
}
|
307
|
-
|
308
|
-
if ($.ui.ddmanager && !o.dropBehaviour) {
|
309
|
-
$.ui.ddmanager.prepareOffsets(this, event);
|
310
|
-
}
|
311
|
-
|
312
|
-
this.dragging = true;
|
313
|
-
|
314
|
-
this.helper.addClass("ui-sortable-helper");
|
315
|
-
this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
|
316
|
-
return true;
|
317
|
-
|
318
|
-
},
|
319
|
-
|
320
|
-
_mouseDrag: function(event) {
|
321
|
-
var i, item, itemElement, intersection,
|
322
|
-
o = this.options,
|
323
|
-
scrolled = false;
|
324
|
-
|
325
|
-
//Compute the helpers position
|
326
|
-
this.position = this._generatePosition(event);
|
327
|
-
this.positionAbs = this._convertPositionTo("absolute");
|
328
|
-
|
329
|
-
if (!this.lastPositionAbs) {
|
330
|
-
this.lastPositionAbs = this.positionAbs;
|
331
|
-
}
|
332
|
-
|
333
|
-
//Do scrolling
|
334
|
-
if(this.options.scroll) {
|
335
|
-
if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
|
336
|
-
|
337
|
-
if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
|
338
|
-
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
|
339
|
-
} else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
|
340
|
-
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
|
341
|
-
}
|
342
|
-
|
343
|
-
if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
|
344
|
-
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
|
345
|
-
} else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
|
346
|
-
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
|
347
|
-
}
|
348
|
-
|
349
|
-
} else {
|
350
|
-
|
351
|
-
if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
|
352
|
-
scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
|
353
|
-
} else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
|
354
|
-
scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
|
355
|
-
}
|
356
|
-
|
357
|
-
if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
|
358
|
-
scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
|
359
|
-
} else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
|
360
|
-
scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
|
361
|
-
}
|
362
|
-
|
363
|
-
}
|
364
|
-
|
365
|
-
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
|
366
|
-
$.ui.ddmanager.prepareOffsets(this, event);
|
367
|
-
}
|
368
|
-
}
|
369
|
-
|
370
|
-
//Regenerate the absolute position used for position checks
|
371
|
-
this.positionAbs = this._convertPositionTo("absolute");
|
372
|
-
|
373
|
-
//Set the helper position
|
374
|
-
if(!this.options.axis || this.options.axis !== "y") {
|
375
|
-
this.helper[0].style.left = this.position.left+"px";
|
376
|
-
}
|
377
|
-
if(!this.options.axis || this.options.axis !== "x") {
|
378
|
-
this.helper[0].style.top = this.position.top+"px";
|
379
|
-
}
|
380
|
-
|
381
|
-
//Rearrange
|
382
|
-
for (i = this.items.length - 1; i >= 0; i--) {
|
383
|
-
|
384
|
-
//Cache variables and intersection, continue if no intersection
|
385
|
-
item = this.items[i];
|
386
|
-
itemElement = item.item[0];
|
387
|
-
intersection = this._intersectsWithPointer(item);
|
388
|
-
if (!intersection) {
|
389
|
-
continue;
|
390
|
-
}
|
391
|
-
|
392
|
-
// Only put the placeholder inside the current Container, skip all
|
393
|
-
// items from other containers. This works because when moving
|
394
|
-
// an item from one container to another the
|
395
|
-
// currentContainer is switched before the placeholder is moved.
|
396
|
-
//
|
397
|
-
// Without this, moving items in "sub-sortables" can cause
|
398
|
-
// the placeholder to jitter between the outer and inner container.
|
399
|
-
if (item.instance !== this.currentContainer) {
|
400
|
-
continue;
|
401
|
-
}
|
402
|
-
|
403
|
-
// cannot intersect with itself
|
404
|
-
// no useless actions that have been done before
|
405
|
-
// no action if the item moved is the parent of the item checked
|
406
|
-
if (itemElement !== this.currentItem[0] &&
|
407
|
-
this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
|
408
|
-
!$.contains(this.placeholder[0], itemElement) &&
|
409
|
-
(this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
|
410
|
-
) {
|
411
|
-
|
412
|
-
this.direction = intersection === 1 ? "down" : "up";
|
413
|
-
|
414
|
-
if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
|
415
|
-
this._rearrange(event, item);
|
416
|
-
} else {
|
417
|
-
break;
|
418
|
-
}
|
419
|
-
|
420
|
-
this._trigger("change", event, this._uiHash());
|
421
|
-
break;
|
422
|
-
}
|
423
|
-
}
|
424
|
-
|
425
|
-
//Post events to containers
|
426
|
-
this._contactContainers(event);
|
427
|
-
|
428
|
-
//Interconnect with droppables
|
429
|
-
if($.ui.ddmanager) {
|
430
|
-
$.ui.ddmanager.drag(this, event);
|
431
|
-
}
|
432
|
-
|
433
|
-
//Call callbacks
|
434
|
-
this._trigger("sort", event, this._uiHash());
|
435
|
-
|
436
|
-
this.lastPositionAbs = this.positionAbs;
|
437
|
-
return false;
|
438
|
-
|
439
|
-
},
|
440
|
-
|
441
|
-
_mouseStop: function(event, noPropagation) {
|
442
|
-
|
443
|
-
if(!event) {
|
444
|
-
return;
|
445
|
-
}
|
446
|
-
|
447
|
-
//If we are using droppables, inform the manager about the drop
|
448
|
-
if ($.ui.ddmanager && !this.options.dropBehaviour) {
|
449
|
-
$.ui.ddmanager.drop(this, event);
|
450
|
-
}
|
451
|
-
|
452
|
-
if(this.options.revert) {
|
453
|
-
var that = this,
|
454
|
-
cur = this.placeholder.offset(),
|
455
|
-
axis = this.options.axis,
|
456
|
-
animation = {};
|
457
|
-
|
458
|
-
if ( !axis || axis === "x" ) {
|
459
|
-
animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
|
460
|
-
}
|
461
|
-
if ( !axis || axis === "y" ) {
|
462
|
-
animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
|
463
|
-
}
|
464
|
-
this.reverting = true;
|
465
|
-
$(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
|
466
|
-
that._clear(event);
|
467
|
-
});
|
468
|
-
} else {
|
469
|
-
this._clear(event, noPropagation);
|
470
|
-
}
|
471
|
-
|
472
|
-
return false;
|
473
|
-
|
474
|
-
},
|
475
|
-
|
476
|
-
cancel: function() {
|
477
|
-
|
478
|
-
if(this.dragging) {
|
479
|
-
|
480
|
-
this._mouseUp({ target: null });
|
481
|
-
|
482
|
-
if(this.options.helper === "original") {
|
483
|
-
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
|
484
|
-
} else {
|
485
|
-
this.currentItem.show();
|
486
|
-
}
|
487
|
-
|
488
|
-
//Post deactivating events to containers
|
489
|
-
for (var i = this.containers.length - 1; i >= 0; i--){
|
490
|
-
this.containers[i]._trigger("deactivate", null, this._uiHash(this));
|
491
|
-
if(this.containers[i].containerCache.over) {
|
492
|
-
this.containers[i]._trigger("out", null, this._uiHash(this));
|
493
|
-
this.containers[i].containerCache.over = 0;
|
494
|
-
}
|
495
|
-
}
|
496
|
-
|
497
|
-
}
|
498
|
-
|
499
|
-
if (this.placeholder) {
|
500
|
-
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
|
501
|
-
if(this.placeholder[0].parentNode) {
|
502
|
-
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
|
503
|
-
}
|
504
|
-
if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
|
505
|
-
this.helper.remove();
|
506
|
-
}
|
507
|
-
|
508
|
-
$.extend(this, {
|
509
|
-
helper: null,
|
510
|
-
dragging: false,
|
511
|
-
reverting: false,
|
512
|
-
_noFinalSort: null
|
513
|
-
});
|
514
|
-
|
515
|
-
if(this.domPosition.prev) {
|
516
|
-
$(this.domPosition.prev).after(this.currentItem);
|
517
|
-
} else {
|
518
|
-
$(this.domPosition.parent).prepend(this.currentItem);
|
519
|
-
}
|
520
|
-
}
|
521
|
-
|
522
|
-
return this;
|
523
|
-
|
524
|
-
},
|
525
|
-
|
526
|
-
serialize: function(o) {
|
527
|
-
|
528
|
-
var items = this._getItemsAsjQuery(o && o.connected),
|
529
|
-
str = [];
|
530
|
-
o = o || {};
|
531
|
-
|
532
|
-
$(items).each(function() {
|
533
|
-
var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
|
534
|
-
if (res) {
|
535
|
-
str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
|
536
|
-
}
|
537
|
-
});
|
538
|
-
|
539
|
-
if(!str.length && o.key) {
|
540
|
-
str.push(o.key + "=");
|
541
|
-
}
|
542
|
-
|
543
|
-
return str.join("&");
|
544
|
-
|
545
|
-
},
|
546
|
-
|
547
|
-
toArray: function(o) {
|
548
|
-
|
549
|
-
var items = this._getItemsAsjQuery(o && o.connected),
|
550
|
-
ret = [];
|
551
|
-
|
552
|
-
o = o || {};
|
553
|
-
|
554
|
-
items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
|
555
|
-
return ret;
|
556
|
-
|
557
|
-
},
|
558
|
-
|
559
|
-
/* Be careful with the following core functions */
|
560
|
-
_intersectsWith: function(item) {
|
561
|
-
|
562
|
-
var x1 = this.positionAbs.left,
|
563
|
-
x2 = x1 + this.helperProportions.width,
|
564
|
-
y1 = this.positionAbs.top,
|
565
|
-
y2 = y1 + this.helperProportions.height,
|
566
|
-
l = item.left,
|
567
|
-
r = l + item.width,
|
568
|
-
t = item.top,
|
569
|
-
b = t + item.height,
|
570
|
-
dyClick = this.offset.click.top,
|
571
|
-
dxClick = this.offset.click.left,
|
572
|
-
isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
|
573
|
-
isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
|
574
|
-
isOverElement = isOverElementHeight && isOverElementWidth;
|
575
|
-
|
576
|
-
if ( this.options.tolerance === "pointer" ||
|
577
|
-
this.options.forcePointerForContainers ||
|
578
|
-
(this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
|
579
|
-
) {
|
580
|
-
return isOverElement;
|
581
|
-
} else {
|
582
|
-
|
583
|
-
return (l < x1 + (this.helperProportions.width / 2) && // Right Half
|
584
|
-
x2 - (this.helperProportions.width / 2) < r && // Left Half
|
585
|
-
t < y1 + (this.helperProportions.height / 2) && // Bottom Half
|
586
|
-
y2 - (this.helperProportions.height / 2) < b ); // Top Half
|
587
|
-
|
588
|
-
}
|
589
|
-
},
|
590
|
-
|
591
|
-
_intersectsWithPointer: function(item) {
|
592
|
-
|
593
|
-
var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
|
594
|
-
isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
|
595
|
-
isOverElement = isOverElementHeight && isOverElementWidth,
|
596
|
-
verticalDirection = this._getDragVerticalDirection(),
|
597
|
-
horizontalDirection = this._getDragHorizontalDirection();
|
598
|
-
|
599
|
-
if (!isOverElement) {
|
600
|
-
return false;
|
601
|
-
}
|
602
|
-
|
603
|
-
return this.floating ?
|
604
|
-
( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
|
605
|
-
: ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
|
606
|
-
|
607
|
-
},
|
608
|
-
|
609
|
-
_intersectsWithSides: function(item) {
|
610
|
-
|
611
|
-
var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
|
612
|
-
isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
|
613
|
-
verticalDirection = this._getDragVerticalDirection(),
|
614
|
-
horizontalDirection = this._getDragHorizontalDirection();
|
615
|
-
|
616
|
-
if (this.floating && horizontalDirection) {
|
617
|
-
return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
|
618
|
-
} else {
|
619
|
-
return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
|
620
|
-
}
|
621
|
-
|
622
|
-
},
|
623
|
-
|
624
|
-
_getDragVerticalDirection: function() {
|
625
|
-
var delta = this.positionAbs.top - this.lastPositionAbs.top;
|
626
|
-
return delta !== 0 && (delta > 0 ? "down" : "up");
|
627
|
-
},
|
628
|
-
|
629
|
-
_getDragHorizontalDirection: function() {
|
630
|
-
var delta = this.positionAbs.left - this.lastPositionAbs.left;
|
631
|
-
return delta !== 0 && (delta > 0 ? "right" : "left");
|
632
|
-
},
|
633
|
-
|
634
|
-
refresh: function(event) {
|
635
|
-
this._refreshItems(event);
|
636
|
-
this._setHandleClassName();
|
637
|
-
this.refreshPositions();
|
638
|
-
return this;
|
639
|
-
},
|
640
|
-
|
641
|
-
_connectWith: function() {
|
642
|
-
var options = this.options;
|
643
|
-
return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
|
644
|
-
},
|
645
|
-
|
646
|
-
_getItemsAsjQuery: function(connected) {
|
647
|
-
|
648
|
-
var i, j, cur, inst,
|
649
|
-
items = [],
|
650
|
-
queries = [],
|
651
|
-
connectWith = this._connectWith();
|
652
|
-
|
653
|
-
if(connectWith && connected) {
|
654
|
-
for (i = connectWith.length - 1; i >= 0; i--){
|
655
|
-
cur = $(connectWith[i], this.document[0]);
|
656
|
-
for ( j = cur.length - 1; j >= 0; j--){
|
657
|
-
inst = $.data(cur[j], this.widgetFullName);
|
658
|
-
if(inst && inst !== this && !inst.options.disabled) {
|
659
|
-
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
|
660
|
-
}
|
661
|
-
}
|
662
|
-
}
|
663
|
-
}
|
664
|
-
|
665
|
-
queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
|
666
|
-
|
667
|
-
function addItems() {
|
668
|
-
items.push( this );
|
669
|
-
}
|
670
|
-
for (i = queries.length - 1; i >= 0; i--){
|
671
|
-
queries[i][0].each( addItems );
|
672
|
-
}
|
673
|
-
|
674
|
-
return $(items);
|
675
|
-
|
676
|
-
},
|
677
|
-
|
678
|
-
_removeCurrentsFromItems: function() {
|
679
|
-
|
680
|
-
var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
|
681
|
-
|
682
|
-
this.items = $.grep(this.items, function (item) {
|
683
|
-
for (var j=0; j < list.length; j++) {
|
684
|
-
if(list[j] === item.item[0]) {
|
685
|
-
return false;
|
686
|
-
}
|
687
|
-
}
|
688
|
-
return true;
|
689
|
-
});
|
690
|
-
|
691
|
-
},
|
692
|
-
|
693
|
-
_refreshItems: function(event) {
|
694
|
-
|
695
|
-
this.items = [];
|
696
|
-
this.containers = [this];
|
697
|
-
|
698
|
-
var i, j, cur, inst, targetData, _queries, item, queriesLength,
|
699
|
-
items = this.items,
|
700
|
-
queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
|
701
|
-
connectWith = this._connectWith();
|
702
|
-
|
703
|
-
if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
|
704
|
-
for (i = connectWith.length - 1; i >= 0; i--){
|
705
|
-
cur = $(connectWith[i], this.document[0]);
|
706
|
-
for (j = cur.length - 1; j >= 0; j--){
|
707
|
-
inst = $.data(cur[j], this.widgetFullName);
|
708
|
-
if(inst && inst !== this && !inst.options.disabled) {
|
709
|
-
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
|
710
|
-
this.containers.push(inst);
|
711
|
-
}
|
712
|
-
}
|
713
|
-
}
|
714
|
-
}
|
715
|
-
|
716
|
-
for (i = queries.length - 1; i >= 0; i--) {
|
717
|
-
targetData = queries[i][1];
|
718
|
-
_queries = queries[i][0];
|
719
|
-
|
720
|
-
for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
|
721
|
-
item = $(_queries[j]);
|
722
|
-
|
723
|
-
item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
|
724
|
-
|
725
|
-
items.push({
|
726
|
-
item: item,
|
727
|
-
instance: targetData,
|
728
|
-
width: 0, height: 0,
|
729
|
-
left: 0, top: 0
|
730
|
-
});
|
731
|
-
}
|
732
|
-
}
|
733
|
-
|
734
|
-
},
|
735
|
-
|
736
|
-
refreshPositions: function(fast) {
|
737
|
-
|
738
|
-
//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
|
739
|
-
if(this.offsetParent && this.helper) {
|
740
|
-
this.offset.parent = this._getParentOffset();
|
741
|
-
}
|
742
|
-
|
743
|
-
var i, item, t, p;
|
744
|
-
|
745
|
-
for (i = this.items.length - 1; i >= 0; i--){
|
746
|
-
item = this.items[i];
|
747
|
-
|
748
|
-
//We ignore calculating positions of all connected containers when we're not over them
|
749
|
-
if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
|
750
|
-
continue;
|
751
|
-
}
|
752
|
-
|
753
|
-
t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
|
754
|
-
|
755
|
-
if (!fast) {
|
756
|
-
item.width = t.outerWidth();
|
757
|
-
item.height = t.outerHeight();
|
758
|
-
}
|
759
|
-
|
760
|
-
p = t.offset();
|
761
|
-
item.left = p.left;
|
762
|
-
item.top = p.top;
|
763
|
-
}
|
764
|
-
|
765
|
-
if(this.options.custom && this.options.custom.refreshContainers) {
|
766
|
-
this.options.custom.refreshContainers.call(this);
|
767
|
-
} else {
|
768
|
-
for (i = this.containers.length - 1; i >= 0; i--){
|
769
|
-
p = this.containers[i].element.offset();
|
770
|
-
this.containers[i].containerCache.left = p.left;
|
771
|
-
this.containers[i].containerCache.top = p.top;
|
772
|
-
this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
|
773
|
-
this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
|
774
|
-
}
|
775
|
-
}
|
776
|
-
|
777
|
-
return this;
|
778
|
-
},
|
779
|
-
|
780
|
-
_createPlaceholder: function(that) {
|
781
|
-
that = that || this;
|
782
|
-
var className,
|
783
|
-
o = that.options;
|
784
|
-
|
785
|
-
if(!o.placeholder || o.placeholder.constructor === String) {
|
786
|
-
className = o.placeholder;
|
787
|
-
o.placeholder = {
|
788
|
-
element: function() {
|
789
|
-
|
790
|
-
var nodeName = that.currentItem[0].nodeName.toLowerCase(),
|
791
|
-
element = $( "<" + nodeName + ">", that.document[0] )
|
792
|
-
.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
|
793
|
-
.removeClass("ui-sortable-helper");
|
794
|
-
|
795
|
-
if ( nodeName === "tr" ) {
|
796
|
-
that.currentItem.children().each(function() {
|
797
|
-
$( "<td> </td>", that.document[0] )
|
798
|
-
.attr( "colspan", $( this ).attr( "colspan" ) || 1 )
|
799
|
-
.appendTo( element );
|
800
|
-
});
|
801
|
-
} else if ( nodeName === "img" ) {
|
802
|
-
element.attr( "src", that.currentItem.attr( "src" ) );
|
803
|
-
}
|
804
|
-
|
805
|
-
if ( !className ) {
|
806
|
-
element.css( "visibility", "hidden" );
|
807
|
-
}
|
808
|
-
|
809
|
-
return element;
|
810
|
-
},
|
811
|
-
update: function(container, p) {
|
812
|
-
|
813
|
-
// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
|
814
|
-
// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
|
815
|
-
if(className && !o.forcePlaceholderSize) {
|
816
|
-
return;
|
817
|
-
}
|
818
|
-
|
819
|
-
//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
|
820
|
-
if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
|
821
|
-
if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
|
822
|
-
}
|
823
|
-
};
|
824
|
-
}
|
825
|
-
|
826
|
-
//Create the placeholder
|
827
|
-
that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
|
828
|
-
|
829
|
-
//Append it after the actual current item
|
830
|
-
that.currentItem.after(that.placeholder);
|
831
|
-
|
832
|
-
//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
|
833
|
-
o.placeholder.update(that, that.placeholder);
|
834
|
-
|
835
|
-
},
|
836
|
-
|
837
|
-
_contactContainers: function(event) {
|
838
|
-
var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
|
839
|
-
innermostContainer = null,
|
840
|
-
innermostIndex = null;
|
841
|
-
|
842
|
-
// get innermost container that intersects with item
|
843
|
-
for (i = this.containers.length - 1; i >= 0; i--) {
|
844
|
-
|
845
|
-
// never consider a container that's located within the item itself
|
846
|
-
if($.contains(this.currentItem[0], this.containers[i].element[0])) {
|
847
|
-
continue;
|
848
|
-
}
|
849
|
-
|
850
|
-
if(this._intersectsWith(this.containers[i].containerCache)) {
|
851
|
-
|
852
|
-
// if we've already found a container and it's more "inner" than this, then continue
|
853
|
-
if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
|
854
|
-
continue;
|
855
|
-
}
|
856
|
-
|
857
|
-
innermostContainer = this.containers[i];
|
858
|
-
innermostIndex = i;
|
859
|
-
|
860
|
-
} else {
|
861
|
-
// container doesn't intersect. trigger "out" event if necessary
|
862
|
-
if(this.containers[i].containerCache.over) {
|
863
|
-
this.containers[i]._trigger("out", event, this._uiHash(this));
|
864
|
-
this.containers[i].containerCache.over = 0;
|
865
|
-
}
|
866
|
-
}
|
867
|
-
|
868
|
-
}
|
869
|
-
|
870
|
-
// if no intersecting containers found, return
|
871
|
-
if(!innermostContainer) {
|
872
|
-
return;
|
873
|
-
}
|
874
|
-
|
875
|
-
// move the item into the container if it's not there already
|
876
|
-
if(this.containers.length === 1) {
|
877
|
-
if (!this.containers[innermostIndex].containerCache.over) {
|
878
|
-
this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
|
879
|
-
this.containers[innermostIndex].containerCache.over = 1;
|
880
|
-
}
|
881
|
-
} else {
|
882
|
-
|
883
|
-
//When entering a new container, we will find the item with the least distance and append our item near it
|
884
|
-
dist = 10000;
|
885
|
-
itemWithLeastDistance = null;
|
886
|
-
floating = innermostContainer.floating || this._isFloating(this.currentItem);
|
887
|
-
posProperty = floating ? "left" : "top";
|
888
|
-
sizeProperty = floating ? "width" : "height";
|
889
|
-
axis = floating ? "clientX" : "clientY";
|
890
|
-
|
891
|
-
for (j = this.items.length - 1; j >= 0; j--) {
|
892
|
-
if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
|
893
|
-
continue;
|
894
|
-
}
|
895
|
-
if(this.items[j].item[0] === this.currentItem[0]) {
|
896
|
-
continue;
|
897
|
-
}
|
898
|
-
|
899
|
-
cur = this.items[j].item.offset()[posProperty];
|
900
|
-
nearBottom = false;
|
901
|
-
if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
|
902
|
-
nearBottom = true;
|
903
|
-
}
|
904
|
-
|
905
|
-
if ( Math.abs( event[ axis ] - cur ) < dist ) {
|
906
|
-
dist = Math.abs( event[ axis ] - cur );
|
907
|
-
itemWithLeastDistance = this.items[ j ];
|
908
|
-
this.direction = nearBottom ? "up": "down";
|
909
|
-
}
|
910
|
-
}
|
911
|
-
|
912
|
-
//Check if dropOnEmpty is enabled
|
913
|
-
if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
|
914
|
-
return;
|
915
|
-
}
|
916
|
-
|
917
|
-
if(this.currentContainer === this.containers[innermostIndex]) {
|
918
|
-
if ( !this.currentContainer.containerCache.over ) {
|
919
|
-
this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
|
920
|
-
this.currentContainer.containerCache.over = 1;
|
921
|
-
}
|
922
|
-
return;
|
923
|
-
}
|
924
|
-
|
925
|
-
itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
|
926
|
-
this._trigger("change", event, this._uiHash());
|
927
|
-
this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
|
928
|
-
this.currentContainer = this.containers[innermostIndex];
|
929
|
-
|
930
|
-
//Update the placeholder
|
931
|
-
this.options.placeholder.update(this.currentContainer, this.placeholder);
|
932
|
-
|
933
|
-
this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
|
934
|
-
this.containers[innermostIndex].containerCache.over = 1;
|
935
|
-
}
|
936
|
-
|
937
|
-
|
938
|
-
},
|
939
|
-
|
940
|
-
_createHelper: function(event) {
|
941
|
-
|
942
|
-
var o = this.options,
|
943
|
-
helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
|
944
|
-
|
945
|
-
//Add the helper to the DOM if that didn't happen already
|
946
|
-
if(!helper.parents("body").length) {
|
947
|
-
$(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
|
948
|
-
}
|
949
|
-
|
950
|
-
if(helper[0] === this.currentItem[0]) {
|
951
|
-
this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
|
952
|
-
}
|
953
|
-
|
954
|
-
if(!helper[0].style.width || o.forceHelperSize) {
|
955
|
-
helper.width(this.currentItem.width());
|
956
|
-
}
|
957
|
-
if(!helper[0].style.height || o.forceHelperSize) {
|
958
|
-
helper.height(this.currentItem.height());
|
959
|
-
}
|
960
|
-
|
961
|
-
return helper;
|
962
|
-
|
963
|
-
},
|
964
|
-
|
965
|
-
_adjustOffsetFromHelper: function(obj) {
|
966
|
-
if (typeof obj === "string") {
|
967
|
-
obj = obj.split(" ");
|
968
|
-
}
|
969
|
-
if ($.isArray(obj)) {
|
970
|
-
obj = {left: +obj[0], top: +obj[1] || 0};
|
971
|
-
}
|
972
|
-
if ("left" in obj) {
|
973
|
-
this.offset.click.left = obj.left + this.margins.left;
|
974
|
-
}
|
975
|
-
if ("right" in obj) {
|
976
|
-
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
|
977
|
-
}
|
978
|
-
if ("top" in obj) {
|
979
|
-
this.offset.click.top = obj.top + this.margins.top;
|
980
|
-
}
|
981
|
-
if ("bottom" in obj) {
|
982
|
-
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
|
983
|
-
}
|
984
|
-
},
|
985
|
-
|
986
|
-
_getParentOffset: function() {
|
987
|
-
|
988
|
-
|
989
|
-
//Get the offsetParent and cache its position
|
990
|
-
this.offsetParent = this.helper.offsetParent();
|
991
|
-
var po = this.offsetParent.offset();
|
992
|
-
|
993
|
-
// This is a special case where we need to modify a offset calculated on start, since the following happened:
|
994
|
-
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
|
995
|
-
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
|
996
|
-
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
|
997
|
-
if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
|
998
|
-
po.left += this.scrollParent.scrollLeft();
|
999
|
-
po.top += this.scrollParent.scrollTop();
|
1000
|
-
}
|
1001
|
-
|
1002
|
-
// This needs to be actually done for all browsers, since pageX/pageY includes this information
|
1003
|
-
// with an ugly IE fix
|
1004
|
-
if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
|
1005
|
-
po = { top: 0, left: 0 };
|
1006
|
-
}
|
1007
|
-
|
1008
|
-
return {
|
1009
|
-
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
|
1010
|
-
left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
|
1011
|
-
};
|
1012
|
-
|
1013
|
-
},
|
1014
|
-
|
1015
|
-
_getRelativeOffset: function() {
|
1016
|
-
|
1017
|
-
if(this.cssPosition === "relative") {
|
1018
|
-
var p = this.currentItem.position();
|
1019
|
-
return {
|
1020
|
-
top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
|
1021
|
-
left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
|
1022
|
-
};
|
1023
|
-
} else {
|
1024
|
-
return { top: 0, left: 0 };
|
1025
|
-
}
|
1026
|
-
|
1027
|
-
},
|
1028
|
-
|
1029
|
-
_cacheMargins: function() {
|
1030
|
-
this.margins = {
|
1031
|
-
left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
|
1032
|
-
top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
|
1033
|
-
};
|
1034
|
-
},
|
1035
|
-
|
1036
|
-
_cacheHelperProportions: function() {
|
1037
|
-
this.helperProportions = {
|
1038
|
-
width: this.helper.outerWidth(),
|
1039
|
-
height: this.helper.outerHeight()
|
1040
|
-
};
|
1041
|
-
},
|
1042
|
-
|
1043
|
-
_setContainment: function() {
|
1044
|
-
|
1045
|
-
var ce, co, over,
|
1046
|
-
o = this.options;
|
1047
|
-
if(o.containment === "parent") {
|
1048
|
-
o.containment = this.helper[0].parentNode;
|
1049
|
-
}
|
1050
|
-
if(o.containment === "document" || o.containment === "window") {
|
1051
|
-
this.containment = [
|
1052
|
-
0 - this.offset.relative.left - this.offset.parent.left,
|
1053
|
-
0 - this.offset.relative.top - this.offset.parent.top,
|
1054
|
-
o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
|
1055
|
-
(o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
|
1056
|
-
];
|
1057
|
-
}
|
1058
|
-
|
1059
|
-
if(!(/^(document|window|parent)$/).test(o.containment)) {
|
1060
|
-
ce = $(o.containment)[0];
|
1061
|
-
co = $(o.containment).offset();
|
1062
|
-
over = ($(ce).css("overflow") !== "hidden");
|
1063
|
-
|
1064
|
-
this.containment = [
|
1065
|
-
co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
|
1066
|
-
co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
|
1067
|
-
co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
|
1068
|
-
co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
|
1069
|
-
];
|
1070
|
-
}
|
1071
|
-
|
1072
|
-
},
|
1073
|
-
|
1074
|
-
_convertPositionTo: function(d, pos) {
|
1075
|
-
|
1076
|
-
if(!pos) {
|
1077
|
-
pos = this.position;
|
1078
|
-
}
|
1079
|
-
var mod = d === "absolute" ? 1 : -1,
|
1080
|
-
scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
|
1081
|
-
scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
1082
|
-
|
1083
|
-
return {
|
1084
|
-
top: (
|
1085
|
-
pos.top + // The absolute mouse position
|
1086
|
-
this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
1087
|
-
this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
|
1088
|
-
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
|
1089
|
-
),
|
1090
|
-
left: (
|
1091
|
-
pos.left + // The absolute mouse position
|
1092
|
-
this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
1093
|
-
this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
|
1094
|
-
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
|
1095
|
-
)
|
1096
|
-
};
|
1097
|
-
|
1098
|
-
},
|
1099
|
-
|
1100
|
-
_generatePosition: function(event) {
|
1101
|
-
|
1102
|
-
var top, left,
|
1103
|
-
o = this.options,
|
1104
|
-
pageX = event.pageX,
|
1105
|
-
pageY = event.pageY,
|
1106
|
-
scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
1107
|
-
|
1108
|
-
// This is another very weird special case that only happens for relative elements:
|
1109
|
-
// 1. If the css position is relative
|
1110
|
-
// 2. and the scroll parent is the document or similar to the offset parent
|
1111
|
-
// we have to refresh the relative offset during the scroll so there are no jumps
|
1112
|
-
if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
|
1113
|
-
this.offset.relative = this._getRelativeOffset();
|
1114
|
-
}
|
1115
|
-
|
1116
|
-
/*
|
1117
|
-
* - Position constraining -
|
1118
|
-
* Constrain the position to a mix of grid, containment.
|
1119
|
-
*/
|
1120
|
-
|
1121
|
-
if(this.originalPosition) { //If we are not dragging yet, we won't check for options
|
1122
|
-
|
1123
|
-
if(this.containment) {
|
1124
|
-
if(event.pageX - this.offset.click.left < this.containment[0]) {
|
1125
|
-
pageX = this.containment[0] + this.offset.click.left;
|
1126
|
-
}
|
1127
|
-
if(event.pageY - this.offset.click.top < this.containment[1]) {
|
1128
|
-
pageY = this.containment[1] + this.offset.click.top;
|
1129
|
-
}
|
1130
|
-
if(event.pageX - this.offset.click.left > this.containment[2]) {
|
1131
|
-
pageX = this.containment[2] + this.offset.click.left;
|
1132
|
-
}
|
1133
|
-
if(event.pageY - this.offset.click.top > this.containment[3]) {
|
1134
|
-
pageY = this.containment[3] + this.offset.click.top;
|
1135
|
-
}
|
1136
|
-
}
|
1137
|
-
|
1138
|
-
if(o.grid) {
|
1139
|
-
top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
|
1140
|
-
pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
|
1141
|
-
|
1142
|
-
left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
|
1143
|
-
pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
|
1144
|
-
}
|
1145
|
-
|
1146
|
-
}
|
1147
|
-
|
1148
|
-
return {
|
1149
|
-
top: (
|
1150
|
-
pageY - // The absolute mouse position
|
1151
|
-
this.offset.click.top - // Click offset (relative to the element)
|
1152
|
-
this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
|
1153
|
-
this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
|
1154
|
-
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
|
1155
|
-
),
|
1156
|
-
left: (
|
1157
|
-
pageX - // The absolute mouse position
|
1158
|
-
this.offset.click.left - // Click offset (relative to the element)
|
1159
|
-
this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
|
1160
|
-
this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
|
1161
|
-
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
|
1162
|
-
)
|
1163
|
-
};
|
1164
|
-
|
1165
|
-
},
|
1166
|
-
|
1167
|
-
_rearrange: function(event, i, a, hardRefresh) {
|
1168
|
-
|
1169
|
-
a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
|
1170
|
-
|
1171
|
-
//Various things done here to improve the performance:
|
1172
|
-
// 1. we create a setTimeout, that calls refreshPositions
|
1173
|
-
// 2. on the instance, we have a counter variable, that get's higher after every append
|
1174
|
-
// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
|
1175
|
-
// 4. this lets only the last addition to the timeout stack through
|
1176
|
-
this.counter = this.counter ? ++this.counter : 1;
|
1177
|
-
var counter = this.counter;
|
1178
|
-
|
1179
|
-
this._delay(function() {
|
1180
|
-
if(counter === this.counter) {
|
1181
|
-
this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
|
1182
|
-
}
|
1183
|
-
});
|
1184
|
-
|
1185
|
-
},
|
1186
|
-
|
1187
|
-
_clear: function(event, noPropagation) {
|
1188
|
-
|
1189
|
-
this.reverting = false;
|
1190
|
-
// We delay all events that have to be triggered to after the point where the placeholder has been removed and
|
1191
|
-
// everything else normalized again
|
1192
|
-
var i,
|
1193
|
-
delayedTriggers = [];
|
1194
|
-
|
1195
|
-
// We first have to update the dom position of the actual currentItem
|
1196
|
-
// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
|
1197
|
-
if(!this._noFinalSort && this.currentItem.parent().length) {
|
1198
|
-
this.placeholder.before(this.currentItem);
|
1199
|
-
}
|
1200
|
-
this._noFinalSort = null;
|
1201
|
-
|
1202
|
-
if(this.helper[0] === this.currentItem[0]) {
|
1203
|
-
for(i in this._storedCSS) {
|
1204
|
-
if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
|
1205
|
-
this._storedCSS[i] = "";
|
1206
|
-
}
|
1207
|
-
}
|
1208
|
-
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
|
1209
|
-
} else {
|
1210
|
-
this.currentItem.show();
|
1211
|
-
}
|
1212
|
-
|
1213
|
-
if(this.fromOutside && !noPropagation) {
|
1214
|
-
delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
|
1215
|
-
}
|
1216
|
-
if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
|
1217
|
-
delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
|
1218
|
-
}
|
1219
|
-
|
1220
|
-
// Check if the items Container has Changed and trigger appropriate
|
1221
|
-
// events.
|
1222
|
-
if (this !== this.currentContainer) {
|
1223
|
-
if(!noPropagation) {
|
1224
|
-
delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
|
1225
|
-
delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
|
1226
|
-
delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
|
1227
|
-
}
|
1228
|
-
}
|
1229
|
-
|
1230
|
-
|
1231
|
-
//Post events to containers
|
1232
|
-
function delayEvent( type, instance, container ) {
|
1233
|
-
return function( event ) {
|
1234
|
-
container._trigger( type, event, instance._uiHash( instance ) );
|
1235
|
-
};
|
1236
|
-
}
|
1237
|
-
for (i = this.containers.length - 1; i >= 0; i--){
|
1238
|
-
if (!noPropagation) {
|
1239
|
-
delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
|
1240
|
-
}
|
1241
|
-
if(this.containers[i].containerCache.over) {
|
1242
|
-
delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
|
1243
|
-
this.containers[i].containerCache.over = 0;
|
1244
|
-
}
|
1245
|
-
}
|
1246
|
-
|
1247
|
-
//Do what was originally in plugins
|
1248
|
-
if ( this.storedCursor ) {
|
1249
|
-
this.document.find( "body" ).css( "cursor", this.storedCursor );
|
1250
|
-
this.storedStylesheet.remove();
|
1251
|
-
}
|
1252
|
-
if(this._storedOpacity) {
|
1253
|
-
this.helper.css("opacity", this._storedOpacity);
|
1254
|
-
}
|
1255
|
-
if(this._storedZIndex) {
|
1256
|
-
this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
|
1257
|
-
}
|
1258
|
-
|
1259
|
-
this.dragging = false;
|
1260
|
-
|
1261
|
-
if(!noPropagation) {
|
1262
|
-
this._trigger("beforeStop", event, this._uiHash());
|
1263
|
-
}
|
1264
|
-
|
1265
|
-
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
|
1266
|
-
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
|
1267
|
-
|
1268
|
-
if ( !this.cancelHelperRemoval ) {
|
1269
|
-
if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
|
1270
|
-
this.helper.remove();
|
1271
|
-
}
|
1272
|
-
this.helper = null;
|
1273
|
-
}
|
1274
|
-
|
1275
|
-
if(!noPropagation) {
|
1276
|
-
for (i=0; i < delayedTriggers.length; i++) {
|
1277
|
-
delayedTriggers[i].call(this, event);
|
1278
|
-
} //Trigger all delayed events
|
1279
|
-
this._trigger("stop", event, this._uiHash());
|
1280
|
-
}
|
1281
|
-
|
1282
|
-
this.fromOutside = false;
|
1283
|
-
return !this.cancelHelperRemoval;
|
1284
|
-
|
1285
|
-
},
|
1286
|
-
|
1287
|
-
_trigger: function() {
|
1288
|
-
if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
|
1289
|
-
this.cancel();
|
1290
|
-
}
|
1291
|
-
},
|
1292
|
-
|
1293
|
-
_uiHash: function(_inst) {
|
1294
|
-
var inst = _inst || this;
|
1295
|
-
return {
|
1296
|
-
helper: inst.helper,
|
1297
|
-
placeholder: inst.placeholder || $([]),
|
1298
|
-
position: inst.position,
|
1299
|
-
originalPosition: inst.originalPosition,
|
1300
|
-
offset: inst.positionAbs,
|
1301
|
-
item: inst.currentItem,
|
1302
|
-
sender: _inst ? _inst.element : null
|
1303
|
-
};
|
1304
|
-
}
|
1305
|
-
|
1306
|
-
});
|
1307
|
-
|
1308
|
-
}));
|