From 23c844b90db28bb2299982d4c66e16557cc7d53e Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 21 Jun 2018 13:39:00 +0200 Subject: [PATCH] Remove magicsuggest from api then add it to vendor --- Gruntfile.js | 20 +- api/js/etemplate/et2_widget_taglist.js | 11 +- api/js/jquery/magicsuggest/README.md | 102 -- api/js/jquery/magicsuggest/README_1.md | 109 -- api/js/jquery/magicsuggest/bower.json | 9 - api/js/jquery/magicsuggest/composer.json | 22 - .../jquery/magicsuggest/magicsuggest-min.css | 1 - .../jquery/magicsuggest/magicsuggest-min.js | 1 - api/js/jquery/magicsuggest/magicsuggest.css | 263 --- .../magicsuggest/magicsuggest.jquery.json | 36 - api/js/jquery/magicsuggest/magicsuggest.js | 1603 ----------------- api/templates/default/etemplate2.css | 12 +- composer.json | 3 +- composer.lock | 150 +- mail/templates/mobile/app.css | 4 +- mail/templates/pixelegg/app.css | 4 +- mail/templates/pixelegg/app.less | 2 +- 17 files changed, 184 insertions(+), 2168 deletions(-) delete mode 100644 api/js/jquery/magicsuggest/README.md delete mode 100644 api/js/jquery/magicsuggest/README_1.md delete mode 100644 api/js/jquery/magicsuggest/bower.json delete mode 100644 api/js/jquery/magicsuggest/composer.json delete mode 100644 api/js/jquery/magicsuggest/magicsuggest-min.css delete mode 100644 api/js/jquery/magicsuggest/magicsuggest-min.js delete mode 100644 api/js/jquery/magicsuggest/magicsuggest.css delete mode 100644 api/js/jquery/magicsuggest/magicsuggest.jquery.json delete mode 100644 api/js/jquery/magicsuggest/magicsuggest.js diff --git a/Gruntfile.js b/Gruntfile.js index 138ea3437a..a4e0bb1345 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -148,7 +148,7 @@ module.exports = function (grunt) { "api/js/etemplate/et2_widget_styles.js", "api/js/etemplate/et2_widget_link.js", "api/js/etemplate/et2_widget_selectAccount.js", - "api/js/jquery/magicsuggest/magicsuggest.js", + "vendor/egroupware/magicsuggest/magicsuggest.js", "api/js/etemplate/et2_widget_taglist.js", "api/js/etemplate/et2_extension_customfields.js", "api/js/etemplate/et2_dataview_interfaces.js", @@ -283,7 +283,7 @@ module.exports = function (grunt) { "pixelegg/css/pixelegg.min.css": [ "api/js/jquery/chosen/chosen.css", "vendor/bower-asset/jquery-ui/themes/redmond/jquery-ui.css", - "api/js/jquery/magicsuggest/magicsuggest.css", + "vendor/egroupware/magicsuggest/magicsuggest.css", "api/js/jquery/jpicker/css/jPicker-1.1.6.min.css", "api/js/jquery/jquery-ui-timepicker-addon.css", "api/js/jquery/blueimp/css/blueimp-gallery.min.css", @@ -299,7 +299,7 @@ module.exports = function (grunt) { "pixelegg/css/mobile.min.css": [ "api/js/jquery/chosen/chosen.css", "vendor/bower-asset/jquery-ui/themes/redmond/jquery-ui.css", - "api/js/jquery/magicsuggest/magicsuggest.css", + "vendor/egroupware/magicsuggest/magicsuggest.css", "api/js/jquery/jpicker/css/jPicker-1.1.6.min.css", "api/js/jquery/jquery-ui-timepicker-addon.css", "api/js/jquery/blueimp/css/blueimp-gallery.min.css", @@ -315,7 +315,7 @@ module.exports = function (grunt) { "pixelegg/mobile/fw_mobile.min.css": [ "api/js/jquery/chosen/chosen.css", "vendor/bower-asset/jquery-ui/themes/redmond/jquery-ui.css", - "api/js/jquery/magicsuggest/magicsuggest.css", + "vendor/egroupware/magicsuggest/magicsuggest.css", "api/js/jquery/jpicker/css/jPicker-1.1.6.min.css", "api/js/jquery/jquery-ui-timepicker-addon.css", "api/js/jquery/blueimp/css/blueimp-gallery.min.css", @@ -331,7 +331,7 @@ module.exports = function (grunt) { "pixelegg/css/Standard.min.css": [ "api/js/jquery/chosen/chosen.css", "vendor/bower-asset/jquery-ui/themes/redmond/jquery-ui.css", - "api/js/jquery/magicsuggest/magicsuggest.css", + "vendor/egroupware/magicsuggest/magicsuggest.css", "api/js/jquery/jpicker/css/jPicker-1.1.6.min.css", "api/js/jquery/jquery-ui-timepicker-addon.css", "api/js/jquery/blueimp/css/blueimp-gallery.min.css", @@ -347,7 +347,7 @@ module.exports = function (grunt) { "pixelegg/css/Compact.min.css": [ "api/js/jquery/chosen/chosen.css", "vendor/bower-asset/jquery-ui/themes/redmond/jquery-ui.css", - "api/js/jquery/magicsuggest/magicsuggest.css", + "vendor/egroupware/magicsuggest/magicsuggest.css", "api/js/jquery/jpicker/css/jPicker-1.1.6.min.css", "api/js/jquery/jquery-ui-timepicker-addon.css", "api/js/jquery/blueimp/css/blueimp-gallery.min.css", @@ -363,7 +363,7 @@ module.exports = function (grunt) { "pixelegg/css/Traditional.min.css": [ "api/js/jquery/chosen/chosen.css", "vendor/bower-asset/jquery-ui/themes/redmond/jquery-ui.css", - "api/js/jquery/magicsuggest/magicsuggest.css", + "vendor/egroupware/magicsuggest/magicsuggest.css", "api/js/jquery/jpicker/css/jPicker-1.1.6.min.css", "api/js/jquery/jquery-ui-timepicker-addon.css", "api/js/jquery/blueimp/css/blueimp-gallery.min.css", @@ -383,7 +383,7 @@ module.exports = function (grunt) { "jdots/css/high-contrast.min.css": [ "api/js/jquery/chosen/chosen.css", "vendor/bower-asset/jquery-ui/themes/redmond/jquery-ui.css", - "api/js/jquery/magicsuggest/magicsuggest.css", + "vendor/egroupware/magicsuggest/magicsuggest.css", "api/js/jquery/jpicker/css/jPicker-1.1.6.min.css", "api/js/jquery/jquery-ui-timepicker-addon.css", "api/js/jquery/blueimp/css/blueimp-gallery.min.css", @@ -403,7 +403,7 @@ module.exports = function (grunt) { "jdots/css/jdots.min.css": [ "api/js/jquery/chosen/chosen.css", "vendor/bower-asset/jquery-ui/themes/redmond/jquery-ui.css", - "api/js/jquery/magicsuggest/magicsuggest.css", + "vendor/egroupware/magicsuggest/magicsuggest.css", "api/js/jquery/jpicker/css/jPicker-1.1.6.min.css", "api/js/jquery/jquery-ui-timepicker-addon.css", "api/js/jquery/blueimp/css/blueimp-gallery.min.css", @@ -422,7 +422,7 @@ module.exports = function (grunt) { "jdots/css/orange-green.min.css": [ "api/js/jquery/chosen/chosen.css", "vendor/bower-asset/jquery-ui/themes/redmond/jquery-ui.css", - "api/js/jquery/magicsuggest/magicsuggest.css", + "vendor/egroupware/magicsuggest/magicsuggest.css", "api/js/jquery/jpicker/css/jPicker-1.1.6.min.css", "api/js/jquery/jquery-ui-timepicker-addon.css", "api/js/jquery/blueimp/css/blueimp-gallery.min.css", diff --git a/api/js/etemplate/et2_widget_taglist.js b/api/js/etemplate/et2_widget_taglist.js index 82d1a6337a..79761991d7 100644 --- a/api/js/etemplate/et2_widget_taglist.js +++ b/api/js/etemplate/et2_widget_taglist.js @@ -12,7 +12,7 @@ /*egw:uses et2_core_inputWidget; - /api/js/jquery/magicsuggest/magicsuggest.js; + /vendor/egroupware/magicsuggest/magicsuggest.js; */ /** @@ -127,6 +127,12 @@ var et2_taglist = (function(){ "use strict"; return et2_selectbox.extend([et2_IR type: "integer", default: 3, description: "minimum number of characters before expanding the combo" + }, + editModeEnabled: { + name: "Enable edit mode for tags", + type: "boolean", + "default": true, + description: "Allow to modify a tag by clicking on edit icon. It only can be enabled if only allowFreeEntries is true." } }, @@ -243,7 +249,8 @@ var et2_taglist = (function(){ "use strict"; return et2_selectbox.extend([et2_IR highlight: false, // otherwise renderer have to return strings selectFirst: true, groupBy: this.options.groupBy && typeof this.options.groupBy == 'string' ? this.options.groupBy : null, - minChars: parseInt(this.options.minChars) ? parseInt(this.options.minChars) : 0 + minChars: parseInt(this.options.minChars) ? parseInt(this.options.minChars) : 0, + editModeEnabled: this.options.editModeEnabled }, this.lib_options); if(this.options.height) { diff --git a/api/js/jquery/magicsuggest/README.md b/api/js/jquery/magicsuggest/README.md deleted file mode 100644 index 7c4a2cbfec..0000000000 --- a/api/js/jquery/magicsuggest/README.md +++ /dev/null @@ -1,102 +0,0 @@ -MagicSuggest v1.3 --------------------------- - -Check out full documentation and examples here: http://nicolasbize.github.com/magicsuggest/ - -Milestone change log: - -v1.3.1 BugFixing again! (Minor Tagged Milestone - August 17th, 2013) -==================================================================== -- (fix) enable after disable now works (credits to amanokerim - https://github.com/amanokerim) -- (fix) trigger icon now takes full height (credits to DioVayne - https://github.com/DioVayne) -- (fix) clear now compatible with isSilent (credits to Coywolf - https://github.com/Coywolf) -- (fix) groupBy was broken by 1.3.0 -- (fea) compatibility with latest jQuery 1.10.2 (credits to RafaelMalgor - https://github.com/RafaelMalgor) -- (fea) resulted JSON objects can now have a custom result property resultsField (credits to RafaelMalgor - https://github.com/RafaelMalgor) - -v1.3.0 Some more features and bugfixing (Minor Tagged Milestone - May 25th, 2013) -================================================================================= -- (fea) combo component can now be fetched through the same div element (credits to meghuizen - https://github.com/meghuizen) -- (fix) CSS bug with 1.2.7+ with triggerHidden (credits to ScullWM - https://github.com/ScullWM) -- (fix) container would always render with 1 row even though a bunch of data was loaded (credits to travishaagen - https://github.com/travishaagen) -- (fea) added minimum jQuery version to work in docs (credits to rajeshmeniya - https://github.com/rajeshmeniya) -- (fix) input was not correctly enabled / disabled (credits to zerekw - https://github.com/zerekw) -- (fea) added getName and setName to easily fetch/set form name of component (credits to jbmoens - https://github.com/jbmoens) -- (fix) when a value is specified in the DOM original element, it is passed correctly to MS. (credits to jbmoens - https://github.com/jbmoens) -- (fix) input space now always uses the remaining space as this leads to less issues. -- (fea) combo has now more logic when used for a single selection combo box. -- (fix) space taken for single selection on a small combo remains on one line. (credits to ScullWM - https://github.com/ScullWM) -- (fea) multiple items can now be selected through the Ctrl key (credits to meghuizen - https://github.com/meghuizen) -- (fea) trigger icon now uses pure CSS (credits to meghuizen - https://github.com/meghuizen) -- (fea) cfg(data) can now take a function as parameter (credits to meghuizen - https://github.com/meghuizen) -- (fea) cfg(data) can take a json object whose data items are within the results property -- (fix) CSS has been fixed so it behaves correctly within a bootstrap modal (credits to daenuprobst - https://github.com/daenuprobst) -- (fea) suggestion rendering optimized by reducing draw calls to one. (credits to meghuizen - https://github.com/meghuizen) -- (fix) tags can now longer be removed when the combo is disabled (credits to grena - https://github.com/grena) -- (fix) setting data was only going through visible set of suggestions (credits to grena - https://github.com/grena) -- (fix) missing semi-colons, went through full jslint (credits to grena - https://github.com/grena) -- (fix) suggestions were not appearing when maxSuggestions was set to 10. (credits to zerekw - https://github.com/zerekw and plasmaxy - https://github.com/plasmaxy) -- (fix) the clear function was broken (credits to travishaagen - https://github.com/travishaagen) -- (fea) the component's config can now be setup entirely from the DOM container element. -- (fea) added a silent mode to selection changing methods in order to know if it was user-triggered or not. (credits to travishaagen - https://github.com/travishaagen) -- (fea) added a setData(object) method to fill the combo after it has been rendered (credits to travishaagen - https://github.com/travishaagen) -- (fix) ajax query was sent twice when the user was typing faster than the typeDelay (credits to arvenom - https://github.com/arvenom) -- (fix) highlighting the search results was also highlighting html tags when using custom rendering (credits to pstuart2 - https://github.com/pstuart2) -- (fea) added cfg(strictSuggest) so that user can choose how the suggestions will be made -- (fea) added cfg(toggleOnClick) so that the user can expand/close the combo by clicking on it (credits to psulek - https://github.com/psulek) -- (fix) empty suggestion text was wrongly triggered when performing initial ajax call (credits to curtgrimes - https://github.com/curtgrimes) -- (fea) added cfg(selectionRenderer) (credits to pstuart2 - https://github.com/pstuart2) -- (fix) empty text class was not triggered properly (credits to jods4 - https://github.com/jods4) -- (fix) IE8 compatibility (credits to Airborn22 - https://github.com/Airborn22) -- (fea) MagicSuggest can now be rendered from a select dom component. (credits to Yogu - https://github.com/Yogu) -- (fea) on blur now automatically adds the typed text to the selection if free entries are allowed (credits to Airborn22 - https://github.com/Airborn22) -- (fea) new public method empty() which will clear the user text. -- (fix) make sure combo is filled prior to triggering load event -- (fea) renamed some events for better readability - -v1.2.0 Standardization on jQuery plugins (Minor Tagged Milestone - Mar. 4th 2013) -================================================================================= -- (fix) fixed disabled behaviour when one could still edit the emptyText -- (fix) collapse method would throw an error -- (cfg) typeDelay: Amount (in ms) between keyboard registers (credits to jayesbee - https://github.com/jayesbee) -- (fea) standardized on jQuery plugin (credits to jayesbee - https://github.com/jayesbee) -- (fea) added documentation examples -- (cfg) name: name used for magicsuggest as a form element (credits to iambibhas - https://github.com/iambibhas) -- (fix) start up rendering when value rendered as text -- (cfg) dataParams: additional parameters for ajax request (credits to jayesbee - https://github.com/jayesbee) -- (fix) other rendering issues with inner text - -v1.1.0 Various enhancements and bug fixing (Minor Tagged Milestone - Feb. 19th 2013) -==================================================================================== -- (fea) close cross style now blends in a bit more -- (fea) escape now collapses the combo (without loosing focus) -- (fix) can't enter entries made out of space -- (cfg) noSuggestionText: text displayed when there are no suggestions from given data -- (cfg) minCharsRenderer: allows to customize message when not enough characters are entered to trigger a search -- (cfg) maxEntryRenderer: allows to customize message when too many characters have been entered -- (cfg) maxEntryLength: amount of characters to limit user input -- (cfg) style: custom style applied to the main container -- (cfg) infoMsgCls: custom class to apply to the helper -- (fea) new helper message on upper right to inform on the component status -- (cfg) id: allows to give the component a custom ID -- (cfg) inputCfg : allows additional parameters passed out to the INPUT tag. Enables usage of AngularJS's custom tags for ex. -- (cfg) renderer : allows custom rendering within the combo. -- (cfg) groupBy : allows grouping within the combo box listing. -- (fix) blur event now registers correctly when selecting an element from the combo -- (fix) flicker in IE when hovering trigger -- (cfg) strictSuggest : set how suggestions will be proposed -- (fix) maxResults is now correctly interpreted -- (fix) maxSelection is now correctly interpreted -- (cfg) method : set the ajax method, default to 'POST' -- (fea) ajax request can now interpret multiple results from server base. -- (fix) bug where the blur event would be triggered when clicking upon the page -- (cfg) required : triggers invalid / valid events when not filled -- (fea) validation through isValid() method - -v1.0. initial component release -=============================== -- choose to allow free entries or not -- keyboard management -- theme ability -- static and dynamic data processing -- positionning \ No newline at end of file diff --git a/api/js/jquery/magicsuggest/README_1.md b/api/js/jquery/magicsuggest/README_1.md deleted file mode 100644 index 4deb74ca3c..0000000000 --- a/api/js/jquery/magicsuggest/README_1.md +++ /dev/null @@ -1,109 +0,0 @@ -MagicSuggest v2.0.0 --------------------------- -MagicSuggest has a new home here: http://nicolasbize.com/magicsuggest/ -It includes a great new API documentation, examples, tutorials and more! - -Milestone change log: - -MagicSuggest v.2.0.0 -==================== -- New home at http://nicolasbize.com/magicsuggest/ to run dynamic examples that gh-pages couldn't handle -- Now runs with Bootstrap 3 (required) -- Responsive design -- No more intrusive loading - -v1.3.1 BugFixing again! (Minor Tagged Milestone - August 17th, 2013) -==================================================================== -- (fix) enable after disable now works (credits to amanokerim - https://github.com/amanokerim) -- (fix) trigger icon now takes full height (credits to DioVayne - https://github.com/DioVayne) -- (fix) clear now compatible with isSilent (credits to Coywolf - https://github.com/Coywolf) -- (fix) groupBy was broken by 1.3.0 -- (fea) compatibility with latest jQuery 1.10.2 (credits to RafaelMalgor - https://github.com/RafaelMalgor) -- (fea) resulted JSON objects can now have a custom result property resultsField (credits to RafaelMalgor - https://github.com/RafaelMalgor) - -v1.3.0 Some more features and bugfixing (Minor Tagged Milestone - May 25th, 2013) -================================================================================= -- (fea) combo component can now be fetched through the same div element (credits to meghuizen - https://github.com/meghuizen) -- (fix) CSS bug with 1.2.7+ with triggerHidden (credits to ScullWM - https://github.com/ScullWM) -- (fix) container would always render with 1 row even though a bunch of data was loaded (credits to travishaagen - https://github.com/travishaagen) -- (fea) added minimum jQuery version to work in docs (credits to rajeshmeniya - https://github.com/rajeshmeniya) -- (fix) input was not correctly enabled / disabled (credits to zerekw - https://github.com/zerekw) -- (fea) added getName and setName to easily fetch/set form name of component (credits to jbmoens - https://github.com/jbmoens) -- (fix) when a value is specified in the DOM original element, it is passed correctly to MS. (credits to jbmoens - https://github.com/jbmoens) -- (fix) input space now always uses the remaining space as this leads to less issues. -- (fea) combo has now more logic when used for a single selection combo box. -- (fix) space taken for single selection on a small combo remains on one line. (credits to ScullWM - https://github.com/ScullWM) -- (fea) multiple items can now be selected through the Ctrl key (credits to meghuizen - https://github.com/meghuizen) -- (fea) trigger icon now uses pure CSS (credits to meghuizen - https://github.com/meghuizen) -- (fea) cfg(data) can now take a function as parameter (credits to meghuizen - https://github.com/meghuizen) -- (fea) cfg(data) can take a json object whose data items are within the results property -- (fix) CSS has been fixed so it behaves correctly within a bootstrap modal (credits to daenuprobst - https://github.com/daenuprobst) -- (fea) suggestion rendering optimized by reducing draw calls to one. (credits to meghuizen - https://github.com/meghuizen) -- (fix) tags can now longer be removed when the combo is disabled (credits to grena - https://github.com/grena) -- (fix) setting data was only going through visible set of suggestions (credits to grena - https://github.com/grena) -- (fix) missing semi-colons, went through full jslint (credits to grena - https://github.com/grena) -- (fix) suggestions were not appearing when maxSuggestions was set to 10. (credits to zerekw - https://github.com/zerekw and plasmaxy - https://github.com/plasmaxy) -- (fix) the clear function was broken (credits to travishaagen - https://github.com/travishaagen) -- (fea) the component's config can now be setup entirely from the DOM container element. -- (fea) added a silent mode to selection changing methods in order to know if it was user-triggered or not. (credits to travishaagen - https://github.com/travishaagen) -- (fea) added a setData(object) method to fill the combo after it has been rendered (credits to travishaagen - https://github.com/travishaagen) -- (fix) ajax query was sent twice when the user was typing faster than the typeDelay (credits to arvenom - https://github.com/arvenom) -- (fix) highlighting the search results was also highlighting html tags when using custom rendering (credits to pstuart2 - https://github.com/pstuart2) -- (fea) added cfg(strictSuggest) so that user can choose how the suggestions will be made -- (fea) added cfg(toggleOnClick) so that the user can expand/close the combo by clicking on it (credits to psulek - https://github.com/psulek) -- (fix) empty suggestion text was wrongly triggered when performing initial ajax call (credits to curtgrimes - https://github.com/curtgrimes) -- (fea) added cfg(selectionRenderer) (credits to pstuart2 - https://github.com/pstuart2) -- (fix) empty text class was not triggered properly (credits to jods4 - https://github.com/jods4) -- (fix) IE8 compatibility (credits to Airborn22 - https://github.com/Airborn22) -- (fea) MagicSuggest can now be rendered from a select dom component. (credits to Yogu - https://github.com/Yogu) -- (fea) on blur now automatically adds the typed text to the selection if free entries are allowed (credits to Airborn22 - https://github.com/Airborn22) -- (fea) new public method empty() which will clear the user text. -- (fix) make sure combo is filled prior to triggering load event -- (fea) renamed some events for better readability - -v1.2.0 Standardization on jQuery plugins (Minor Tagged Milestone - Mar. 4th 2013) -================================================================================= -- (fix) fixed disabled behaviour when one could still edit the emptyText -- (fix) collapse method would throw an error -- (cfg) typeDelay: Amount (in ms) between keyboard registers (credits to jayesbee - https://github.com/jayesbee) -- (fea) standardized on jQuery plugin (credits to jayesbee - https://github.com/jayesbee) -- (fea) added documentation examples -- (cfg) name: name used for magicsuggest as a form element (credits to iambibhas - https://github.com/iambibhas) -- (fix) start up rendering when value rendered as text -- (cfg) dataParams: additional parameters for ajax request (credits to jayesbee - https://github.com/jayesbee) -- (fix) other rendering issues with inner text - -v1.1.0 Various enhancements and bug fixing (Minor Tagged Milestone - Feb. 19th 2013) -==================================================================================== -- (fea) close cross style now blends in a bit more -- (fea) escape now collapses the combo (without loosing focus) -- (fix) can't enter entries made out of space -- (cfg) noSuggestionText: text displayed when there are no suggestions from given data -- (cfg) minCharsRenderer: allows to customize message when not enough characters are entered to trigger a search -- (cfg) maxEntryRenderer: allows to customize message when too many characters have been entered -- (cfg) maxEntryLength: amount of characters to limit user input -- (cfg) style: custom style applied to the main container -- (cfg) infoMsgCls: custom class to apply to the helper -- (fea) new helper message on upper right to inform on the component status -- (cfg) id: allows to give the component a custom ID -- (cfg) inputCfg : allows additional parameters passed out to the INPUT tag. Enables usage of AngularJS's custom tags for ex. -- (cfg) renderer : allows custom rendering within the combo. -- (cfg) groupBy : allows grouping within the combo box listing. -- (fix) blur event now registers correctly when selecting an element from the combo -- (fix) flicker in IE when hovering trigger -- (cfg) strictSuggest : set how suggestions will be proposed -- (fix) maxResults is now correctly interpreted -- (fix) maxSelection is now correctly interpreted -- (cfg) method : set the ajax method, default to 'POST' -- (fea) ajax request can now interpret multiple results from server base. -- (fix) bug where the blur event would be triggered when clicking upon the page -- (cfg) required : triggers invalid / valid events when not filled -- (fea) validation through isValid() method - -v1.0. initial component release -=============================== -- choose to allow free entries or not -- keyboard management -- theme ability -- static and dynamic data processing -- positionning \ No newline at end of file diff --git a/api/js/jquery/magicsuggest/bower.json b/api/js/jquery/magicsuggest/bower.json deleted file mode 100644 index 1955cade59..0000000000 --- a/api/js/jquery/magicsuggest/bower.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "magicsuggest", - "version": "2.1.4", - "main": ["magicsuggest.js", "magicsuggest.css"], - "dependencies": { - "bootstrap": "~3", - "jquery": ">= 1.8.3" - } -} diff --git a/api/js/jquery/magicsuggest/composer.json b/api/js/jquery/magicsuggest/composer.json deleted file mode 100644 index ae0fd8a0c3..0000000000 --- a/api/js/jquery/magicsuggest/composer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "nicolasbize/magicsuggest", - "description": "MagicSuggest is a multiple selection auto suggest combo box for Bootstrap 3.", - "version": "2.1.4", - "type": "component", - "homepage": "http://nicolasbize.com/magicsuggest", - "license": "MIT", - "require": { - "components/bootstrap": ">=3.0.0", - "components/jquery": ">=1.8.3" - }, - "extra": { - "component": { - "scripts": [ - "magicsuggest.js" - ], - "files": [ - "magicsuggest.css" - ] - } - } -} diff --git a/api/js/jquery/magicsuggest/magicsuggest-min.css b/api/js/jquery/magicsuggest/magicsuggest-min.css deleted file mode 100644 index 4639434a96..0000000000 --- a/api/js/jquery/magicsuggest/magicsuggest-min.css +++ /dev/null @@ -1 +0,0 @@ -.ms-ctn{position:relative;padding:5px 12px;height:auto}.ms-inv{border:1px solid #c00}.ms-ctn-readonly{cursor:pointer}.ms-ctn-disabled{cursor:not-allowed;background-color:#eee}.ms-ctn-bootstrap-focus,.ms-ctn-bootstrap-focus .ms-res-ctn{border-color:rgba(82,168,236,0.8)!important;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)!important;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)!important;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)!important;border-bottom-left-radius:0;border-bottom-right-radius:0}.ms-ctn-focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.ms-ctn input{border:0;box-shadow:none;-webkit-transition:none;outline:0;display:block;padding:0;line-height:1.42857143;margin:1px 0;width:100%}.ms-ctn .ms-sel-ctn input{float:left}.ms-ctn-disabled input{cursor:not-allowed;background-color:#eee}.ms-ctn .ms-input-readonly{cursor:pointer}.ms-ctn .ms-empty-text{color:#DDD}.ms-ctn input:focus{border:0;box-shadow:none;-webkit-transition:none;background:#FFF}.ms-ctn input::-ms-clear{width:0;height:0}.ms-ctn .ms-trigger{top:0;width:25px;height:100%;position:absolute;right:0;background:transparent;border-left:1px solid #CCC;cursor:pointer}.ms-ctn .ms-trigger .ms-trigger-ico{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #333;border-right:4px solid transparent;border-left:4px solid transparent;content:"";margin-left:8px;margin-top:15px}.ms-ctn .ms-trigger:hover{background-color:#e6e6e6}.ms-ctn .ms-trigger:hover .ms-trigger-ico{background-position:0 -4px}.ms-ctn-disabled .ms-trigger{cursor:not-allowed;background-color:#eee}.ms-ctn-bootstrap-focus{border-bottom:1px solid #CCC}.ms-res-ctn{width:100%;display:block;overflow-y:auto}.ms-res-ctn .ms-res-group{line-height:23px;text-align:left;padding:2px 5px;font-weight:bold;border-bottom:1px dotted #CCC;border-top:1px solid #CCC;background:#f3edff;color:#333}.ms-res-ctn .ms-res-item{line-height:25px;text-align:left;padding:2px 5px;color:#666;cursor:pointer}.ms-res-ctn .ms-res-item-grouped{padding-left:15px}.ms-res-ctn .ms-res-odd{background:#fafafa}.ms-res-ctn .ms-res-item-active{background-color:#f5f5f5}.ms-res-ctn .ms-res-item-disabled{color:#CCC;cursor:default}.ms-sel-ctn{overflow:auto;line-height:18px;padding-right:25px}.ms-no-trigger .ms-sel-ctn{padding-right:0}.ms-sel-ctn .ms-sel-item{background:#f3f3f3;color:#999;float:left;font-size:12px;padding:3px 5px;border-radius:3px;border:1px solid #DDD;margin:3px 0 1px 0}.ms-sel-ctn .ms-sel-invalid{border-color:#f8a5a5!important;background:#fdf2f2!important}.ms-sel-ctn .ms-sel-item:hover{border:1px solid #BBB}.ms-ctn .ms-sel-item{background:#f3f3f3;color:#999;float:left;font-size:12px;padding:0 5px;border-radius:3px;border:1px solid #DDD;margin:1px 5px 1px 0}.ms-ctn .ms-sel-item:hover{border:1px solid transparent}.ms-ctn-focus .ms-sel-item:hover{border:1px solid #BBB}.ms-sel-ctn .ms-sel-text{background:#FFF;color:#666;padding-right:0;margin-left:0;font-size:14px;font-weight:normal}.ms-as-string .ms-sel-text{border-color:transparent}.ms-res-ctn .ms-res-item em{font-style:normal;background:#565656;color:#FFF}.ms-sel-ctn .ms-sel-text:hover{background:#FFF}.ms-sel-ctn .ms-sel-item-active{border:1px solid red;background:#757575}.ms-stacked .ms-sel-item{float:inherit}.ms-sel-ctn .ms-sel-item .ms-close-btn{width:7px;cursor:pointer;height:7px;float:right;margin:6px 2px 0 10px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAOCAYAAADjXQYbAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4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/u2AAAAAElFTkSuQmCC);background-position:0 -7px}.ms-sel-ctn .ms-sel-item .ms-close-btn:hover{background-position:0 0}.ms-stacked .ms-sel-item .ms-close-btn{margin-left:0}.ms-helper{color:#AAA;font-size:10px;position:absolute;top:-17px;right:0}.ms-ctn.input-lg .ms-trigger .ms-trigger-ico{margin-top:17px}.ms-ctn.input-sm .ms-trigger .ms-trigger-ico{margin-top:13px}.ms-ctn.input-lg .ms-sel-ctn .ms-sel-item{padding-top:2px;padding-bottom:3px}.ms-ctn.input-sm .ms-sel-ctn{line-height:15px}.ms-ctn.input-sm .ms-sel-ctn .ms-sel-item{padding-top:1px;padding-bottom:1px;margin-top:0;margin-bottom:0}.ms-ctn.input-sm .ms-sel-ctn .ms-sel-item .ms-close-btn{margin-top:4px}.ms-ctn .ms-sel-ctn{margin-left:-7px}.ms-ctn .ms-trigger:hover{width:24px;right:1px;border-radius:0 3px 3px 0} \ No newline at end of file diff --git a/api/js/jquery/magicsuggest/magicsuggest-min.js b/api/js/jquery/magicsuggest/magicsuggest-min.js deleted file mode 100644 index ef69768652..0000000000 --- a/api/js/jquery/magicsuggest/magicsuggest-min.js +++ /dev/null @@ -1 +0,0 @@ -(function($){"use strict";var MagicSuggest=function(element,options){var ms=this;var defaults={allowFreeEntries:true,allowDuplicates:false,ajaxConfig:{},autoSelect:true,selectFirst:false,queryParam:"query",beforeSend:function(){},cls:"",data:null,dataUrlParams:{},disabled:false,disabledField:null,displayField:"name",editable:true,expanded:false,expandOnFocus:false,groupBy:null,hideTrigger:false,highlight:true,id:null,infoMsgCls:"",inputCfg:{},invalidCls:"ms-inv",matchCase:false,maxDropHeight:290,maxEntryLength:null,maxEntryRenderer:function(v){return"Please reduce your entry by "+v+" character"+(v>1?"s":"")},maxSuggestions:null,maxSelection:10,maxSelectionRenderer:function(v){return"You cannot choose more than "+v+" item"+(v>1?"s":"")},method:"POST",minChars:0,minCharsRenderer:function(v){return"Please type "+v+" more character"+(v>1?"s":"")},mode:"local",name:null,noSuggestionText:"No suggestions",placeholder:"Type or click here",renderer:null,required:false,resultAsString:false,resultAsStringDelimiter:",",resultsField:"results",selectionCls:"",selectionContainer:null,selectionPosition:"inner",selectionRenderer:null,selectionStacked:false,sortDir:"asc",sortOrder:null,strictSuggest:false,style:"",toggleOnClick:false,typeDelay:400,useTabKey:false,useCommaKey:true,useZebraStyle:false,value:null,valueField:"id",vregex:null,vtype:null};var conf=$.extend({},options);var cfg=$.extend(true,{},defaults,conf);this.addToSelection=function(items,isSilent){if(!cfg.maxSelection||_selection.length0?"":cfg.placeholder)};this.clear=function(isSilent){this.removeFromSelection(_selection.slice(0),isSilent)};this.collapse=function(){if(cfg.expanded===true){this.combobox.detach();cfg.expanded=false;$(this).trigger("collapse",[this])}};this.disable=function(){this.container.addClass("ms-ctn-disabled");cfg.disabled=true;ms.input.attr("disabled",true)};this.empty=function(){this.input.val("")};this.enable=function(){this.container.removeClass("ms-ctn-disabled");cfg.disabled=false;ms.input.attr("disabled",false)};this.expand=function(){if(!cfg.expanded&&(this.input.val().length>=cfg.minChars||this.combobox.children().size()>0)){this.combobox.appendTo(this.container);self._processSuggestions();cfg.expanded=true;$(this).trigger("expand",[this])}};this.isDisabled=function(){return cfg.disabled};this.isValid=function(){var valid=cfg.required===false||_selection.length>0;if(cfg.vtype||cfg.vregex){$.each(_selection,function(index,item){valid=valid&&self._validateSingleItem(item[cfg.valueField])})}return valid};this.getDataUrlParams=function(){return cfg.dataUrlParams};this.getName=function(){return cfg.name};this.getSelection=function(){return _selection};this.getRawValue=function(){return ms.input.val()};this.getValue=function(){return $.map(_selection,function(o){return o[cfg.valueField]})};this.removeFromSelection=function(items,isSilent){if(!$.isArray(items)){items=[items]}var valuechanged=false;$.each(items,function(index,json){var i=$.inArray(json[cfg.valueField],ms.getValue());if(i>-1){_selection.splice(i,1);valuechanged=true}});if(valuechanged===true){self._renderSelection();if(isSilent!==true){$(this).trigger("selectionchange",[this,this.getSelection()])}if(cfg.expandOnFocus){ms.expand()}if(cfg.expanded){self._processSuggestions()}}this.input.attr("placeholder",cfg.selectionPosition==="inner"&&this.getValue().length>0?"":cfg.placeholder)};this.getData=function(){return _cbData};this.setData=function(data){cfg.data=data;self._processSuggestions()};this.setName=function(name){cfg.name=name;if(name){cfg.name+=name.indexOf("[]")>0?"":"[]"}if(ms._valueContainer){$.each(ms._valueContainer.children(),function(i,el){el.name=cfg.name})}};this.setSelection=function(items){this.clear();this.addToSelection(items)};this.setValue=function(values){var items=[];$.each(values,function(index,value){var found=false;$.each(_cbData,function(i,item){if(item[cfg.valueField]==value){items.push(item);found=true;return false}});if(!found){if(typeof value==="object"){items.push(value)}else{var json={};json[cfg.valueField]=value;json[cfg.displayField]=value;items.push(json)}}});if(items.length>0){this.addToSelection(items)}};this.setDataUrlParams=function(params){cfg.dataUrlParams=$.extend({},params)};var _selection=[],_comboItemHeight=0,_timer,_hasFocus=false,_groups=null,_cbData=[],_ctrlDown=false,KEYCODES={BACKSPACE:8,TAB:9,ENTER:13,CTRL:17,ESC:27,SPACE:32,UPARROW:38,DOWNARROW:40,COMMA:188};var self={_displaySuggestions:function(data){ms.combobox.show();ms.combobox.empty();var resHeight=0,nbGroups=0;if(_groups===null){self._renderComboItems(data);resHeight=_comboItemHeight*data.length}else{for(var grpName in _groups){nbGroups+=1;$("
",{"class":"ms-res-group",html:grpName}).appendTo(ms.combobox);self._renderComboItems(_groups[grpName].items,true)}var _groupItemHeight=ms.combobox.find(".ms-res-group").outerHeight();if(_groupItemHeight!==null){var tmpResHeight=nbGroups*_groupItemHeight;resHeight=_comboItemHeight*data.length+tmpResHeight}else{resHeight=_comboItemHeight*(data.length+nbGroups)}}if(resHeight=ms.combobox.height()&&resHeight>cfg.maxDropHeight){ms.combobox.height(cfg.maxDropHeight)}if(data.length===1&&cfg.autoSelect===true){ms.combobox.children().filter(":not(.ms-res-item-disabled):last").addClass("ms-res-item-active")}if(cfg.selectFirst===true){ms.combobox.children().filter(":not(.ms-res-item-disabled):first").addClass("ms-res-item-active")}if(data.length===0&&ms.getRawValue()!==""){var noSuggestionText=cfg.noSuggestionText.replace(/\{\{.*\}\}/,ms.input.val());self._updateHelper(noSuggestionText);ms.collapse()}if(cfg.allowFreeEntries===false){if(data.length===0){$(ms.input).addClass(cfg.invalidCls);ms.combobox.hide()}else{$(ms.input).removeClass(cfg.invalidCls)}}},_getEntriesFromStringArray:function(data){var json=[];$.each(data,function(index,s){var entry={};entry[cfg.displayField]=entry[cfg.valueField]=$.trim(s);json.push(entry)});return json},_highlightSuggestion:function(html){var q=ms.input.val();var specialCharacters=["^","$","*","+","?",".","(",")",":","!","|","{","}","[","]"];$.each(specialCharacters,function(index,value){q=q.replace(value,"\\"+value)});if(q.length===0){return html}var glob=cfg.matchCase===true?"g":"gi";return html.replace(new RegExp("("+q+")(?!([^<]+)?>)",glob),"$1")},_moveSelectedRow:function(dir){if(!cfg.expanded){ms.expand()}var list,start,active,scrollPos;list=ms.combobox.find(".ms-res-item:not(.ms-res-item-disabled)");if(dir==="down"){start=list.eq(0)}else{start=list.filter(":last")}active=ms.combobox.find(".ms-res-item-active:not(.ms-res-item-disabled):first");if(active.length>0){if(dir==="down"){start=active.nextAll(".ms-res-item:not(.ms-res-item-disabled)").first();if(start.length===0){start=list.eq(0)}scrollPos=ms.combobox.scrollTop();ms.combobox.scrollTop(0);if(start[0].offsetTop+start.outerHeight()>ms.combobox.height()){ms.combobox.scrollTop(scrollPos+_comboItemHeight)}}else{start=active.prevAll(".ms-res-item:not(.ms-res-item-disabled)").first();if(start.length===0){start=list.filter(":last");ms.combobox.scrollTop(_comboItemHeight*list.length)}if(start[0].offsetTop0&&typeof data[0]==="string"){_cbData=self._getEntriesFromStringArray(data)}else{_cbData=data[cfg.resultsField]||data}}var sortedData=cfg.mode==="remote"?_cbData:self._sortAndTrim(_cbData);self._displaySuggestions(self._group(sortedData))}},_render:function(el){ms.setName(cfg.name);ms.container=$("
",{"class":"ms-ctn form-control "+(cfg.resultAsString?"ms-as-string ":"")+cfg.cls+($(el).hasClass("input-lg")?" input-lg":"")+($(el).hasClass("input-sm")?" input-sm":"")+(cfg.disabled===true?" ms-ctn-disabled":"")+(cfg.editable===true?"":" ms-ctn-readonly")+(cfg.hideTrigger===false?"":" ms-no-trigger"),style:cfg.style,id:cfg.id});ms.container.focus($.proxy(handlers._onFocus,this));ms.container.blur($.proxy(handlers._onBlur,this));ms.container.keydown($.proxy(handlers._onKeyDown,this));ms.container.keyup($.proxy(handlers._onKeyUp,this));ms.input=$("",$.extend({type:"text","class":cfg.editable===true?"":" ms-input-readonly",readonly:!cfg.editable,placeholder:cfg.placeholder,disabled:cfg.disabled},cfg.inputCfg));ms.input.focus($.proxy(handlers._onInputFocus,this));ms.input.click($.proxy(handlers._onInputClick,this));ms.combobox=$("
",{"class":"ms-res-ctn dropdown-menu"}).height(cfg.maxDropHeight);ms.combobox.on("click","div.ms-res-item",$.proxy(handlers._onComboItemSelected,this));ms.combobox.on("mouseover","div.ms-res-item",$.proxy(handlers._onComboItemMouseOver,this));if(cfg.selectionContainer){ms.selectionContainer=cfg.selectionContainer;$(ms.selectionContainer).addClass("ms-sel-ctn")}else{ms.selectionContainer=$("
",{"class":"ms-sel-ctn"})}ms.selectionContainer.click($.proxy(handlers._onFocus,this));if(cfg.selectionPosition==="inner"&&!cfg.selectionContainer){ms.selectionContainer.append(ms.input)}else{ms.container.append(ms.input)}ms.helper=$("",{"class":"ms-helper "+cfg.infoMsgCls});self._updateHelper();ms.container.append(ms.helper);$(el).replaceWith(ms.container);if(!cfg.selectionContainer){switch(cfg.selectionPosition){case"bottom":ms.selectionContainer.insertAfter(ms.container);if(cfg.selectionStacked===true){ms.selectionContainer.width(ms.container.width());ms.selectionContainer.addClass("ms-stacked")}break;case"right":ms.selectionContainer.insertAfter(ms.container);ms.container.css("float","left");break;default:ms.container.append(ms.selectionContainer);break}}if(cfg.hideTrigger===false){ms.trigger=$("
",{"class":"ms-trigger",html:'
'});ms.trigger.click($.proxy(handlers._onTriggerClick,this));ms.container.append(ms.trigger)}$(window).resize($.proxy(handlers._onWindowResized,this));if(cfg.value!==null||cfg.data!==null){if(typeof cfg.data==="string"){self._asyncValues=cfg.value;self._processSuggestions()}else{self._processSuggestions();if(cfg.value!==null){ms.setValue(cfg.value);self._renderSelection()}}}$("body").click(function(e){if(ms.container.hasClass("ms-ctn-focus")&&ms.container.has(e.target).length===0&&e.target.className.indexOf("ms-res-item")<0&&e.target.className.indexOf("ms-close-btn")<0&&ms.container[0]!==e.target){handlers._onBlur()}});if(cfg.expanded===true){cfg.expanded=false;ms.expand()}},_renderComboItems:function(items,isGrouped){var ref=this,html="";$.each(items,function(index,value){var displayed=cfg.renderer!==null?cfg.renderer.call(ref,value):value[cfg.displayField];var disabled=cfg.disabledField!==null&&value[cfg.disabledField]===true;var resultItemEl=$("
",{"class":"ms-res-item "+(isGrouped?"ms-res-item-grouped ":"")+(disabled?"ms-res-item-disabled ":"")+(index%2===1&&cfg.useZebraStyle===true?"ms-res-odd":""),html:cfg.highlight===true?self._highlightSuggestion(displayed):displayed,"data-json":JSON.stringify(value)});html+=$("
").append(resultItemEl).html()});ms.combobox.append(html);_comboItemHeight=ms.combobox.find(".ms-res-item:first").outerHeight()},_renderSelection:function(){var ref=this,w=0,inputOffset=0,items=[],asText=cfg.resultAsString===true&&!_hasFocus;ms.selectionContainer.find(".ms-sel-item").remove();if(ms._valueContainer!==undefined){ms._valueContainer.remove()}$.each(_selection,function(index,value){var selectedItemEl,delItemEl,selectedItemHtml=cfg.selectionRenderer!==null?cfg.selectionRenderer.call(ref,value):value[cfg.displayField];var validCls=self._validateSingleItem(value[cfg.displayField])?"":" ms-sel-invalid";if(asText===true){selectedItemEl=$("
",{"class":"ms-sel-item ms-sel-text "+cfg.selectionCls+validCls,html:selectedItemHtml+(index===_selection.length-1?"":cfg.resultAsStringDelimiter)}).data("json",value)}else{selectedItemEl=$("
",{"class":"ms-sel-item "+cfg.selectionCls+validCls,html:selectedItemHtml}).data("json",value);if(cfg.disabled===false){delItemEl=$("",{"class":"ms-close-btn"}).data("json",value).appendTo(selectedItemEl);delItemEl.click($.proxy(handlers._onTagTriggerClick,ref))}}items.push(selectedItemEl)});ms.selectionContainer.prepend(items);ms._valueContainer=$("
",{style:"display: none;"});$.each(ms.getValue(),function(i,val){var el=$("",{type:"hidden",name:cfg.name,value:val});el.appendTo(ms._valueContainer)});ms._valueContainer.appendTo(ms.selectionContainer);if(cfg.selectionPosition==="inner"&&!cfg.selectionContainer){ms.input.width(0);inputOffset=ms.input.offset().left-ms.selectionContainer.offset().left;w=ms.container.width()-inputOffset-42;ms.input.width(w)}if(_selection.length===cfg.maxSelection){self._updateHelper(cfg.maxSelectionRenderer.call(this,_selection.length))}else{ms.helper.hide()}},_selectItem:function(item){if(cfg.maxSelection===1){_selection=[]}ms.addToSelection(item.data("json"));item.removeClass("ms-res-item-active");if(cfg.expandOnFocus===false||_selection.length===cfg.maxSelection){ms.collapse()}if(!_hasFocus){ms.input.focus()}else if(_hasFocus&&(cfg.expandOnFocus||_ctrlDown)){self._processSuggestions();if(_ctrlDown){ms.expand()}}},_sortAndTrim:function(data){var q=ms.getRawValue(),filtered=[],newSuggestions=[],selectedValues=ms.getValue();if(q.length>0){$.each(data,function(index,obj){var name=obj[cfg.displayField];if(cfg.matchCase===true&&name.indexOf(q)>-1||cfg.matchCase===false&&name.toLowerCase().indexOf(q.toLowerCase())>-1){if(cfg.strictSuggest===false||name.toLowerCase().indexOf(q.toLowerCase())===0){filtered.push(obj)}}})}else{filtered=data}$.each(filtered,function(index,obj){if(cfg.allowDuplicates||$.inArray(obj[cfg.valueField],selectedValues)===-1){newSuggestions.push(obj)}});if(cfg.sortOrder!==null){newSuggestions.sort(function(a,b){if(a[cfg.sortOrder]b[cfg.sortOrder]){return cfg.sortDir==="asc"?1:-1}return 0})}if(cfg.maxSuggestions&&cfg.maxSuggestions>0){newSuggestions=newSuggestions.slice(0,cfg.maxSuggestions)}return newSuggestions},_group:function(data){if(cfg.groupBy!==null){_groups={};$.each(data,function(index,value){var props=cfg.groupBy.indexOf(".")>-1?cfg.groupBy.split("."):cfg.groupBy;var prop=value[cfg.groupBy];if(typeof props!="string"){prop=value;while(props.length>0){prop=prop[props.shift()]}}if(_groups[prop]===undefined){_groups[prop]={title:prop,items:[value]}}else{_groups[prop].items.push(value)}})}return data},_updateHelper:function(html){ms.helper.html(html);if(!ms.helper.is(":visible")){ms.helper.fadeIn()}},_validateSingleItem:function(value){if(cfg.vregex!==null&&cfg.vregex instanceof RegExp){return cfg.vregex.test(value)}else if(cfg.vtype!==null){switch(cfg.vtype){case"alpha":return/^[a-zA-Z_]+$/.test(value);case"alphanum":return/^[a-zA-Z0-9_]+$/.test(value);case"email":return/^(\w+)([\-+.][\w]+)*@(\w[\-\w]*\.){1,5}([A-Za-z]){2,6}$/.test(value);case"url":return/(((^https?)|(^ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i.test(value);case"ipaddress":return/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(value)}}return true}};var handlers={_onBlur:function(){ms.container.removeClass("ms-ctn-focus");ms.collapse();_hasFocus=false;if(ms.getRawValue()!==""&&cfg.allowFreeEntries===true){var obj={};obj[cfg.displayField]=obj[cfg.valueField]=ms.getRawValue().trim();ms.addToSelection(obj)}self._renderSelection();if(ms.isValid()===false){ms.container.addClass(cfg.invalidCls)}else if(ms.input.val()!==""&&cfg.allowFreeEntries===false){ms.empty();self._updateHelper("")}$(ms).trigger("blur",[ms])},_onComboItemMouseOver:function(e){var target=$(e.currentTarget);if(!target.hasClass("ms-res-item-disabled")){ms.combobox.children().removeClass("ms-res-item-active");target.addClass("ms-res-item-active")}},_onComboItemSelected:function(e){var target=$(e.currentTarget);if(!target.hasClass("ms-res-item-disabled")){self._selectItem($(e.currentTarget))}},_onFocus:function(){ms.input.focus()},_onInputClick:function(){if(ms.isDisabled()===false&&_hasFocus){if(cfg.toggleOnClick===true){if(cfg.expanded){ms.collapse()}else{ms.expand()}}}},_onInputFocus:function(){if(ms.isDisabled()===false&&!_hasFocus){_hasFocus=true;ms.container.addClass("ms-ctn-focus");ms.container.removeClass(cfg.invalidCls);var curLength=ms.getRawValue().length;if(cfg.expandOnFocus===true){ms.expand()}if(_selection.length===cfg.maxSelection){self._updateHelper(cfg.maxSelectionRenderer.call(this,_selection.length))}else if(curLength0&&cfg.selectionPosition==="inner"){_selection.pop();self._renderSelection();$(ms).trigger("selectionchange",[ms,ms.getSelection()]);ms.input.attr("placeholder",cfg.selectionPosition==="inner"&&ms.getValue().length>0?"":cfg.placeholder);ms.input.focus();e.preventDefault()}break;case KEYCODES.TAB:case KEYCODES.ESC:e.preventDefault();break;case KEYCODES.ENTER:if(freeInput!==""||cfg.expanded){e.preventDefault()}break;case KEYCODES.COMMA:if(cfg.useCommaKey===true){e.preventDefault()}break;case KEYCODES.CTRL:_ctrlDown=true;break;case KEYCODES.DOWNARROW:e.preventDefault();self._moveSelectedRow("down");break;case KEYCODES.UPARROW:e.preventDefault();self._moveSelectedRow("up");break;default:if(_selection.length===cfg.maxSelection){e.preventDefault()}break}},_onKeyUp:function(e){var freeInput=ms.getRawValue(),inputValid=$.trim(ms.input.val()).length>0&&(!cfg.maxEntryLength||$.trim(ms.input.val()).length<=cfg.maxEntryLength),selected,obj={};$(ms).trigger("keyup",[ms,e]);clearTimeout(_timer);if(e.keyCode===KEYCODES.ESC&&cfg.expanded){ms.combobox.hide()}if(e.keyCode===KEYCODES.TAB&&cfg.useTabKey===false||e.keyCode>KEYCODES.ENTER&&e.keyCode0){self._selectItem(selected);return}}if(inputValid===true&&cfg.allowFreeEntries===true){obj[cfg.displayField]=obj[cfg.valueField]=freeInput.trim();ms.addToSelection(obj);ms.collapse();ms.input.focus()}break}default:if(_selection.length===cfg.maxSelection){self._updateHelper(cfg.maxSelectionRenderer.call(this,_selection.length))}else{if(freeInput.lengthcfg.maxEntryLength){self._updateHelper(cfg.maxEntryRenderer.call(this,freeInput.length-cfg.maxEntryLength));if(cfg.expanded===true){ms.collapse()}}else{ms.helper.hide();if(cfg.minChars<=freeInput.length){_timer=setTimeout(function(){if(cfg.expanded===true){self._processSuggestions()}else{ms.expand()}},cfg.typeDelay)}}}break}},_onTagTriggerClick:function(e){ms.removeFromSelection($(e.currentTarget).data("json"))},_onTriggerClick:function(){if(ms.isDisabled()===false&&!(cfg.expandOnFocus===true&&_selection.length===cfg.maxSelection)){$(ms).trigger("triggerclick",[ms]);if(cfg.expanded===true){ms.collapse()}else{var curLength=ms.getRawValue().length;if(curLength>=cfg.minChars){ms.input.focus();ms.expand()}else{self._updateHelper(cfg.minCharsRenderer.call(this,cfg.minChars-curLength))}}}},_onWindowResized:function(){self._renderSelection()}};if(element!==null){self._render(element)}};$.fn.magicSuggest=function(options){var obj=$(this);if(obj.size()===1&&obj.data("magicSuggest")){return obj.data("magicSuggest")}obj.each(function(i){var cntr=$(this);if(cntr.data("magicSuggest")){return}if(this.nodeName.toLowerCase()==="select"){options.data=[];options.value=[];$.each(this.children,function(index,child){if(child.nodeName&&child.nodeName.toLowerCase()==="option"){options.data.push({id:child.value,name:child.text});if($(child).attr("selected")){options.value.push(child.value)}}})}var def={};$.each(this.attributes,function(i,att){def[att.name]=att.name==="value"&&att.value!==""?JSON.parse(att.value):att.value});var field=new MagicSuggest(this,$.extend([],$.fn.magicSuggest.defaults,options,def));cntr.data("magicSuggest",field);field.container.data("magicSuggest",field)});if(obj.size()===1){return obj.data("magicSuggest")}return obj};$.fn.magicSuggest.defaults={}})(jQuery); \ No newline at end of file diff --git a/api/js/jquery/magicsuggest/magicsuggest.css b/api/js/jquery/magicsuggest/magicsuggest.css deleted file mode 100644 index e2070dd180..0000000000 --- a/api/js/jquery/magicsuggest/magicsuggest.css +++ /dev/null @@ -1,263 +0,0 @@ -/** - * Multiple Selection Component for Bootstrap - * Check nicolasbize.github.io/magicsuggest/ for latest updates. - * - * Author: Nicolas Bize - * Created: Feb 8th 2013 - * Last Updated: Oct 16th 2014 - * Version: 2.1.4 - * Licence: MagicSuggest is licenced under MIT licence (http://opensource.org/licenses/MIT) - */ -.ms-ctn{ - position: relative; - padding: 5px 12px; - height: auto; -} -.ms-inv{ - border: 1px solid #CC0000; -} -.ms-ctn-readonly{ - cursor: pointer; -} -.ms-ctn-disabled{ - cursor: not-allowed; - background-color: #eeeeee; -} -.ms-ctn-bootstrap-focus, -.ms-ctn-bootstrap-focus .ms-res-ctn{ - border-color: rgba(82, 168, 236, 0.8) !important; - /* IE6-9 */ - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6) !important; - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6) !important; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6) !important; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; -} -.ms-ctn-focus{ - border-color: #66afe9; - outline: 0; - -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); - box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); -} -.ms-ctn input{ - border: 0; - box-shadow: none; - -webkit-transition: none; - outline: none; - display: block; - padding: 0; - line-height: 1.42857143; - margin: 1px 0; - width: 100%; -} -.ms-ctn .ms-sel-ctn input{ - float: left; -} -.ms-ctn-disabled input{ - cursor: not-allowed; - background-color: #eeeeee; -} -.ms-ctn .ms-input-readonly{ - cursor: pointer; -} -.ms-ctn .ms-empty-text{ - color: #DDD; -} -.ms-ctn input:focus{ - border: 0; - box-shadow: none; - -webkit-transition: none; - background: #FFF; -} -.ms-ctn input::-ms-clear { - width: 0; - height: 0; -} -.ms-ctn .ms-trigger{ - top: 0; - width: 25px; - height:100%; - position:absolute; - right:0; - background: transparent; - border-left: 1px solid #CCC; - cursor: pointer; -} -.ms-ctn .ms-trigger .ms-trigger-ico { - display: inline-block; - width: 0; - height: 0; - vertical-align: top; - border-top: 4px solid #333; - border-right: 4px solid transparent; - border-left: 4px solid transparent; - content: ""; - margin-left: 8px; - margin-top: 15px; -} -.ms-ctn .ms-trigger:hover{ - background-color: #e6e6e6; -} -.ms-ctn .ms-trigger:hover .ms-trigger-ico{ - background-position: 0 -4px; -} -.ms-ctn-disabled .ms-trigger{ - cursor: not-allowed; - background-color: #eeeeee; -} -.ms-ctn-bootstrap-focus{ - border-bottom: 1px solid #CCC; -} -.ms-res-ctn{ - width: 100%; - display: block; - overflow-y: auto; -} -.ms-res-ctn .ms-res-group{ - line-height: 23px; - text-align: left; - padding: 2px 5px; - font-weight: bold; - border-bottom: 1px dotted #CCC; - border-top: 1px solid #CCC; - background: #f3edff; - color: #333; -} -.ms-res-ctn .ms-res-item{ - line-height: 25px; - text-align: left; - padding: 2px 5px; - color: #666; - cursor: pointer; -} -.ms-res-ctn .ms-res-item-grouped{ - padding-left: 15px; -} -.ms-res-ctn .ms-res-odd{ - background: #FAFAFA; -} -.ms-res-ctn .ms-res-item-active{ - background-color: #F5F5F5; -} -.ms-res-ctn .ms-res-item-disabled{ - color: #CCC; - cursor: default; -} -.ms-sel-ctn{ - overflow: auto; - line-height: 18px; - padding-right: 25px; -} -.ms-no-trigger .ms-sel-ctn{ - padding-right: 0; -} -/** Outer and global tags **/ -.ms-sel-ctn .ms-sel-item{ - background: #F3F3F3; - color: #999; - float: left; - font-size: 12px; - padding: 3px 5px; - border-radius: 3px; - border: 1px solid #DDD; - margin: 3px 0px 1px 0; -} -.ms-sel-ctn .ms-sel-invalid{ - border-color: rgb(248, 165, 165) !important; - background: #FDF2F2 !important; -} -.ms-sel-ctn .ms-sel-item:hover{ - border: 1px solid #BBB; -} -/** For inner tags **/ -.ms-ctn .ms-sel-item{ - background: #F3F3F3; - color: #999; - float: left; - font-size: 12px; - padding: 0 5px; - border-radius: 3px; - border: 1px solid #DDD; - margin: 1px 5px 1px 0; -} -.ms-ctn .ms-sel-item:hover{ - border: 1px solid transparent; -} -.ms-ctn-focus .ms-sel-item:hover{ - border: 1px solid #BBB; -} -.ms-sel-ctn .ms-sel-text{ - background: #FFF; - color: #666; - padding-right: 0; - margin-left: 0; - font-size: 14px; - font-weight: normal; -} -.ms-as-string .ms-sel-text{ - border-color: transparent; -} -.ms-res-ctn .ms-res-item em{ - font-style: normal; - background: #565656; - color: #FFF; -} -.ms-sel-ctn .ms-sel-text:hover{ - background: #FFF; -} -.ms-sel-ctn .ms-sel-item-active{ - border: 1px solid red; - background: #757575; -} -.ms-stacked .ms-sel-item{ - float: inherit; -} -.ms-sel-ctn .ms-sel-item .ms-close-btn{ - width: 7px; - cursor: pointer; - height: 7px; - float: right; - margin: 6px 2px 0 10px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAOCAYAAADjXQYbAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0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ms-sel-ctn .ms-sel-item .ms-close-btn:hover{ - background-position: 0 0; -} -.ms-helper{ - color: #AAA; - font-size: 10px; - position: absolute; - top: -17px; - right: 0; -} -.ms-ctn.input-lg .ms-trigger .ms-trigger-ico { - margin-top: 17px -} -.ms-ctn.input-sm .ms-trigger .ms-trigger-ico { - margin-top: 13px -} -.ms-ctn.input-lg .ms-sel-ctn .ms-sel-item { - padding-top: 2px; - padding-bottom: 3px; -} -.ms-ctn.input-sm .ms-sel-ctn { - line-height: 15px; -} -.ms-ctn.input-sm .ms-sel-ctn .ms-sel-item { - padding-top: 1px; - padding-bottom: 1px; - margin-top:0; - margin-bottom: 0; -} -.ms-ctn.input-sm .ms-sel-ctn .ms-sel-item .ms-close-btn { - margin-top: 4px; -} -.ms-ctn .ms-sel-ctn { - margin-left: -7px; -} -.ms-ctn .ms-trigger:hover { - width:24px; - right: 1px; - border-radius: 0 3px 3px 0; -} diff --git a/api/js/jquery/magicsuggest/magicsuggest.jquery.json b/api/js/jquery/magicsuggest/magicsuggest.jquery.json deleted file mode 100644 index cf15454a16..0000000000 --- a/api/js/jquery/magicsuggest/magicsuggest.jquery.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "magicsuggest", - "title": "MagicSuggest", - "description": "MagicSuggest is a multiple selection auto suggest combo box for Bootstrap 3.", - "keywords": [ - "select", - "suggest", - "autocomplete", - "typeahead", - "dropdown", - "multiselect", - "tag", - "tagging", - "bootstrap", - "combobox" - ], - "version": "2.1.4", - "author": { - "name": "Nicolas Bize", - "url": "https://github.com/nicolasbize" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://nicolasbize.com/magicsuggest/licence.html" - } - ], - "bugs": "https://github.com/nicolasbize/magicsuggest/issues", - "homepage": "http://nicolasbize.com/magicsuggest/", - "docs": "http://nicolasbize.com/magicsuggest/doc.html", - "download": "https://github.com/nicolasbize/magicsuggest/releases", - "dependencies": { - "jquery": ">=1.8.3", - "bootstrap": ">=3.0.0" - } -} diff --git a/api/js/jquery/magicsuggest/magicsuggest.js b/api/js/jquery/magicsuggest/magicsuggest.js deleted file mode 100644 index 171a2e39a1..0000000000 --- a/api/js/jquery/magicsuggest/magicsuggest.js +++ /dev/null @@ -1,1603 +0,0 @@ -/** - * Multiple Selection Component for Bootstrap - * Check nicolasbize.github.io/magicsuggest/ for latest updates. - * - * Author: Nicolas Bize - * Created: Feb 8th 2013 - * Last Updated: Oct 16th 2014 - * Version: 2.1.4 - * Licence: MagicSuggest is licenced under MIT licence (http://opensource.org/licenses/MIT) - */ -(function($) -{ - "use strict"; - var MagicSuggest = function(element, options) - { - var ms = this; - - /** - * Initializes the MagicSuggest component - */ - var defaults = { - /********** CONFIGURATION PROPERTIES ************/ - /** - * Restricts or allows the user to validate typed entries. - * Defaults to true. - */ - allowFreeEntries: true, - - /** - * Restricts or allows the user to add the same entry more than once - * Defaults to false. - */ - allowDuplicates: false, - - /** - * Additional config object passed to each $.ajax call - */ - ajaxConfig: {}, - - /** - * If a single suggestion comes out, it is preselected. - */ - autoSelect: true, - - /** - * Auto select the first matching item with multiple items shown - */ - selectFirst: false, - - /** - * Allow customization of query parameter - */ - queryParam: 'query', - - /** - * A function triggered just before the ajax request is sent, similar to jQuery - */ - beforeSend: function(){ }, - - /** - * A custom CSS class to apply to the field's underlying element. - */ - cls: '', - - /** - * JSON Data source used to populate the combo box. 3 options are available here: - * No Data Source (default) - * When left null, the combo box will not suggest anything. It can still enable the user to enter - * multiple entries if allowFreeEntries is * set to true (default). - * Static Source - * You can pass an array of JSON objects, an array of strings or even a single CSV string as the - * data source.For ex. data: [* {id:0,name:"Paris"}, {id: 1, name: "New York"}] - * You can also pass any json object with the results property containing the json array. - * Url - * You can pass the url from which the component will fetch its JSON data.Data will be fetched - * using a POST ajax request that will * include the entered text as 'query' parameter. The results - * fetched from the server can be: - * - an array of JSON objects (ex: [{id:...,name:...},{...}]) - * - a string containing an array of JSON objects ready to be parsed (ex: "[{id:...,name:...},{...}]") - * - a JSON object whose data will be contained in the results property - * (ex: {results: [{id:...,name:...},{...}] - * Function - * You can pass a function which returns an array of JSON objects (ex: [{id:...,name:...},{...}]) - * The function can return the JSON data or it can use the first argument as function to handle the data. - * Only one (callback function or return value) is needed for the function to succeed. - * See the following example: - * function (response) { var myjson = [{name: 'test', id: 1}]; response(myjson); return myjson; } - */ - data: null, - - /** - * Additional parameters to the ajax call - */ - dataUrlParams: {}, - - /** - * Start the component in a disabled state. - */ - disabled: false, - - /** - * Name of JSON object property that defines the disabled behaviour - */ - disabledField: null, - - /** - * Name of JSON object property displayed in the combo list - */ - displayField: 'name', - - /** - * Set to false if you only want mouse interaction. In that case the combo will - * automatically expand on focus. - */ - editable: true, - - /** - * Set starting state for combo. - */ - expanded: false, - - /** - * Automatically expands combo on focus. - */ - expandOnFocus: false, - - /** - * JSON property by which the list should be grouped - */ - groupBy: null, - - /** - * Set to true to hide the trigger on the right - */ - hideTrigger: false, - - /** - * Set to true to highlight search input within displayed suggestions - */ - highlight: true, - - /** - * A custom ID for this component - */ - id: null, - - /** - * A class that is added to the info message appearing on the top-right part of the component - */ - infoMsgCls: '', - - /** - * Additional parameters passed out to the INPUT tag. Enables usage of AngularJS's custom tags for ex. - */ - inputCfg: {}, - - /** - * The class that is applied to show that the field is invalid - */ - invalidCls: 'ms-inv', - - /** - * Set to true to filter data results according to case. Useless if the data is fetched remotely - */ - matchCase: false, - - /** - * Once expanded, the combo's height will take as much room as the # of available results. - * In case there are too many results displayed, this will fix the drop down height. - */ - maxDropHeight: 290, - - /** - * Defines how long the user free entry can be. Set to null for no limit. - */ - maxEntryLength: null, - - /** - * A function that defines the helper text when the max entry length has been surpassed. - */ - maxEntryRenderer: function(v) { - return 'Please reduce your entry by ' + v + ' character' + (v > 1 ? 's':''); - }, - - /** - * The maximum number of results displayed in the combo drop down at once. - */ - maxSuggestions: null, - - /** - * The maximum number of items the user can select if multiple selection is allowed. - * Set to null to remove the limit. - */ - maxSelection: 10, - - /** - * A function that defines the helper text when the max selection amount has been reached. The function has a single - * parameter which is the number of selected elements. - */ - maxSelectionRenderer: function(v) { - return 'You cannot choose more than ' + v + ' item' + (v > 1 ? 's':''); - }, - - /** - * The method used by the ajax request. - */ - method: 'POST', - - /** - * The minimum number of characters the user must type before the combo expands and offers suggestions. - */ - minChars: 0, - - /** - * A function that defines the helper text when not enough letters are set. The function has a single - * parameter which is the difference between the required amount of letters and the current one. - */ - minCharsRenderer: function(v) { - return 'Please type ' + v + ' more character' + (v > 1 ? 's':''); - }, - - /** - * Whether or not sorting / filtering should be done remotely or locally. - * Use either 'local' or 'remote' - */ - mode: 'local', - - /** - * The name used as a form element. - */ - name: null, - - /** - * The text displayed when there are no suggestions. - */ - noSuggestionText: 'No suggestions', - - /** - * The default placeholder text when nothing has been entered - */ - placeholder: 'Type or click here', - - /** - * A function used to define how the items will be presented in the combo - */ - renderer: null, - - /** - * Whether or not this field should be required - */ - required: false, - - /** - * Set to true to render selection as a delimited string - */ - resultAsString: false, - - /** - * Text delimiter to use in a delimited string. - */ - resultAsStringDelimiter: ',', - - /** - * Name of JSON object property that represents the list of suggested objects - */ - resultsField: 'results', - - /** - * A custom CSS class to add to a selected item - */ - selectionCls: '', - - /** - * An optional element replacement in which the selection is rendered - */ - selectionContainer: null, - - /** - * Where the selected items will be displayed. Only 'right', 'bottom' and 'inner' are valid values - */ - selectionPosition: 'inner', - - /** - * A function used to define how the items will be presented in the tag list - */ - selectionRenderer: null, - - /** - * Set to true to stack the selectioned items when positioned on the bottom - * Requires the selectionPosition to be set to 'bottom' - */ - selectionStacked: false, - - /** - * Direction used for sorting. Only 'asc' and 'desc' are valid values - */ - sortDir: 'asc', - - /** - * name of JSON object property for local result sorting. - * Leave null if you do not wish the results to be ordered or if they are already ordered remotely. - */ - sortOrder: null, - - /** - * If set to true, suggestions will have to start by user input (and not simply contain it as a substring) - */ - strictSuggest: false, - - /** - * Custom style added to the component container. - */ - style: '', - - /** - * If set to true, the combo will expand / collapse when clicked upon - */ - toggleOnClick: false, - - - /** - * Amount (in ms) between keyboard registers. - */ - typeDelay: 400, - - /** - * If set to true, tab won't blur the component but will be registered as the ENTER key - */ - useTabKey: false, - - /** - * If set to true, using comma will validate the user's choice - */ - useCommaKey: true, - - - /** - * Determines whether or not the results will be displayed with a zebra table style - */ - useZebraStyle: false, - - /** - * initial value for the field - */ - value: null, - - /** - * name of JSON object property that represents its underlying value - */ - valueField: 'id', - - /** - * regular expression to validate the values against - */ - vregex: null, - - /** - * type to validate against - */ - vtype: null - }; - - var conf = $.extend({},options); - var cfg = $.extend(true, {}, defaults, conf); - - /********** PUBLIC METHODS ************/ - /** - * Add one or multiple json items to the current selection - * @param items - json object or array of json objects - * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered - */ - this.addToSelection = function(items, isSilent) - { - if (!cfg.maxSelection || _selection.length < cfg.maxSelection) { - if (!$.isArray(items)) { - items = [items]; - } - var valuechanged = false; - $.each(items, function(index, json) { - if (cfg.allowDuplicates || $.inArray(json[cfg.valueField], ms.getValue()) === -1) { - _selection.push(json); - valuechanged = true; - } - }); - if(valuechanged === true) { - self._renderSelection(); - this.empty(); - if (isSilent !== true) { - $(this).trigger('selectionchange', [this, this.getSelection()]); - } - } - } - this.input.attr('placeholder', (cfg.selectionPosition === 'inner' && this.getValue().length > 0) ? '' : cfg.placeholder); - }; - - /** - * Clears the current selection - * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered - */ - this.clear = function(isSilent) - { - this.removeFromSelection(_selection.slice(0), isSilent); // clone array to avoid concurrency issues - }; - - /** - * Collapse the drop down part of the combo - */ - this.collapse = function() - { - if (cfg.expanded === true) { - this.combobox.detach(); - cfg.expanded = false; - $(this).trigger('collapse', [this]); - } - }; - - /** - * Set the component in a disabled state. - */ - this.disable = function() - { - this.container.addClass('ms-ctn-disabled'); - cfg.disabled = true; - ms.input.attr('disabled', true); - }; - - /** - * Empties out the combo user text - */ - this.empty = function(){ - this.input.val(''); - }; - - /** - * Set the component in a enable state. - */ - this.enable = function() - { - this.container.removeClass('ms-ctn-disabled'); - cfg.disabled = false; - ms.input.attr('disabled', false); - }; - - /** - * Expand the drop drown part of the combo. - */ - this.expand = function() - { - if (!cfg.expanded && (this.input.val().length >= cfg.minChars || this.combobox.children().size() > 0)) { - this.combobox.appendTo(this.container); - self._processSuggestions(); - cfg.expanded = true; - $(this).trigger('expand', [this]); - } - }; - - /** - * Retrieve component enabled status - */ - this.isDisabled = function() - { - return cfg.disabled; - }; - - /** - * Checks whether the field is valid or not - * @return {boolean} - */ - this.isValid = function() - { - var valid = cfg.required === false || _selection.length > 0; - if(cfg.vtype || cfg.vregex){ - $.each(_selection, function(index, item){ - valid = valid && self._validateSingleItem(item[cfg.valueField]); - }); - } - return valid; - }; - - /** - * Gets the data params for current ajax request - */ - this.getDataUrlParams = function() - { - return cfg.dataUrlParams; - }; - - /** - * Gets the name given to the form input - */ - this.getName = function() - { - return cfg.name; - }; - - /** - * Retrieve an array of selected json objects - * @return {Array} - */ - this.getSelection = function() - { - return _selection; - }; - - /** - * Retrieve the current text entered by the user - */ - this.getRawValue = function(){ - return ms.input.val(); - }; - - /** - * Retrieve an array of selected values - */ - this.getValue = function() - { - return $.map(_selection, function(o) { - return o[cfg.valueField]; - }); - }; - - /** - * Remove one or multiples json items from the current selection - * @param items - json object or array of json objects - * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered - */ - this.removeFromSelection = function(items, isSilent) - { - if (!$.isArray(items)) { - items = [items]; - } - var valuechanged = false; - $.each(items, function(index, json) { - var i = $.inArray(json[cfg.valueField], ms.getValue()); - if (i > -1) { - _selection.splice(i, 1); - valuechanged = true; - } - }); - if (valuechanged === true) { - self._renderSelection(); - if(isSilent !== true){ - $(this).trigger('selectionchange', [this, this.getSelection()]); - } - if(cfg.expandOnFocus){ - ms.expand(); - } - if(cfg.expanded) { - self._processSuggestions(); - } - } - this.input.attr('placeholder', (cfg.selectionPosition === 'inner' && this.getValue().length > 0) ? '' : cfg.placeholder); - }; - - /** - * Get current data - */ - this.getData = function(){ - return _cbData; - }; - - /** - * Set up some combo data after it has been rendered - * @param data - */ - this.setData = function(data){ - cfg.data = data; - self._processSuggestions(); - }; - - /** - * Set the maximum allowed selections - * @param {integer} name - */ - this.setMaxSelection = function(max) - { - cfg.maxSelection = max; - }; - - /** - * Sets the name for the input field so it can be fetched in the form - * @param name - */ - this.setName = function(name){ - cfg.name = name; - if(name){ - cfg.name += name.indexOf('[]') > 0 ? '' : '[]'; - } - if(ms._valueContainer){ - $.each(ms._valueContainer.children(), function(i, el){ - el.name = cfg.name; - }); - } - }; - - /** - * Sets the current selection with the JSON items provided - * @param items - */ - this.setSelection = function(items){ - this.clear(); - this.addToSelection(items); - }; - - /** - * Sets a value for the combo box. Value must be an array of values with data type matching valueField one. - * @param data - */ - this.setValue = function(values) - { - var items = []; - - $.each(values, function(index, value) { - // first try to see if we have the full objects from our data set - var found = false; - $.each(_cbData, function(i,item){ - if(item[cfg.valueField] == value){ - items.push(item); - found = true; - return false; - } - }); - if(!found){ - if(typeof(value) === 'object'){ - items.push(value); - } else { - var json = {}; - json[cfg.valueField] = value; - json[cfg.displayField] = value; - items.push(json); - } - } - }); - if(items.length > 0) { - this.addToSelection(items); - } - }; - - /** - * Sets data params for subsequent ajax requests - * @param params - */ - this.setDataUrlParams = function(params) - { - cfg.dataUrlParams = $.extend({},params); - }; - - /********** PRIVATE ************/ - var _selection = [], // selected objects - _comboItemHeight = 0, // height for each combo item. - _timer, - _hasFocus = false, - _groups = null, - _cbData = [], - _ctrlDown = false, - _cntInMf = false, // Content is in modification mode. - KEYCODES = { - BACKSPACE: 8, - TAB: 9, - ENTER: 13, - CTRL: 17, - ESC: 27, - SPACE: 32, - UPARROW: 38, - DOWNARROW: 40, - COMMA: 188 - }; - - var self = { - - /** - * Empties the result container and refills it with the array of json results in input - * @private - */ - _displaySuggestions: function(data) { - ms.combobox.show(); - ms.combobox.empty(); - - var resHeight = 0, // total height taken by displayed results. - nbGroups = 0; - - if(_groups === null) { - self._renderComboItems(data); - resHeight = _comboItemHeight * data.length; - } - else { - for(var grpName in _groups) { - nbGroups += 1; - $('
', { - 'class': 'ms-res-group', - html: grpName - }).appendTo(ms.combobox); - self._renderComboItems(_groups[grpName].items, true); - } - var _groupItemHeight = ms.combobox.find('.ms-res-group').outerHeight(); - if(_groupItemHeight !== null) { - var tmpResHeight = nbGroups * _groupItemHeight; - resHeight = (_comboItemHeight * data.length) + tmpResHeight; - } else { - resHeight = _comboItemHeight * (data.length + nbGroups); - } - } - - if(resHeight < ms.combobox.height() || resHeight <= cfg.maxDropHeight) { - ms.combobox.height(resHeight); - } - else if(resHeight >= ms.combobox.height() && resHeight > cfg.maxDropHeight) { - ms.combobox.height(cfg.maxDropHeight); - } - - if(data.length === 1 && cfg.autoSelect === true) { - ms.combobox.children().filter(':not(.ms-res-item-disabled):last').addClass('ms-res-item-active'); - } - - if (cfg.selectFirst === true) { - ms.combobox.children().filter(':not(.ms-res-item-disabled):first').addClass('ms-res-item-active'); - } - - if(data.length === 0 && ms.getRawValue() !== "") { - var noSuggestionText = cfg.noSuggestionText.replace(/\{\{.*\}\}/, ms.input.val()); - self._updateHelper(noSuggestionText); - ms.collapse(); - } - - // When free entry is off, add invalid class to input if no data matches - if(cfg.allowFreeEntries === false) { - if(data.length === 0) { - $(ms.input).addClass(cfg.invalidCls); - ms.combobox.hide(); - } else { - $(ms.input).removeClass(cfg.invalidCls); - } - } - }, - - /** - * Returns an array of json objects from an array of strings. - * @private - */ - _getEntriesFromStringArray: function(data) { - var json = []; - $.each(data, function(index, s) { - var entry = {}; - entry[cfg.displayField] = entry[cfg.valueField] = $.trim(s); - json.push(entry); - }); - return json; - }, - - /** - * Replaces html with highlighted html according to case - * @param html - * @private - */ - _highlightSuggestion: function(html) { - var q = ms.input.val(); - - //escape special regex characters - var specialCharacters = ['^', '$', '*', '+', '?', '.', '(', ')', ':', '!', '|', '{', '}', '[', ']']; - - $.each(specialCharacters, function (index, value) { - q = q.replace(value, "\\" + value); - }) - - if(q.length === 0) { - return html; // nothing entered as input - } - - var glob = cfg.matchCase === true ? 'g' : 'gi'; - return html.replace(new RegExp('(' + q + ')(?!([^<]+)?>)', glob), '$1'); - }, - - /** - * Moves the selected cursor amongst the list item - * @param dir - 'up' or 'down' - * @private - */ - _moveSelectedRow: function(dir) { - if(!cfg.expanded) { - ms.expand(); - } - var list, start, active, scrollPos; - list = ms.combobox.find(".ms-res-item:not(.ms-res-item-disabled)"); - if(dir === 'down') { - start = list.eq(0); - } - else { - start = list.filter(':last'); - } - active = ms.combobox.find('.ms-res-item-active:not(.ms-res-item-disabled):first'); - if(active.length > 0) { - if(dir === 'down') { - start = active.nextAll('.ms-res-item:not(.ms-res-item-disabled)').first(); - if(start.length === 0) { - start = list.eq(0); - } - scrollPos = ms.combobox.scrollTop(); - ms.combobox.scrollTop(0); - if(start[0].offsetTop + start.outerHeight() > ms.combobox.height()) { - ms.combobox.scrollTop(scrollPos + _comboItemHeight); - } - } - else { - start = active.prevAll('.ms-res-item:not(.ms-res-item-disabled)').first(); - if(start.length === 0) { - start = list.filter(':last'); - ms.combobox.scrollTop(_comboItemHeight * list.length); - } - if(start[0].offsetTop < ms.combobox.scrollTop()) { - ms.combobox.scrollTop(ms.combobox.scrollTop() - _comboItemHeight); - } - } - } - list.removeClass("ms-res-item-active"); - start.addClass("ms-res-item-active"); - }, - - /** - * According to given data and query, sort and add suggestions in their container - * @private - */ - _processSuggestions: function(source) { - var json = null, data = source || cfg.data; - if(data !== null) { - if(typeof(data) === 'function'){ - data = data.call(ms, ms.getRawValue(),cfg); - } - if(typeof(data) === 'string') { // get results from ajax - $(ms).trigger('beforeload', [ms]); - var queryParams = {} - queryParams[cfg.queryParam] = ms.input.val(); - var params = $.extend(queryParams, cfg.dataUrlParams); - $.ajax($.extend({ - type: cfg.method, - url: data, - data: params, - beforeSend: cfg.beforeSend, - success: function(asyncData){ - json = typeof(asyncData) === 'string' ? JSON.parse(asyncData) : asyncData; - self._processSuggestions(json); - $(ms).trigger('load', [ms, json]); - if(self._asyncValues){ - ms.setValue(typeof(self._asyncValues) === 'string' ? JSON.parse(self._asyncValues) : self._asyncValues); - self._renderSelection(); - delete(self._asyncValues); - } - }, - error: function(){ - throw("Could not reach server"); - } - }, cfg.ajaxConfig)); - return; - } else { // results from local array - if(data.length > 0 && typeof(data[0]) === 'string') { // results from array of strings - _cbData = self._getEntriesFromStringArray(data); - } else { // regular json array or json object with results property - _cbData = data[cfg.resultsField] || data; - } - } - var sortedData = cfg.mode === 'remote' ? _cbData : self._sortAndTrim(_cbData); - self._displaySuggestions(self._group(sortedData)); - - } - }, - - /** - * Render the component to the given input DOM element - * @private - */ - _render: function(el) { - ms.setName(cfg.name); // make sure the form name is correct - // holds the main div, will relay the focus events to the contained input element. - ms.container = $('
', { - 'class': 'ms-ctn form-control ' + (cfg.resultAsString ? 'ms-as-string ' : '') + cfg.cls + - ($(el).hasClass('input-lg') ? ' input-lg' : '') + - ($(el).hasClass('input-sm') ? ' input-sm' : '') + - (cfg.disabled === true ? ' ms-ctn-disabled' : '') + - (cfg.editable === true ? '' : ' ms-ctn-readonly') + - (cfg.hideTrigger === false ? '' : ' ms-no-trigger'), - style: cfg.style, - id: cfg.id - }); - ms.container.focus($.proxy(handlers._onFocus, this)); - ms.container.blur($.proxy(handlers._onBlur, this)); - ms.container.keydown($.proxy(handlers._onKeyDown, this)); - ms.container.keyup($.proxy(handlers._onKeyUp, this)); - - // holds the input field - ms.input = $('', $.extend({ - type: 'text', - 'class': cfg.editable === true ? '' : ' ms-input-readonly', - readonly: !cfg.editable, - placeholder: cfg.placeholder, - disabled: cfg.disabled - }, cfg.inputCfg)); - - ms.input.focus($.proxy(handlers._onInputFocus, this)); - ms.input.click($.proxy(handlers._onInputClick, this)); - - // holds the suggestions. will always be placed on focus - ms.combobox = $('
', { - 'class': 'ms-res-ctn dropdown-menu' - }).height(cfg.maxDropHeight); - - // bind the onclick and mouseover using delegated events (needs jQuery >= 1.7) - ms.combobox.on('click', 'div.ms-res-item', $.proxy(handlers._onComboItemSelected, this)); - ms.combobox.on('mouseover', 'div.ms-res-item', $.proxy(handlers._onComboItemMouseOver, this)); - - if(cfg.selectionContainer){ - ms.selectionContainer = cfg.selectionContainer; - $(ms.selectionContainer).addClass('ms-sel-ctn'); - } else { - ms.selectionContainer = $('
', { - 'class': 'ms-sel-ctn' - }); - } - ms.selectionContainer.click($.proxy(handlers._onFocus, this)); - - if(cfg.selectionPosition === 'inner' && !cfg.selectionContainer) { - ms.selectionContainer.append(ms.input); - } - else { - ms.container.append(ms.input); - } - - ms.helper = $('', { - 'class': 'ms-helper ' + cfg.infoMsgCls - }); - self._updateHelper(); - ms.container.append(ms.helper); - - - // Render the whole thing - $(el).replaceWith(ms.container); - - if(!cfg.selectionContainer){ - switch(cfg.selectionPosition) { - case 'bottom': - ms.selectionContainer.insertAfter(ms.container); - if(cfg.selectionStacked === true) { - ms.selectionContainer.width(ms.container.width()); - ms.selectionContainer.addClass('ms-stacked'); - } - break; - case 'right': - ms.selectionContainer.insertAfter(ms.container); - ms.container.css('float', 'left'); - break; - default: - ms.container.append(ms.selectionContainer); - break; - } - } - - - // holds the trigger on the right side - if(cfg.hideTrigger === false) { - ms.trigger = $('
', { - 'class': 'ms-trigger', - html: '
' - }); - ms.trigger.click($.proxy(handlers._onTriggerClick, this)); - ms.container.append(ms.trigger); - } - - $(window).resize($.proxy(handlers._onWindowResized, this)); - - // do not perform an initial call if we are using ajax unless we have initial values - if((cfg.value !== null || cfg.data !== null) && ms.container.is(':visible')){ - if(typeof(cfg.data) === 'string'){ - self._asyncValues = cfg.value; - self._processSuggestions(); - } else { - self._processSuggestions(); - if(cfg.value !== null){ - ms.setValue(cfg.value); - self._renderSelection(); - } - } - - } - - $("body").click(function(e) { - if(ms.container.hasClass('ms-ctn-focus') && - ms.container.has(e.target).length === 0 && - e.target.className.indexOf('ms-res-item') < 0 && - e.target.className.indexOf('ms-close-btn') < 0 && - ms.container[0] !== e.target) { - handlers._onBlur(); - } - }); - - if(cfg.expanded === true) { - cfg.expanded = false; - ms.expand(); - } - }, - - /** - * Renders each element within the combo box - * @private - */ - _renderComboItems: function(items, isGrouped) { - var ref = this, html = ''; - $.each(items, function(index, value) { - var displayed = cfg.renderer !== null ? cfg.renderer.call(ref, value) : value[cfg.displayField]; - var disabled = cfg.disabledField !== null && value[cfg.disabledField] === true; - var resultItemEl = $('
', { - 'class': 'ms-res-item ' + (isGrouped ? 'ms-res-item-grouped ':'') + - (disabled ? 'ms-res-item-disabled ':'') + - (index % 2 === 1 && cfg.useZebraStyle === true ? 'ms-res-odd' : ''), - html: cfg.highlight === true ? self._highlightSuggestion(displayed) : displayed, - 'data-json': JSON.stringify(value) - }); - html += $('
').append(resultItemEl).html(); - }); - ms.combobox.append(html); - _comboItemHeight = ms.combobox.find('.ms-res-item:first').outerHeight(); - }, - - /** - * Renders the selected items into their container. - * @private - */ - _renderSelection: function() { - var ref = this, w = 0, inputOffset = 0, items = [], - asText = cfg.resultAsString === true && !_hasFocus; - - ms.selectionContainer.find('.ms-sel-item').remove(); - if(ms._valueContainer !== undefined) { - ms._valueContainer.remove(); - } - - $.each(_selection, function(index, value){ - - var selectedItemEl, delItemEl, - selectedItemHtml = cfg.selectionRenderer !== null ? cfg.selectionRenderer.call(ref, value) : value[cfg.displayField]; - - var validCls = self._validateSingleItem(value[cfg.displayField]) ? '' : ' ms-sel-invalid'; - - // tag representing selected value - if(asText === true) { - selectedItemEl = $('
', { - 'class': 'ms-sel-item ms-sel-text ' + cfg.selectionCls + validCls, - html: selectedItemHtml + (index === (_selection.length - 1) ? '' : cfg.resultAsStringDelimiter) - }).data('json', value); - } - else { - selectedItemEl = $('
', { - 'class': 'ms-sel-item ' + cfg.selectionCls + validCls, - html: selectedItemHtml - }).data('json', value); - - if(cfg.disabled === false){ - // small cross img - delItemEl = $('', { - 'class': 'ms-close-btn' - }).data('json', value).appendTo(selectedItemEl); - - delItemEl.click($.proxy(handlers._onTagTriggerClick, ref)); - if (cfg.allowFreeEntries === true){ - selectedItemEl.dblclick($.proxy(handlers._onTagEditTriggerDblClick, ref)); - } - } - } - - items.push(selectedItemEl); - }); - ms.selectionContainer.prepend(items); - - // store the values, behaviour of multiple select - ms._valueContainer = $('
', { - style: 'display: none;' - }); - $.each(ms.getValue(), function(i, val){ - var el = $('', { - type: 'hidden', - name: cfg.name, - value: val - }); - el.appendTo(ms._valueContainer); - }); - ms._valueContainer.appendTo(ms.selectionContainer); - - if(cfg.selectionPosition === 'inner' && !cfg.selectionContainer && (ms.container.is(':visible')||ms.getValue().length>0)) { - var inputPadding = ms.input.outerWidth(true) - ms.input.width(); - ms.input.width(0); - inputOffset = Math.max(0,ms.input.offset().left - ms.selectionContainer.offset().left); - w = ms.container.width() - inputOffset - (cfg.hideTrigger ? inputPadding : 42); - ms.input.width(w); - } - - if(_selection.length === cfg.maxSelection){ - self._updateHelper(cfg.maxSelectionRenderer.call(this, _selection.length)); - } else { - ms.helper.hide(); - } - }, - - /** - * Select an item either through keyboard or mouse - * @param item - * @private - */ - _selectItem: function(item) { - if(cfg.maxSelection === 1){ - _selection = []; - } - ms.addToSelection(item.data('json')); - item.removeClass('ms-res-item-active'); - if(cfg.expandOnFocus === false || _selection.length === cfg.maxSelection){ - ms.collapse(); - } - if(!_hasFocus){ - ms.input.focus(); - } else if(_hasFocus && (cfg.expandOnFocus || _ctrlDown)){ - self._processSuggestions(); - if(_ctrlDown){ - ms.expand(); - } - } - }, - - /** - * Sorts the results and cut them down to max # of displayed results at once - * @private - */ - _sortAndTrim: function(data) { - var q = ms.getRawValue(), - filtered = [], - newSuggestions = [], - selectedValues = ms.getValue(); - // filter the data according to given input - if(q.length > 0) { - $.each(data, function(index, obj) { - var name = obj[cfg.displayField]; - if((cfg.matchCase === true && name.indexOf(q) > -1) || - (cfg.matchCase === false && name.toLowerCase().indexOf(q.toLowerCase()) > -1)) { - if(cfg.strictSuggest === false || name.toLowerCase().indexOf(q.toLowerCase()) === 0) { - filtered.push(obj); - } - } - }); - } - else { - filtered = data; - } - // take out the ones that have already been selected - $.each(filtered, function(index, obj) { - if (cfg.allowDuplicates || $.inArray(obj[cfg.valueField], selectedValues) === -1) { - newSuggestions.push(obj); - } - }); - // sort the data - if(cfg.sortOrder !== null) { - newSuggestions.sort(function(a,b) { - if(a[cfg.sortOrder] < b[cfg.sortOrder]) { - return cfg.sortDir === 'asc' ? -1 : 1; - } - if(a[cfg.sortOrder] > b[cfg.sortOrder]) { - return cfg.sortDir === 'asc' ? 1 : -1; - } - return 0; - }); - } - // trim it down - if(cfg.maxSuggestions && cfg.maxSuggestions > 0) { - newSuggestions = newSuggestions.slice(0, cfg.maxSuggestions); - } - return newSuggestions; - - }, - - _group: function(data){ - // build groups - if(cfg.groupBy !== null) { - _groups = {}; - - $.each(data, function(index, value) { - var props = cfg.groupBy.indexOf('.') > -1 ? cfg.groupBy.split('.') : cfg.groupBy; - var prop = value[cfg.groupBy]; - if(typeof(props) != 'string'){ - prop = value; - while(props.length > 0){ - prop = prop[props.shift()]; - } - } - if(_groups[prop] === undefined) { - _groups[prop] = {title: prop, items: [value]}; - } - else { - _groups[prop].items.push(value); - } - }); - } - return data; - }, - - /** - * Update the helper text - * @private - */ - _updateHelper: function(html) { - ms.helper.html(html); - if(!ms.helper.is(":visible")) { - ms.helper.fadeIn(); - } - }, - - /** - * Validate an item against vtype or vregex - * @private - */ - _validateSingleItem: function(value){ - if(cfg.vregex !== null && cfg.vregex instanceof RegExp){ - return cfg.vregex.test(value); - } else if(cfg.vtype !== null) { - switch(cfg.vtype){ - case 'alpha': - return (/^[a-zA-Z_]+$/).test(value); - case 'alphanum': - return (/^[a-zA-Z0-9_]+$/).test(value); - case 'email': - return (/^(\w+)([\-+.][\w]+)*@(\w[\-\w]*\.){1,5}([A-Za-z]){2,6}$/).test(value); - case 'url': - return (/(((^https?)|(^ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i).test(value); - case 'ipaddress': - return (/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/).test(value); - } - } - return true; - } - }; - - var handlers = { - /** - * Triggered when blurring out of the component - * @private - */ - _onBlur: function() { - ms.container.removeClass('ms-ctn-focus'); - ms.collapse(); - _cntInMf = false; - _hasFocus = false; - if(ms.getRawValue() !== '' && cfg.allowFreeEntries === true){ - var obj = {}; - obj[cfg.displayField] = obj[cfg.valueField] = ms.getRawValue().trim(); - ms.addToSelection(obj); - } - self._renderSelection(); - - if(ms.isValid() === false) { - ms.container.addClass(cfg.invalidCls); - } - - else if(ms.input.val() !== '' && cfg.allowFreeEntries === false) { - ms.empty(); - self._updateHelper(''); - } - - $(ms).trigger('blur', [ms]); - }, - - /** - * Triggered when hovering an element in the combo - * @param e - * @private - */ - _onComboItemMouseOver: function(e) { - var target = $(e.currentTarget); - if(!target.hasClass('ms-res-item-disabled')){ - ms.combobox.children().removeClass('ms-res-item-active'); - target.addClass('ms-res-item-active'); - } - }, - - /** - * Triggered when an item is chosen from the list - * @param e - * @private - */ - _onComboItemSelected: function(e) { - var target = $(e.currentTarget); - if(!target.hasClass('ms-res-item-disabled')){ - self._selectItem($(e.currentTarget)); - } - }, - - /** - * Triggered when focusing on the container div. Will focus on the input field instead. - * @private - */ - _onFocus: function() { - if (!_cntInMf) - { - ms.input.focus(); - } - else - { - _cntInMf = false; - } - }, - - /** - * Triggered when clicking on the input text field - * @private - */ - _onInputClick: function(){ - if (ms.isDisabled() === false && _hasFocus && !_cntInMf) { - if (cfg.toggleOnClick === true) { - if (cfg.expanded){ - ms.collapse(); - } else { - ms.expand(); - } - } - } - }, - - /** - * Triggered when focusing on the input text field. - * @private - */ - _onInputFocus: function() { - if(ms.isDisabled() === false && !_hasFocus && !_cntInMf) { - _hasFocus = true; - ms.container.addClass('ms-ctn-focus'); - ms.container.removeClass(cfg.invalidCls); - - var curLength = ms.getRawValue().length; - if(cfg.expandOnFocus === true){ - ms.expand(); - } - - if(_selection.length === cfg.maxSelection) { - self._updateHelper(cfg.maxSelectionRenderer.call(this, _selection.length)); - } else if(curLength < cfg.minChars) { - self._updateHelper(cfg.minCharsRenderer.call(this, cfg.minChars - curLength)); - } - - setTimeout(function(){self._renderSelection()},400); - $(ms).trigger('focus', [ms]); - } - }, - - /** - * Triggered when the user presses a key while the component has focus - * This is where we want to handle all keys that don't require the user input field - * since it hasn't registered the key hit yet - * @param e keyEvent - * @private - */ - _onKeyDown: function(e) { - // check how tab should be handled - var active = ms.combobox.find('.ms-res-item-active:not(.ms-res-item-disabled):first'), - freeInput = ms.input.val(); - $(ms).trigger('keydown', [ms, e]); - - if(e.keyCode === KEYCODES.TAB && (cfg.useTabKey === false || - (cfg.useTabKey === true && active.length === 0 && ms.input.val().length === 0))) { - handlers._onBlur(); - return; - } - switch(e.keyCode) { - case KEYCODES.BACKSPACE: - if(freeInput.length === 0 && ms.getSelection().length > 0 && cfg.selectionPosition === 'inner') { - _selection.pop(); - self._renderSelection(); - $(ms).trigger('selectionchange', [ms, ms.getSelection()]); - ms.input.attr('placeholder', (cfg.selectionPosition === 'inner' && ms.getValue().length > 0) ? '' : cfg.placeholder); - ms.input.focus(); - e.preventDefault(); - } - break; - case KEYCODES.TAB: - case KEYCODES.ESC: - e.preventDefault(); - break; - case KEYCODES.ENTER: - if(freeInput !== '' || cfg.expanded){ - e.preventDefault(); - } - break; - case KEYCODES.COMMA: - if(cfg.useCommaKey === true){ - e.preventDefault(); - } - break; - case KEYCODES.CTRL: - _ctrlDown = true; - break; - case KEYCODES.DOWNARROW: - e.preventDefault(); - self._moveSelectedRow("down"); - break; - case KEYCODES.UPARROW: - e.preventDefault(); - self._moveSelectedRow("up"); - break; - default: - if(_selection.length === cfg.maxSelection) { - e.preventDefault(); - } - break; - } - }, - - /** - * Triggered when a key is released while the component has focus - * @param e - * @private - */ - _onKeyUp: function(e) { - var freeInput = ms.getRawValue(), - inputValid = $.trim(ms.input.val()).length > 0 && - (!cfg.maxEntryLength || $.trim(ms.input.val()).length <= cfg.maxEntryLength), - selected, - obj = {}; - - $(ms).trigger('keyup', [ms, e]); - - clearTimeout(_timer); - - // collapse if escape, but keep focus. - if(e.keyCode === KEYCODES.ESC && cfg.expanded) { - ms.combobox.hide(); - } - // ignore a bunch of keys - if((e.keyCode === KEYCODES.TAB && cfg.useTabKey === false) || (e.keyCode > KEYCODES.ENTER && e.keyCode < KEYCODES.SPACE)) { - if(e.keyCode === KEYCODES.CTRL){ - _ctrlDown = false; - } - return; - } - switch(e.keyCode) { - case KEYCODES.UPARROW: - case KEYCODES.DOWNARROW: - e.preventDefault(); - break; - case KEYCODES.ENTER: - case KEYCODES.TAB: - case KEYCODES.COMMA: - if(e.keyCode !== KEYCODES.COMMA || cfg.useCommaKey === true) { - e.preventDefault(); - if(cfg.expanded === true){ // if a selection is performed, select it and reset field - selected = ms.combobox.find('.ms-res-item-active:not(.ms-res-item-disabled):first'); - if(selected.length > 0) { - self._selectItem(selected); - return; - } - } - // if no selection or if freetext entered and free entries allowed, add new obj to selection - if(inputValid === true && cfg.allowFreeEntries === true) { - obj[cfg.displayField] = obj[cfg.valueField] = freeInput.trim(); - ms.addToSelection(obj); - ms.collapse(); // reset combo suggestions - ms.input.focus(); - } - break; - } - default: - if(_selection.length === cfg.maxSelection){ - self._updateHelper(cfg.maxSelectionRenderer.call(this, _selection.length)); - } - else { - if(freeInput.length < cfg.minChars) { - self._updateHelper(cfg.minCharsRenderer.call(this, cfg.minChars - freeInput.length)); - if(cfg.expanded === true) { - ms.collapse(); - } - } - else if(cfg.maxEntryLength && freeInput.length > cfg.maxEntryLength) { - self._updateHelper(cfg.maxEntryRenderer.call(this, freeInput.length - cfg.maxEntryLength)); - if(cfg.expanded === true) { - ms.collapse(); - } - } - else { - ms.helper.hide(); - if(cfg.minChars <= freeInput.length){ - _timer = setTimeout(function() { - if(cfg.expanded === true) { - self._processSuggestions(); - } else { - ms.expand(); - } - }, cfg.typeDelay); - } - } - } - break; - } - }, - - /** - * Triggered when clicking upon cross for deletion - * @param e - * @private - */ - _onTagTriggerClick: function(e) { - ms.removeFromSelection($(e.currentTarget).data('json')); - }, - - /** - * Triggerd when double clicking upon selected item in order to edit its content - * @param e - * @private - */ - _onTagEditTriggerDblClick: function(e) { - var itemData = $(e.currentTarget).data('json'); - if (ms.input.val() === '') - { - ms.input.val(itemData.label); - ms.removeFromSelection(itemData); - ms.input.select(); - _cntInMf = true; // item is in modification mode - } - }, - - /** - * Triggered when clicking on the small trigger in the right - * @private - */ - _onTriggerClick: function() { - if(ms.isDisabled() === false && !(cfg.expandOnFocus === true && _selection.length === cfg.maxSelection)) { - $(ms).trigger('triggerclick', [ms]); - if(cfg.expanded === true) { - ms.collapse(); - } else { - var curLength = ms.getRawValue().length; - if(curLength >= cfg.minChars){ - ms.input.focus(); - ms.expand(); - } else { - self._updateHelper(cfg.minCharsRenderer.call(this, cfg.minChars - curLength)); - } - } - } - }, - - /** - * Triggered when the browser window is resized - * @private - */ - _onWindowResized: function() { - self._renderSelection(); - } - }; - - // startup point - if(element !== null) { - self._render(element); - } - }; - - $.fn.magicSuggest = function(options) { - var obj = $(this); - - if(obj.size() === 1 && obj.data('magicSuggest')) { - return obj.data('magicSuggest'); - } - - obj.each(function(i) { - // assume $(this) is an element - var cntr = $(this); - - // Return early if this element already has a plugin instance - if(cntr.data('magicSuggest')){ - return; - } - - if(this.nodeName.toLowerCase() === 'select'){ // rendering from select - options.data = []; - options.value = []; - $.each(this.children, function(index, child){ - if(child.nodeName && child.nodeName.toLowerCase() === 'option'){ - options.data.push({id: child.value, name: child.text}); - if($(child).attr('selected')){ - options.value.push(child.value); - } - } - }); - } - - var def = {}; - // set values from DOM container element - $.each(this.attributes, function(i, att){ - def[att.name] = att.name === 'value' && att.value !== '' ? JSON.parse(att.value) : att.value; - }); - - var field = new MagicSuggest(this, $.extend([], $.fn.magicSuggest.defaults, options, def)); - cntr.data('magicSuggest', field); - field.container.data('magicSuggest', field); - }); - - if(obj.size() === 1) { - return obj.data('magicSuggest'); - } - return obj; - }; - - $.fn.magicSuggest.defaults = {}; -})(jQuery); \ No newline at end of file diff --git a/api/templates/default/etemplate2.css b/api/templates/default/etemplate2.css index c21266ee7a..0afe7fc9d0 100644 --- a/api/templates/default/etemplate2.css +++ b/api/templates/default/etemplate2.css @@ -7,7 +7,7 @@ * Magic suggest / tag list widget */ /* These imports processed by framework */ -/*@import url("../../js/jquery/magicsuggest/magicsuggest.css");*/ +/*@import url("../../../vendor/egroupware/magicsuggest/magicsuggest.css");*/ /*@import url("../../js/jquery/jpicker/css/jPicker-1.1.6.min.css");*/ /*@import url("../../js/jquery/jquery-ui-timepicker-addon.css");*/ /*@import url("../../js/jquery/blueimp/css/blueimp-gallery.min.css");*/ @@ -1000,6 +1000,16 @@ ul.et2_link_string { background-repeat: no-repeat; margin: 2px -16px 0 10px; } +.et2_taglist div.ms-sel-ctn .ms-edit-btn, +.et2_taglist div.ms-sel-ctn .ms-check-btn{ + width: 10px; + height: 10px; + background-position: 0px -10px; + background-size: cover; + background-repeat: no-repeat; + margin: 2px 10px 0 2px; +} +.et2_taglist div.ms-sel-ctn span.ms-check-btn {margin: 2px 10px 0 10px;} .et2_taglist .ms-res-ctn { position:absolute; background: #FFF; diff --git a/composer.json b/composer.json index 470a0fe931..09ca9ccc53 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,8 @@ "npm-asset/as-jqplot" : "1.0.*", "npm-asset/gridster":"0.5.*", "adldap2/adldap2": "=4.0.4", - "egroupware/ckeditor": "^4" + "egroupware/ckeditor": "^4", + "egroupware/magicsuggest": "^2.1" }, "require-dev": { } diff --git a/composer.lock b/composer.lock index ae50841323..4dc79193cc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "881022c01663ee3c186a83514fabe1c2", + "hash": "84b694bd9f6a9580e983b49e7ca2d4d5", + "content-hash": "82677726f3064e3f1ecadf479a569d3f", "packages": [ { "name": "adldap2/adldap2", @@ -54,7 +55,7 @@ "ldap", "windows" ], - "time": "2016-07-14T18:11:24+00:00" + "time": "2016-07-14 18:11:24" }, { "name": "bower-asset/cropper", @@ -216,6 +217,110 @@ "bower-asset-ignore": [] } }, + { + "name": "components/bootstrap", + "version": "4.1.1", + "source": { + "type": "git", + "url": "https://github.com/components/bootstrap.git", + "reference": "6c183f17f5d8fbfb38af412c5e0a52135f7d01c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/components/bootstrap/zipball/6c183f17f5d8fbfb38af412c5e0a52135f7d01c9", + "reference": "6c183f17f5d8fbfb38af412c5e0a52135f7d01c9", + "shasum": "" + }, + "require": { + "components/jquery": ">=2" + }, + "type": "component", + "extra": { + "component": { + "scripts": [ + "js/bootstrap.js" + ], + "files": [ + "js/*.js", + "css/*.css", + "css/*.map" + ], + "shim": { + "deps": [ + "jquery" + ] + } + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jacob Thornton", + "email": "jacobthornton@gmail.com" + }, + { + "name": "Mark Otto", + "email": "markdotto@gmail.com" + } + ], + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", + "homepage": "http://getbootstrap.com", + "keywords": [ + "css", + "framework", + "front-end", + "mobile-first", + "responsive", + "sass", + "web" + ], + "time": "2018-05-06 21:06:16" + }, + { + "name": "components/jquery", + "version": "3.3.1", + "source": { + "type": "git", + "url": "https://github.com/components/jquery.git", + "reference": "459648cda77875519c5da3ae1dd0ed5d170aa649" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/components/jquery/zipball/459648cda77875519c5da3ae1dd0ed5d170aa649", + "reference": "459648cda77875519c5da3ae1dd0ed5d170aa649", + "shasum": "" + }, + "type": "component", + "extra": { + "component": { + "scripts": [ + "jquery.js" + ], + "files": [ + "jquery.min.js", + "jquery.min.map", + "jquery.slim.js", + "jquery.slim.min.js", + "jquery.slim.min.map" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "JS Foundation and other contributors" + } + ], + "description": "jQuery JavaScript Library", + "homepage": "http://jquery.com", + "time": "2018-03-04 13:23:48" + }, { "name": "egroupware/ckeditor", "version": "v4.9.2", @@ -250,6 +355,43 @@ "homepage": "https://github.com/EGroupware/ckeditor", "time": "2018-05-08 13:42:32" }, + { + "name": "egroupware/magicsuggest", + "version": "2.1.5", + "source": { + "type": "git", + "url": "https://github.com/EGroupware/magicsuggest.git", + "reference": "2818189cd8ae69b1ab6dccd5d4516ffa19b92e55" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/EGroupware/magicsuggest/zipball/2818189cd8ae69b1ab6dccd5d4516ffa19b92e55", + "reference": "2818189cd8ae69b1ab6dccd5d4516ffa19b92e55", + "shasum": "" + }, + "require": { + "components/bootstrap": ">=3.0.0", + "components/jquery": ">=1.8.3" + }, + "type": "component", + "extra": { + "component": { + "scripts": [ + "magicsuggest.js" + ], + "files": [ + "magicsuggest.css" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Compiled version of magicsuggest customized for EGroupware project.", + "homepage": "https://github.com/EGroupware/magicsuggest", + "time": "2018-06-21 10:14:03" + }, { "name": "fxp/composer-asset-plugin", "version": "v1.2.2", @@ -1569,9 +1711,7 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "php": 15 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/mail/templates/mobile/app.css b/mail/templates/mobile/app.css index 884366f76f..fdf11d4a20 100644 --- a/mail/templates/mobile/app.css +++ b/mail/templates/mobile/app.css @@ -1155,7 +1155,9 @@ body { #mail-compose .mailComposeHeaders span.ms-close-btn, #mail-compose .mailComposeHeadersSection span.ms-close-btn, #mail-compose .mailComposeHeaders span.ms-edit-btn, -#mail-compose .mailComposeHeadersSection span.ms-edit-btn { +#mail-compose .mailComposeHeadersSection span.ms-edit-btn, +#mail-compose .mailComposeHeaders span.ms-check-btn, +#mail-compose .mailComposeHeadersSection span.ms-check-btn { padding-right: 0px; } #mail-compose .mailComposeHeaders div, diff --git a/mail/templates/pixelegg/app.css b/mail/templates/pixelegg/app.css index cb51d873eb..10320b0635 100755 --- a/mail/templates/pixelegg/app.css +++ b/mail/templates/pixelegg/app.css @@ -1143,7 +1143,9 @@ body { #mail-compose .mailComposeHeaders span.ms-close-btn, #mail-compose .mailComposeHeadersSection span.ms-close-btn, #mail-compose .mailComposeHeaders span.ms-edit-btn, -#mail-compose .mailComposeHeadersSection span.ms-edit-btn { +#mail-compose .mailComposeHeadersSection span.ms-edit-btn, +#mail-compose .mailComposeHeaders span.ms-check-btn, +#mail-compose .mailComposeHeadersSection span.ms-check-btn { padding-right: 0px; } #mail-compose .mailComposeHeaders div, diff --git a/mail/templates/pixelegg/app.less b/mail/templates/pixelegg/app.less index 08d451cf30..5b69eae39d 100755 --- a/mail/templates/pixelegg/app.less +++ b/mail/templates/pixelegg/app.less @@ -244,7 +244,7 @@ body { padding-right: 5px; } - span.ms-close-btn, span.ms-edit-btn { + span.ms-close-btn, span.ms-edit-btn, span.ms-check-btn { padding-right: 0px; }