Ver código fonte

Extracted the original positioning out

With this change, any instances overriding the dropdown is
required to decorate it with the positioning module.
Kevin Brown 10 anos atrás
pai
commit
81db43fa99

+ 4 - 1
Gruntfile.js

@@ -10,7 +10,10 @@ module.exports = function (grunt) {
 
   fullIncludes = [
     'jquery',
-    'select2/compat/matcher'
+
+    'select2/compat/matcher',
+
+    'select2/dropdown/attachContainer'
   ].concat(includes);
 
   var i18nModules = [];

+ 22 - 2
dist/js/select2.amd.full.js

@@ -2586,8 +2586,7 @@ define('select2/dropdown',[
   };
 
   Dropdown.prototype.position = function ($dropdown, $container) {
-    var $dropdownContainer = $container.find('.dropdown-wrapper');
-    $dropdownContainer.append($dropdown);
+    // Should be implmented in subclasses
   };
 
   Dropdown.prototype.destroy = function () {
@@ -2961,12 +2960,17 @@ define('select2/defaults',[
 
   './i18n/en'
 ], function ($, ResultsList,
+
              SingleSelection, MultipleSelection, Placeholder, AllowClear,
              SelectionSearch,
+
              Utils, Translation, DIACRITICS,
+
              SelectData, ArrayData, AjaxData, Tags, MinimumInputLength,
+
              Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
              AttachBody,
+
              EnglishTranslation) {
   function Defaults () {
     this.reset();
@@ -3580,6 +3584,22 @@ define('select2/compat/matcher',[
   return oldMatcher;
 });
 
+define('select2/dropdown/attachContainer',[
+
+], function () {
+  function AttachContainer (decorated, $element, options) {
+    decorated.call(this, $element, options);
+  }
+
+  AttachContainer.prototype.position =
+    function (decorated, $container, $dropdown) {
+    var $dropdownContainer = $container.find('.dropdown-wrapper');
+    $dropdownContainer.append($dropdown);
+  };
+
+  return AttachContainer;
+});
+
 define('jquery.select2',[
   'jquery',
   'select2/core'

+ 6 - 2
dist/js/select2.amd.js

@@ -2586,8 +2586,7 @@ define('select2/dropdown',[
   };
 
   Dropdown.prototype.position = function ($dropdown, $container) {
-    var $dropdownContainer = $container.find('.dropdown-wrapper');
-    $dropdownContainer.append($dropdown);
+    // Should be implmented in subclasses
   };
 
   Dropdown.prototype.destroy = function () {
@@ -2961,12 +2960,17 @@ define('select2/defaults',[
 
   './i18n/en'
 ], function ($, ResultsList,
+
              SingleSelection, MultipleSelection, Placeholder, AllowClear,
              SelectionSearch,
+
              Utils, Translation, DIACRITICS,
+
              SelectData, ArrayData, AjaxData, Tags, MinimumInputLength,
+
              Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
              AttachBody,
+
              EnglishTranslation) {
   function Defaults () {
     this.reset();

+ 22 - 2
dist/js/select2.full.js

@@ -12121,8 +12121,7 @@ define('select2/dropdown',[
   };
 
   Dropdown.prototype.position = function ($dropdown, $container) {
-    var $dropdownContainer = $container.find('.dropdown-wrapper');
-    $dropdownContainer.append($dropdown);
+    // Should be implmented in subclasses
   };
 
   Dropdown.prototype.destroy = function () {
@@ -12496,12 +12495,17 @@ define('select2/defaults',[
 
   './i18n/en'
 ], function ($, ResultsList,
+
              SingleSelection, MultipleSelection, Placeholder, AllowClear,
              SelectionSearch,
+
              Utils, Translation, DIACRITICS,
+
              SelectData, ArrayData, AjaxData, Tags, MinimumInputLength,
+
              Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
              AttachBody,
+
              EnglishTranslation) {
   function Defaults () {
     this.reset();
@@ -13115,6 +13119,22 @@ define('select2/compat/matcher',[
   return oldMatcher;
 });
 
+define('select2/dropdown/attachContainer',[
+
+], function () {
+  function AttachContainer (decorated, $element, options) {
+    decorated.call(this, $element, options);
+  }
+
+  AttachContainer.prototype.position =
+    function (decorated, $container, $dropdown) {
+    var $dropdownContainer = $container.find('.dropdown-wrapper');
+    $dropdownContainer.append($dropdown);
+  };
+
+  return AttachContainer;
+});
+
 define('jquery.select2',[
   'jquery',
   'select2/core'

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
dist/js/select2.full.min.js


+ 6 - 2
dist/js/select2.js

@@ -3014,8 +3014,7 @@ define('select2/dropdown',[
   };
 
   Dropdown.prototype.position = function ($dropdown, $container) {
-    var $dropdownContainer = $container.find('.dropdown-wrapper');
-    $dropdownContainer.append($dropdown);
+    // Should be implmented in subclasses
   };
 
   Dropdown.prototype.destroy = function () {
@@ -3389,12 +3388,17 @@ define('select2/defaults',[
 
   './i18n/en'
 ], function ($, ResultsList,
+
              SingleSelection, MultipleSelection, Placeholder, AllowClear,
              SelectionSearch,
+
              Utils, Translation, DIACRITICS,
+
              SelectData, ArrayData, AjaxData, Tags, MinimumInputLength,
+
              Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
              AttachBody,
+
              EnglishTranslation) {
   function Defaults () {
     this.reset();

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
dist/js/select2.min.js


+ 5 - 0
src/js/select2/defaults.js

@@ -26,12 +26,17 @@ define([
 
   './i18n/en'
 ], function ($, ResultsList,
+
              SingleSelection, MultipleSelection, Placeholder, AllowClear,
              SelectionSearch,
+
              Utils, Translation, DIACRITICS,
+
              SelectData, ArrayData, AjaxData, Tags, MinimumInputLength,
+
              Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
              AttachBody,
+
              EnglishTranslation) {
   function Defaults () {
     this.reset();

+ 1 - 2
src/js/select2/dropdown.js

@@ -20,8 +20,7 @@ define([
   };
 
   Dropdown.prototype.position = function ($dropdown, $container) {
-    var $dropdownContainer = $container.find('.dropdown-wrapper');
-    $dropdownContainer.append($dropdown);
+    // Should be implmented in subclasses
   };
 
   Dropdown.prototype.destroy = function () {

+ 15 - 0
src/js/select2/dropdown/attachContainer.js

@@ -0,0 +1,15 @@
+define([
+
+], function () {
+  function AttachContainer (decorated, $element, options) {
+    decorated.call(this, $element, options);
+  }
+
+  AttachContainer.prototype.position =
+    function (decorated, $container, $dropdown) {
+    var $dropdownContainer = $container.find('.dropdown-wrapper');
+    $dropdownContainer.append($dropdown);
+  };
+
+  return AttachContainer;
+});

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff