From 33cf820581bc514f9ba34855ff65b4c5d23bd6f4 Mon Sep 17 00:00:00 2001 From: farthinker Date: Mon, 1 Aug 2016 13:46:39 +0800 Subject: [PATCH] CHG: publish v2.1.3 --- CHANGELOG.md | 4 ++++ bower.json | 2 +- dist/simple-select.js | 7 +++++-- dist/simple-select.min.js | 4 ++-- package.json | 2 +- src/simple-select.coffee | 3 +++ styles/simple-select.css | 4 +++- styles/simple-select.scss | 6 ++++++ 8 files changed, 25 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8abe25..bf1fa75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ +## V2.1.3 - 2016-08-01 + +* Fix touch event bug on mobile device. + ## V2.1.2 - 2016-07-27 * `input.textField` will be set empty if `allowInput` option is false and no item is selected when it blurs. diff --git a/bower.json b/bower.json index 4c68e9e..45c0a91 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "simple_select", - "version": "2.1.2", + "version": "2.1.3", "homepage": "https://github.com/mycolorway/simple-select", "authors": [ "farthinker " diff --git a/dist/simple-select.js b/dist/simple-select.js index 2f2ac93..af642cd 100644 --- a/dist/simple-select.js +++ b/dist/simple-select.js @@ -1,5 +1,5 @@ /** - * simple-select v2.1.2 + * simple-select v2.1.3 * http://mycolorway.github.io/simple-select * * Copyright Mycolorway Design @@ -1088,7 +1088,10 @@ SimpleSelect = (function(superClass) { SimpleSelect.prototype._render = function() { this.el.hide().data("simpleSelect", this); - return this.wrapper = $(SimpleSelect._tpl).data("simpleSelect", this).addClass(this.opts.cls).insertBefore(this.el); + this.wrapper = $(SimpleSelect._tpl).data("simpleSelect", this).addClass(this.opts.cls).insertBefore(this.el); + if (this.opts.remote) { + return this.wrapper.addClass('simple-select-remote'); + } }; SimpleSelect.prototype._bind = function() { diff --git a/dist/simple-select.min.js b/dist/simple-select.min.js index 33531cc..e406be2 100644 --- a/dist/simple-select.min.js +++ b/dist/simple-select.min.js @@ -1,2 +1,2 @@ -/* simple-select v2.1.2 | (c) Mycolorway Design | MIT License */ -!function(t,e){"object"==typeof module&&module.exports?module.exports=e(require("jquery"),require("simple-module")):(t.SimpleSelect=e(t.jQuery,t.SimpleModule),t.simple=t.simple||{},t.simple.select=function(e){return new t.SimpleSelect(e)},t.simple.select.locales=t.SimpleSelect.locales)}(this,function(t,e){var i=require=function t(e,i,r){function n(s,l){if(!i[s]){if(!e[s]){var u="function"==typeof require&&require;if(!l&&u)return u(s,!0);if(o)return o(s,!0);var p=new Error("Cannot find module '"+s+"'");throw p.code="MODULE_NOT_FOUND",p}var a=i[s]={exports:{}};e[s][0].call(a.exports,function(t){var i=e[s][1][t];return n(i?i:t)},a,a.exports,t,e,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s",{text:e.name,value:e.value,data:e.data}).appendTo(i)},i.prototype._render=function(){return this.el.empty(),0===this.groups.length?this.el.append("",{label:r.name}),t.each(r.items,function(t,i){return e._renderOption(i,n)}),e.el.append(n)}}(this)),this.el},i.prototype.setGroups=function(t){return this.groups=t,this._render()},i.prototype.getValue=function(){return this.el.val()},i.prototype.setValue=function(t){return this.el.val(t)},i.prototype.getBlankOption=function(){var t;return t=this.el.find('option:not([value]), option[value=""]'),t.length>0&&t},i}(e),r.exports=s},{"./models/group.coffee":4}],2:[function(i,r,n){var o,s,l=function(t,e){function i(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=i("./models/item.coffee"),o=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return l(i,e),i.prototype.opts={el:null,dataProvider:null,noWrap:!1,placeholder:"",selected:!1},i.prototype._init=function(){return this.el=t(this.opts.el),this.dataProvider=this.opts.dataProvider,this.focused=!1,this._inputDelay=200,this._render(),this._bind()},i.prototype._render=function(){return this.el.append('\n\n\n \n\n\n \n'),this.el.find(this.opts.noWrap?"textarea":"input:text").remove(),this.textField=this.el.find(".text-field"),this.textField.attr("placeholder",this.opts.placeholder),this.setSelected(this.opts.selected),this.el},i.prototype._bind=function(){return this.el.on("mousedown click",function(t){return function(e){return e.preventDefault(),t.textField.focus(),!1}}(this)),this.el.find(".link-expand").on("mousedown click",function(t){return function(e){return e.preventDefault(),!t.disabled&&(t.focused||t.focus(),t.trigger("expandClick"),!1)}}(this)),this.el.find(".link-clear").on("mousedown click",function(t){return function(e){return e.preventDefault(),!t.disabled&&(t.trigger("clearClick"),!1)}}(this)),this.textField.on("keydown.simple-select",function(t){return function(e){var i;return 40===e.which||38===e.which?(e.preventDefault(),i=40===e.which?"down":"up",t.triggerHandler("arrowPress",[i])):13===e.which?(e.preventDefault(),t.triggerHandler("enterPress")):27===e.which?(e.preventDefault(),t.blur()):8===e.which?t._onBackspacePress(e):void 0}}(this)).on("input.simple-select",function(t){return function(e){return t._inputTimer&&(clearTimeout(t._inputTimer),t._inputTimer=null),t._inputTimer=setTimeout(function(){return t._onInputChange()},t._inputDelay)}}(this)).on("blur.simple-select",function(t){return function(e){return t.focused=!1,t.triggerHandler("blur"),null}}(this)).on("focus.simple-select",function(t){return function(e){return t.focused=!0,t.triggerHandler("focus"),null}}(this))},i.prototype._onBackspacePress=function(t){if(this.selected)return t.preventDefault(),this.clear()},i.prototype._onInputChange=function(){return this._autoresize(),this.setSelected(!1),this.triggerHandler("change",[this.getValue()])},i.prototype._autoresize=function(){var t,e,i;if(!this.opts.noWrap)return this.textField.css("height",0),i=parseFloat(this.textField[0].scrollHeight),e=parseFloat(this.textField.css("border-top-width")),t=parseFloat(this.textField.css("border-bottom-width")),this.textField.css("height",i+e+t)},i.prototype.setValue=function(t){return this.textField.val(t),this._onInputChange()},i.prototype.getValue=function(){return this.textField.val()},i.prototype.setSelected=function(t){return null==t&&(t=!1),t?(t instanceof s||(t=this.dataProvider.getItem(t)),this.textField.val(t.name),this._autoresize(),this.el.addClass("selected")):this.el.removeClass("selected"),this.selected=t,t},i.prototype.setDisabled=function(t){return null==t&&(t=!1),this.disabled=t,this.textField.prop("disabled",t),this.el.toggleClass("disabled",t),t},i.prototype.focus=function(){return this.textField.focus()},i.prototype.blur=function(){return this.textField.blur()},i.prototype.clear=function(){return this.setValue("")},i}(e),r.exports=o},{"./models/item.coffee":5}],3:[function(i,r,n){var o,s,l=function(t,e){function i(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=i("./group.coffee"),o=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return l(i,e),i.prototype.opts={remote:!1,groups:null,selectEl:null},i.prototype._init=function(){return this.remote=this.opts.remote,this.opts.groups?this.setGroupsFromJson(this.opts.groups):this.opts.selectEl?this.setGroupsFromHtml(this.opts.selectEl):void 0},i.prototype._fetch=function(e,i){var r,n;if(this.remote&&this.triggerHandler("beforeFetch")!==!1)return n=function(t){return function(e){return t.setGroupsFromJson(e),t.triggerHandler("fetch",[t.groups]),"function"==typeof i?i(t.groups):void 0}}(this),e?t.ajax({url:this.remote.url,data:t.extend({},this.remote.params,(r={},r[""+this.remote.searchKey]=e,r)),dataType:"json"}).done(function(t){return n(t)}):void n([])},i.prototype.setGroupsFromJson=function(e){if(e)return this.groups=[],t.isArray(e)?this.groups.push(new s({items:e})):t.isPlainObject(e)&&t.each(e,function(t){return function(e,i){return t.groups.push(new s({name:e,items:i}))}}(this)),this.triggerHandler("change",[this.groups]),this.groups},i.prototype.setGroupsFromHtml=function(e){var i,r,n;if(r=t(e),r&&r.length>0)return this.groups=[],n=function(e){var i;return i=[],e.each(function(e,r){var n,o;if(n=t(r),o=n.val())return i.push([n.text(),o,n.data()])}),i},(i=r.find("optgroup")).length>0?i.each(function(e){return function(i,r){var o;return o=t(r),e.groups.push(new s({name:o.attr("label"),items:n(o.find("option"))}))}}(this)):this.groups.push(new s({items:n(r.find("option"))})),this.triggerHandler("change",[this.groups]),this.groups},i.prototype.getGroups=function(){return this.groups},i.prototype.getItem=function(e){var i;return i=null,t.each(this.groups,function(t,r){if(i=r.getItem(e))return!1}),i},i.prototype.getItemByName=function(e){var i;return i=null,t.each(this.groups,function(t,r){if(i=r.getItemByName(e))return!1}),i},i.prototype.filter=function(e,i){var r;return this.remote?this._fetch(e,function(t){return function(){return"function"==typeof i&&i(t.groups,e),t.triggerHandler("filter",[t.groups,e])}}(this)):(r=[],t.each(this.groups,function(t,i){var n;if(n=i.filterItems(e),n.items.length>0)return r.push(n)}),"function"==typeof i&&i(r,e),this.triggerHandler("filter",[r,e])),null},i.prototype.excludeItems=function(e,i){var r;return null==e&&(e=[]),null==i&&(i=this.groups),r=[],t.each(i,function(t,i){var n;if(n=i.excludeItems(e),n.items.length>0)return r.push(n)}),r},i}(e),r.exports=o},{"./group.coffee":4}],4:[function(e,i,r){var n,o;o=e("./item.coffee"),n=function(){function e(i){this.name=i.name||e.defaultName,this.items=[],t.isArray(i.items)&&i.items.length>0&&t.each(i.items,function(e){return function(i,r){return t.isArray(r)&&(r={name:r[0],value:r[1],data:r.length>2?r[2]:null}),e.items.push(new o(r))}}(this))}return e.defaultName="__default__",e.prototype.filterItems=function(i){var r;return r=new e({name:this.name}),t.each(this.items,function(t,e){if(e.match(i))return r.items.push(e)}),r},e.prototype.excludeItems=function(i){var r;return i=i.map(function(t){return t.value}),r=new e({name:this.name}),t.each(this.items,function(t,e){if(i.indexOf(e.value)===-1)return r.items.push(e)}),r},e.prototype.getItem=function(e){var i;return i=null,t.each(this.items,function(t,r){if(r.value===e&&(i=r),i)return!1}),i},e.prototype.getItemByName=function(e){var i;return i=null,t.each(this.items,function(t,r){if(r.name===e&&(i=r),i)return!1}),i},e}(),i.exports=n},{"./item.coffee":5}],5:[function(i,r,n){var o,s=function(t,e){function i(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},l={}.hasOwnProperty;o=function(e){function i(e){this.name=e.name,this.value=e.value.toString(),this.data={},t.isPlainObject(e.data)&&t.each(e.data,function(e){return function(i,r){return i=i.replace(/^data-/,"").split("-"),t.each(i,function(t,e){if(t>0)return i[t]=e.charAt(0).toUpperCase()+e.slice(1)}),e.data[i.join()]=r,null}}(this))}return s(i,e),i.prototype.match=function(t){var e,i,r;try{r=new RegExp("(^|\\s)"+t,"i")}catch(t){e=t,r=new RegExp("","i")}return i=this.data.key||this.name,r.test(i)},i}(e),r.exports=o},{}],6:[function(e,i,r){var n,o,s,l=function(t,e){function i(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},u={}.hasOwnProperty;o=e("./models/item.coffee"),n=e("./input.coffee"),s=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return l(i,e),i.prototype.opts={el:null,dataProvider:null,placeholder:"",selected:!1},i._itemTpl='
\n \n \n
',i.prototype._render=function(){return this.el.append('').addClass("multiple"),this.textField=this.el.find("textarea"),this.textField.attr("placeholder",this.opts.placeholder),t.isArray(this.opts.selected)&&t.each(this.opts.selected,function(t){return function(e,i){return t.addSelected(i)}}(this)),this.el},i.prototype._bind=function(){return i.__super__._bind.call(this),this.el.on("mousedown click",".selected-item",function(e){return function(i){var r;return i.preventDefault(),r=t(i.currentTarget),e.triggerHandler("itemClick",[r,r.data("item")]),!1}}(this))},i.prototype._onBackspacePress=function(t){if(!this.getValue())return t.preventDefault(),this.el.find(".selected-item:last").mousedown()},i.prototype._onInputChange=function(){return this.triggerHandler("change",[this.getValue()])},i.prototype._autoresize=function(){},i.prototype._setPlaceholder=function(t){return null==t&&(t=!0),t?this.textField.attr("placeholder",this.opts.placeholder):this.textField.removeAttr("placeholder")},i.prototype.setSelected=function(t){return null==t&&(t=!1),t?this.addSelected(t):this.clear()},i.prototype.addSelected=function(e){var r;if(e instanceof o||(e=this.dataProvider.getItem(e)),e)return this.selected||(this.selected=[]),this.selected.push(e),r=t(i._itemTpl).attr("data-value",e.value).data("item",e),r.find(".item-label").text(e.name),r.insertBefore(this.textField),this.setValue(""),this._setPlaceholder(!1),e},i.prototype.removeSelected=function(e){if(e instanceof o||(e=this.dataProvider.getItem(e)),e)return this.selected&&(t.each(this.selected,function(t){return function(i,r){if(r.value===e.value)return t.selected.splice(i,1),!1}}(this)),0===this.selected.length&&(this.selected=!1,this._setPlaceholder(!0))),this.el.find(".selected-item[data-value='"+e.value+"']").remove(),this.setValue(""),e},i.prototype.clear=function(){return this.setValue(""),this.selected=!1,this._setPlaceholder(!0),this.el.find(".selected-item").remove()},i}(n),i.exports=s},{"./input.coffee":2,"./models/item.coffee":5}],7:[function(i,r,n){var o,s,l,u=function(t,e){function i(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},p={}.hasOwnProperty;o=i("./models/group.coffee"),s=i("./models/item.coffee"),l=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return u(i,e),i._itemTpl='
\n \n \n
',i.prototype.opts={el:null,groups:[],dataProvider:null,onItemRender:null,localse:{}},i.prototype._init=function(){return this.el=t(this.opts.el),this.dataProvider=this.opts.dataProvider,this.groups=this.opts.groups,this._render(),this._bind()},i.prototype._renderItem=function(e){var r;return r=t(i._itemTpl).data("item",e),r.find(".label").text(e.name),e.data.hint&&r.find(".hint").text(e.data.hint),r.attr("data-value",e.value),this.el.append(r),t.isFunction(this.opts.onItemRender)&&this.opts.onItemRender.call(this,r,e),r},i.prototype._render=function(){var e;return this.el.empty(),e=1===this.groups.length&&this.groups[0].name===o.defaultName,0===this.groups.length||e&&0===this.groups[0].items.length?t('
').text(this.opts.locales.noResults).appendTo(this.el):e?t.each(this.groups[0].items,function(t){return function(e,i){return t._renderItem(i)}}(this)):t.each(this.groups,function(e){return function(i,r){return t('
').text(r.name).appendTo(e.el),t.each(r.items,function(t,i){return e._renderItem(i)})}}(this)),this.el},i.prototype._bind=function(){return this.el.on("mousedown click",".select-item",function(e){return function(i){var r;return i.preventDefault(),r=t(i.currentTarget),e.triggerHandler("itemClick",[r,r.data("item")]),!1}}(this))},i.prototype._scrollToHighlighted=function(){var t;if(t=this.el.find(".select-item.highlighted"),t.length>0)return this.el.scrollTop(t.position().top)},i.prototype.setGroups=function(t){return this.setHighlighted(!1),this.setLoading(!1),this.setActive(!1),this.groups=t,this._render(),t},i.prototype.setHighlighted=function(t){return null==t&&(t=!1),t?(t instanceof s||(t=this.dataProvider.getItem(t)),this.el.find(".select-item[data-value='"+t.value+"']").addClass("highlighted").siblings().removeClass("highlighted")):this.el.find(".select-item.highlighted").removeClass("highlighted"),this.highlighted=t,t},i.prototype.highlightNextItem=function(){var t;if(t=this.highlighted?this.el.find(".select-item[data-value='"+this.highlighted.value+"']").nextAll(".select-item:first"):this.el.find(".select-item:first"),t.length>0)return this.setHighlighted(t.data("item"))},i.prototype.highlightPrevItem=function(){var t;if(t=this.highlighted?this.el.find(".select-item[data-value='"+this.highlighted.value+"']").prevAll(".select-item:first"):this.el.find(".select-item:first"),t.length>0)return this.setHighlighted(t.data("item"))},i.prototype.setLoading=function(e){if(null==e&&(e=!0),e!==this.loading)return this.loading=e,e?(this.el.find(".loading").length>0||t('
').text(this.opts.locales.loading).appendTo(this.el),this.el.addClass("loading")):(this.el.removeClass("loading"),this.el.find(".loading").remove()),this.setActive(e),e},i.prototype.setActive=function(t){if(null==t&&(t=!0),t!==this.active)return this.active=t,this.el.toggleClass("active",t),t?(this._scrollToHighlighted(),this.triggerHandler("show")):this.triggerHandler("hide"),t},i.prototype.setPosition=function(t){return t&&this.el.css(t),this},i}(e),r.exports=l},{"./models/group.coffee":4,"./models/item.coffee":5}],"simple-select":[function(i,r,n){var o,s,l,u,p,a,h,c,d=function(t,e){function i(){this.constructor=t}for(var r in e)f.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},f={}.hasOwnProperty;o=i("./models/data-provider.coffee"),s=i("./models/group.coffee"),p=i("./models/item.coffee"),l=i("./html-select.coffee"),u=i("./input.coffee"),a=i("./multiple-input.coffee"),h=i("./popover.coffee"),c=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return d(i,e),i.prototype.opts={el:null,remote:!1,cls:"",onItemRender:null,placeholder:"",allowInput:!1,noWrap:!1,locales:null},i.locales={loading:"Loading...",noResults:"No results found"},i._tpl='
\n
\n
\n
',i.prototype._init=function(){var e,r,n,s;if(this.el=t(this.opts.el),!(this.el.length>0))throw new Error("simple select: option el is required");if(null!=(s=this.el.data("simpleSelect"))&&s.destroy(),this.locales=t.extend({},i.locales,this.opts.locales),this.multiple=this.el.is("[multiple]"),this._render(),this.dataProvider=new o({remote:this.opts.remote,selectEl:this.el}),this.htmlSelect=new l({el:this.el}),n=this.opts.placeholder?this.opts.placeholder:(e=this.htmlSelect.getBlankOption())?e.text():"",this.multiple?(this.input=new a({el:this.wrapper.find(".input"),dataProvider:this.dataProvider,placeholder:n,selected:this.htmlSelect.getValue()}),r=this.dataProvider.excludeItems(this.input.selected)):(this.input=new u({el:this.wrapper.find(".input"),dataProvider:this.dataProvider,placeholder:n,noWrap:this.opts.noWrap,selected:this.htmlSelect.getValue()}),r=this.dataProvider.groups),this.popover=new h({el:this.wrapper.find(".popover"),dataProvider:this.dataProvider,groups:r,onItemRender:this.opts.onItemRender,locales:this.locales}),this._bind(),this.el.prop("disabled"))return this.disable()},i.prototype._render=function(){return this.el.hide().data("simpleSelect",this),this.wrapper=t(i._tpl).data("simpleSelect",this).addClass(this.opts.cls).insertBefore(this.el)},i.prototype._bind=function(){return this.dataProvider.on("filter",function(t){return function(e,i,r){return t.multiple&&t.input.selected&&(i=t.dataProvider.excludeItems(t.input.selected,i)),t.popover.setGroups(i),t.popover.setActive(!(t.dataProvider.remote&&!r))}}(this)),this.dataProvider.on("beforeFetch",function(t){return function(e){return t.popover.setLoading(!0)}}(this)).on("fetch",function(t){return function(e){return t.popover.setLoading(!1)}}(this)),this.popover.on("itemClick",function(t){return function(e,i,r){return t.selectItem(r)}}(this)),this.popover.on("show",function(t){return function(e){return t._setPopoverPosition(),!t.multiple&&t.input.selected?t.popover.setHighlighted(t.input.selected):t.popover.highlighted?void 0:t.popover.highlightNextItem()}}(this)),this.input.on("itemClick",function(t){return function(e,i,r){return t.unselectItem(r)}}(this)),this.input.on("clearClick",function(t){return function(e){return t.clear()}}(this)),this.input.on("expandClick",function(t){return function(e){return t.popover.setActive(!0)}}(this)),this.input.on("arrowPress",function(t){return function(e,i){if(t.popover.active)return"up"===i?t.popover.highlightPrevItem():t.popover.highlightNextItem()}}(this)),this.input.on("enterPress",function(t){return function(e){return t.popover.active?(t.popover.highlighted?t.selectItem(t.popover.highlighted):t.multiple||t._setUserInput(),t.popover.setActive(!1)):t.el.closest("form").submit()}}(this)),this.input.on("change",function(t){return function(e,i){return t.multiple||t._syncValue(),t.dataProvider.filter(i),t._setPopoverPosition()}}(this)),this.input.on("focus",function(t){return function(e){return(!t.dataProvider.remote||t.input.getValue()&&!t.input.selected)&&t.popover.setActive(!0),null}}(this)),this.input.on("blur",function(t){return function(e){var i,r;return t.multiple||t.input.selected||(r=t.input.getValue(),(i=t.dataProvider.getItemByName(r))?t.selectItem(i):(t.opts.allowInput||t.input.setValue(""),t._setUserInput())),t.popover.setActive(!1),null}}(this))},i.prototype._setUserInput=function(t){if(null==t&&(t=this.input.getValue()),this.opts.allowInput&&!this.multiple)return this.wrapper.siblings(this.opts.allowInput).val(t)},i.prototype._setPopoverPosition=function(){return this.popover.setPosition({top:this.input.el.outerHeight()+2,left:0})},i.prototype._syncValue=function(){var e,i,r,n;return r=this.multiple?this.input.selected||[]:this.input.selected?[this.input.selected]:[],e=this.htmlSelect.getValue()||[],t.isArray(e)||(e=[e]),this.dataProvider.remote&&(i=new s({items:r}),this.htmlSelect.setGroups([i])),n=r.map(function(t){return t.value}),r.length>0?this.htmlSelect.setValue(n):this.htmlSelect.setValue(""),e.join(",")!==n.join(",")&&this.triggerHandler("change",[this.input.selected]),r},i.prototype.selectItem=function(t){if(t instanceof p||(t=this.dataProvider.getItem(t)),t)return this.multiple?this.input.addSelected(t):this.input.setSelected(t),this.popover.setActive(!1),this.opts.remote?this.popover.setGroups([]):this.multiple||(this.popover.setGroups(this.dataProvider.getGroups()),this.popover.setHighlighted(t)),this._setUserInput(""),this._syncValue(),t},i.prototype.unselectItem=function(t){if(this.multiple&&(t instanceof p||(t=this.dataProvider.getItem(t)),t))return this.input.removeSelected(t),this._syncValue(),t},i.prototype.clear=function(){return this.input.clear(),this.popover.setActive(!1),this._setUserInput(""),this},i.prototype.focus=function(){return this.input.focus()},i.prototype.blur=function(){return this.input.blur()},i.prototype.disable=function(){return this.input.setDisabled(!0),this.htmlSelect.setDisabled(!0),this.wrapper.addClass("disabled"),this},i.prototype.enable=function(){return this.input.setDisabled(!1),this.htmlSelect.setDisabled(!1),this.wrapper.removeClass("disabled"),this},i.prototype.destroy=function(){return this.el.removeData("simpleSelect").insertAfter(this.wrapper).show(),this.wrapper.remove(),this},i}(e),r.exports=c},{"./html-select.coffee":1,"./input.coffee":2,"./models/data-provider.coffee":3,"./models/group.coffee":4,"./models/item.coffee":5,"./multiple-input.coffee":6,"./popover.coffee":7}]},{},[]);return i("simple-select")}); \ No newline at end of file +/* simple-select v2.1.3 | (c) Mycolorway Design | MIT License */ +!function(t,e){"object"==typeof module&&module.exports?module.exports=e(require("jquery"),require("simple-module")):(t.SimpleSelect=e(t.jQuery,t.SimpleModule),t.simple=t.simple||{},t.simple.select=function(e){return new t.SimpleSelect(e)},t.simple.select.locales=t.SimpleSelect.locales)}(this,function(t,e){var i=require=function t(e,i,r){function n(s,l){if(!i[s]){if(!e[s]){var u="function"==typeof require&&require;if(!l&&u)return u(s,!0);if(o)return o(s,!0);var p=new Error("Cannot find module '"+s+"'");throw p.code="MODULE_NOT_FOUND",p}var a=i[s]={exports:{}};e[s][0].call(a.exports,function(t){var i=e[s][1][t];return n(i?i:t)},a,a.exports,t,e,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s",{text:e.name,value:e.value,data:e.data}).appendTo(i)},i.prototype._render=function(){return this.el.empty(),0===this.groups.length?this.el.append("",{label:r.name}),t.each(r.items,function(t,i){return e._renderOption(i,n)}),e.el.append(n)}}(this)),this.el},i.prototype.setGroups=function(t){return this.groups=t,this._render()},i.prototype.getValue=function(){return this.el.val()},i.prototype.setValue=function(t){return this.el.val(t)},i.prototype.getBlankOption=function(){var t;return t=this.el.find('option:not([value]), option[value=""]'),t.length>0&&t},i}(e),r.exports=s},{"./models/group.coffee":4}],2:[function(i,r,n){var o,s,l=function(t,e){function i(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=i("./models/item.coffee"),o=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return l(i,e),i.prototype.opts={el:null,dataProvider:null,noWrap:!1,placeholder:"",selected:!1},i.prototype._init=function(){return this.el=t(this.opts.el),this.dataProvider=this.opts.dataProvider,this.focused=!1,this._inputDelay=200,this._render(),this._bind()},i.prototype._render=function(){return this.el.append('\n\n\n \n\n\n \n'),this.el.find(this.opts.noWrap?"textarea":"input:text").remove(),this.textField=this.el.find(".text-field"),this.textField.attr("placeholder",this.opts.placeholder),this.setSelected(this.opts.selected),this.el},i.prototype._bind=function(){return this.el.on("mousedown click",function(t){return function(e){return e.preventDefault(),t.textField.focus(),!1}}(this)),this.el.find(".link-expand").on("mousedown click",function(t){return function(e){return e.preventDefault(),!t.disabled&&(t.focused||t.focus(),t.trigger("expandClick"),!1)}}(this)),this.el.find(".link-clear").on("mousedown click",function(t){return function(e){return e.preventDefault(),!t.disabled&&(t.trigger("clearClick"),!1)}}(this)),this.textField.on("keydown.simple-select",function(t){return function(e){var i;return 40===e.which||38===e.which?(e.preventDefault(),i=40===e.which?"down":"up",t.triggerHandler("arrowPress",[i])):13===e.which?(e.preventDefault(),t.triggerHandler("enterPress")):27===e.which?(e.preventDefault(),t.blur()):8===e.which?t._onBackspacePress(e):void 0}}(this)).on("input.simple-select",function(t){return function(e){return t._inputTimer&&(clearTimeout(t._inputTimer),t._inputTimer=null),t._inputTimer=setTimeout(function(){return t._onInputChange()},t._inputDelay)}}(this)).on("blur.simple-select",function(t){return function(e){return t.focused=!1,t.triggerHandler("blur"),null}}(this)).on("focus.simple-select",function(t){return function(e){return t.focused=!0,t.triggerHandler("focus"),null}}(this))},i.prototype._onBackspacePress=function(t){if(this.selected)return t.preventDefault(),this.clear()},i.prototype._onInputChange=function(){return this._autoresize(),this.setSelected(!1),this.triggerHandler("change",[this.getValue()])},i.prototype._autoresize=function(){var t,e,i;if(!this.opts.noWrap)return this.textField.css("height",0),i=parseFloat(this.textField[0].scrollHeight),e=parseFloat(this.textField.css("border-top-width")),t=parseFloat(this.textField.css("border-bottom-width")),this.textField.css("height",i+e+t)},i.prototype.setValue=function(t){return this.textField.val(t),this._onInputChange()},i.prototype.getValue=function(){return this.textField.val()},i.prototype.setSelected=function(t){return null==t&&(t=!1),t?(t instanceof s||(t=this.dataProvider.getItem(t)),this.textField.val(t.name),this._autoresize(),this.el.addClass("selected")):this.el.removeClass("selected"),this.selected=t,t},i.prototype.setDisabled=function(t){return null==t&&(t=!1),this.disabled=t,this.textField.prop("disabled",t),this.el.toggleClass("disabled",t),t},i.prototype.focus=function(){return this.textField.focus()},i.prototype.blur=function(){return this.textField.blur()},i.prototype.clear=function(){return this.setValue("")},i}(e),r.exports=o},{"./models/item.coffee":5}],3:[function(i,r,n){var o,s,l=function(t,e){function i(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=i("./group.coffee"),o=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return l(i,e),i.prototype.opts={remote:!1,groups:null,selectEl:null},i.prototype._init=function(){return this.remote=this.opts.remote,this.opts.groups?this.setGroupsFromJson(this.opts.groups):this.opts.selectEl?this.setGroupsFromHtml(this.opts.selectEl):void 0},i.prototype._fetch=function(e,i){var r,n;if(this.remote&&this.triggerHandler("beforeFetch")!==!1)return n=function(t){return function(e){return t.setGroupsFromJson(e),t.triggerHandler("fetch",[t.groups]),"function"==typeof i?i(t.groups):void 0}}(this),e?t.ajax({url:this.remote.url,data:t.extend({},this.remote.params,(r={},r[""+this.remote.searchKey]=e,r)),dataType:"json"}).done(function(t){return n(t)}):void n([])},i.prototype.setGroupsFromJson=function(e){if(e)return this.groups=[],t.isArray(e)?this.groups.push(new s({items:e})):t.isPlainObject(e)&&t.each(e,function(t){return function(e,i){return t.groups.push(new s({name:e,items:i}))}}(this)),this.triggerHandler("change",[this.groups]),this.groups},i.prototype.setGroupsFromHtml=function(e){var i,r,n;if(r=t(e),r&&r.length>0)return this.groups=[],n=function(e){var i;return i=[],e.each(function(e,r){var n,o;if(n=t(r),o=n.val())return i.push([n.text(),o,n.data()])}),i},(i=r.find("optgroup")).length>0?i.each(function(e){return function(i,r){var o;return o=t(r),e.groups.push(new s({name:o.attr("label"),items:n(o.find("option"))}))}}(this)):this.groups.push(new s({items:n(r.find("option"))})),this.triggerHandler("change",[this.groups]),this.groups},i.prototype.getGroups=function(){return this.groups},i.prototype.getItem=function(e){var i;return i=null,t.each(this.groups,function(t,r){if(i=r.getItem(e))return!1}),i},i.prototype.getItemByName=function(e){var i;return i=null,t.each(this.groups,function(t,r){if(i=r.getItemByName(e))return!1}),i},i.prototype.filter=function(e,i){var r;return this.remote?this._fetch(e,function(t){return function(){return"function"==typeof i&&i(t.groups,e),t.triggerHandler("filter",[t.groups,e])}}(this)):(r=[],t.each(this.groups,function(t,i){var n;if(n=i.filterItems(e),n.items.length>0)return r.push(n)}),"function"==typeof i&&i(r,e),this.triggerHandler("filter",[r,e])),null},i.prototype.excludeItems=function(e,i){var r;return null==e&&(e=[]),null==i&&(i=this.groups),r=[],t.each(i,function(t,i){var n;if(n=i.excludeItems(e),n.items.length>0)return r.push(n)}),r},i}(e),r.exports=o},{"./group.coffee":4}],4:[function(e,i,r){var n,o;o=e("./item.coffee"),n=function(){function e(i){this.name=i.name||e.defaultName,this.items=[],t.isArray(i.items)&&i.items.length>0&&t.each(i.items,function(e){return function(i,r){return t.isArray(r)&&(r={name:r[0],value:r[1],data:r.length>2?r[2]:null}),e.items.push(new o(r))}}(this))}return e.defaultName="__default__",e.prototype.filterItems=function(i){var r;return r=new e({name:this.name}),t.each(this.items,function(t,e){if(e.match(i))return r.items.push(e)}),r},e.prototype.excludeItems=function(i){var r;return i=i.map(function(t){return t.value}),r=new e({name:this.name}),t.each(this.items,function(t,e){if(i.indexOf(e.value)===-1)return r.items.push(e)}),r},e.prototype.getItem=function(e){var i;return i=null,t.each(this.items,function(t,r){if(r.value===e&&(i=r),i)return!1}),i},e.prototype.getItemByName=function(e){var i;return i=null,t.each(this.items,function(t,r){if(r.name===e&&(i=r),i)return!1}),i},e}(),i.exports=n},{"./item.coffee":5}],5:[function(i,r,n){var o,s=function(t,e){function i(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},l={}.hasOwnProperty;o=function(e){function i(e){this.name=e.name,this.value=e.value.toString(),this.data={},t.isPlainObject(e.data)&&t.each(e.data,function(e){return function(i,r){return i=i.replace(/^data-/,"").split("-"),t.each(i,function(t,e){if(t>0)return i[t]=e.charAt(0).toUpperCase()+e.slice(1)}),e.data[i.join()]=r,null}}(this))}return s(i,e),i.prototype.match=function(t){var e,i,r;try{r=new RegExp("(^|\\s)"+t,"i")}catch(t){e=t,r=new RegExp("","i")}return i=this.data.key||this.name,r.test(i)},i}(e),r.exports=o},{}],6:[function(e,i,r){var n,o,s,l=function(t,e){function i(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},u={}.hasOwnProperty;o=e("./models/item.coffee"),n=e("./input.coffee"),s=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return l(i,e),i.prototype.opts={el:null,dataProvider:null,placeholder:"",selected:!1},i._itemTpl='
\n \n \n
',i.prototype._render=function(){return this.el.append('').addClass("multiple"),this.textField=this.el.find("textarea"),this.textField.attr("placeholder",this.opts.placeholder),t.isArray(this.opts.selected)&&t.each(this.opts.selected,function(t){return function(e,i){return t.addSelected(i)}}(this)),this.el},i.prototype._bind=function(){return i.__super__._bind.call(this),this.el.on("mousedown click",".selected-item",function(e){return function(i){var r;return i.preventDefault(),r=t(i.currentTarget),e.triggerHandler("itemClick",[r,r.data("item")]),!1}}(this))},i.prototype._onBackspacePress=function(t){if(!this.getValue())return t.preventDefault(),this.el.find(".selected-item:last").mousedown()},i.prototype._onInputChange=function(){return this.triggerHandler("change",[this.getValue()])},i.prototype._autoresize=function(){},i.prototype._setPlaceholder=function(t){return null==t&&(t=!0),t?this.textField.attr("placeholder",this.opts.placeholder):this.textField.removeAttr("placeholder")},i.prototype.setSelected=function(t){return null==t&&(t=!1),t?this.addSelected(t):this.clear()},i.prototype.addSelected=function(e){var r;if(e instanceof o||(e=this.dataProvider.getItem(e)),e)return this.selected||(this.selected=[]),this.selected.push(e),r=t(i._itemTpl).attr("data-value",e.value).data("item",e),r.find(".item-label").text(e.name),r.insertBefore(this.textField),this.setValue(""),this._setPlaceholder(!1),e},i.prototype.removeSelected=function(e){if(e instanceof o||(e=this.dataProvider.getItem(e)),e)return this.selected&&(t.each(this.selected,function(t){return function(i,r){if(r.value===e.value)return t.selected.splice(i,1),!1}}(this)),0===this.selected.length&&(this.selected=!1,this._setPlaceholder(!0))),this.el.find(".selected-item[data-value='"+e.value+"']").remove(),this.setValue(""),e},i.prototype.clear=function(){return this.setValue(""),this.selected=!1,this._setPlaceholder(!0),this.el.find(".selected-item").remove()},i}(n),i.exports=s},{"./input.coffee":2,"./models/item.coffee":5}],7:[function(i,r,n){var o,s,l,u=function(t,e){function i(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},p={}.hasOwnProperty;o=i("./models/group.coffee"),s=i("./models/item.coffee"),l=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return u(i,e),i._itemTpl='
\n \n \n
',i.prototype.opts={el:null,groups:[],dataProvider:null,onItemRender:null,localse:{}},i.prototype._init=function(){return this.el=t(this.opts.el),this.dataProvider=this.opts.dataProvider,this.groups=this.opts.groups,this._render(),this._bind()},i.prototype._renderItem=function(e){var r;return r=t(i._itemTpl).data("item",e),r.find(".label").text(e.name),e.data.hint&&r.find(".hint").text(e.data.hint),r.attr("data-value",e.value),this.el.append(r),t.isFunction(this.opts.onItemRender)&&this.opts.onItemRender.call(this,r,e),r},i.prototype._render=function(){var e;return this.el.empty(),e=1===this.groups.length&&this.groups[0].name===o.defaultName,0===this.groups.length||e&&0===this.groups[0].items.length?t('
').text(this.opts.locales.noResults).appendTo(this.el):e?t.each(this.groups[0].items,function(t){return function(e,i){return t._renderItem(i)}}(this)):t.each(this.groups,function(e){return function(i,r){return t('
').text(r.name).appendTo(e.el),t.each(r.items,function(t,i){return e._renderItem(i)})}}(this)),this.el},i.prototype._bind=function(){return this.el.on("mousedown click",".select-item",function(e){return function(i){var r;return i.preventDefault(),r=t(i.currentTarget),e.triggerHandler("itemClick",[r,r.data("item")]),!1}}(this))},i.prototype._scrollToHighlighted=function(){var t;if(t=this.el.find(".select-item.highlighted"),t.length>0)return this.el.scrollTop(t.position().top)},i.prototype.setGroups=function(t){return this.setHighlighted(!1),this.setLoading(!1),this.setActive(!1),this.groups=t,this._render(),t},i.prototype.setHighlighted=function(t){return null==t&&(t=!1),t?(t instanceof s||(t=this.dataProvider.getItem(t)),this.el.find(".select-item[data-value='"+t.value+"']").addClass("highlighted").siblings().removeClass("highlighted")):this.el.find(".select-item.highlighted").removeClass("highlighted"),this.highlighted=t,t},i.prototype.highlightNextItem=function(){var t;if(t=this.highlighted?this.el.find(".select-item[data-value='"+this.highlighted.value+"']").nextAll(".select-item:first"):this.el.find(".select-item:first"),t.length>0)return this.setHighlighted(t.data("item"))},i.prototype.highlightPrevItem=function(){var t;if(t=this.highlighted?this.el.find(".select-item[data-value='"+this.highlighted.value+"']").prevAll(".select-item:first"):this.el.find(".select-item:first"),t.length>0)return this.setHighlighted(t.data("item"))},i.prototype.setLoading=function(e){if(null==e&&(e=!0),e!==this.loading)return this.loading=e,e?(this.el.find(".loading").length>0||t('
').text(this.opts.locales.loading).appendTo(this.el),this.el.addClass("loading")):(this.el.removeClass("loading"),this.el.find(".loading").remove()),this.setActive(e),e},i.prototype.setActive=function(t){if(null==t&&(t=!0),t!==this.active)return this.active=t,this.el.toggleClass("active",t),t?(this._scrollToHighlighted(),this.triggerHandler("show")):this.triggerHandler("hide"),t},i.prototype.setPosition=function(t){return t&&this.el.css(t),this},i}(e),r.exports=l},{"./models/group.coffee":4,"./models/item.coffee":5}],"simple-select":[function(i,r,n){var o,s,l,u,p,a,h,c,d=function(t,e){function i(){this.constructor=t}for(var r in e)f.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},f={}.hasOwnProperty;o=i("./models/data-provider.coffee"),s=i("./models/group.coffee"),p=i("./models/item.coffee"),l=i("./html-select.coffee"),u=i("./input.coffee"),a=i("./multiple-input.coffee"),h=i("./popover.coffee"),c=function(e){function i(){return i.__super__.constructor.apply(this,arguments)}return d(i,e),i.prototype.opts={el:null,remote:!1,cls:"",onItemRender:null,placeholder:"",allowInput:!1,noWrap:!1,locales:null},i.locales={loading:"Loading...",noResults:"No results found"},i._tpl='
\n
\n
\n
',i.prototype._init=function(){var e,r,n,s;if(this.el=t(this.opts.el),!(this.el.length>0))throw new Error("simple select: option el is required");if(null!=(s=this.el.data("simpleSelect"))&&s.destroy(),this.locales=t.extend({},i.locales,this.opts.locales),this.multiple=this.el.is("[multiple]"),this._render(),this.dataProvider=new o({remote:this.opts.remote,selectEl:this.el}),this.htmlSelect=new l({el:this.el}),n=this.opts.placeholder?this.opts.placeholder:(e=this.htmlSelect.getBlankOption())?e.text():"",this.multiple?(this.input=new a({el:this.wrapper.find(".input"),dataProvider:this.dataProvider,placeholder:n,selected:this.htmlSelect.getValue()}),r=this.dataProvider.excludeItems(this.input.selected)):(this.input=new u({el:this.wrapper.find(".input"),dataProvider:this.dataProvider,placeholder:n,noWrap:this.opts.noWrap,selected:this.htmlSelect.getValue()}),r=this.dataProvider.groups),this.popover=new h({el:this.wrapper.find(".popover"),dataProvider:this.dataProvider,groups:r,onItemRender:this.opts.onItemRender,locales:this.locales}),this._bind(),this.el.prop("disabled"))return this.disable()},i.prototype._render=function(){if(this.el.hide().data("simpleSelect",this),this.wrapper=t(i._tpl).data("simpleSelect",this).addClass(this.opts.cls).insertBefore(this.el),this.opts.remote)return this.wrapper.addClass("simple-select-remote")},i.prototype._bind=function(){return this.dataProvider.on("filter",function(t){return function(e,i,r){return t.multiple&&t.input.selected&&(i=t.dataProvider.excludeItems(t.input.selected,i)),t.popover.setGroups(i),t.popover.setActive(!(t.dataProvider.remote&&!r))}}(this)),this.dataProvider.on("beforeFetch",function(t){return function(e){return t.popover.setLoading(!0)}}(this)).on("fetch",function(t){return function(e){return t.popover.setLoading(!1)}}(this)),this.popover.on("itemClick",function(t){return function(e,i,r){return t.selectItem(r)}}(this)),this.popover.on("show",function(t){return function(e){return t._setPopoverPosition(),!t.multiple&&t.input.selected?t.popover.setHighlighted(t.input.selected):t.popover.highlighted?void 0:t.popover.highlightNextItem()}}(this)),this.input.on("itemClick",function(t){return function(e,i,r){return t.unselectItem(r)}}(this)),this.input.on("clearClick",function(t){return function(e){return t.clear()}}(this)),this.input.on("expandClick",function(t){return function(e){return t.popover.setActive(!0)}}(this)),this.input.on("arrowPress",function(t){return function(e,i){if(t.popover.active)return"up"===i?t.popover.highlightPrevItem():t.popover.highlightNextItem()}}(this)),this.input.on("enterPress",function(t){return function(e){return t.popover.active?(t.popover.highlighted?t.selectItem(t.popover.highlighted):t.multiple||t._setUserInput(),t.popover.setActive(!1)):t.el.closest("form").submit()}}(this)),this.input.on("change",function(t){return function(e,i){return t.multiple||t._syncValue(),t.dataProvider.filter(i),t._setPopoverPosition()}}(this)),this.input.on("focus",function(t){return function(e){return(!t.dataProvider.remote||t.input.getValue()&&!t.input.selected)&&t.popover.setActive(!0),null}}(this)),this.input.on("blur",function(t){return function(e){var i,r;return t.multiple||t.input.selected||(r=t.input.getValue(),(i=t.dataProvider.getItemByName(r))?t.selectItem(i):(t.opts.allowInput||t.input.setValue(""),t._setUserInput())),t.popover.setActive(!1),null}}(this))},i.prototype._setUserInput=function(t){if(null==t&&(t=this.input.getValue()),this.opts.allowInput&&!this.multiple)return this.wrapper.siblings(this.opts.allowInput).val(t)},i.prototype._setPopoverPosition=function(){return this.popover.setPosition({top:this.input.el.outerHeight()+2,left:0})},i.prototype._syncValue=function(){var e,i,r,n;return r=this.multiple?this.input.selected||[]:this.input.selected?[this.input.selected]:[],e=this.htmlSelect.getValue()||[],t.isArray(e)||(e=[e]),this.dataProvider.remote&&(i=new s({items:r}),this.htmlSelect.setGroups([i])),n=r.map(function(t){return t.value}),r.length>0?this.htmlSelect.setValue(n):this.htmlSelect.setValue(""),e.join(",")!==n.join(",")&&this.triggerHandler("change",[this.input.selected]),r},i.prototype.selectItem=function(t){if(t instanceof p||(t=this.dataProvider.getItem(t)),t)return this.multiple?this.input.addSelected(t):this.input.setSelected(t),this.popover.setActive(!1),this.opts.remote?this.popover.setGroups([]):this.multiple||(this.popover.setGroups(this.dataProvider.getGroups()),this.popover.setHighlighted(t)),this._setUserInput(""),this._syncValue(),t},i.prototype.unselectItem=function(t){if(this.multiple&&(t instanceof p||(t=this.dataProvider.getItem(t)),t))return this.input.removeSelected(t),this._syncValue(),t},i.prototype.clear=function(){return this.input.clear(),this.popover.setActive(!1),this._setUserInput(""),this},i.prototype.focus=function(){return this.input.focus()},i.prototype.blur=function(){return this.input.blur()},i.prototype.disable=function(){return this.input.setDisabled(!0),this.htmlSelect.setDisabled(!0),this.wrapper.addClass("disabled"),this},i.prototype.enable=function(){return this.input.setDisabled(!1),this.htmlSelect.setDisabled(!1),this.wrapper.removeClass("disabled"),this},i.prototype.destroy=function(){return this.el.removeData("simpleSelect").insertAfter(this.wrapper).show(),this.wrapper.remove(),this},i}(e),r.exports=c},{"./html-select.coffee":1,"./input.coffee":2,"./models/data-provider.coffee":3,"./models/group.coffee":4,"./models/item.coffee":5,"./multiple-input.coffee":6,"./popover.coffee":7}]},{},[]);return i("simple-select")}); \ No newline at end of file diff --git a/package.json b/package.json index 4ac052a..4a79901 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "simple-select", "githubOwner": "mycolorway", - "version": "2.1.2", + "version": "2.1.3", "description": "Autocomplete select component", "homepage": "http://mycolorway.github.io/simple-select", "repository": { diff --git a/src/simple-select.coffee b/src/simple-select.coffee index 6a804d1..11fdcef 100644 --- a/src/simple-select.coffee +++ b/src/simple-select.coffee @@ -89,6 +89,9 @@ class SimpleSelect extends SimpleModule .addClass(@opts.cls) .insertBefore @el + if @opts.remote + @wrapper.addClass 'simple-select-remote' + _bind: -> # data provider events @dataProvider.on 'filter', (e, groups, value) => diff --git a/styles/simple-select.css b/styles/simple-select.css index e3df23f..74b862e 100644 --- a/styles/simple-select.css +++ b/styles/simple-select.css @@ -1,5 +1,5 @@ /** - * simple-select v2.1.2 + * simple-select v2.1.3 * http://mycolorway.github.io/simple-select * * Copyright Mycolorway Design @@ -140,3 +140,5 @@ .simple-select .popover.loading .select-item, .simple-select .popover.loading .select-group { display: none; } + .simple-select.simple-select-remote .input .link-expand { + display: none; } diff --git a/styles/simple-select.scss b/styles/simple-select.scss index 821446d..7894c82 100644 --- a/styles/simple-select.scss +++ b/styles/simple-select.scss @@ -182,4 +182,10 @@ $height: 24px; } } } + + &.simple-select-remote { + .input .link-expand { + display: none; + } + } }