first commit
This commit is contained in:
commit
8403e29e76
1395 files changed
+535675
No files matched your search
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sérgio Dinis Lopes
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,12 @@
|
||||
jQuery.Flexdatalist
|
||||
======
|
||||
|
||||
Flexdatalist is (another) jQuery autocomplete plugin with support for <code><datalist></code>. Check the documentation page to see the plugin in action.
|
||||
|
||||
## Demo & Documentation ##
|
||||
|
||||
Check out the [examples and documentation](http://projects.sergiodinislopes.pt/flexdatalist/) page.
|
||||
|
||||
### License
|
||||
Flexdatalist is licensed under the [MIT license](http://opensource.org/licenses/MIT).
|
||||
Copyright (c) 2016 [Sérgio Dinis Lopes](http://github.com/sergiodlopes)
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "jquery-flexdatalist",
|
||||
"version": "1.7.2",
|
||||
"main": ["jquery.flexdatalist.js"],
|
||||
"dependencies": {
|
||||
"jquery": ">=1.7"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
.flexdatalist-results {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border: 1px solid #444;
|
||||
border-top: none;
|
||||
background: #fff;
|
||||
z-index: 100000;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
||||
color: #333;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.flexdatalist-results li {
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding: 0 15px;
|
||||
font-size: 14px;
|
||||
line-height: 35px;
|
||||
}
|
||||
.flexdatalist-results li span.highlight {
|
||||
font-weight: 700;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.flexdatalist-results li.active {
|
||||
background: #2B82C9;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grouped items
|
||||
*/
|
||||
.flexdatalist-results li.group {
|
||||
background: #F3F3F4;
|
||||
color: #666;
|
||||
padding: 0 8px;
|
||||
}
|
||||
.flexdatalist-results li .group-name {
|
||||
font-weight: 700;
|
||||
}
|
||||
.flexdatalist-results li .group-item-count {
|
||||
font-size: 85%;
|
||||
color: #777;
|
||||
display: inline-block;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiple items
|
||||
*/
|
||||
.flexdatalist-multiple:before {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
.flexdatalist-multiple {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0 0 0 10px;
|
||||
list-style: none;
|
||||
text-align: left;
|
||||
cursor: text;
|
||||
}
|
||||
.flexdatalist-multiple:after {
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
.flexdatalist-multiple li {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
margin: 5px 5px 5px 0;
|
||||
float: left;
|
||||
}
|
||||
.flexdatalist-multiple li.input-container,
|
||||
.flexdatalist-multiple li.input-container input {
|
||||
border: none;
|
||||
width: 280px;
|
||||
height: auto;
|
||||
padding: 0;
|
||||
line-height: 25px;
|
||||
}
|
||||
.flexdatalist-multiple li.value {
|
||||
display: inline-block;
|
||||
padding: 2px 25px 2px 5px;
|
||||
background: #efefef;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.flexdatalist-multiple li.toggle {
|
||||
cursor: pointer;
|
||||
transition: opacity ease-in-out 300ms;
|
||||
}
|
||||
.flexdatalist-multiple li.toggle.disabled {
|
||||
text-decoration: line-through;
|
||||
opacity: 0.80;
|
||||
}
|
||||
|
||||
.flexdatalist-multiple li.value span.fdl-remove {
|
||||
font-weight: 700;
|
||||
padding: 0 5px;
|
||||
font-size: 20px;
|
||||
line-height: 25px;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
opacity: 0.70;
|
||||
}
|
||||
.flexdatalist-multiple li.value span.fdl-remove:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
.flexdatalist-results{position:absolute;top:0;left:0;border:1px solid #444;border-top:none;background:#fff;z-index:100000;max-height:300px;overflow-y:auto;box-shadow:0 4px 5px rgba(0,0,0,.15);color:#333;list-style:none;margin:0;padding:0}.flexdatalist-results li{border-bottom:1px solid #ccc;padding:0 15px;font-size:14px;line-height:35px}.flexdatalist-results li span.highlight{font-weight:700;text-decoration:underline}.flexdatalist-results li.active{background:#2B82C9;color:#fff;cursor:pointer}.flexdatalist-results li.group{background:#F3F3F4;color:#666;padding:0 8px}.flexdatalist-results li .group-name{font-weight:700}.flexdatalist-results li .group-item-count{font-size:85%;color:#777;display:inline-block;padding-left:10px}.flexdatalist-multiple:after,.flexdatalist-multiple:before{content:'';display:block;clear:both}.flexdatalist-multiple{width:100%;margin:0;padding:0 0 0 10px;list-style:none;text-align:left;cursor:text}.flexdatalist-multiple li{display:inline-block;position:relative;margin:5px 5px 5px 0;float:left}.flexdatalist-multiple li.input-container,.flexdatalist-multiple li.input-container input{border:none;width:280px;height:auto;padding:0;line-height:25px}.flexdatalist-multiple li.value{display:inline-block;padding:2px 25px 2px 5px;background:#efefef;border-radius:3px}.flexdatalist-multiple li.toggle{cursor:pointer;transition:opacity ease-in-out .3s}.flexdatalist-multiple li.toggle.disabled{text-decoration:line-through;opacity:.8}.flexdatalist-multiple li.value span.fdl-remove{font-weight:700;padding:0 5px;font-size:20px;line-height:25px;cursor:pointer;position:absolute;top:0;right:0;opacity:.7}.flexdatalist-multiple li.value span.fdl-remove:hover{opacity:1}
|
||||
@@ -0,0 +1 @@
|
||||
jQuery.fn.flexdatalist=function(e,t){"use strict";var i,a=$(document),s=$(this),r=this;if(i=function(){var t=$(this),i={},a="",s=null;t.attr("name");t.hasClass("flexdatalist-set")&&r._destroy(t),t._options=function(e,i){var a=t.data("flexdatalist");if(!r._isDefined(e))return t.data("flexdatalist");if(r._isDefined(i))a[e]=i;else{if(!r._isObject(e))return r._isDefined(a,e)?a[e]:null;a=e}return a.searchIn=r._csvToArray(a.searchIn),a.relatives=a.relatives&&$(a.relatives).length>0?$(a.relatives):null,a.textProperty=null===a.textProperty?a.searchIn[0]:a.textProperty,a.visibleProperties=r._csvToArray(a.visibleProperties,a.searchIn),t.data("flexdatalist",a),t},t._options($.extend({url:null,data:[],params:{},relatives:null,chainedRelatives:!1,cache:!0,minLength:2,groupBy:!1,selectionRequired:!1,focusFirstResult:!1,textProperty:null,valueProperty:null,visibleProperties:[],searchIn:["label"],searchContain:!1,searchEqual:!1,searchDisabled:!1,normalizeString:null,multiple:t.attr("multiple"),maxShownResults:100,toggleSelected:!1,_values:[]},e,t.data()));var n=t.clone(!1).attr({list:null,name:null}).addClass("flexdatalist-alias").removeClass("flexdatalist");if(t._options("multiple")){var l=$("<ul>").addClass("flexdatalist-multiple").css({"background-color":t.css("background-color"),"border-color":t.css("border-left-color"),"border-width":t.css("border-left-width"),"border-style":t.css("border-left-style"),"border-radius":t.css("border-top-left-radius")}).insertAfter(t).click(function(){$(this).find("input").focus()});$('<li class="input-container">').addClass("flexdatalist-multiple-value").append(n).appendTo(l)}else n.insertAfter(t);t.addClass("flexdatalist").attr("type","hidden"),t._init=function(){var e=t._options();n.on("input keydown",function(i){var a=t._keyword();188===r._keyNum(i)&&!e.selectionRequired&&e.multiple?(i.preventDefault(),t._value(a),t._removeResults()):9===r._keyNum(i)&&t._removeResults()}).on("input keyup",function(i){if(t._changed()&&13!==r._keyNum(i)){var s=t._keyword();e.multiple||e.selectionRequired||t._value(s),s.length>=e.minLength?t._search(function(e){t._showResults(e)}):t._removeResults(),!e.multiple&&(0===s.length||s.length<e.minLength)&&t._value("")}a=t._keyword()}).focus(function(){var i=t._keyword();0===e.minLength?""===i&&t._tdata(function(e){t._showResults(e)}):i.length>=e.minLength&&!t._selected()&&t._search(function(e){t._showResults(e)})}).attr("autocomplete","off"),n.attr("autofocus")&&n.focus(),window.onresize=function(){t._position()},t.addClass("flexdatalist-set")},t._changed=function(){return a!==t._keyword()},t._chained=function(){var e=t._options();if(e.relatives&&e.chainedRelatives){var a=function(i){e.relatives.each(function(){var a=r._isEmpty($(this).val()),s=r._isEmpty(t.val());n.prop("disabled",a),i||!a&&s||(t._value(""),n.val(""),e.multiple&&l.find("li .remove").click())})};e.relatives.on("change",function(){a(),i={}}),a(!0)}},t._initValue=function(){var e=t.attr("value");r._isEmpty(e)||(t._options("originalValue",t.val()),t.val(""),n.val(""),t._parseValue(e,function(e){r._isEmpty(e)||t._values(e),a=t._keyword()}))},t._parseValue=function(e,i){var a=t._options();if(t._toJSON())try{i(JSON.parse(e))}catch(s){}else if(t._toCSV()||"string"==typeof a.valueProperty){var r=e.split(",");if("string"==typeof a.valueProperty){var n=a.searchIn;a.searchIn=a.valueProperty.split(","),a.searchEqual=!0,t._search(function(e){e.length>0&&i(e),a.searchIn=n,a.searchEqual=!1},r)}else i(r)}else i(e)},t._tdata=function(e){t.hasClass("flexdatalist-loading")||(t.trigger("before:flexdatalist.data"),t._url(function(i){t._data(function(a){a=a.concat(i);for(var s=t._options("_values"),r=0;r<a.length;r++){var n=a[r];s&&s.indexOf(t._getText(n))>-1&&delete a[r]}t.trigger("after:flexdatalist.data",[a]),e(a)})}))},t._data=function(e){var i=t._options();t._keyword();"string"==typeof i.data?t._remote({url:i.data,success:function(a){var s=t._remoteData(a);i.data=s,e(s)}}):e(i.data)},t._url=function(e){var i=t._options(),a=t._keyword(),n=a;return r._isEmpty(i.url)||i.minLength>a.length?e([]):(clearTimeout(s),void(s=setTimeout(function(){i.cache&&2!==i.cache&&(n=a.substring(0,i.minLength>0?i.minLength:1));var s=t._cache(n);return s?void e(s):void t._remote({url:i.url,data:$.extend(t._relativesData(),i.params,{keyword:a,contain:i.searchContain,selected:t.val()}),success:function(s){t.removeClass("flexdatalist-loading");var r=t._remoteData(s),l=t._keyword();l.length>a.length?t._search(function(e){t._showResults(e)}):l.length>=i.minLength&&e(r),t._cache(n,r)}})},200)))},t._remote=function(e){t.addClass("flexdatalist-loading"),e=$.extend({type:"post",dataType:"json",complete:function(){t.removeClass("flexdatalist-loading")}},e),$.ajax(e)},t._remoteData=function(e){var t=e.results?e.results:e;return"string"==typeof t&&0===t.indexOf("[{")&&(t=JSON.parse(t)),r._isObject(t)?t:[]},t._relativesData=function(){var e=t._options("relatives"),i={};return e&&(i.relatives={},e.each(function(){var e=$(this);i.relatives[e.attrLine truncated
|
||||
Reference in new issue
Block a user