Sha256: 411e9170e6b0f104b3f45adcf42b301059bbc8e3c5c78412c9cd8a1476c17b6c

Contents?: true

Size: 1.39 KB

Versions: 72

Compression:

Stored size: 1.39 KB

Contents

define([
  'jquery',
  './utils'
], function ($, CompatUtils) {
  // No-op CSS adapter that discards all classes by default
  function _dropdownAdapter (clazz) {
    return null;
  }

  function DropdownCSS () { }

  DropdownCSS.prototype.render = function (decorated) {
    var $dropdown = decorated.call(this);

    var dropdownCssClass = this.options.get('dropdownCssClass') || '';

    if ($.isFunction(dropdownCssClass)) {
      dropdownCssClass = dropdownCssClass(this.$element);
    }

    var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');
    dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;

    if (dropdownCssClass.indexOf(':all:') !== -1) {
      dropdownCssClass = dropdownCssClass.replace(':all:', '');

      var _cssAdapter = dropdownCssAdapter;

      dropdownCssAdapter = function (clazz) {
        var adapted = _cssAdapter(clazz);

        if (adapted != null) {
          // Append the old one along with the adapted one
          return adapted + ' ' + clazz;
        }

        return clazz;
      };
    }

    var dropdownCss = this.options.get('dropdownCss') || {};

    if ($.isFunction(dropdownCss)) {
      dropdownCss = dropdownCss(this.$element);
    }

    CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);

    $dropdown.css(dropdownCss);
    $dropdown.addClass(dropdownCssClass);

    return $dropdown;
  };

  return DropdownCSS;
});

Version data entries

72 entries across 72 versions & 6 rubygems

Version Path
card-1.93.1 mod/bootstrap/vendor/select2/src/js/select2/compat/dropdownCss.js
card-1.93.0 mod/bootstrap/vendor/select2/src/js/select2/compat/dropdownCss.js
trestle-0.8.0 vendor/assets/bower_components/trestle/select2/src/js/select2/compat/dropdownCss.js
locomotivecms-3.2.0.rc1 vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/dropdownCss.js
locomotivecms-3.1.1 vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/dropdownCss.js
locomotivecms-3.1.0 vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/dropdownCss.js
locomotivecms-3.1.0.rc3 vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/dropdownCss.js
locomotivecms-3.1.0.rc2 vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/dropdownCss.js
locomotivecms-3.1.0.rc1 vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/dropdownCss.js
locomotivecms-3.0.1 vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/dropdownCss.js
locomotivecms-3.0.0 vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/dropdownCss.js
locomotivecms-3.0.0.rc7 vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/dropdownCss.js